@performant-software/geospatial 1.2.0-beta.23 → 1.2.0-beta.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/es/index.js CHANGED
@@ -1,3 +1,2 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- import*as t from"@peripleo/maplibre";var e,n,r,i,o={6843:function(t,e,n){t.exports=function(){var t=function(t,e){var n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on:function(t,e,r){if(void 0===n[t])throw new Error("Invalid event type: "+t);n[t].push({selector:e,fn:r})},render:function(t){e.store.featureChanged(t)}},i=function(t,i){for(var o=n[t],s=o.length;s--;){var a=o[s];if(a.selector(i)){a.fn.call(r,i)||e.store.render(),e.ui.updateMapClasses();break}}};return t.start.call(r),{render:t.render,stop:function(){t.stop&&t.stop()},trash:function(){t.trash&&(t.trash(),e.store.render())},combineFeatures:function(){t.combineFeatures&&t.combineFeatures()},uncombineFeatures:function(){t.uncombineFeatures&&t.uncombineFeatures()},drag:function(t){i("drag",t)},click:function(t){i("click",t)},mousemove:function(t){i("mousemove",t)},mousedown:function(t){i("mousedown",t)},mouseup:function(t){i("mouseup",t)},mouseout:function(t){i("mouseout",t)},keydown:function(t){i("keydown",t)},keyup:function(t){i("keyup",t)},touchstart:function(t){i("touchstart",t)},touchmove:function(t){i("touchmove",t)},touchend:function(t){i("touchend",t)},tap:function(t){i("tap",t)}}};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r={},i={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142};function o(t){var e=0;if(t&&t.length>0){e+=Math.abs(s(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(s(t[n]))}return e}function s(t){var e,n,r,o,s,l,u=0,c=t.length;if(c>2){for(l=0;l<c;l++)l===c-2?(r=c-2,o=c-1,s=0):l===c-1?(r=c-1,o=0,s=1):(r=l,o=l+1,s=l+2),e=t[r],n=t[o],u+=(a(t[s][0])-a(e[0]))*Math.sin(a(n[1]));u=u*i.RADIUS*i.RADIUS/2}return u}function a(t){return t*Math.PI/180}r.geometry=function t(e){var n,r=0;switch(e.type){case"Polygon":return o(e.coordinates);case"MultiPolygon":for(n=0;n<e.coordinates.length;n++)r+=o(e.coordinates[n]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(n=0;n<e.geometries.length;n++)r+=t(e.geometries[n]);return r}},r.ring=s;var l={CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},u={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},c={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},h={POLYGON:"polygon",LINE:"line_string",POINT:"point"},p={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},f={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select",STATIC:"static"},d={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},g={MOVE:"move",CHANGE_COORDINATES:"change_coordinates"},m={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},y={ACTIVE:"true",INACTIVE:"false"},_=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],v=-85,x=Object.freeze({__proto__:null,classes:l,sources:u,cursors:c,types:h,geojsonTypes:p,modes:f,events:d,updateActions:g,meta:m,activeStates:y,interactions:_,LAT_MIN:-90,LAT_RENDERED_MIN:v,LAT_MAX:90,LAT_RENDERED_MAX:85,LNG_MIN:-270,LNG_MAX:270}),b={Point:0,LineString:1,MultiLineString:1,Polygon:2};function w(t,e){var n=b[t.geometry.type]-b[e.geometry.type];return 0===n&&t.geometry.type===p.POLYGON?t.area-e.area:n}function E(t){return t.map((function(t){return t.geometry.type===p.POLYGON&&(t.area=r.geometry({type:p.FEATURE,property:{},geometry:t.geometry})),t})).sort(w).map((function(t){return delete t.area,t}))}function S(t,e){return void 0===e&&(e=0),[[t.point.x-e,t.point.y-e],[t.point.x+e,t.point.y+e]]}function I(t){if(this._items={},this._nums={},this._length=t?t.length:0,t)for(var e=0,n=t.length;e<n;e++)this.add(t[e]),void 0!==t[e]&&("string"==typeof t[e]?this._items[t[e]]=e:this._nums[t[e]]=e)}I.prototype.add=function(t){return this.has(t)||(this._length++,"string"==typeof t?this._items[t]=this._length:this._nums[t]=this._length),this},I.prototype.delete=function(t){return!1===this.has(t)||(this._length--,delete this._items[t],delete this._nums[t]),this},I.prototype.has=function(t){return!("string"!=typeof t&&"number"!=typeof t||void 0===this._items[t]&&void 0===this._nums[t])},I.prototype.values=function(){var t=this,e=[];return Object.keys(this._items).forEach((function(n){e.push({k:n,v:t._items[n]})})),Object.keys(this._nums).forEach((function(n){e.push({k:JSON.parse(n),v:t._nums[n]})})),e.sort((function(t,e){return t.v-e.v})).map((function(t){return t.k}))},I.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};var C=[m.FEATURE,m.MIDPOINT,m.VERTEX],T={click:function(t,e,n){return P(t,e,n,n.options.clickBuffer)},touch:function(t,e,n){return P(t,e,n,n.options.touchBuffer)}};function P(t,e,n,r){if(null===n.map)return[];var i=t?S(t,r):e,o={};n.options.styles&&(o.layers=n.options.styles.map((function(t){return t.id})).filter((function(t){return null!=n.map.getLayer(t)})));var s=n.map.queryRenderedFeatures(i,o).filter((function(t){return-1!==C.indexOf(t.properties.meta)})),a=new I,l=[];return s.forEach((function(t){var e=t.properties.id;a.has(e)||(a.add(e),l.push(t))})),E(l)}function M(t,e){var n=T.click(t,null,e),r={mouse:c.NONE};return n[0]&&(r.mouse=n[0].properties.active===y.ACTIVE?c.MOVE:c.POINTER,r.feature=n[0].properties.meta),-1!==e.events.currentModeName().indexOf("draw")&&(r.mouse=c.ADD),e.ui.queueMapClasses(r),e.ui.updateMapClasses(),n[0]}function L(t,e){var n=t.x-e.x,r=t.y-e.y;return Math.sqrt(n*n+r*r)}function A(t,e,n){void 0===n&&(n={});var r=null!=n.fineTolerance?n.fineTolerance:4,i=null!=n.grossTolerance?n.grossTolerance:12,o=null!=n.interval?n.interval:500;t.point=t.point||e.point,t.time=t.time||e.time;var s=L(t.point,e.point);return s<r||s<i&&e.time-t.time<o}function k(t,e,n){void 0===n&&(n={});var r=null!=n.tolerance?n.tolerance:25,i=null!=n.interval?n.interval:250;return t.point=t.point||e.point,t.time=t.time||e.time,L(t.point,e.point)<r&&e.time-t.time<i}var N={exports:{}},D=N.exports=function(t,e){if(e||(e=16),void 0===t&&(t=128),t<=0)return"0";for(var n=Math.log(Math.pow(2,t))/Math.log(e),r=2;n===1/0;r*=2)n=Math.log(Math.pow(2,t/r))/Math.log(e)*r;var i=n-Math.floor(n),o="";for(r=0;r<Math.floor(n);r++)o=Math.floor(Math.random()*e).toString(e)+o;if(i){var s=Math.pow(e,i);o=Math.floor(Math.random()*s).toString(e)+o}var a=parseInt(o,e);return a!==1/0&&a>=Math.pow(2,t)?D(t,e):o};D.rack=function(t,e,n){var r=function(r){var o=0;do{if(o++>10){if(!n)throw new Error("too many ID collisions, use more bits");t+=n}var s=D(t,e)}while(Object.hasOwnProperty.call(i,s));return i[s]=r,s},i=r.hats={};return r.get=function(t){return r.hats[t]},r.set=function(t,e){return r.hats[t]=e,r},r.bits=t||128,r.base=e||16,r};var R=e(N.exports),O=function(t,e){this.ctx=t,this.properties=e.properties||{},this.coordinates=e.geometry.coordinates,this.id=e.id||R(),this.type=e.geometry.type};O.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},O.prototype.incomingCoords=function(t){this.setCoordinates(t)},O.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},O.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},O.prototype.setProperty=function(t,e){this.properties[t]=e},O.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:p.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},O.prototype.internal=function(t){var e={id:this.id,meta:m.FEATURE,"meta:type":this.type,active:y.INACTIVE,mode:t};if(this.ctx.options.userProperties)for(var n in this.properties)e["user_"+n]=this.properties[n];return{type:p.FEATURE,properties:e,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var z=function(t,e){O.call(this,t,e)};(z.prototype=Object.create(O.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},z.prototype.updateCoordinate=function(t,e,n){this.coordinates=3===arguments.length?[e,n]:[t,e],this.changed()},z.prototype.getCoordinate=function(){return this.getCoordinates()};var F=function(t,e){O.call(this,t,e)};(F.prototype=Object.create(O.prototype)).isValid=function(){return this.coordinates.length>1},F.prototype.addCoordinate=function(t,e,n){this.changed();var r=parseInt(t,10);this.coordinates.splice(r,0,[e,n])},F.prototype.getCoordinate=function(t){var e=parseInt(t,10);return JSON.parse(JSON.stringify(this.coordinates[e]))},F.prototype.removeCoordinate=function(t){this.changed(),this.coordinates.splice(parseInt(t,10),1)},F.prototype.updateCoordinate=function(t,e,n){var r=parseInt(t,10);this.coordinates[r]=[e,n],this.changed()};var B=function(t,e){O.call(this,t,e),this.coordinates=this.coordinates.map((function(t){return t.slice(0,-1)}))};(B.prototype=Object.create(O.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((function(t){return t.length>2}))},B.prototype.incomingCoords=function(t){this.coordinates=t.map((function(t){return t.slice(0,-1)})),this.changed()},B.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},B.prototype.addCoordinate=function(t,e,n){this.changed();var r=t.split(".").map((function(t){return parseInt(t,10)}));this.coordinates[r[0]].splice(r[1],0,[e,n])},B.prototype.removeCoordinate=function(t){this.changed();var e=t.split(".").map((function(t){return parseInt(t,10)})),n=this.coordinates[e[0]];n&&(n.splice(e[1],1),n.length<3&&this.coordinates.splice(e[0],1))},B.prototype.getCoordinate=function(t){var e=t.split(".").map((function(t){return parseInt(t,10)})),n=this.coordinates[e[0]];return JSON.parse(JSON.stringify(n[e[1]]))},B.prototype.getCoordinates=function(){return this.coordinates.map((function(t){return t.concat([t[0]])}))},B.prototype.updateCoordinate=function(t,e,n){this.changed();var r=t.split("."),i=parseInt(r[0],10),o=parseInt(r[1],10);void 0===this.coordinates[i]&&(this.coordinates[i]=[]),this.coordinates[i][o]=[e,n]};var U={MultiPoint:z,MultiLineString:F,MultiPolygon:B},V=function(t,e,n,r,i){var o=n.split("."),s=parseInt(o[0],10),a=o[1]?o.slice(1).join("."):null;return t[s][e](a,r,i)},j=function(t,e){if(O.call(this,t,e),delete this.coordinates,this.model=U[e.geometry.type],void 0===this.model)throw new TypeError(e.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(e.geometry.coordinates)};function G(t){this.map=t.map,this.drawConfig=JSON.parse(JSON.stringify(t.options||{})),this._ctx=t}(j.prototype=Object.create(O.prototype))._coordinatesToFeatures=function(t){var e=this,n=this.model.bind(this);return t.map((function(t){return new n(e.ctx,{id:R(),type:p.FEATURE,properties:{},geometry:{coordinates:t,type:e.type.replace("Multi","")}})}))},j.prototype.isValid=function(){return this.features.every((function(t){return t.isValid()}))},j.prototype.setCoordinates=function(t){this.features=this._coordinatesToFeatures(t),this.changed()},j.prototype.getCoordinate=function(t){return V(this.features,"getCoordinate",t)},j.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((function(t){return t.type===p.POLYGON?t.getCoordinates():t.coordinates}))))},j.prototype.updateCoordinate=function(t,e,n){V(this.features,"updateCoordinate",t,e,n),this.changed()},j.prototype.addCoordinate=function(t,e,n){V(this.features,"addCoordinate",t,e,n),this.changed()},j.prototype.removeCoordinate=function(t){V(this.features,"removeCoordinate",t),this.changed()},j.prototype.getFeatures=function(){return this.features},G.prototype.setSelected=function(t){return this._ctx.store.setSelected(t)},G.prototype.setSelectedCoordinates=function(t){var e=this;this._ctx.store.setSelectedCoordinates(t),t.reduce((function(t,n){return void 0===t[n.feature_id]&&(t[n.feature_id]=!0,e._ctx.store.get(n.feature_id).changed()),t}),{})},G.prototype.getSelected=function(){return this._ctx.store.getSelected()},G.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},G.prototype.isSelected=function(t){return this._ctx.store.isSelected(t)},G.prototype.getFeature=function(t){return this._ctx.store.get(t)},G.prototype.select=function(t){return this._ctx.store.select(t)},G.prototype.deselect=function(t){return this._ctx.store.deselect(t)},G.prototype.deleteFeature=function(t,e){return void 0===e&&(e={}),this._ctx.store.delete(t,e)},G.prototype.addFeature=function(t){return this._ctx.store.add(t)},G.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},G.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},G.prototype.setActionableState=function(t){void 0===t&&(t={});var e={trash:t.trash||!1,combineFeatures:t.combineFeatures||!1,uncombineFeatures:t.uncombineFeatures||!1};return this._ctx.events.actionable(e)},G.prototype.changeMode=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._ctx.events.changeMode(t,e,n)},G.prototype.updateUIClasses=function(t){return this._ctx.ui.queueMapClasses(t)},G.prototype.activateUIButton=function(t){return this._ctx.ui.setActiveButton(t)},G.prototype.featuresAt=function(t,e,n){if(void 0===n&&(n="click"),"click"!==n&&"touch"!==n)throw new Error("invalid buffer type");return T[n](t,e,this._ctx)},G.prototype.newFeature=function(t){var e=t.geometry.type;return e===p.POINT?new z(this._ctx,t):e===p.LINE_STRING?new F(this._ctx,t):e===p.POLYGON?new B(this._ctx,t):new j(this._ctx,t)},G.prototype.isInstanceOf=function(t,e){if(t===p.POINT)return e instanceof z;if(t===p.LINE_STRING)return e instanceof F;if(t===p.POLYGON)return e instanceof B;if("MultiFeature"===t)return e instanceof j;throw new Error("Unknown feature class: "+t)},G.prototype.doRender=function(t){return this._ctx.store.featureChanged(t)},G.prototype.onSetup=function(){},G.prototype.onDrag=function(){},G.prototype.onClick=function(){},G.prototype.onMouseMove=function(){},G.prototype.onMouseDown=function(){},G.prototype.onMouseUp=function(){},G.prototype.onMouseOut=function(){},G.prototype.onKeyUp=function(){},G.prototype.onKeyDown=function(){},G.prototype.onTouchStart=function(){},G.prototype.onTouchMove=function(){},G.prototype.onTouchEnd=function(){},G.prototype.onTap=function(){},G.prototype.onStop=function(){},G.prototype.onTrash=function(){},G.prototype.onCombineFeature=function(){},G.prototype.onUncombineFeature=function(){},G.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var q={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},$=Object.keys(q);function X(t){return[].concat(t).filter((function(t){return void 0!==t}))}function Z(){var t=this;if(!t.ctx.map||void 0===t.ctx.map.getSource(u.HOT))return l();var e=t.ctx.events.currentModeName();t.ctx.ui.queueMapClasses({mode:e});var n=[],r=[];t.isDirty?r=t.getAllIds():(n=t.getChangedIds().filter((function(e){return void 0!==t.get(e)})),r=t.sources.hot.filter((function(e){return e.properties.id&&-1===n.indexOf(e.properties.id)&&void 0!==t.get(e.properties.id)})).map((function(t){return t.properties.id}))),t.sources.hot=[];var i=t.sources.cold.length;t.sources.cold=t.isDirty?[]:t.sources.cold.filter((function(t){var e=t.properties.id||t.properties.parent;return-1===n.indexOf(e)}));var o=i!==t.sources.cold.length||r.length>0;function s(n,r){var i=t.get(n).internal(e);t.ctx.events.currentModeRender(i,(function(e){t.sources[r].push(e)}))}if(n.forEach((function(t){return s(t,"hot")})),r.forEach((function(t){return s(t,"cold")})),o&&t.ctx.map.getSource(u.COLD).setData({type:p.FEATURE_COLLECTION,features:t.sources.cold}),t.ctx.map.getSource(u.HOT).setData({type:p.FEATURE_COLLECTION,features:t.sources.hot}),t._emitSelectionChange&&(t.ctx.map.fire(d.SELECTION_CHANGE,{features:t.getSelected().map((function(t){return t.toGeoJSON()})),points:t.getSelectedCoordinates().map((function(t){return{type:p.FEATURE,properties:{},geometry:{type:p.POINT,coordinates:t.coordinates}}}))}),t._emitSelectionChange=!1),t._deletedFeaturesToEmit.length){var a=t._deletedFeaturesToEmit.map((function(t){return t.toGeoJSON()}));t._deletedFeaturesToEmit=[],t.ctx.map.fire(d.DELETE,{features:a})}function l(){t.isDirty=!1,t.clearChangedIds()}l(),t.ctx.map.fire(d.RENDER,{})}function Y(t){var e,n=this;this._features={},this._featureIds=new I,this._selectedFeatureIds=new I,this._selectedCoordinates=[],this._changedFeatureIds=new I,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=t,this.sources={hot:[],cold:[]},this.render=function(){e||(e=requestAnimationFrame((function(){e=null,Z.call(n)})))},this.isDirty=!1}function W(t,e){var n=t._selectedCoordinates.filter((function(e){return t._selectedFeatureIds.has(e.feature_id)}));t._selectedCoordinates.length===n.length||e.silent||(t._emitSelectionChange=!0),t._selectedCoordinates=n}Y.prototype.createRenderBatch=function(){var t=this,e=this.render,n=0;return this.render=function(){n++},function(){t.render=e,n>0&&t.render()}},Y.prototype.setDirty=function(){return this.isDirty=!0,this},Y.prototype.featureChanged=function(t){return this._changedFeatureIds.add(t),this},Y.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},Y.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},Y.prototype.getAllIds=function(){return this._featureIds.values()},Y.prototype.add=function(t){return this.featureChanged(t.id),this._features[t.id]=t,this._featureIds.add(t.id),this},Y.prototype.delete=function(t,e){var n=this;return void 0===e&&(e={}),X(t).forEach((function(t){n._featureIds.has(t)&&(n._featureIds.delete(t),n._selectedFeatureIds.delete(t),e.silent||-1===n._deletedFeaturesToEmit.indexOf(n._features[t])&&n._deletedFeaturesToEmit.push(n._features[t]),delete n._features[t],n.isDirty=!0)})),W(this,e),this},Y.prototype.get=function(t){return this._features[t]},Y.prototype.getAll=function(){var t=this;return Object.keys(this._features).map((function(e){return t._features[e]}))},Y.prototype.select=function(t,e){var n=this;return void 0===e&&(e={}),X(t).forEach((function(t){n._selectedFeatureIds.has(t)||(n._selectedFeatureIds.add(t),n._changedFeatureIds.add(t),e.silent||(n._emitSelectionChange=!0))})),this},Y.prototype.deselect=function(t,e){var n=this;return void 0===e&&(e={}),X(t).forEach((function(t){n._selectedFeatureIds.has(t)&&(n._selectedFeatureIds.delete(t),n._changedFeatureIds.add(t),e.silent||(n._emitSelectionChange=!0))})),W(this,e),this},Y.prototype.clearSelected=function(t){return void 0===t&&(t={}),this.deselect(this._selectedFeatureIds.values(),{silent:t.silent}),this},Y.prototype.setSelected=function(t,e){var n=this;return void 0===e&&(e={}),t=X(t),this.deselect(this._selectedFeatureIds.values().filter((function(e){return-1===t.indexOf(e)})),{silent:e.silent}),this.select(t.filter((function(t){return!n._selectedFeatureIds.has(t)})),{silent:e.silent}),this},Y.prototype.setSelectedCoordinates=function(t){return this._selectedCoordinates=t,this._emitSelectionChange=!0,this},Y.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},Y.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},Y.prototype.getSelected=function(){var t=this;return this._selectedFeatureIds.values().map((function(e){return t.get(e)}))},Y.prototype.getSelectedCoordinates=function(){var t=this;return this._selectedCoordinates.map((function(e){return{coordinates:t.get(e.feature_id).getCoordinate(e.coord_path)}}))},Y.prototype.isSelected=function(t){return this._selectedFeatureIds.has(t)},Y.prototype.setFeatureProperty=function(t,e,n){this.get(t).setProperty(e,n),this.featureChanged(t)},Y.prototype.storeMapConfig=function(){var t=this;_.forEach((function(e){t.ctx.map[e]&&(t._mapInitialConfig[e]=t.ctx.map[e].isEnabled())}))},Y.prototype.restoreMapConfig=function(){var t=this;Object.keys(this._mapInitialConfig).forEach((function(e){t._mapInitialConfig[e]?t.ctx.map[e].enable():t.ctx.map[e].disable()}))},Y.prototype.getInitialConfigValue=function(t){return void 0===this._mapInitialConfig[t]||this._mapInitialConfig[t]};var H=Object.prototype.hasOwnProperty,K=e((function(){for(var t=arguments,e={},n=0;n<arguments.length;n++){var r=t[n];for(var i in r)H.call(r,i)&&(e[i]=r[i])}return e})),J=["mode","feature","mouse"];function Q(e){var n=null,r=null,i={onRemove:function(){return e.map.off("load",i.connect),clearInterval(r),i.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,n&&n.parentNode&&n.parentNode.removeChild(n),n=null,this},connect:function(){e.map.off("load",i.connect),clearInterval(r),i.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd:function(o){var s=o.fire;return o.fire=function(t,e){var n=arguments;return 1===s.length&&1!==arguments.length&&(n=[K({},{type:t},e)]),s.apply(o,n)},e.map=o,e.events=function(e){var n=Object.keys(e.options.modes).reduce((function(t,n){return t[n]=function(t){var e=Object.keys(t);return function(n,r){void 0===r&&(r={});var i={},o=e.reduce((function(e,n){return e[n]=t[n],e}),new G(n));return{start:function(){var e=this;i=o.onSetup(r),$.forEach((function(n){var r,s=q[n],a=function(){return!1};t[s]&&(a=function(){return!0}),e.on(n,a,(r=s,function(t){return o[r](i,t)}))}))},stop:function(){o.onStop(i)},trash:function(){o.onTrash(i)},combineFeatures:function(){o.onCombineFeatures(i)},uncombineFeatures:function(){o.onUncombineFeatures(i)},render:function(t,e){o.toDisplayFeatures(i,t,e)}}}}(e.options.modes[n]),t}),{}),r={},i={},o={},s=null,a=null;o.drag=function(t,n){n({point:t.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:c.DRAG}),a.drag(t)):t.originalEvent.stopPropagation()},o.mousedrag=function(t){o.drag(t,(function(t){return!A(r,t)}))},o.touchdrag=function(t){o.drag(t,(function(t){return!k(i,t)}))},o.mousemove=function(t){if(1===(void 0!==t.originalEvent.buttons?t.originalEvent.buttons:t.originalEvent.which))return o.mousedrag(t);var n=M(t,e);t.featureTarget=n,a.mousemove(t)},o.mousedown=function(t){r={time:(new Date).getTime(),point:t.point};var n=M(t,e);t.featureTarget=n,a.mousedown(t)},o.mouseup=function(t){var n=M(t,e);t.featureTarget=n,A(r,{point:t.point,time:(new Date).getTime()})?a.click(t):a.mouseup(t)},o.mouseout=function(t){a.mouseout(t)},o.touchstart=function(t){if(e.options.touchEnabled){i={time:(new Date).getTime(),point:t.point};var n=T.touch(t,null,e)[0];t.featureTarget=n,a.touchstart(t)}},o.touchmove=function(t){if(e.options.touchEnabled)return a.touchmove(t),o.touchdrag(t)},o.touchend=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled){var n=T.touch(t,null,e)[0];t.featureTarget=n,k(i,{time:(new Date).getTime(),point:t.point})?a.tap(t):a.touchend(t)}};var l=function(t){return!(8===t||46===t||t>=48&&t<=57)};function u(r,i,o){void 0===o&&(o={}),a.stop();var l=n[r];if(void 0===l)throw new Error(r+" is not valid");s=r;var u=l(e,i);a=t(u,e),o.silent||e.map.fire(d.MODE_CHANGE,{mode:r}),e.store.setDirty(),e.store.render()}o.keydown=function(t){(t.srcElement||t.target).classList.contains("mapboxgl-canvas")&&(8!==t.keyCode&&46!==t.keyCode||!e.options.controls.trash?l(t.keyCode)?a.keydown(t):49===t.keyCode&&e.options.controls.point?u(f.DRAW_POINT):50===t.keyCode&&e.options.controls.line_string?u(f.DRAW_LINE_STRING):51===t.keyCode&&e.options.controls.polygon&&u(f.DRAW_POLYGON):(t.preventDefault(),a.trash()))},o.keyup=function(t){l(t.keyCode)&&a.keyup(t)},o.zoomend=function(){e.store.changeZoom()},o.data=function(t){if("style"===t.dataType){var n=e.setup,r=e.map,i=e.options,o=e.store;i.styles.some((function(t){return r.getLayer(t.id)}))||(n.addLayers(),o.setDirty(),o.render())}};var h={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){s=e.options.defaultMode,a=t(n[s](e),e)},changeMode:u,actionable:function(t){var n=!1;Object.keys(t).forEach((function(e){if(void 0===h[e])throw new Error("Invalid action type");h[e]!==t[e]&&(n=!0),h[e]=t[e]})),n&&e.map.fire(d.ACTIONABLE,{actions:h})},currentModeName:function(){return s},currentModeRender:function(t,e){return a.render(t,e)},fire:function(t,e){o[t]&&o[t](e)},addEventListeners:function(){e.map.on("mousemove",o.mousemove),e.map.on("mousedown",o.mousedown),e.map.on("mouseup",o.mouseup),e.map.on("data",o.data),e.map.on("touchmove",o.touchmove),e.map.on("touchstart",o.touchstart),e.map.on("touchend",o.touchend),e.container.addEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",o.keydown),e.container.addEventListener("keyup",o.keyup))},removeEventListeners:function(){e.map.off("mousemove",o.mousemove),e.map.off("mousedown",o.mousedown),e.map.off("mouseup",o.mouseup),e.map.off("data",o.data),e.map.off("touchmove",o.touchmove),e.map.off("touchstart",o.touchstart),e.map.off("touchend",o.touchend),e.container.removeEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",o.keydown),e.container.removeEventListener("keyup",o.keyup))},trash:function(t){a.trash(t)},combineFeatures:function(){a.combineFeatures()},uncombineFeatures:function(){a.uncombineFeatures()},getMode:function(){return s}}}(e),e.ui=function(t){var e={},n=null,r={mode:null,feature:null,mouse:null},i={mode:null,feature:null,mouse:null};function o(t){i=K(i,t)}function s(){var e,n;if(t.container){var o=[],s=[];J.forEach((function(t){i[t]!==r[t]&&(o.push(t+"-"+r[t]),null!==i[t]&&s.push(t+"-"+i[t]))})),o.length>0&&(e=t.container.classList).remove.apply(e,o),s.length>0&&(n=t.container.classList).add.apply(n,s),r=K(r,i)}}function a(t,e){void 0===e&&(e={});var r=document.createElement("button");return r.className=l.CONTROL_BUTTON+" "+e.className,r.setAttribute("title",e.title),e.container.appendChild(r),r.addEventListener("click",(function(r){if(r.preventDefault(),r.stopPropagation(),r.target===n)return u(),void e.onDeactivate();c(t),e.onActivate()}),!0),r}function u(){n&&(n.classList.remove(l.ACTIVE_BUTTON),n=null)}function c(t){u();var r=e[t];r&&r&&"trash"!==t&&(r.classList.add(l.ACTIVE_BUTTON),n=r)}return{setActiveButton:c,queueMapClasses:o,updateMapClasses:s,clearMapClasses:function(){o({mode:null,feature:null,mouse:null}),s()},addButtons:function(){var n=t.options.controls,r=document.createElement("div");return r.className=l.CONTROL_GROUP+" "+l.CONTROL_BASE,n?(n[h.LINE]&&(e[h.LINE]=a(h.LINE,{container:r,className:l.CONTROL_BUTTON_LINE,title:"LineString tool "+(t.options.keybindings?"(l)":""),onActivate:function(){return t.events.changeMode(f.DRAW_LINE_STRING)},onDeactivate:function(){return t.events.trash()}})),n[h.POLYGON]&&(e[h.POLYGON]=a(h.POLYGON,{container:r,className:l.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(t.options.keybindings?"(p)":""),onActivate:function(){return t.events.changeMode(f.DRAW_POLYGON)},onDeactivate:function(){return t.events.trash()}})),n[h.POINT]&&(e[h.POINT]=a(h.POINT,{container:r,className:l.CONTROL_BUTTON_POINT,title:"Marker tool "+(t.options.keybindings?"(m)":""),onActivate:function(){return t.events.changeMode(f.DRAW_POINT)},onDeactivate:function(){return t.events.trash()}})),n.trash&&(e.trash=a("trash",{container:r,className:l.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:function(){t.events.trash()}})),n.combine_features&&(e.combine_features=a("combineFeatures",{container:r,className:l.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:function(){t.events.combineFeatures()}})),n.uncombine_features&&(e.uncombine_features=a("uncombineFeatures",{container:r,className:l.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:function(){t.events.uncombineFeatures()}})),r):r},removeButtons:function(){Object.keys(e).forEach((function(t){var n=e[t];n.parentNode&&n.parentNode.removeChild(n),delete e[t]}))}}}(e),e.container=o.getContainer(),e.store=new Y(e),n=e.ui.addButtons(),e.options.boxSelect&&(e.boxZoomInitial=o.boxZoom.isEnabled(),o.boxZoom.disable(),o.dragPan.disable(),o.dragPan.enable()),o.loaded()?i.connect():(o.on("load",i.connect),r=setInterval((function(){o.loaded()&&i.connect()}),16)),e.events.start(),n},addLayers:function(){e.map.addSource(u.COLD,{data:{type:p.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(u.HOT,{data:{type:p.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach((function(t){e.map.addLayer(t)})),e.store.setDirty(!0),e.store.render()},removeLayers:function(){e.options.styles.forEach((function(t){e.map.getLayer(t.id)&&e.map.removeLayer(t.id)})),e.map.getSource(u.COLD)&&e.map.removeSource(u.COLD),e.map.getSource(u.HOT)&&e.map.removeSource(u.HOT)}};return e.setup=i,i}var tt=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}];function et(t){return function(e){var n=e.featureTarget;return!!n&&!!n.properties&&n.properties.meta===t}}function nt(t){return!!t.originalEvent&&!!t.originalEvent.shiftKey&&0===t.originalEvent.button}function rt(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.active===y.ACTIVE&&t.featureTarget.properties.meta===m.FEATURE}function it(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.active===y.INACTIVE&&t.featureTarget.properties.meta===m.FEATURE}function ot(t){return void 0===t.featureTarget}function st(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.meta===m.FEATURE}function at(t){var e=t.featureTarget;return!!e&&!!e.properties&&e.properties.meta===m.VERTEX}function lt(t){return!!t.originalEvent&&!0===t.originalEvent.shiftKey}function ut(t){return 27===t.keyCode}function ct(t){return 13===t.keyCode}var ht=Object.freeze({__proto__:null,isOfMetaType:et,isShiftMousedown:nt,isActiveFeature:rt,isInactiveFeature:it,noTarget:ot,isFeature:st,isVertex:at,isShiftDown:lt,isEscapeKey:ut,isEnterKey:ct,isTrue:function(){return!0}}),pt=ft;function ft(t,e){this.x=t,this.y=e}ft.prototype={clone:function(){return new ft(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_rotateAround:function(t,e){var n=Math.cos(t),r=Math.sin(t),i=e.x+n*(this.x-e.x)-r*(this.y-e.y),o=e.y+r*(this.x-e.x)+n*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ft.convert=function(t){return t instanceof ft?t:Array.isArray(t)?new ft(t[0],t[1]):t};var dt=e(pt);function gt(t,e){var n=e.getBoundingClientRect();return new dt(t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0))}function mt(t,e,n,r){return{type:p.FEATURE,properties:{meta:m.VERTEX,parent:t,coord_path:n,active:r?y.ACTIVE:y.INACTIVE},geometry:{type:p.POINT,coordinates:e}}}function yt(t,e,n){var r=e.geometry.coordinates,i=n.geometry.coordinates;if(r[1]>85||r[1]<v||i[1]>85||i[1]<v)return null;var o={lng:(r[0]+i[0])/2,lat:(r[1]+i[1])/2};return{type:p.FEATURE,properties:{meta:m.MIDPOINT,parent:t,lng:o.lng,lat:o.lat,coord_path:n.properties.coord_path},geometry:{type:p.POINT,coordinates:[o.lng,o.lat]}}}function _t(t,e,n){void 0===e&&(e={}),void 0===n&&(n=null);var r,i=t.geometry,o=i.type,s=i.coordinates,a=t.properties&&t.properties.id,l=[];function u(t,n){var r="",i=null;t.forEach((function(t,o){var s=null!=n?n+"."+o:String(o),u=mt(a,t,s,c(s));if(e.midpoints&&i){var h=yt(a,i,u);h&&l.push(h)}i=u;var p=JSON.stringify(t);r!==p&&l.push(u),0===o&&(r=p)}))}function c(t){return!!e.selectedPaths&&-1!==e.selectedPaths.indexOf(t)}return o===p.POINT?l.push(mt(a,s,n,c(n))):o===p.POLYGON?s.forEach((function(t,e){u(t,null!==n?n+"."+e:String(e))})):o===p.LINE_STRING?u(s,n):0===o.indexOf(p.MULTI_PREFIX)&&(r=o.replace(p.MULTI_PREFIX,""),s.forEach((function(n,i){var o={type:p.FEATURE,properties:t.properties,geometry:{type:r,coordinates:n}};l=l.concat(_t(o,e,i))}))),l}var vt={enable:function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t._ctx&&t._ctx.store&&t._ctx.store.getInitialConfigValue&&t._ctx.store.getInitialConfigValue("doubleClickZoom")&&t.map.doubleClickZoom.enable()}),0)},disable:function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t.map.doubleClickZoom.disable()}),0)}},xt={exports:{}},bt=function(t){if(!t||!t.type)return null;var e=wt[t.type];return e?"geometry"===e?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]}:"feature"===e?{type:"FeatureCollection",features:[t]}:"featurecollection"===e?t:void 0:null},wt={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"},Et=e(bt),St=Object.freeze({__proto__:null,default:function t(e){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.reduce((function(e,n){return e.concat(t(n))}),[]),e;case"Feature":return e.geometry?t(e.geometry).map((function(t){var n={type:"Feature",properties:JSON.parse(JSON.stringify(e.properties)),geometry:t};return void 0!==e.id&&(n.id=e.id),n})):[e];case"MultiPoint":return e.coordinates.map((function(t){return{type:"Point",coordinates:t}}));case"MultiPolygon":return e.coordinates.map((function(t){return{type:"Polygon",coordinates:t}}));case"MultiLineString":return e.coordinates.map((function(t){return{type:"LineString",coordinates:t}}));case"GeometryCollection":return e.geometries.map(t).reduce((function(t,e){return t.concat(e)}),[]);case"Point":case"Polygon":case"LineString":return[e]}}}),It=bt,Ct=function(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){if(this instanceof t){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(e,n))}return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}(St);Ct instanceof Function||(Ct=Ct.default);var Tt={exports:{}},Pt=Tt.exports=function(t){return new Mt(t)};function Mt(t){this.value=t}function Lt(t,e,n){var r=[],i=[],o=!0;return function t(s){var a=n?At(s):s,l={},u=!0,c={node:a,node_:s,path:[].concat(r),parent:i[i.length-1],parents:i,key:r.slice(-1)[0],isRoot:0===r.length,level:r.length,circular:null,update:function(t,e){c.isRoot||(c.parent.node[c.key]=t),c.node=t,e&&(u=!1)},delete:function(t){delete c.parent.node[c.key],t&&(u=!1)},remove:function(t){Dt(c.parent.node)?c.parent.node.splice(c.key,1):delete c.parent.node[c.key],t&&(u=!1)},keys:null,before:function(t){l.before=t},after:function(t){l.after=t},pre:function(t){l.pre=t},post:function(t){l.post=t},stop:function(){o=!1},block:function(){u=!1}};if(!o)return c;function h(){if("object"==typeof c.node&&null!==c.node){c.keys&&c.node_===c.node||(c.keys=kt(c.node)),c.isLeaf=0==c.keys.length;for(var t=0;t<i.length;t++)if(i[t].node_===s){c.circular=i[t];break}}else c.isLeaf=!0,c.keys=null;c.notLeaf=!c.isLeaf,c.notRoot=!c.isRoot}h();var p=e.call(c,c.node);return void 0!==p&&c.update&&c.update(p),l.before&&l.before.call(c,c.node),u?("object"!=typeof c.node||null===c.node||c.circular||(i.push(c),h(),Rt(c.keys,(function(e,i){r.push(e),l.pre&&l.pre.call(c,c.node[e],e);var o=t(c.node[e]);n&&Ot.call(c.node,e)&&(c.node[e]=o.node),o.isLast=i==c.keys.length-1,o.isFirst=0==i,l.post&&l.post.call(c,o),r.pop()})),i.pop()),l.after&&l.after.call(c,c.node),c):c}(t).node}function At(t){if("object"==typeof t&&null!==t){var e;if(Dt(t))e=[];else if("[object Date]"===Nt(t))e=new Date(t.getTime?t.getTime():t);else if(function(t){return"[object RegExp]"===Nt(t)}(t))e=new RegExp(t);else if(function(t){return"[object Error]"===Nt(t)}(t))e={message:t.message};else if(function(t){return"[object Boolean]"===Nt(t)}(t))e=new Boolean(t);else if(function(t){return"[object Number]"===Nt(t)}(t))e=new Number(t);else if(function(t){return"[object String]"===Nt(t)}(t))e=new String(t);else if(Object.create&&Object.getPrototypeOf)e=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)e={};else{var n=t.constructor&&t.constructor.prototype||t.__proto__||{},r=function(){};r.prototype=n,e=new r}return Rt(kt(t),(function(n){e[n]=t[n]})),e}return t}Mt.prototype.get=function(t){for(var e=this.value,n=0;n<t.length;n++){var r=t[n];if(!e||!Ot.call(e,r)){e=void 0;break}e=e[r]}return e},Mt.prototype.has=function(t){for(var e=this.value,n=0;n<t.length;n++){var r=t[n];if(!e||!Ot.call(e,r))return!1;e=e[r]}return!0},Mt.prototype.set=function(t,e){for(var n=this.value,r=0;r<t.length-1;r++){var i=t[r];Ot.call(n,i)||(n[i]={}),n=n[i]}return n[t[r]]=e,e},Mt.prototype.map=function(t){return Lt(this.value,t,!0)},Mt.prototype.forEach=function(t){return this.value=Lt(this.value,t,!1),this.value},Mt.prototype.reduce=function(t,e){var n=1===arguments.length,r=n?this.value:e;return this.forEach((function(e){this.isRoot&&n||(r=t.call(this,r,e))})),r},Mt.prototype.paths=function(){var t=[];return this.forEach((function(e){t.push(this.path)})),t},Mt.prototype.nodes=function(){var t=[];return this.forEach((function(e){t.push(this.node)})),t},Mt.prototype.clone=function(){var t=[],e=[];return function n(r){for(var i=0;i<t.length;i++)if(t[i]===r)return e[i];if("object"==typeof r&&null!==r){var o=At(r);return t.push(r),e.push(o),Rt(kt(r),(function(t){o[t]=n(r[t])})),t.pop(),e.pop(),o}return r}(this.value)};var kt=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function Nt(t){return Object.prototype.toString.call(t)}var Dt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},Rt=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;n<t.length;n++)e(t[n],n,t)};Rt(kt(Mt.prototype),(function(t){Pt[t]=function(e){var n=[].slice.call(arguments,1),r=new Mt(e);return r[t].apply(r,n)}}));var Ot=Object.hasOwnProperty||function(t,e){return e in t},zt=Tt.exports,Ft=Bt;function Bt(t){if(!(this instanceof Bt))return new Bt(t);this._bbox=t||[1/0,1/0,-1/0,-1/0],this._valid=!!t}Bt.prototype.include=function(t){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[0]),this._bbox[3]=Math.max(this._bbox[3],t[1]),this},Bt.prototype.equals=function(t){var e;return e=t instanceof Bt?t.bbox():t,this._bbox[0]==e[0]&&this._bbox[1]==e[1]&&this._bbox[2]==e[2]&&this._bbox[3]==e[3]},Bt.prototype.center=function(t){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},Bt.prototype.union=function(t){var e;return this._valid=!0,e=t instanceof Bt?t.bbox():t,this._bbox[0]=Math.min(this._bbox[0],e[0]),this._bbox[1]=Math.min(this._bbox[1],e[1]),this._bbox[2]=Math.max(this._bbox[2],e[2]),this._bbox[3]=Math.max(this._bbox[3],e[3]),this},Bt.prototype.bbox=function(){return this._valid?this._bbox:null},Bt.prototype.contains=function(t){if(!t)return this._fastContains();if(!this._valid)return null;var e=t[0],n=t[1];return this._bbox[0]<=e&&this._bbox[1]<=n&&this._bbox[2]>=e&&this._bbox[3]>=n},Bt.prototype.intersect=function(t){return this._valid?(e=t instanceof Bt?t.bbox():t,!(this._bbox[0]>e[2]||this._bbox[2]<e[0]||this._bbox[3]<e[1]||this._bbox[1]>e[3])):null;var e},Bt.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},Bt.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var Ut=function(t){if(!t)return[];var e=Ct(It(t)),n=[];return e.features.forEach((function(t){t.geometry&&(n=n.concat(function(t){return function t(e){return Array.isArray(e)&&e.length&&"number"==typeof e[0]?[e]:e.reduce((function(e,n){return Array.isArray(n)&&Array.isArray(n[0])?e.concat(t(n)):(e.push(n),e)}),[])}(t)}(t.geometry.coordinates)))})),n},Vt=zt,jt=Ft,Gt={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},qt=Object.keys(Gt);function $t(t){for(var e=jt(),n=Ut(t),r=0;r<n.length;r++)e.include(n[r]);return e}xt.exports=function(t){return $t(t).bbox()},xt.exports.polygon=function(t){return $t(t).polygon()},xt.exports.bboxify=function(t){return Vt(t).map((function(t){t&&qt.some((function(e){return!!t[e]&&-1!==Gt[e].indexOf(t.type)}))&&(t.bbox=$t(t).bbox(),this.update(t))}))};var Xt=e(xt.exports),Zt=-90;function Yt(t,e){var n=Zt,r=90,i=Zt,o=90,s=270,a=-270;t.forEach((function(t){var e=Xt(t),l=e[1],u=e[3],c=e[0],h=e[2];l>n&&(n=l),u<r&&(r=u),u>i&&(i=u),l<o&&(o=l),c<s&&(s=c),h>a&&(a=h)}));var l=e;return n+l.lat>85&&(l.lat=85-n),i+l.lat>90&&(l.lat=90-i),r+l.lat<-85&&(l.lat=-85-r),o+l.lat<Zt&&(l.lat=Zt-o),s+l.lng<=-270&&(l.lng+=360*Math.ceil(Math.abs(l.lng)/360)),a+l.lng>=270&&(l.lng-=360*Math.ceil(Math.abs(l.lng)/360)),l}function Wt(t,e){var n=Yt(t.map((function(t){return t.toGeoJSON()})),e);t.forEach((function(t){var e,r=t.getCoordinates(),i=function(t){var e={lng:t[0]+n.lng,lat:t[1]+n.lat};return[e.lng,e.lat]},o=function(t){return t.map((function(t){return i(t)}))};t.type===p.POINT?e=i(r):t.type===p.LINE_STRING||t.type===p.MULTI_POINT?e=r.map(i):t.type===p.POLYGON||t.type===p.MULTI_LINE_STRING?e=r.map(o):t.type===p.MULTI_POLYGON&&(e=r.map((function(t){return t.map((function(t){return o(t)}))}))),t.incomingCoords(e)}))}var Ht={onSetup:function(t){var e=this,n={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:t.featureIds||[]};return this.setSelected(n.initiallySelectedFeatureIds.filter((function(t){return void 0!==e.getFeature(t)}))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),n},fireUpdate:function(){this.map.fire(d.UPDATE,{action:g.MOVE,features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(){var t=this,e=this.getSelected(),n=e.filter((function(e){return t.isInstanceOf("MultiFeature",e)})),r=!1;if(e.length>1){r=!0;var i=e[0].type.replace("Multi","");e.forEach((function(t){t.type.replace("Multi","")!==i&&(r=!1)}))}var o=n.length>0,s=e.length>0;this.setActionableState({combineFeatures:r,uncombineFeatures:o,trash:s})},getUniqueIds:function(t){return t.length?t.map((function(t){return t.properties.id})).filter((function(t){return void 0!==t})).reduce((function(t,e){return t.add(e),t}),new I).values():[]},stopExtendedInteractions:function(t){t.boxSelectElement&&(t.boxSelectElement.parentNode&&t.boxSelectElement.parentNode.removeChild(t.boxSelectElement),t.boxSelectElement=null),this.map.dragPan.enable(),t.boxSelecting=!1,t.canBoxSelect=!1,t.dragMoving=!1,t.canDragMove=!1},onStop:function(){vt.enable(this)},onMouseMove:function(t,e){return st(e)&&t.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(t),!0},onMouseOut:function(t){return!t.dragMoving||this.fireUpdate()}};Ht.onTap=Ht.onClick=function(t,e){return ot(e)?this.clickAnywhere(t,e):et(m.VERTEX)(e)?this.clickOnVertex(t,e):st(e)?this.clickOnFeature(t,e):void 0},Ht.clickAnywhere=function(t){var e=this,n=this.getSelectedIds();n.length&&(this.clearSelectedFeatures(),n.forEach((function(t){return e.doRender(t)}))),vt.enable(this),this.stopExtendedInteractions(t)},Ht.clickOnVertex=function(t,e){this.changeMode(f.DIRECT_SELECT,{featureId:e.featureTarget.properties.parent,coordPath:e.featureTarget.properties.coord_path,startPos:e.lngLat}),this.updateUIClasses({mouse:c.MOVE})},Ht.startOnActiveFeature=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),this.doRender(e.featureTarget.properties.id),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},Ht.clickOnFeature=function(t,e){var n=this;vt.disable(this),this.stopExtendedInteractions(t);var r=lt(e),i=this.getSelectedIds(),o=e.featureTarget.properties.id,s=this.isSelected(o);if(!r&&s&&this.getFeature(o).type!==p.POINT)return this.changeMode(f.DIRECT_SELECT,{featureId:o});s&&r?(this.deselect(o),this.updateUIClasses({mouse:c.POINTER}),1===i.length&&vt.enable(this)):!s&&r?(this.select(o),this.updateUIClasses({mouse:c.MOVE})):s||r||(i.forEach((function(t){return n.doRender(t)})),this.setSelected(o),this.updateUIClasses({mouse:c.MOVE})),this.doRender(o)},Ht.onMouseDown=function(t,e){return rt(e)?this.startOnActiveFeature(t,e):this.drawConfig.boxSelect&&nt(e)?this.startBoxSelect(t,e):void 0},Ht.startBoxSelect=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),t.boxSelectStartLocation=gt(e.originalEvent,this.map.getContainer()),t.canBoxSelect=!0},Ht.onTouchStart=function(t,e){if(rt(e))return this.startOnActiveFeature(t,e)},Ht.onDrag=function(t,e){return t.canDragMove?this.dragMove(t,e):this.drawConfig.boxSelect&&t.canBoxSelect?this.whileBoxSelect(t,e):void 0},Ht.whileBoxSelect=function(t,e){t.boxSelecting=!0,this.updateUIClasses({mouse:c.ADD}),t.boxSelectElement||(t.boxSelectElement=document.createElement("div"),t.boxSelectElement.classList.add(l.BOX_SELECT),this.map.getContainer().appendChild(t.boxSelectElement));var n=gt(e.originalEvent,this.map.getContainer()),r=Math.min(t.boxSelectStartLocation.x,n.x),i=Math.max(t.boxSelectStartLocation.x,n.x),o=Math.min(t.boxSelectStartLocation.y,n.y),s=Math.max(t.boxSelectStartLocation.y,n.y),a="translate("+r+"px, "+o+"px)";t.boxSelectElement.style.transform=a,t.boxSelectElement.style.WebkitTransform=a,t.boxSelectElement.style.width=i-r+"px",t.boxSelectElement.style.height=s-o+"px"},Ht.dragMove=function(t,e){t.dragMoving=!0,e.originalEvent.stopPropagation();var n={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};Wt(this.getSelected(),n),t.dragMoveLocation=e.lngLat},Ht.onTouchEnd=Ht.onMouseUp=function(t,e){var n=this;if(t.dragMoving)this.fireUpdate();else if(t.boxSelecting){var r=[t.boxSelectStartLocation,gt(e.originalEvent,this.map.getContainer())],i=this.featuresAt(null,r,"click"),o=this.getUniqueIds(i).filter((function(t){return!n.isSelected(t)}));o.length&&(this.select(o),o.forEach((function(t){return n.doRender(t)})),this.updateUIClasses({mouse:c.MOVE}))}this.stopExtendedInteractions(t)},Ht.toDisplayFeatures=function(t,e,n){e.properties.active=this.isSelected(e.properties.id)?y.ACTIVE:y.INACTIVE,n(e),this.fireActionable(),e.properties.active===y.ACTIVE&&e.geometry.type!==p.POINT&&_t(e).forEach(n)},Ht.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},Ht.onCombineFeatures=function(){var t=this.getSelected();if(!(0===t.length||t.length<2)){for(var e=[],n=[],r=t[0].type.replace("Multi",""),i=0;i<t.length;i++){var o=t[i];if(o.type.replace("Multi","")!==r)return;o.type.includes("Multi")?o.getCoordinates().forEach((function(t){e.push(t)})):e.push(o.getCoordinates()),n.push(o.toGeoJSON())}if(n.length>1){var s=this.newFeature({type:p.FEATURE,properties:n[0].properties,geometry:{type:"Multi"+r,coordinates:e}});this.addFeature(s),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([s.id]),this.map.fire(d.COMBINE_FEATURES,{createdFeatures:[s.toGeoJSON()],deletedFeatures:n})}this.fireActionable()}},Ht.onUncombineFeatures=function(){var t=this,e=this.getSelected();if(0!==e.length){for(var n=[],r=[],i=function(i){var o=e[i];t.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach((function(e){t.addFeature(e),e.properties=o.properties,n.push(e.toGeoJSON()),t.select([e.id])})),t.deleteFeature(o.id,{silent:!0}),r.push(o.toGeoJSON()))},o=0;o<e.length;o++)i(o);n.length>1&&this.map.fire(d.UNCOMBINE_FEATURES,{createdFeatures:n,deletedFeatures:r}),this.fireActionable()}};var Kt=et(m.VERTEX),Jt=et(m.MIDPOINT),Qt={fireUpdate:function(){this.map.fire(d.UPDATE,{action:g.CHANGE_COORDINATES,features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(t){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:t.selectedCoordPaths.length>0})},startDragging:function(t,e){this.map.dragPan.disable(),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},stopDragging:function(t){this.map.dragPan.enable(),t.dragMoving=!1,t.canDragMove=!1,t.dragMoveLocation=null},onVertex:function(t,e){this.startDragging(t,e);var n=e.featureTarget.properties,r=t.selectedCoordPaths.indexOf(n.coord_path);lt(e)||-1!==r?lt(e)&&-1===r&&t.selectedCoordPaths.push(n.coord_path):t.selectedCoordPaths=[n.coord_path];var i=this.pathsToCoordinates(t.featureId,t.selectedCoordPaths);this.setSelectedCoordinates(i)},onMidpoint:function(t,e){this.startDragging(t,e);var n=e.featureTarget.properties;t.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),t.selectedCoordPaths=[n.coord_path]},pathsToCoordinates:function(t,e){return e.map((function(e){return{feature_id:t,coord_path:e}}))},onFeature:function(t,e){0===t.selectedCoordPaths.length?this.startDragging(t,e):this.stopDragging(t)},dragFeature:function(t,e,n){Wt(this.getSelected(),n),t.dragMoveLocation=e.lngLat},dragVertex:function(t,e,n){for(var r=t.selectedCoordPaths.map((function(e){return t.feature.getCoordinate(e)})),i=Yt(r.map((function(t){return{type:p.FEATURE,properties:{},geometry:{type:p.POINT,coordinates:t}}})),n),o=0;o<r.length;o++){var s=r[o];t.feature.updateCoordinate(t.selectedCoordPaths[o],s[0]+i.lng,s[1]+i.lat)}},clickNoTarget:function(){this.changeMode(f.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(f.SIMPLE_SELECT)},clickActiveFeature:function(t){t.selectedCoordPaths=[],this.clearSelectedCoordinates(),t.feature.changed()},onSetup:function(t){var e=t.featureId,n=this.getFeature(e);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===p.POINT)throw new TypeError("direct_select mode doesn't handle point features");var r={featureId:e,feature:n,dragMoveLocation:t.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:t.coordPath?[t.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(e,r.selectedCoordPaths)),this.setSelected(e),vt.disable(this),this.setActionableState({trash:!0}),r},onStop:function(){vt.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(t,e,n){t.featureId===e.properties.id?(e.properties.active=y.ACTIVE,n(e),_t(e,{map:this.map,midpoints:!0,selectedPaths:t.selectedCoordPaths}).forEach(n)):(e.properties.active=y.INACTIVE,n(e)),this.fireActionable(t)},onTrash:function(t){t.selectedCoordPaths.sort((function(t,e){return e.localeCompare(t,"en",{numeric:!0})})).forEach((function(e){return t.feature.removeCoordinate(e)})),this.fireUpdate(),t.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(t),!1===t.feature.isValid()&&(this.deleteFeature([t.featureId]),this.changeMode(f.SIMPLE_SELECT,{}))},onMouseMove:function(t,e){var n=rt(e),r=Kt(e),i=Jt(e),o=0===t.selectedCoordPaths.length;return n&&o||r&&!o?this.updateUIClasses({mouse:c.MOVE}):this.updateUIClasses({mouse:c.NONE}),(r||n||i)&&t.dragMoving&&this.fireUpdate(),this.stopDragging(t),!0},onMouseOut:function(t){return t.dragMoving&&this.fireUpdate(),!0}};Qt.onTouchStart=Qt.onMouseDown=function(t,e){return Kt(e)?this.onVertex(t,e):rt(e)?this.onFeature(t,e):Jt(e)?this.onMidpoint(t,e):void 0},Qt.onDrag=function(t,e){if(!0===t.canDragMove){t.dragMoving=!0,e.originalEvent.stopPropagation();var n={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};t.selectedCoordPaths.length>0?this.dragVertex(t,e,n):this.dragFeature(t,e,n),t.dragMoveLocation=e.lngLat}},Qt.onClick=function(t,e){return ot(e)?this.clickNoTarget(t,e):rt(e)?this.clickActiveFeature(t,e):it(e)?this.clickInactive(t,e):void this.stopDragging(t)},Qt.onTap=function(t,e){return ot(e)?this.clickNoTarget(t,e):rt(e)?this.clickActiveFeature(t,e):it(e)?this.clickInactive(t,e):void 0},Qt.onTouchEnd=Qt.onMouseUp=function(t){t.dragMoving&&this.fireUpdate(),this.stopDragging(t)};var te={};function ee(t,e){return!!t.lngLat&&t.lngLat.lng===e[0]&&t.lngLat.lat===e[1]}te.onSetup=function(){var t=this.newFeature({type:p.FEATURE,properties:{},geometry:{type:p.POINT,coordinates:[]}});return this.addFeature(t),this.clearSelectedFeatures(),this.updateUIClasses({mouse:c.ADD}),this.activateUIButton(h.POINT),this.setActionableState({trash:!0}),{point:t}},te.stopDrawingAndRemove=function(t){this.deleteFeature([t.point.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT)},te.onTap=te.onClick=function(t,e){this.updateUIClasses({mouse:c.MOVE}),t.point.updateCoordinate("",e.lngLat.lng,e.lngLat.lat),this.map.fire(d.CREATE,{features:[t.point.toGeoJSON()]}),this.changeMode(f.SIMPLE_SELECT,{featureIds:[t.point.id]})},te.onStop=function(t){this.activateUIButton(),t.point.getCoordinate().length||this.deleteFeature([t.point.id],{silent:!0})},te.toDisplayFeatures=function(t,e,n){var r=e.properties.id===t.point.id;if(e.properties.active=r?y.ACTIVE:y.INACTIVE,!r)return n(e)},te.onTrash=te.stopDrawingAndRemove,te.onKeyUp=function(t,e){if(ut(e)||ct(e))return this.stopDrawingAndRemove(t,e)};var ne={onSetup:function(){var t=this.newFeature({type:p.FEATURE,properties:{},geometry:{type:p.POLYGON,coordinates:[[]]}});return this.addFeature(t),this.clearSelectedFeatures(),vt.disable(this),this.updateUIClasses({mouse:c.ADD}),this.activateUIButton(h.POLYGON),this.setActionableState({trash:!0}),{polygon:t,currentVertexPosition:0}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&ee(e,t.polygon.coordinates[0][t.currentVertexPosition-1]))return this.changeMode(f.SIMPLE_SELECT,{featureIds:[t.polygon.id]});this.updateUIClasses({mouse:c.ADD}),t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),t.currentVertexPosition++,t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(f.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},onMouseMove:function(t,e){t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),at(e)&&this.updateUIClasses({mouse:c.POINTER})}};ne.onTap=ne.onClick=function(t,e){return at(e)?this.clickOnVertex(t,e):this.clickAnywhere(t,e)},ne.onKeyUp=function(t,e){ut(e)?(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT)):ct(e)&&this.changeMode(f.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},ne.onStop=function(t){this.updateUIClasses({mouse:c.NONE}),vt.enable(this),this.activateUIButton(),void 0!==this.getFeature(t.polygon.id)&&(t.polygon.removeCoordinate("0."+t.currentVertexPosition),t.polygon.isValid()?this.map.fire(d.CREATE,{features:[t.polygon.toGeoJSON()]}):(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT,{},{silent:!0})))},ne.toDisplayFeatures=function(t,e,n){var r=e.properties.id===t.polygon.id;if(e.properties.active=r?y.ACTIVE:y.INACTIVE,!r)return n(e);if(0!==e.geometry.coordinates.length){var i=e.geometry.coordinates[0].length;if(!(i<3)){if(e.properties.meta=m.FEATURE,n(mt(t.polygon.id,e.geometry.coordinates[0][0],"0.0",!1)),i>3){var o=e.geometry.coordinates[0].length-3;n(mt(t.polygon.id,e.geometry.coordinates[0][o],"0."+o,!1))}if(i<=4){var s=[[e.geometry.coordinates[0][0][0],e.geometry.coordinates[0][0][1]],[e.geometry.coordinates[0][1][0],e.geometry.coordinates[0][1][1]]];if(n({type:p.FEATURE,properties:e.properties,geometry:{coordinates:s,type:p.LINE_STRING}}),3===i)return}return n(e)}}},ne.onTrash=function(t){this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT)};var re={onSetup:function(t){var e,n,r=(t=t||{}).featureId,i="forward";if(r){if(!(e=this.getFeature(r)))throw new Error("Could not find a feature with the provided featureId");var o=t.from;if(o&&"Feature"===o.type&&o.geometry&&"Point"===o.geometry.type&&(o=o.geometry),o&&"Point"===o.type&&o.coordinates&&2===o.coordinates.length&&(o=o.coordinates),!o||!Array.isArray(o))throw new Error("Please use the `from` property to indicate which point to continue the line from");var s=e.coordinates.length-1;if(e.coordinates[s][0]===o[0]&&e.coordinates[s][1]===o[1])n=s+1,e.addCoordinate.apply(e,[n].concat(e.coordinates[s]));else{if(e.coordinates[0][0]!==o[0]||e.coordinates[0][1]!==o[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");i="backwards",n=0,e.addCoordinate.apply(e,[n].concat(e.coordinates[0]))}}else e=this.newFeature({type:p.FEATURE,properties:{},geometry:{type:p.LINE_STRING,coordinates:[]}}),n=0,this.addFeature(e);return this.clearSelectedFeatures(),vt.disable(this),this.updateUIClasses({mouse:c.ADD}),this.activateUIButton(h.LINE),this.setActionableState({trash:!0}),{line:e,currentVertexPosition:n,direction:i}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&ee(e,t.line.coordinates[t.currentVertexPosition-1])||"backwards"===t.direction&&ee(e,t.line.coordinates[t.currentVertexPosition+1]))return this.changeMode(f.SIMPLE_SELECT,{featureIds:[t.line.id]});this.updateUIClasses({mouse:c.ADD}),t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),"forward"===t.direction?(t.currentVertexPosition++,t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)):t.line.addCoordinate(0,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(f.SIMPLE_SELECT,{featureIds:[t.line.id]})},onMouseMove:function(t,e){t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),at(e)&&this.updateUIClasses({mouse:c.POINTER})}};re.onTap=re.onClick=function(t,e){if(at(e))return this.clickOnVertex(t,e);this.clickAnywhere(t,e)},re.onKeyUp=function(t,e){ct(e)?this.changeMode(f.SIMPLE_SELECT,{featureIds:[t.line.id]}):ut(e)&&(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT))},re.onStop=function(t){vt.enable(this),this.activateUIButton(),void 0!==this.getFeature(t.line.id)&&(t.line.removeCoordinate(""+t.currentVertexPosition),t.line.isValid()?this.map.fire(d.CREATE,{features:[t.line.toGeoJSON()]}):(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT,{},{silent:!0})))},re.onTrash=function(t){this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(f.SIMPLE_SELECT)},re.toDisplayFeatures=function(t,e,n){var r=e.properties.id===t.line.id;if(e.properties.active=r?y.ACTIVE:y.INACTIVE,!r)return n(e);e.geometry.coordinates.length<2||(e.properties.meta=m.FEATURE,n(mt(t.line.id,e.geometry.coordinates["forward"===t.direction?e.geometry.coordinates.length-2:1],""+("forward"===t.direction?e.geometry.coordinates.length-2:1),!1)),n(e))};var ie={simple_select:Ht,direct_select:Qt,draw_point:te,draw_polygon:ne,draw_line_string:re},oe={defaultMode:f.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:tt,modes:ie,controls:{},userProperties:!1},se={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},ae={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function le(t,e){return t.map((function(t){return t.source?t:K(t,{id:t.id+"."+e,source:"hot"===e?u.HOT:u.COLD})}))}var ue={exports:{}};!function(t,e){var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Array]",a="[object Boolean]",l="[object Date]",u="[object Error]",c="[object Function]",h="[object Map]",p="[object Number]",f="[object Object]",d="[object Promise]",g="[object RegExp]",m="[object Set]",y="[object String]",_="[object WeakMap]",v="[object ArrayBuffer]",x="[object DataView]",b=/^\[object .+?Constructor\]$/,w=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[o]=E[s]=E[v]=E[a]=E[x]=E[l]=E[u]=E[c]=E[h]=E[p]=E[f]=E[g]=E[m]=E[y]=E[_]=!1;var S="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,I="object"==typeof self&&self&&self.Object===Object&&self,C=S||I||Function("return this")(),T=e&&!e.nodeType&&e,P=T&&t&&!t.nodeType&&t,M=P&&P.exports===T,L=M&&S.process,A=function(){try{return L&&L.binding&&L.binding("util")}catch(t){}}(),k=A&&A.isTypedArray;function N(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function D(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function R(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var O,z,F,B=Array.prototype,U=Function.prototype,V=Object.prototype,j=C["__core-js_shared__"],G=U.toString,q=V.hasOwnProperty,$=(O=/[^.]+$/.exec(j&&j.keys&&j.keys.IE_PROTO||""))?"Symbol(src)_1."+O:"",X=V.toString,Z=RegExp("^"+G.call(q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Y=M?C.Buffer:void 0,W=C.Symbol,H=C.Uint8Array,K=V.propertyIsEnumerable,J=B.splice,Q=W?W.toStringTag:void 0,tt=Object.getOwnPropertySymbols,et=Y?Y.isBuffer:void 0,nt=(z=Object.keys,F=Object,function(t){return z(F(t))}),rt=Pt(C,"DataView"),it=Pt(C,"Map"),ot=Pt(C,"Promise"),st=Pt(C,"Set"),at=Pt(C,"WeakMap"),lt=Pt(Object,"create"),ut=kt(rt),ct=kt(it),ht=kt(ot),pt=kt(st),ft=kt(at),dt=W?W.prototype:void 0,gt=dt?dt.valueOf:void 0;function mt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function yt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function _t(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function vt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new _t;++e<n;)this.add(t[e])}function xt(t){var e=this.__data__=new yt(t);this.size=e.size}function bt(t,e){for(var n=t.length;n--;)if(Nt(t[n][0],e))return n;return-1}function wt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Q&&Q in Object(t)?function(t){var e=q.call(t,Q),n=t[Q];try{t[Q]=void 0;var r=!0}catch(t){}var i=X.call(t);return r&&(e?t[Q]=n:delete t[Q]),i}(t):function(t){return X.call(t)}(t)}function Et(t){return Ut(t)&&wt(t)==o}function St(t,e,n,r,i){return t===e||(null==t||null==e||!Ut(t)&&!Ut(e)?t!=t&&e!=e:function(t,e,n,r,i,c){var d=Rt(t),_=Rt(e),b=d?s:Lt(t),w=_?s:Lt(e),E=(b=b==o?f:b)==f,S=(w=w==o?f:w)==f,I=b==w;if(I&&Ot(t)){if(!Ot(e))return!1;d=!0,E=!1}if(I&&!E)return c||(c=new xt),d||Vt(t)?It(t,e,n,r,i,c):function(t,e,n,r,i,o,s){switch(n){case x:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case v:return!(t.byteLength!=e.byteLength||!o(new H(t),new H(e)));case a:case l:case p:return Nt(+t,+e);case u:return t.name==e.name&&t.message==e.message;case g:case y:return t==e+"";case h:var c=D;case m:var f=1&r;if(c||(c=R),t.size!=e.size&&!f)return!1;var d=s.get(t);if(d)return d==e;r|=2,s.set(t,e);var _=It(c(t),c(e),r,i,o,s);return s.delete(t),_;case"[object Symbol]":if(gt)return gt.call(t)==gt.call(e)}return!1}(t,e,b,n,r,i,c);if(!(1&n)){var C=E&&q.call(t,"__wrapped__"),T=S&&q.call(e,"__wrapped__");if(C||T){var P=C?t.value():t,M=T?e.value():e;return c||(c=new xt),i(P,M,n,r,c)}}return!!I&&(c||(c=new xt),function(t,e,n,r,i,o){var s=1&n,a=Ct(t),l=a.length;if(l!=Ct(e).length&&!s)return!1;for(var u=l;u--;){var c=a[u];if(!(s?c in e:q.call(e,c)))return!1}var h=o.get(t);if(h&&o.get(e))return h==e;var p=!0;o.set(t,e),o.set(e,t);for(var f=s;++u<l;){var d=t[c=a[u]],g=e[c];if(r)var m=s?r(g,d,c,e,t,o):r(d,g,c,t,e,o);if(!(void 0===m?d===g||i(d,g,n,r,o):m)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){var y=t.constructor,_=e.constructor;y==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof _&&_ instanceof _||(p=!1)}return o.delete(t),o.delete(e),p}(t,e,n,r,i,c))}(t,e,n,r,St,i))}function It(t,e,n,r,i,o){var s=1&n,a=t.length,l=e.length;if(a!=l&&!(s&&l>a))return!1;var u=o.get(t);if(u&&o.get(e))return u==e;var c=-1,h=!0,p=2&n?new vt:void 0;for(o.set(t,e),o.set(e,t);++c<a;){var f=t[c],d=e[c];if(r)var g=s?r(d,f,c,e,t,o):r(f,d,c,t,e,o);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!N(e,(function(t,e){if(s=e,!p.has(s)&&(f===t||i(f,t,n,r,o)))return p.push(e);var s}))){h=!1;break}}else if(f!==d&&!i(f,d,n,r,o)){h=!1;break}}return o.delete(t),o.delete(e),h}function Ct(t){return function(t,e,n){var r=e(t);return Rt(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,jt,Mt)}function Tt(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function Pt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Bt(t)||function(t){return!!$&&$ in t}(t))&&(zt(t)?Z:b).test(kt(t))}(n)?n:void 0}mt.prototype.clear=function(){this.__data__=lt?lt(null):{},this.size=0},mt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},mt.prototype.get=function(t){var e=this.__data__;if(lt){var n=e[t];return n===r?void 0:n}return q.call(e,t)?e[t]:void 0},mt.prototype.has=function(t){var e=this.__data__;return lt?void 0!==e[t]:q.call(e,t)},mt.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=lt&&void 0===e?r:e,this},yt.prototype.clear=function(){this.__data__=[],this.size=0},yt.prototype.delete=function(t){var e=this.__data__,n=bt(e,t);return!(n<0||(n==e.length-1?e.pop():J.call(e,n,1),--this.size,0))},yt.prototype.get=function(t){var e=this.__data__,n=bt(e,t);return n<0?void 0:e[n][1]},yt.prototype.has=function(t){return bt(this.__data__,t)>-1},yt.prototype.set=function(t,e){var n=this.__data__,r=bt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},_t.prototype.clear=function(){this.size=0,this.__data__={hash:new mt,map:new(it||yt),string:new mt}},_t.prototype.delete=function(t){var e=Tt(this,t).delete(t);return this.size-=e?1:0,e},_t.prototype.get=function(t){return Tt(this,t).get(t)},_t.prototype.has=function(t){return Tt(this,t).has(t)},_t.prototype.set=function(t,e){var n=Tt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},vt.prototype.add=vt.prototype.push=function(t){return this.__data__.set(t,r),this},vt.prototype.has=function(t){return this.__data__.has(t)},xt.prototype.clear=function(){this.__data__=new yt,this.size=0},xt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},xt.prototype.get=function(t){return this.__data__.get(t)},xt.prototype.has=function(t){return this.__data__.has(t)},xt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof yt){var r=n.__data__;if(!it||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new _t(r)}return n.set(t,e),this.size=n.size,this};var Mt=tt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s)&&(o[i++]=s)}return o}(tt(t),(function(e){return K.call(t,e)})))}:function(){return[]},Lt=wt;function At(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||w.test(t))&&t>-1&&t%1==0&&t<e}function kt(t){if(null!=t){try{return G.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Nt(t,e){return t===e||t!=t&&e!=e}(rt&&Lt(new rt(new ArrayBuffer(1)))!=x||it&&Lt(new it)!=h||ot&&Lt(ot.resolve())!=d||st&&Lt(new st)!=m||at&&Lt(new at)!=_)&&(Lt=function(t){var e=wt(t),n=e==f?t.constructor:void 0,r=n?kt(n):"";if(r)switch(r){case ut:return x;case ct:return h;case ht:return d;case pt:return m;case ft:return _}return e});var Dt=Et(function(){return arguments}())?Et:function(t){return Ut(t)&&q.call(t,"callee")&&!K.call(t,"callee")},Rt=Array.isArray,Ot=et||function(){return!1};function zt(t){if(!Bt(t))return!1;var e=wt(t);return e==c||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ft(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}function Bt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ut(t){return null!=t&&"object"==typeof t}var Vt=k?function(t){return function(e){return t(e)}}(k):function(t){return Ut(t)&&Ft(t.length)&&!!E[wt(t)]};function jt(t){return null!=(e=t)&&Ft(e.length)&&!zt(e)?function(t,e){var n=Rt(t),r=!n&&Dt(t),i=!n&&!r&&Ot(t),o=!n&&!r&&!i&&Vt(t),s=n||r||i||o,a=s?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],l=a.length;for(var u in t)!e&&!q.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||At(u,l))||a.push(u);return a}(t):function(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||V))return nt(t);var e,n,r=[];for(var i in Object(t))q.call(t,i)&&"constructor"!=i&&r.push(i);return r}(t);var e}t.exports=function(t,e){return St(t,e)}}(ue,ue.exports);var ce=e(ue.exports);function he(t,e){return t.length===e.length&&JSON.stringify(t.map((function(t){return t})).sort())===JSON.stringify(e.map((function(t){return t})).sort())}var pe={Polygon:B,LineString:F,Point:z,MultiPolygon:j,MultiLineString:j,MultiPoint:j},fe=Object.freeze({__proto__:null,CommonSelectors:ht,constrainFeatureMovement:Yt,createMidPoint:yt,createSupplementaryPoints:_t,createVertex:mt,doubleClickZoom:vt,euclideanDistance:L,featuresAt:T,getFeatureAtAndSetCursors:M,isClick:A,isEventAtCoordinates:ee,isTap:k,mapEventToBoundingBox:S,ModeHandler:t,moveFeatures:Wt,sortFeatures:E,stringSetsAreEqual:he,StringSet:I,theme:tt,toDenseArray:X});function de(t){!function(t,e){var n={options:t=function(t){void 0===t&&(t={});var e=K(t);return t.controls||(e.controls={}),!1===t.displayControlsDefault?e.controls=K(ae,t.controls):e.controls=K(se,t.controls),(e=K(oe,e)).styles=le(e.styles,"cold").concat(le(e.styles,"hot")),e}(t)};e=function(t,e){return e.modes=f,e.getFeatureIdsAt=function(e){return T.click({point:e},null,t).map((function(t){return t.properties.id}))},e.getSelectedIds=function(){return t.store.getSelectedIds()},e.getSelected=function(){return{type:p.FEATURE_COLLECTION,features:t.store.getSelectedIds().map((function(e){return t.store.get(e)})).map((function(t){return t.toGeoJSON()}))}},e.getSelectedPoints=function(){return{type:p.FEATURE_COLLECTION,features:t.store.getSelectedCoordinates().map((function(t){return{type:p.FEATURE,properties:{},geometry:{type:p.POINT,coordinates:t.coordinates}}}))}},e.set=function(n){if(void 0===n.type||n.type!==p.FEATURE_COLLECTION||!Array.isArray(n.features))throw new Error("Invalid FeatureCollection");var r=t.store.createRenderBatch(),i=t.store.getAllIds().slice(),o=e.add(n),s=new I(o);return(i=i.filter((function(t){return!s.has(t)}))).length&&e.delete(i),r(),o},e.add=function(e){var n=JSON.parse(JSON.stringify(Et(e))).features.map((function(e){if(e.id=e.id||R(),null===e.geometry)throw new Error("Invalid geometry: null");if(void 0===t.store.get(e.id)||t.store.get(e.id).type!==e.geometry.type){var n=pe[e.geometry.type];if(void 0===n)throw new Error("Invalid geometry type: "+e.geometry.type+".");var r=new n(t,e);t.store.add(r)}else{var i=t.store.get(e.id);i.properties=e.properties,ce(i.properties,e.properties)||t.store.featureChanged(i.id),ce(i.getCoordinates(),e.geometry.coordinates)||i.incomingCoords(e.geometry.coordinates)}return e.id}));return t.store.render(),n},e.get=function(e){var n=t.store.get(e);if(n)return n.toGeoJSON()},e.getAll=function(){return{type:p.FEATURE_COLLECTION,features:t.store.getAll().map((function(t){return t.toGeoJSON()}))}},e.delete=function(n){return t.store.delete(n,{silent:!0}),e.getMode()!==f.DIRECT_SELECT||t.store.getSelectedIds().length?t.store.render():t.events.changeMode(f.SIMPLE_SELECT,void 0,{silent:!0}),e},e.deleteAll=function(){return t.store.delete(t.store.getAllIds(),{silent:!0}),e.getMode()===f.DIRECT_SELECT?t.events.changeMode(f.SIMPLE_SELECT,void 0,{silent:!0}):t.store.render(),e},e.changeMode=function(n,r){return void 0===r&&(r={}),n===f.SIMPLE_SELECT&&e.getMode()===f.SIMPLE_SELECT?(he(r.featureIds||[],t.store.getSelectedIds())||(t.store.setSelected(r.featureIds,{silent:!0}),t.store.render()),e):(n===f.DIRECT_SELECT&&e.getMode()===f.DIRECT_SELECT&&r.featureId===t.store.getSelectedIds()[0]||t.events.changeMode(n,r,{silent:!0}),e)},e.getMode=function(){return t.events.getMode()},e.trash=function(){return t.events.trash({silent:!0}),e},e.combineFeatures=function(){return t.events.combineFeatures({silent:!0}),e},e.uncombineFeatures=function(){return t.events.uncombineFeatures({silent:!0}),e},e.setFeatureProperty=function(n,r,i){return t.store.setFeatureProperty(n,r,i),e},e}(n,e),n.api=e;var r=Q(n);e.onAdd=r.onAdd,e.onRemove=r.onRemove,e.types=h,e.options=t}(t,this)}return de.modes=ie,de.constants=x,de.lib=fe,de}()},5824:(t,e,n)=>{var r=n(4262);function i(t){var e=[1/0,1/0,-1/0,-1/0];return r.coordEach(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}i.default=i,e.A=i},462:(t,e)=>{function n(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function r(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!f(t[0])||!f(t[1]))throw new Error("coordinates must contain numbers");return n({type:"Point",coordinates:t},e,r)}function i(t,e,r){void 0===r&&(r={});for(var i=0,o=t;i<o.length;i++){var s=o[i];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++)if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}return n({type:"Polygon",coordinates:t},e,r)}function o(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return n({type:"LineString",coordinates:t},e,r)}function s(t,e){void 0===e&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function a(t,e,r){return void 0===r&&(r={}),n({type:"MultiLineString",coordinates:t},e,r)}function l(t,e,r){return void 0===r&&(r={}),n({type:"MultiPoint",coordinates:t},e,r)}function u(t,e,r){return void 0===r&&(r={}),n({type:"MultiPolygon",coordinates:t},e,r)}function c(t,n){void 0===n&&(n="kilometers");var r=e.factors[n];if(!r)throw new Error(n+" units is invalid");return t*r}function h(t,n){void 0===n&&(n="kilometers");var r=e.factors[n];if(!r)throw new Error(n+" units is invalid");return t/r}function p(t){return t%(2*Math.PI)*180/Math.PI}function f(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=6371008.8,e.factors={centimeters:100*e.earthRadius,centimetres:100*e.earthRadius,degrees:e.earthRadius/111325,feet:3.28084*e.earthRadius,inches:39.37*e.earthRadius,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:1e3*e.earthRadius,millimetres:1e3*e.earthRadius,nauticalmiles:e.earthRadius/1852,radians:1,yards:1.0936*e.earthRadius},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1.0936133},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},e.feature=n,e.geometry=function(t,e,n){switch(void 0===n&&(n={}),t){case"Point":return r(e).geometry;case"LineString":return o(e).geometry;case"Polygon":return i(e).geometry;case"MultiPoint":return l(e).geometry;case"MultiLineString":return a(e).geometry;case"MultiPolygon":return u(e).geometry;default:throw new Error(t+" is invalid")}},e.point=r,e.points=function(t,e,n){return void 0===n&&(n={}),s(t.map((function(t){return r(t,e)})),n)},e.polygon=i,e.polygons=function(t,e,n){return void 0===n&&(n={}),s(t.map((function(t){return i(t,e)})),n)},e.lineString=o,e.lineStrings=function(t,e,n){return void 0===n&&(n={}),s(t.map((function(t){return o(t,e)})),n)},e.featureCollection=s,e.multiLineString=a,e.multiPoint=l,e.multiPolygon=u,e.geometryCollection=function(t,e,r){return void 0===r&&(r={}),n({type:"GeometryCollection",geometries:t},e,r)},e.round=function(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n},e.radiansToLength=c,e.lengthToRadians=h,e.lengthToDegrees=function(t,e){return p(h(t,e))},e.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=p,e.degreesToRadians=function(t){return t%360*Math.PI/180},e.convertLength=function(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return c(h(t,e),n)},e.convertArea=function(t,n,r){if(void 0===n&&(n="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=e.areaFactors[n];if(!i)throw new Error("invalid original units");var o=e.areaFactors[r];if(!o)throw new Error("invalid final units");return t/i*o},e.isNumber=f,e.isObject=function(t){return!!t&&t.constructor===Object},e.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!f(t))throw new Error("bbox must only contain numbers")}))},e.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}},4262:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=n(462);function i(t,e,n){if(null!==t)for(var r,o,s,a,l,u,c,h,p=0,f=0,d=t.type,g="FeatureCollection"===d,m="Feature"===d,y=g?t.features.length:1,_=0;_<y;_++){l=(h=!!(c=g?t.features[_].geometry:m?t.geometry:t)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var v=0;v<l;v++){var x=0,b=0;if(null!==(a=h?c.geometries[v]:c)){u=a.coordinates;var w=a.type;switch(p=!n||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(u,f,_,x,b))return!1;f++,x++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(!1===e(u[r],f,_,x,b))return!1;f++,"MultiPoint"===w&&x++}"LineString"===w&&x++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(o=0;o<u[r].length-p;o++){if(!1===e(u[r][o],f,_,x,b))return!1;f++}"MultiLineString"===w&&x++,"Polygon"===w&&b++}"Polygon"===w&&x++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(b=0,o=0;o<u[r].length;o++){for(s=0;s<u[r][o].length-p;s++){if(!1===e(u[r][o][s],f,_,x,b))return!1;f++}b++}x++}break;case"GeometryCollection":for(r=0;r<a.geometries.length;r++)if(!1===i(a.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function o(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function s(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function a(t,e){var n,r,i,o,s,a,l,u,c,h,p=0,f="FeatureCollection"===t.type,d="Feature"===t.type,g=f?t.features.length:1;for(n=0;n<g;n++){for(a=f?t.features[n].geometry:d?t.geometry:t,u=f?t.features[n].properties:d?t.properties:{},c=f?t.features[n].bbox:d?t.bbox:void 0,h=f?t.features[n].id:d?t.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=l?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,p,u,c,h))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],p,u,c,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,p,u,c,h))return!1;p++}}function l(t,e){a(t,(function(t,n,i,o,s){var a,l=null===t?null:t.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return!1!==e(r.feature(t,i,{bbox:o,id:s}),n,0)&&void 0}switch(l){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}for(var u=0;u<t.coordinates.length;u++){var c={type:a,coordinates:t.coordinates[u]};if(!1===e(r.feature(c,i),n,u))return!1}}))}function u(t,e){l(t,(function(t,n,o){var s=0;if(t.geometry){var a=t.geometry.type;if("Point"!==a&&"MultiPoint"!==a){var l,u=0,c=0,h=0;return!1!==i(t,(function(i,a,p,f,d){if(void 0===l||n>u||f>c||d>h)return l=i,u=n,c=f,h=d,void(s=0);var g=r.lineString([l,i],t.properties);if(!1===e(g,n,o,d,s))return!1;s++,l=i}))&&void 0}}}))}function c(t,e){if(!t)throw new Error("geojson is required");l(t,(function(t,n,i){if(null!==t.geometry){var o=t.geometry.type,s=t.geometry.coordinates;switch(o){case"LineString":if(!1===e(t,n,i,0,0))return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(!1===e(r.lineString(s[a],t.properties),n,i,a))return!1}}}))}e.coordAll=function(t){var e=[];return i(t,(function(t){e.push(t)})),e},e.coordEach=i,e.coordReduce=function(t,e,n,r){var o=n;return i(t,(function(t,r,i,s,a){o=0===r&&void 0===n?t:e(o,t,r,i,s,a)}),r),o},e.featureEach=s,e.featureReduce=function(t,e,n){var r=n;return s(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},e.findPoint=function(t,e){if(e=e||{},!r.isObject(e))throw new Error("options is invalid");var n,i=e.featureIndex||0,o=e.multiFeatureIndex||0,s=e.geometryIndex||0,a=e.coordIndex||0,l=e.properties;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i),l=l||t.features[i].properties,n=t.features[i].geometry;break;case"Feature":l=l||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":return r.point(u,l,e);case"MultiPoint":return o<0&&(o=u.length+o),r.point(u[o],l,e);case"LineString":return a<0&&(a=u.length+a),r.point(u[a],l,e);case"Polygon":return s<0&&(s=u.length+s),a<0&&(a=u[s].length+a),r.point(u[s][a],l,e);case"MultiLineString":return o<0&&(o=u.length+o),a<0&&(a=u[o].length+a),r.point(u[o][a],l,e);case"MultiPolygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),a<0&&(a=u[o][s].length-a),r.point(u[o][s][a],l,e)}throw new Error("geojson is invalid")},e.findSegment=function(t,e){if(e=e||{},!r.isObject(e))throw new Error("options is invalid");var n,i=e.featureIndex||0,o=e.multiFeatureIndex||0,s=e.geometryIndex||0,a=e.segmentIndex||0,l=e.properties;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i),l=l||t.features[i].properties,n=t.features[i].geometry;break;case"Feature":l=l||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return a<0&&(a=u.length+a-1),r.lineString([u[a],u[a+1]],l,e);case"Polygon":return s<0&&(s=u.length+s),a<0&&(a=u[s].length+a-1),r.lineString([u[s][a],u[s][a+1]],l,e);case"MultiLineString":return o<0&&(o=u.length+o),a<0&&(a=u[o].length+a-1),r.lineString([u[o][a],u[o][a+1]],l,e);case"MultiPolygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),a<0&&(a=u[o][s].length-a-1),r.lineString([u[o][s][a],u[o][s][a+1]],l,e)}throw new Error("geojson is invalid")},e.flattenEach=l,e.flattenReduce=function(t,e,n){var r=n;return l(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r},e.geomEach=a,e.geomReduce=function(t,e,n){var r=n;return a(t,(function(t,i,o,s,a){r=0===i&&void 0===n?t:e(r,t,i,o,s,a)})),r},e.lineEach=c,e.lineReduce=function(t,e,n){var r=n;return c(t,(function(t,i,o,s){r=0===i&&void 0===n?t:e(r,t,i,o,s)})),r},e.propEach=o,e.propReduce=function(t,e,n){var r=n;return o(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},e.segmentEach=u,e.segmentReduce=function(t,e,n){var r=n,i=!1;return u(t,(function(t,o,s,a,l){r=!1===i&&void 0===n?t:e(r,t,o,s,a,l),i=!0})),r}},9818:(t,e,n)=>{var r=n(528),i=n(8498),o=i(r("String.prototype.indexOf"));t.exports=function(t,e){var n=r(t,!!e);return"function"==typeof n&&o(t,".prototype.")>-1?i(n):n}},8498:(t,e,n)=>{var r=n(9138),i=n(528),o=n(6108),s=i("%TypeError%"),a=i("%Function.prototype.apply%"),l=i("%Function.prototype.call%"),u=i("%Reflect.apply%",!0)||r.call(l,a),c=i("%Object.defineProperty%",!0),h=i("%Math.max%");if(c)try{c({},"a",{value:1})}catch(t){c=null}t.exports=function(t){if("function"!=typeof t)throw new s("a function is required");var e=u(r,l,arguments);return o(e,1+h(0,t.length-(arguments.length-1)),!0)};var p=function(){return u(r,a,arguments)};c?c(t.exports,"apply",{value:p}):t.exports.apply=p},9985:(t,e,n)=>{var r=n(1689),i=n(7803),o=n(3071),s=n(5168).orient2d;function a(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;var i=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],s=0;s<t.length;s++){var a=t[s];a[0]<e[0]&&(e=a),a[0]>r[0]&&(r=a),a[1]<n[1]&&(n=a),a[1]>i[1]&&(i=a)}var l=[e,n,r,i],u=l.slice();for(s=0;s<t.length;s++)o(t[s],l)||u.push(t[s]);return function(t){t.sort(v);for(var e=[],n=0;n<t.length;n++){for(;e.length>=2&&f(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&f(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),e.pop(),e.concat(r)}(u)}(t),s=new r(16);s.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},s.compareMinX=function(t,e){return t[0]-e[0]},s.compareMinY=function(t,e){return t[1]-e[1]},s.load(t);for(var a,u=[],c=0;c<i.length;c++){var h=i[c];s.remove(h),a=g(h,a),u.push(a)}var p=new r(16);for(c=0;c<u.length;c++)p.insert(d(u[c]));for(var y=e*e,_=n*n;u.length;){var x=u.shift(),b=x.p,w=x.next.p,E=m(b,w);if(!(E<_)){var S=E/y;(h=l(s,x.prev.p,b,w,x.next.next.p,S,p))&&Math.min(m(h,b),m(h,w))<=S&&(u.push(x),u.push(g(h,x)),s.remove(h),p.remove(x),p.insert(d(x)),p.insert(d(x.next)))}}x=a;var I=[];do{I.push(x.p),x=x.next}while(x!==a);return I.push(x.p),I}function l(t,e,n,r,o,s,a){for(var l=new i([],u),h=t.data;h;){for(var f=0;f<h.children.length;f++){var d=h.children[f],g=h.leaf?y(d,n,r):c(n,r,d);g>s||l.push({node:d,dist:g})}for(;l.length&&!l.peek().node.children;){var m=l.pop(),_=m.node,v=y(_,e,n),x=y(_,r,o);if(m.dist<v&&m.dist<x&&p(n,_,a)&&p(r,_,a))return _}(h=l.pop())&&(h=h.node)}return null}function u(t,e){return t.dist-e.dist}function c(t,e,n){if(h(t,n)||h(e,n))return 0;var r=_(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=_(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=_(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=_(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY);return 0===s?0:Math.min(r,i,o,s)}function h(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function p(t,e,n){for(var r,i,o,s,a=Math.min(t[0],e[0]),l=Math.min(t[1],e[1]),u=Math.max(t[0],e[0]),c=Math.max(t[1],e[1]),h=n.search({minX:a,minY:l,maxX:u,maxY:c}),p=0;p<h.length;p++)if(r=h[p].p,i=h[p].next.p,o=t,r!==(s=e)&&i!==o&&f(r,i,o)>0!=f(r,i,s)>0&&f(o,s,r)>0!=f(o,s,i)>0)return!1;return!0}function f(t,e,n){return s(t[0],t[1],e[0],e[1],n[0],n[1])}function d(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function g(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,n.prev=e,e.next.prev=n,e.next=n):(n.prev=n,n.next=n),n}function m(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function y(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function _(t,e,n,r,i,o,s,a){var l,u,c,h,p=n-t,f=r-e,d=s-i,g=a-o,m=t-i,y=e-o,_=p*p+f*f,v=p*d+f*g,x=d*d+g*g,b=p*m+f*y,w=d*m+g*y,E=_*x-v*v,S=E,I=E;0===E?(u=0,S=1,h=w,I=x):(h=_*w-v*b,(u=v*w-x*b)<0?(u=0,h=w,I=x):u>S&&(u=S,h=w+v,I=x)),h<0?(h=0,-b<0?u=0:-b>_?u=S:(u=-b,S=_)):h>I&&(h=I,-b+v<0?u=0:-b+v>_?u=S:(u=-b+v,S=_));var C=(1-(c=0===h?0:h/I))*i+c*s-((1-(l=0===u?0:u/S))*t+l*n),T=(1-c)*o+c*a-((1-l)*e+l*r);return C*C+T*T}function v(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}i.default&&(i=i.default),t.exports=a,t.exports.default=a},1689:function(t){t.exports=function(){function t(t,r,i,o,s){!function t(n,r,i,o,s){for(;o>i;){if(o-i>600){var a=o-i+1,l=r-i+1,u=Math.log(a),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(a-c)/a)*(l-a/2<0?-1:1);t(n,r,Math.max(i,Math.floor(r-l*c/a+h)),Math.min(o,Math.floor(r+(a-l)*c/a+h)),s)}var p=n[r],f=i,d=o;for(e(n,i,r),s(n[o],p)>0&&e(n,i,o);f<d;){for(e(n,f,d),f++,d--;s(n[f],p)<0;)f++;for(;s(n[d],p)>0;)d--}0===s(n[i],p)?e(n,i,d):e(n,++d,o),d<=r&&(i=d+1),r<=d&&(o=d-1)}}(t,r,i||0,o||t.length-1,s||n)}function e(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function n(t,e){return t<e?-1:t>e?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function o(t,e){s(t,0,t.children.length,e,t)}function s(t,e,n,r,i){i||(i=d(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=e;o<n;o++){var s=t.children[o];a(i,t.leaf?r(s):s)}return i}function a(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function l(t,e){return t.minX-e.minX}function u(t,e){return t.minY-e.minY}function c(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function h(t){return t.maxX-t.minX+(t.maxY-t.minY)}function p(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function f(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function d(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(e,n,r,i,o){for(var s=[n,r];s.length;)if(!((r=s.pop())-(n=s.pop())<=i)){var a=n+Math.ceil((r-n)/i/2)*i;t(e,a,n,r,o),s.push(n,a,a,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var e=this.data,n=[];if(!f(t,e))return n;for(var r=this.toBBox,i=[];e;){for(var o=0;o<e.children.length;o++){var s=e.children[o],a=e.leaf?r(s):s;f(t,a)&&(e.leaf?n.push(s):p(t,a)?this._all(s,n):i.push(s))}e=i.pop()}return n},r.prototype.collides=function(t){var e=this.data;if(!f(t,e))return!1;for(var n=[];e;){for(var r=0;r<e.children.length;r++){var i=e.children[r],o=e.leaf?this.toBBox(i):i;if(f(t,o)){if(e.leaf||p(t,o))return!0;n.push(i)}}e=n.pop()}return!1},r.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},r.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},r.prototype.clear=function(){return this.data=d([]),this},r.prototype.remove=function(t,e){if(!t)return this;for(var n,r,o,s=this.data,a=this.toBBox(t),l=[],u=[];s||l.length;){if(s||(s=l.pop(),r=l[l.length-1],n=u.pop(),o=!0),s.leaf){var c=i(t,s.children,e);if(-1!==c)return s.children.splice(c,1),l.push(s),this._condense(l),this}o||s.leaf||!p(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(l.push(s),u.push(n),n=0,r=s,s=s.children[0])}return this},r.prototype.toBBox=function(t){return t},r.prototype.compareMinX=function(t,e){return t.minX-e.minX},r.prototype.compareMinY=function(t,e){return t.minY-e.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(t){return this.data=t,this},r.prototype._all=function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},r.prototype._build=function(t,e,n,r){var i,s=n-e+1,a=this._maxEntries;if(s<=a)return o(i=d(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/Math.pow(a,r-1))),(i=d([])).leaf=!1,i.height=r;var l=Math.ceil(s/a),u=l*Math.ceil(Math.sqrt(a));g(t,e,n,u,this.compareMinX);for(var c=e;c<=n;c+=u){var h=Math.min(c+u-1,n);g(t,c,h,l,this.compareMinY);for(var p=c;p<=h;p+=l){var f=Math.min(p+l-1,h);i.children.push(this._build(t,p,f,r-1))}}return o(i,this.toBBox),i},r.prototype._chooseSubtree=function(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){for(var i=1/0,o=1/0,s=void 0,a=0;a<e.children.length;a++){var l=e.children[a],u=c(l),h=(p=t,f=l,(Math.max(f.maxX,p.maxX)-Math.min(f.minX,p.minX))*(Math.max(f.maxY,p.maxY)-Math.min(f.minY,p.minY))-u);h<o?(o=h,i=u<i?u:i,s=l):h===o&&u<i&&(i=u,s=l)}e=s||e.children[0]}var p,f;return e},r.prototype._insert=function(t,e,n){var r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),a(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)},r.prototype._split=function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var s=this._chooseSplitIndex(n,i,r),a=d(n.children.splice(s,n.children.length-s));a.height=n.height,a.leaf=n.leaf,o(n,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)},r.prototype._splitRoot=function(t,e){this.data=d([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,e,n){for(var r,i,o,a,l,u,h,p=1/0,f=1/0,d=e;d<=n-e;d++){var g=s(t,0,d,this.toBBox),m=s(t,d,n,this.toBBox),y=(i=g,o=m,void 0,void 0,void 0,void 0,a=Math.max(i.minX,o.minX),l=Math.max(i.minY,o.minY),u=Math.min(i.maxX,o.maxX),h=Math.min(i.maxY,o.maxY),Math.max(0,u-a)*Math.max(0,h-l)),_=c(g)+c(m);y<p?(p=y,r=d,f=_<f?_:f):y===p&&_<f&&(f=_,r=d)}return r||n-e},r.prototype._chooseSplitAxis=function(t,e,n){var r=t.leaf?this.compareMinX:l,i=t.leaf?this.compareMinY:u;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},r.prototype._allDistMargin=function(t,e,n,r){t.children.sort(r);for(var i=this.toBBox,o=s(t,0,e,i),l=s(t,n-e,n,i),u=h(o)+h(l),c=e;c<n-e;c++){var p=t.children[c];a(o,t.leaf?i(p):p),u+=h(o)}for(var f=n-e-1;f>=e;f--){var d=t.children[f];a(l,t.leaf?i(d):d),u+=h(l)}return u},r.prototype._adjustParentBBoxes=function(t,e,n){for(var r=n;r>=0;r--)a(e[r],t)},r.prototype._condense=function(t){for(var e=t.length-1,n=void 0;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children).splice(n.indexOf(t[e]),1):this.clear():o(t[e],this.toBBox)},r}()},4969:(t,e,n)=>{var r=n(9228),i=n(5387),o=n(5968),s=n(2672),a=n(1026),l=n(9543),u=Date.prototype.getTime;function c(t){return null==t}function h(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length||"function"!=typeof t.copy||"function"!=typeof t.slice||t.length>0&&"number"!=typeof t[0])}t.exports=function t(e,n,p){var f=p||{};return!!(f.strict?o(e,n):e===n)||(!e||!n||"object"!=typeof e&&"object"!=typeof n?f.strict?o(e,n):e==n:function(e,n,o){var p,f;if(typeof e!=typeof n)return!1;if(c(e)||c(n))return!1;if(e.prototype!==n.prototype)return!1;if(i(e)!==i(n))return!1;var d=s(e),g=s(n);if(d!==g)return!1;if(d||g)return e.source===n.source&&a(e)===a(n);if(l(e)&&l(n))return u.call(e)===u.call(n);var m=h(e),y=h(n);if(m!==y)return!1;if(m||y){if(e.length!==n.length)return!1;for(p=0;p<e.length;p++)if(e[p]!==n[p])return!1;return!0}if(typeof e!=typeof n)return!1;try{var _=r(e),v=r(n)}catch(t){return!1}if(_.length!==v.length)return!1;for(_.sort(),v.sort(),p=_.length-1;p>=0;p--)if(_[p]!=v[p])return!1;for(p=_.length-1;p>=0;p--)if(!t(e[f=_[p]],n[f],o))return!1;return!0}(e,n,f))}},686:(t,e,n)=>{var r=n(7239)(),i=n(528),o=r&&i("%Object.defineProperty%",!0);if(o)try{o({},"a",{value:1})}catch(t){o=!1}var s=i("%SyntaxError%"),a=i("%TypeError%"),l=n(9336);t.exports=function(t,e,n){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new a("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new a("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new a("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new a("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new a("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new a("`loose`, if provided, must be a boolean");var r=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],h=!!l&&l(t,e);if(o)o(t,e,{configurable:null===u&&h?h.configurable:!u,enumerable:null===r&&h?h.enumerable:!r,value:n,writable:null===i&&h?h.writable:!i});else{if(!c&&(r||i||u))throw new s("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=n}}},1857:(t,e,n)=>{var r=n(9228),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,s=Array.prototype.concat,a=n(686),l=n(7239)(),u=function(t,e,n,r){if(e in t)if(!0===r){if(t[e]===n)return}else if("function"!=typeof(i=r)||"[object Function]"!==o.call(i)||!r())return;var i;l?a(t,e,n,!0):a(t,e,n)},c=function(t,e){var n=arguments.length>2?arguments[2]:{},o=r(e);i&&(o=s.call(o,Object.getOwnPropertySymbols(e)));for(var a=0;a<o.length;a+=1)u(t,o[a],e[o[a]],n[o[a]])};c.supportsDescriptors=!!l,t.exports=c},8136:t=>{function e(t,e,n,r){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(t,e,n,r)}e.prototype.run=function(t,e,n,r){this._init(t,e,n,r);for(var i=0;i<this._datasetLength;i++)if(1!==this._visited[i]){this._visited[i]=1;var o=this._regionQuery(i);if(o.length<this.minPts)this.noise.push(i);else{var s=this.clusters.length;this.clusters.push([]),this._addToCluster(i,s),this._expandCluster(s,o)}}return this.clusters},e.prototype._init=function(t,e,n,r){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+typeof t+" given");this.dataset=t,this.clusters=[],this.noise=[],this._datasetLength=t.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}e&&(this.epsilon=e),n&&(this.minPts=n),r&&(this.distance=r)},e.prototype._expandCluster=function(t,e){for(var n=0;n<e.length;n++){var r=e[n];if(1!==this._visited[r]){this._visited[r]=1;var i=this._regionQuery(r);i.length>=this.minPts&&(e=this._mergeArrays(e,i))}1!==this._assigned[r]&&this._addToCluster(r,t)}},e.prototype._addToCluster=function(t,e){this.clusters[e].push(t),this._assigned[t]=1},e.prototype._regionQuery=function(t){for(var e=[],n=0;n<this._datasetLength;n++)this.distance(this.dataset[t],this.dataset[n])<this.epsilon&&e.push(n);return e},e.prototype._mergeArrays=function(t,e){for(var n=e.length,r=0;r<n;r++){var i=e[r];t.indexOf(i)<0&&t.push(i)}return t},e.prototype._euclideanDistance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;)n+=(t[r]-e[r])*(t[r]-e[r]);return Math.sqrt(n)},t.exports&&(t.exports=e)},9190:t=>{function e(t,e,n){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(t,e,n)}e.prototype.init=function(t,e,n){this.assignments=[],this.centroids=[],void 0!==t&&(this.dataset=t),void 0!==e&&(this.k=e),void 0!==n&&(this.distance=n)},e.prototype.run=function(t,e){this.init(t,e);for(var n=this.dataset.length,r=0;r<this.k;r++)this.centroids[r]=this.randomCentroid();for(var i=!0;i;){i=this.assign();for(var o=0;o<this.k;o++){for(var s=new Array(c),a=0,l=0;l<c;l++)s[l]=0;for(var u=0;u<n;u++){var c=this.dataset[u].length;if(o===this.assignments[u]){for(l=0;l<c;l++)s[l]+=this.dataset[u][l];a++}}if(a>0){for(l=0;l<c;l++)s[l]/=a;this.centroids[o]=s}else this.centroids[o]=this.randomCentroid(),i=!0}}return this.getClusters()},e.prototype.randomCentroid=function(){var t,e,n=this.dataset.length-1;do{e=Math.round(Math.random()*n),t=this.dataset[e]}while(this.centroids.indexOf(t)>=0);return t},e.prototype.assign=function(){for(var t,e=!1,n=this.dataset.length,r=0;r<n;r++)(t=this.argmin(this.dataset[r],this.centroids,this.distance))!=this.assignments[r]&&(this.assignments[r]=t,e=!0);return e},e.prototype.getClusters=function(){for(var t,e=new Array(this.k),n=0;n<this.assignments.length;n++)void 0===e[t=this.assignments[n]]&&(e[t]=[]),e[t].push(n);return e},e.prototype.argmin=function(t,e,n){for(var r,i=Number.MAX_VALUE,o=0,s=e.length,a=0;a<s;a++)(r=n(t,e[a]))<i&&(i=r,o=a);return o},e.prototype.distance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;){var i=t[r]-e[r];n+=i*i}return Math.sqrt(n)},t.exports&&(t.exports=e)},2037:(t,e,n)=>{if(t.exports)var r=n(624);function i(t,e,n,r){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(t,e,n,r)}i.prototype.run=function(t,e,n,i){this._init(t,e,n,i);for(var o=0,s=this.dataset.length;o<s;o++)if(1!==this._processed[o]){this._processed[o]=1,this.clusters.push([o]);var a=this.clusters.length-1;this._orderedList.push(o);var l=new r(null,null,"asc"),u=this._regionQuery(o);void 0!==this._distanceToCore(o)&&(this._updateQueue(o,u,l),this._expandCluster(a,l))}return this.clusters},i.prototype.getReachabilityPlot=function(){for(var t=[],e=0,n=this._orderedList.length;e<n;e++){var r=this._orderedList[e],i=this._reachability[r];t.push([r,i])}return t},i.prototype._init=function(t,e,n,r){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+typeof t+" given");this.dataset=t,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}e&&(this.epsilon=e),n&&(this.minPts=n),r&&(this.distance=r)},i.prototype._updateQueue=function(t,e,n){var r=this;this._coreDistance=this._distanceToCore(t),e.forEach((function(e){if(void 0===r._processed[e]){var i=r.distance(r.dataset[t],r.dataset[e]),o=Math.max(r._coreDistance,i);void 0===r._reachability[e]?(r._reachability[e]=o,n.insert(e,o)):o<r._reachability[e]&&(r._reachability[e]=o,n.remove(e),n.insert(e,o))}}))},i.prototype._expandCluster=function(t,e){for(var n=e.getElements(),r=0,i=n.length;r<i;r++){var o=n[r];if(void 0===this._processed[o]){var s=this._regionQuery(o);this._processed[o]=1,this.clusters[t].push(o),this._orderedList.push(o),void 0!==this._distanceToCore(o)&&(this._updateQueue(o,s,e),this._expandCluster(t,e))}}},i.prototype._distanceToCore=function(t){for(var e=this.epsilon,n=0;n<e;n++)if(this._regionQuery(t,n).length>=this.minPts)return n},i.prototype._regionQuery=function(t,e){e=e||this.epsilon;for(var n=[],r=0,i=this.dataset.length;r<i;r++)this.distance(this.dataset[t],this.dataset[r])<e&&n.push(r);return n},i.prototype._euclideanDistance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;)n+=(t[r]-e[r])*(t[r]-e[r]);return Math.sqrt(n)},t.exports&&(t.exports=i)},624:t=>{function e(t,e,n){this._queue=[],this._priorities=[],this._sorting="desc",this._init(t,e,n)}e.prototype.insert=function(t,e){for(var n=this._queue.length,r=n;r--;){var i=this._priorities[r];"desc"===this._sorting?e>i&&(n=r):e<i&&(n=r)}this._insertAt(t,e,n)},e.prototype.remove=function(t){for(var e=this._queue.length;e--;)if(t===this._queue[e]){this._queue.splice(e,1),this._priorities.splice(e,1);break}},e.prototype.forEach=function(t){this._queue.forEach(t)},e.prototype.getElements=function(){return this._queue},e.prototype.getElementPriority=function(t){return this._priorities[t]},e.prototype.getPriorities=function(){return this._priorities},e.prototype.getElementsWithPriorities=function(){for(var t=[],e=0,n=this._queue.length;e<n;e++)t.push([this._queue[e],this._priorities[e]]);return t},e.prototype._init=function(t,e,n){if(t&&e){if(this._queue=[],this._priorities=[],t.length!==e.length)throw new Error("Arrays must have the same length");for(var r=0;r<t.length;r++)this.insert(t[r],e[r])}n&&(this._sorting=n)},e.prototype._insertAt=function(t,e,n){this._queue.length===n?(this._queue.push(t),this._priorities.push(e)):(this._queue.splice(n,0,t),this._priorities.splice(n,0,e))},t.exports&&(t.exports=e)},1631:(t,e,n)=>{t.exports&&(t.exports={DBSCAN:n(8136),KMEANS:n(9190),OPTICS:n(2037),PriorityQueue:n(624)})},1767:t=>{function e(t,e,r){r=r||2;var o,s,a,l,h,p,d,g=e&&e.length,m=g?e[0]*r:t.length,y=n(t,0,m,r,!0),_=[];if(!y||y.next===y.prev)return _;if(g&&(y=function(t,e,r,i){var o,s,a,l=[];for(o=0,s=e.length;o<s;o++)(a=n(t,e[o]*i,o<s-1?e[o+1]*i:t.length,i,!1))===a.next&&(a.steiner=!0),l.push(f(a));for(l.sort(u),o=0;o<l.length;o++)r=c(l[o],r);return r}(t,e,y,r)),t.length>80*r){o=a=t[0],s=l=t[1];for(var v=r;v<m;v+=r)(h=t[v])<o&&(o=h),(p=t[v+1])<s&&(s=p),h>a&&(a=h),p>l&&(l=p);d=0!==(d=Math.max(a-o,l-s))?32767/d:0}return i(y,_,r,o,s,d,0),_}function n(t,e,n,r,i){var o,s;if(i===C(t,e,n,r)>0)for(o=e;o<n;o+=r)s=E(o,t[o],t[o+1],s);else for(o=n-r;o>=e;o-=r)s=E(o,t[o],t[o+1],s);return s&&y(s,s.next)&&(S(s),s=s.next),s}function r(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!y(r,r.next)&&0!==m(r.prev,r,r.next))r=r.next;else{if(S(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function i(t,e,n,u,c,h,f){if(t){!f&&h&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=p(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,s,a,l,u=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e<u&&(a++,r=r.nextZ);e++);for(l=u;a>0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,u*=2}while(s>1)}(i)}(t,u,c,h);for(var d,g,m=t;t.prev!==t.next;)if(d=t.prev,g=t.next,h?s(t,u,c,h):o(t))e.push(d.i/n|0),e.push(t.i/n|0),e.push(g.i/n|0),S(t),t=g.next,m=g.next;else if((t=g)===m){f?1===f?i(t=a(r(t),e,n),e,n,u,c,h,2):2===f&&l(t,e,n,u,c,h):i(r(t),e,n,u,c,h,1);break}}}function o(t){var e=t.prev,n=t,r=t.next;if(m(e,n,r)>=0)return!1;for(var i=e.x,o=n.x,s=r.x,a=e.y,l=n.y,u=r.y,c=i<o?i<s?i:s:o<s?o:s,h=a<l?a<u?a:u:l<u?l:u,p=i>o?i>s?i:s:o>s?o:s,f=a>l?a>u?a:u:l>u?l:u,g=r.next;g!==e;){if(g.x>=c&&g.x<=p&&g.y>=h&&g.y<=f&&d(i,a,o,l,s,u,g.x,g.y)&&m(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function s(t,e,n,r){var i=t.prev,o=t,s=t.next;if(m(i,o,s)>=0)return!1;for(var a=i.x,l=o.x,u=s.x,c=i.y,h=o.y,f=s.y,g=a<l?a<u?a:u:l<u?l:u,y=c<h?c<f?c:f:h<f?h:f,_=a>l?a>u?a:u:l>u?l:u,v=c>h?c>f?c:f:h>f?h:f,x=p(g,y,e,n,r),b=p(_,v,e,n,r),w=t.prevZ,E=t.nextZ;w&&w.z>=x&&E&&E.z<=b;){if(w.x>=g&&w.x<=_&&w.y>=y&&w.y<=v&&w!==i&&w!==s&&d(a,c,l,h,u,f,w.x,w.y)&&m(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,E.x>=g&&E.x<=_&&E.y>=y&&E.y<=v&&E!==i&&E!==s&&d(a,c,l,h,u,f,E.x,E.y)&&m(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;w&&w.z>=x;){if(w.x>=g&&w.x<=_&&w.y>=y&&w.y<=v&&w!==i&&w!==s&&d(a,c,l,h,u,f,w.x,w.y)&&m(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;E&&E.z<=b;){if(E.x>=g&&E.x<=_&&E.y>=y&&E.y<=v&&E!==i&&E!==s&&d(a,c,l,h,u,f,E.x,E.y)&&m(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function a(t,e,n){var i=t;do{var o=i.prev,s=i.next.next;!y(o,s)&&_(o,i,i.next,s)&&b(o,s)&&b(s,o)&&(e.push(o.i/n|0),e.push(i.i/n|0),e.push(s.i/n|0),S(i),S(i.next),i=t=s),i=i.next}while(i!==t);return r(i)}function l(t,e,n,o,s,a){var l=t;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&g(l,u)){var c=w(l,u);return l=r(l,l.next),c=r(c,c.next),i(l,e,n,o,s,a,0),void i(c,e,n,o,s,a,0)}u=u.next}l=l.next}while(l!==t)}function u(t,e){return t.x-e.x}function c(t,e){var n=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s&&(s=a,n=r.x<r.next.x?r:r.next,a===i))return n}r=r.next}while(r!==e);if(!n)return null;var l,u=n,c=n.x,p=n.y,f=1/0;r=n;do{i>=r.x&&r.x>=c&&i!==r.x&&d(o<p?i:s,o,c,p,o<p?s:i,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(i-r.x),b(r,t)&&(l<f||l===f&&(r.x>n.x||r.x===n.x&&h(n,r)))&&(n=r,f=l)),r=r.next}while(r!==u);return n}(t,e);if(!n)return e;var i=w(n,t);return r(i,i.next),r(n,n.next)}function h(t,e){return m(t.prev,t,e.prev)<0&&m(e.next,t,t.next)<0}function p(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function f(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function d(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function g(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&_(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(b(t,e)&&b(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(m(t.prev,t,e.prev)||m(t,e.prev,e))||y(t,e)&&m(t.prev,t,t.next)>0&&m(e.prev,e,e.next)>0)}function m(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function y(t,e){return t.x===e.x&&t.y===e.y}function _(t,e,n,r){var i=x(m(t,e,n)),o=x(m(t,e,r)),s=x(m(n,r,t)),a=x(m(n,r,e));return i!==o&&s!==a||!(0!==i||!v(t,n,e))||!(0!==o||!v(t,r,e))||!(0!==s||!v(n,t,r))||!(0!==a||!v(n,e,r))}function v(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function x(t){return t>0?1:t<0?-1:0}function b(t,e){return m(t.prev,t,t.next)<0?m(t,e,t.next)>=0&&m(t,t.prev,e)>=0:m(t,e,t.prev)<0||m(t,t.next,e)<0}function w(t,e){var n=new I(t.i,t.x,t.y),r=new I(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function E(t,e,n,r){var i=new I(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function S(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 I(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function C(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}t.exports=e,t.exports.default=e,e.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(C(t,0,o,n));if(i)for(var a=0,l=e.length;a<l;a++){var u=e[a]*n,c=a<l-1?e[a+1]*n:t.length;s-=Math.abs(C(t,u,c,n))}var h=0;for(a=0;a<r.length;a+=3){var p=r[a]*n,f=r[a+1]*n,d=r[a+2]*n;h+=Math.abs((t[p]-t[d])*(t[f+1]-t[p+1])-(t[p]-t[f])*(t[d+1]-t[p+1]))}return 0===s&&0===h?0:Math.abs((h-s)/s)},e.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n}},8794:t=>{var e=Object.prototype.toString,n=Math.max,r=function(t,e){for(var n=[],r=0;r<t.length;r+=1)n[r]=t[r];for(var i=0;i<e.length;i+=1)n[i+t.length]=e[i];return n};t.exports=function(t){var i=this;if("function"!=typeof i||"[object Function]"!==e.apply(i))throw new TypeError("Function.prototype.bind called on incompatible "+i);for(var o,s=function(t,e){for(var n=[],r=1,i=0;r<t.length;r+=1,i+=1)n[i]=t[r];return n}(arguments),a=n(0,i.length-s.length),l=[],u=0;u<a;u++)l[u]="$"+u;if(o=Function("binder","return function ("+function(t,e){for(var n="",r=0;r<t.length;r+=1)n+=t[r],r+1<t.length&&(n+=",");return n}(l)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof o){var e=i.apply(this,r(s,arguments));return Object(e)===e?e:this}return i.apply(t,r(s,arguments))})),i.prototype){var c=function(){};c.prototype=i.prototype,o.prototype=new c,c.prototype=null}return o}},9138:(t,e,n)=>{var r=n(8794);t.exports=Function.prototype.bind||r},8993:t=>{var e=function(){return"string"==typeof function(){}.name},n=Object.getOwnPropertyDescriptor;if(n)try{n([],"length")}catch(t){n=null}e.functionsHaveConfigurableNames=function(){if(!e()||!n)return!1;var t=n((function(){}),"name");return!!t&&!!t.configurable};var r=Function.prototype.bind;e.boundFunctionsHaveNames=function(){return e()&&"function"==typeof r&&""!==function(){}.bind().name},t.exports=e},3084:(t,e,n)=>{var r=n(4969),i=function(t){this.precision=t&&t.precision?t.precision:17,this.direction=!(!t||!t.direction)&&t.direction,this.pseudoNode=!(!t||!t.pseudoNode)&&t.pseudoNode,this.objectComparator=t&&t.objectComparator?t.objectComparator:a};function o(t){return t.coordinates.map((function(e){return{type:t.type.replace("Multi",""),coordinates:e}}))}function s(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function a(t,e){return r(t,e,{strict:!0})}i.prototype.compare=function(t,e){if(t.type!==e.type||!s(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates,0,!1);case"Polygon":return this.comparePolygon(t,e);case"Feature":return this.compareFeature(t,e);default:if(0===t.type.indexOf("Multi")){var n=this,r=o(t),i=o(e);return r.every((function(t){return this.some((function(e){return n.compare(t,e)}))}),i)}}return!1},i.prototype.compareCoord=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n].toFixed(this.precision)!==e[n].toFixed(this.precision))return!1;return!0},i.prototype.compareLine=function(t,e,n,r){if(!s(t,e))return!1;var i=this.pseudoNode?t:this.removePseudo(t),o=this.pseudoNode?e:this.removePseudo(e);if(!r||this.compareCoord(i[0],o[0])||(o=this.fixStartIndex(o,i))){var a=this.compareCoord(i[n],o[n]);return this.direction||a?this.comparePath(i,o):!!this.compareCoord(i[n],o[o.length-(1+n)])&&this.comparePath(i.slice().reverse(),o)}},i.prototype.fixStartIndex=function(t,e){for(var n,r=-1,i=0;i<t.length;i++)if(this.compareCoord(t[i],e[0])){r=i;break}return r>=0&&(n=[].concat(t.slice(r,t.length),t.slice(1,r+1))),n},i.prototype.comparePath=function(t,e){var n=this;return t.every((function(t,e){return n.compareCoord(t,this[e])}),e)},i.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var n=t.coordinates.slice(1,t.coordinates.length),r=e.coordinates.slice(1,e.coordinates.length),i=this;return n.every((function(t){return this.some((function(e){return i.compareLine(t,e,1,!0)}))}),r)}return!1},i.prototype.compareFeature=function(t,e){return!(t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e))&&this.compare(t.geometry,e.geometry)},i.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},i.prototype.removePseudo=function(t){return t},t.exports=i},6032:(t,e,n)=>{var r=n(8918),i=n(462),o=n(4262),s=n(5824).A,a=o.featureEach,l=(o.coordEach,i.polygon,i.featureCollection);function u(t){var e=new r(t);return e.insert=function(t){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:s(t),r.prototype.insert.call(this,t)},e.load=function(t){var e=[];return Array.isArray(t)?t.forEach((function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:s(t),e.push(t)})):a(t,(function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:s(t),e.push(t)})),r.prototype.load.call(this,e)},e.remove=function(t,e){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:s(t),r.prototype.remove.call(this,t,e)},e.clear=function(){return r.prototype.clear.call(this)},e.search=function(t){var e=r.prototype.search.call(this,this.toBBox(t));return l(e)},e.collides=function(t){return r.prototype.collides.call(this,this.toBBox(t))},e.all=function(){var t=r.prototype.all.call(this);return l(t)},e.toJSON=function(){return r.prototype.toJSON.call(this)},e.fromJSON=function(t){return r.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var e;if(t.bbox)e=t.bbox;else if(Array.isArray(t)&&4===t.length)e=t;else if(Array.isArray(t)&&6===t.length)e=[t[0],t[1],t[3],t[4]];else if("Feature"===t.type)e=s(t);else{if("FeatureCollection"!==t.type)throw new Error("invalid geojson");e=s(t)}return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}},e}t.exports=u,t.exports.default=u},8918:function(t){t.exports=function(){function t(t,r,i,o,s){!function t(n,r,i,o,s){for(;o>i;){if(o-i>600){var a=o-i+1,l=r-i+1,u=Math.log(a),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(a-c)/a)*(l-a/2<0?-1:1);t(n,r,Math.max(i,Math.floor(r-l*c/a+h)),Math.min(o,Math.floor(r+(a-l)*c/a+h)),s)}var p=n[r],f=i,d=o;for(e(n,i,r),s(n[o],p)>0&&e(n,i,o);f<d;){for(e(n,f,d),f++,d--;s(n[f],p)<0;)f++;for(;s(n[d],p)>0;)d--}0===s(n[i],p)?e(n,i,d):e(n,++d,o),d<=r&&(i=d+1),r<=d&&(o=d-1)}}(t,r,i||0,o||t.length-1,s||n)}function e(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function n(t,e){return t<e?-1:t>e?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function o(t,e){s(t,0,t.children.length,e,t)}function s(t,e,n,r,i){i||(i=d(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=e;o<n;o++){var s=t.children[o];a(i,t.leaf?r(s):s)}return i}function a(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function l(t,e){return t.minX-e.minX}function u(t,e){return t.minY-e.minY}function c(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function h(t){return t.maxX-t.minX+(t.maxY-t.minY)}function p(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function f(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function d(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(e,n,r,i,o){for(var s=[n,r];s.length;)if(!((r=s.pop())-(n=s.pop())<=i)){var a=n+Math.ceil((r-n)/i/2)*i;t(e,a,n,r,o),s.push(n,a,a,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var e=this.data,n=[];if(!f(t,e))return n;for(var r=this.toBBox,i=[];e;){for(var o=0;o<e.children.length;o++){var s=e.children[o],a=e.leaf?r(s):s;f(t,a)&&(e.leaf?n.push(s):p(t,a)?this._all(s,n):i.push(s))}e=i.pop()}return n},r.prototype.collides=function(t){var e=this.data;if(!f(t,e))return!1;for(var n=[];e;){for(var r=0;r<e.children.length;r++){var i=e.children[r],o=e.leaf?this.toBBox(i):i;if(f(t,o)){if(e.leaf||p(t,o))return!0;n.push(i)}}e=n.pop()}return!1},r.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},r.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},r.prototype.clear=function(){return this.data=d([]),this},r.prototype.remove=function(t,e){if(!t)return this;for(var n,r,o,s=this.data,a=this.toBBox(t),l=[],u=[];s||l.length;){if(s||(s=l.pop(),r=l[l.length-1],n=u.pop(),o=!0),s.leaf){var c=i(t,s.children,e);if(-1!==c)return s.children.splice(c,1),l.push(s),this._condense(l),this}o||s.leaf||!p(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(l.push(s),u.push(n),n=0,r=s,s=s.children[0])}return this},r.prototype.toBBox=function(t){return t},r.prototype.compareMinX=function(t,e){return t.minX-e.minX},r.prototype.compareMinY=function(t,e){return t.minY-e.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(t){return this.data=t,this},r.prototype._all=function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},r.prototype._build=function(t,e,n,r){var i,s=n-e+1,a=this._maxEntries;if(s<=a)return o(i=d(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/Math.pow(a,r-1))),(i=d([])).leaf=!1,i.height=r;var l=Math.ceil(s/a),u=l*Math.ceil(Math.sqrt(a));g(t,e,n,u,this.compareMinX);for(var c=e;c<=n;c+=u){var h=Math.min(c+u-1,n);g(t,c,h,l,this.compareMinY);for(var p=c;p<=h;p+=l){var f=Math.min(p+l-1,h);i.children.push(this._build(t,p,f,r-1))}}return o(i,this.toBBox),i},r.prototype._chooseSubtree=function(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){for(var i=1/0,o=1/0,s=void 0,a=0;a<e.children.length;a++){var l=e.children[a],u=c(l),h=(p=t,f=l,(Math.max(f.maxX,p.maxX)-Math.min(f.minX,p.minX))*(Math.max(f.maxY,p.maxY)-Math.min(f.minY,p.minY))-u);h<o?(o=h,i=u<i?u:i,s=l):h===o&&u<i&&(i=u,s=l)}e=s||e.children[0]}var p,f;return e},r.prototype._insert=function(t,e,n){var r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),a(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)},r.prototype._split=function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var s=this._chooseSplitIndex(n,i,r),a=d(n.children.splice(s,n.children.length-s));a.height=n.height,a.leaf=n.leaf,o(n,this.toBBox),o(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)},r.prototype._splitRoot=function(t,e){this.data=d([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,e,n){for(var r,i,o,a,l,u,h,p=1/0,f=1/0,d=e;d<=n-e;d++){var g=s(t,0,d,this.toBBox),m=s(t,d,n,this.toBBox),y=(i=g,o=m,void 0,void 0,void 0,void 0,a=Math.max(i.minX,o.minX),l=Math.max(i.minY,o.minY),u=Math.min(i.maxX,o.maxX),h=Math.min(i.maxY,o.maxY),Math.max(0,u-a)*Math.max(0,h-l)),_=c(g)+c(m);y<p?(p=y,r=d,f=_<f?_:f):y===p&&_<f&&(f=_,r=d)}return r||n-e},r.prototype._chooseSplitAxis=function(t,e,n){var r=t.leaf?this.compareMinX:l,i=t.leaf?this.compareMinY:u;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},r.prototype._allDistMargin=function(t,e,n,r){t.children.sort(r);for(var i=this.toBBox,o=s(t,0,e,i),l=s(t,n-e,n,i),u=h(o)+h(l),c=e;c<n-e;c++){var p=t.children[c];a(o,t.leaf?i(p):p),u+=h(o)}for(var f=n-e-1;f>=e;f--){var d=t.children[f];a(l,t.leaf?i(d):d),u+=h(l)}return u},r.prototype._adjustParentBBoxes=function(t,e,n){for(var r=n;r>=0;r--)a(e[r],t)},r.prototype._condense=function(t){for(var e=t.length-1,n=void 0;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children).splice(n.indexOf(t[e]),1):this.clear():o(t[e],this.toBBox)},r}()},528:(t,e,n)=>{var r,i=SyntaxError,o=Function,s=TypeError,a=function(t){try{return o('"use strict"; return ('+t+").constructor;")()}catch(t){}},l=Object.getOwnPropertyDescriptor;if(l)try{l({},"")}catch(t){l=null}var u=function(){throw new s},c=l?function(){try{return u}catch(t){try{return l(arguments,"callee").get}catch(t){return u}}}():u,h=n(3558)(),p=n(6869)(),f=Object.getPrototypeOf||(p?function(t){return t.__proto__}:null),d={},g="undefined"!=typeof Uint8Array&&f?f(Uint8Array):r,m={"%AggregateError%":"undefined"==typeof AggregateError?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?r:ArrayBuffer,"%ArrayIteratorPrototype%":h&&f?f([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?r:Atomics,"%BigInt%":"undefined"==typeof BigInt?r:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?r:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?r:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?r:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?r:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?r:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?r:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&f?f(f([][Symbol.iterator]())):r,"%JSON%":"object"==typeof JSON?JSON:r,"%Map%":"undefined"==typeof Map?r:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h&&f?f((new Map)[Symbol.iterator]()):r,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?r:Promise,"%Proxy%":"undefined"==typeof Proxy?r:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?r:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?r:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h&&f?f((new Set)[Symbol.iterator]()):r,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&f?f(""[Symbol.iterator]()):r,"%Symbol%":h?Symbol:r,"%SyntaxError%":i,"%ThrowTypeError%":c,"%TypedArray%":g,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?r:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?r:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?r:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?r:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?r:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?r:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?r:WeakSet};if(f)try{null.error}catch(t){var y=f(f(t));m["%Error.prototype%"]=y}var _=function t(e){var n;if("%AsyncFunction%"===e)n=a("async function () {}");else if("%GeneratorFunction%"===e)n=a("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=a("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&f&&(n=f(i.prototype))}return m[e]=n,n},v={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},x=n(9138),b=n(8554),w=x.call(Function.call,Array.prototype.concat),E=x.call(Function.apply,Array.prototype.splice),S=x.call(Function.call,String.prototype.replace),I=x.call(Function.call,String.prototype.slice),C=x.call(Function.call,RegExp.prototype.exec),T=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,P=/\\(\\)?/g,M=function(t,e){var n,r=t;if(b(v,r)&&(r="%"+(n=v[r])[0]+"%"),b(m,r)){var o=m[r];if(o===d&&(o=_(r)),void 0===o&&!e)throw new s("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:o}}throw new i("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new s('"allowMissing" argument must be a boolean');if(null===C(/^%?[^%]*%?$/,t))throw new i("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(t){var e=I(t,0,1),n=I(t,-1);if("%"===e&&"%"!==n)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new i("invalid intrinsic syntax, expected opening `%`");var r=[];return S(t,T,(function(t,e,n,i){r[r.length]=n?S(i,P,"$1"):e||t})),r}(t),r=n.length>0?n[0]:"",o=M("%"+r+"%",e),a=o.name,u=o.value,c=!1,h=o.alias;h&&(r=h[0],E(n,w([0,1],h)));for(var p=1,f=!0;p<n.length;p+=1){var d=n[p],g=I(d,0,1),y=I(d,-1);if(('"'===g||"'"===g||"`"===g||'"'===y||"'"===y||"`"===y)&&g!==y)throw new i("property names with quotes must have matching quotes");if("constructor"!==d&&f||(c=!0),b(m,a="%"+(r+="."+d)+"%"))u=m[a];else if(null!=u){if(!(d in u)){if(!e)throw new s("base intrinsic for "+t+" exists, but the property is not available.");return}if(l&&p+1>=n.length){var _=l(u,d);u=(f=!!_)&&"get"in _&&!("originalValue"in _.get)?_.get:u[d]}else f=b(u,d),u=u[d];f&&!c&&(m[a]=u)}}return u}},9336:(t,e,n)=>{var r=n(528)("%Object.getOwnPropertyDescriptor%",!0);if(r)try{r([],"length")}catch(t){r=null}t.exports=r},7239:(t,e,n)=>{var r=n(528)("%Object.defineProperty%",!0),i=function(){if(r)try{return r({},"a",{value:1}),!0}catch(t){return!1}return!1};i.hasArrayLengthDefineBug=function(){if(!i())return null;try{return 1!==r([],"length",{value:1}).length}catch(t){return!0}},t.exports=i},6869:t=>{var e={foo:{}},n=Object;t.exports=function(){return{__proto__:e}.foo===e.foo&&!({__proto__:null}instanceof n)}},3558:(t,e,n)=>{var r="undefined"!=typeof Symbol&&Symbol,i=n(2908);t.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&i()}},2908:t=>{t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),n=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},1913:(t,e,n)=>{var r=n(2908);t.exports=function(){return r()&&!!Symbol.toStringTag}},8554:(t,e,n)=>{var r=Function.prototype.call,i=Object.prototype.hasOwnProperty,o=n(9138);t.exports=o.call(r,i)},5387:(t,e,n)=>{var r=n(1913)(),i=n(9818)("Object.prototype.toString"),o=function(t){return!(r&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===i(t)},s=function(t){return!!o(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==i(t)&&"[object Function]"===i(t.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,t.exports=a?o:s},9543:(t,e,n)=>{var r=Date.prototype.getDay,i=Object.prototype.toString,o=n(1913)();t.exports=function(t){return"object"==typeof t&&null!==t&&(o?function(t){try{return r.call(t),!0}catch(t){return!1}}(t):"[object Date]"===i.call(t))}},2672:(t,e,n)=>{var r,i,o,s,a=n(9818),l=n(1913)();if(l){r=a("Object.prototype.hasOwnProperty"),i=a("RegExp.prototype.exec"),o={};var u=function(){throw o};s={toString:u,valueOf:u},"symbol"==typeof Symbol.toPrimitive&&(s[Symbol.toPrimitive]=u)}var c=a("Object.prototype.toString"),h=Object.getOwnPropertyDescriptor;t.exports=l?function(t){if(!t||"object"!=typeof t)return!1;var e=h(t,"lastIndex");if(!e||!r(e,"value"))return!1;try{i(t,s)}catch(t){return t===o}}:function(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===c(t)}},1513:t=>{var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var o,s,a=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]))n.call(o,u)&&(a[u]=o[u]);if(e){s=e(o);for(var c=0;c<s.length;c++)r.call(o,s[c])&&(a[s[c]]=o[s[c]])}}return a}},2372:t=>{var e=function(t){return t!=t};t.exports=function(t,n){return 0===t&&0===n?1/t==1/n:t===n||!(!e(t)||!e(n))}},5968:(t,e,n)=>{var r=n(1857),i=n(8498),o=n(2372),s=n(1937),a=n(5087),l=i(s(),Object);r(l,{getPolyfill:s,implementation:o,shim:a}),t.exports=l},1937:(t,e,n)=>{var r=n(2372);t.exports=function(){return"function"==typeof Object.is?Object.is:r}},5087:(t,e,n)=>{var r=n(1937),i=n(1857);t.exports=function(){var t=r();return i(Object,{is:t},{is:function(){return Object.is!==t}}),t}},8160:(t,e,n)=>{var r;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,s=n(968),a=Object.prototype.propertyIsEnumerable,l=!a.call({toString:null},"toString"),u=a.call((function(){}),"prototype"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=function(t){var e=t.constructor;return e&&e.prototype===t},p={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!p["$"+t]&&i.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{h(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();r=function(t){var e=null!==t&&"object"==typeof t,n="[object Function]"===o.call(t),r=s(t),a=e&&"[object String]"===o.call(t),p=[];if(!e&&!n&&!r)throw new TypeError("Object.keys called on a non-object");var d=u&&n;if(a&&t.length>0&&!i.call(t,0))for(var g=0;g<t.length;++g)p.push(String(g));if(r&&t.length>0)for(var m=0;m<t.length;++m)p.push(String(m));else for(var y in t)d&&"prototype"===y||!i.call(t,y)||p.push(String(y));if(l)for(var _=function(t){if("undefined"==typeof window||!f)return h(t);try{return h(t)}catch(t){return!1}}(t),v=0;v<c.length;++v)_&&"constructor"===c[v]||!i.call(t,c[v])||p.push(c[v]);return p}}t.exports=r},9228:(t,e,n)=>{var r=Array.prototype.slice,i=n(968),o=Object.keys,s=o?function(t){return o(t)}:n(8160),a=Object.keys;s.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return i(t)?a(r.call(t)):a(t)})}else Object.keys=s;return Object.keys||s},t.exports=s},968:t=>{var e=Object.prototype.toString;t.exports=function(t){var n=e.call(t),r="[object Arguments]"===n;return r||(r="[object Array]"!==n&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),r}},6232:t=>{t.exports=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=(r-n)/2,l=0,u=a-1;l<a;u=l++){var c=e[n+2*l+0],h=e[n+2*l+1],p=e[n+2*u+0],f=e[n+2*u+1];h>o!=f>o&&i<(p-c)*(o-h)/(f-h)+c&&(s=!s)}return s}},3071:(t,e,n)=>{var r=n(6232),i=n(7100);t.exports=function(t,e,n,o){return e.length>0&&Array.isArray(e[0])?i(t,e,n,o):r(t,e,n,o)},t.exports.nested=i,t.exports.flat=r},7100:t=>{t.exports=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=r-n,l=0,u=a-1;l<a;u=l++){var c=e[l+n][0],h=e[l+n][1],p=e[u+n][0],f=e[u+n][1];h>o!=f>o&&i<(p-c)*(o-h)/(f-h)+c&&(s=!s)}return s}},2235:function(t){t.exports=function(){function t(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var e=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function n(t,e){return t>e?1:t<e?-1:0}function r(t,n,r){for(var i=new e(null,null),o=i,s=i;;){var a=r(t,n.key);if(a<0){if(null===n.left)break;if(r(t,n.left.key)<0){var l=n.left;if(n.left=l.right,l.right=n,null===(n=l).left)break}s.left=n,s=n,n=n.left}else{if(!(a>0))break;if(null===n.right)break;if(r(t,n.right.key)>0&&(l=n.right,n.right=l.left,l.left=n,null===(n=l).right))break;o.right=n,o=n,n=n.right}}return o.right=n.left,s.left=n.right,n.left=i.right,n.right=i.left,n}function i(t,n,i,o){var s=new e(t,n);if(null===i)return s.left=s.right=null,s;var a=o(t,(i=r(t,i,o)).key);return a<0?(s.left=i.left,s.right=i,i.left=null):a>=0&&(s.right=i.right,s.left=i,i.right=null),s}function o(t,e,n){var i=null,o=null;if(e){var s=n((e=r(t,e,n)).key,t);0===s?(i=e.left,o=e.right):s<0?(o=e.right,e.right=null,i=e):(i=e.left,e.left=null,o=e)}return{left:i,right:o}}function s(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&s(t.left,o,!1,r,i),t.right&&s(t.right,o,!0,r,i)}}var a=function(){function a(t){void 0===t&&(t=n),this._root=null,this._size=0,this._comparator=t}return a.prototype.insert=function(t,e){return this._size++,this._root=i(t,e,this._root,this._comparator)},a.prototype.add=function(t,n){var i=new e(t,n);null===this._root&&(i.left=i.right=null,this._size++,this._root=i);var o=this._comparator,s=r(t,this._root,o),a=o(t,s.key);return 0===a?this._root=s:(a<0?(i.left=s.left,i.right=s,s.left=null):a>0&&(i.right=s.right,i.left=s,s.right=null),this._size++,this._root=i),this._root},a.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},a.prototype._remove=function(t,e,n){var i;return null===e?null:0===n(t,(e=r(t,e,n)).key)?(null===e.left?i=e.right:(i=r(t,e.left,n)).right=e.right,this._size--,i):e},a.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=r(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},a.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},a.prototype.find=function(t){return this._root&&(this._root=r(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},a.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},a.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},a.prototype.range=function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this},a.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},a.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},a.prototype.min=function(){return this._root?this.minNode(this._root).key:null},a.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},a.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},a.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},a.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},a.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},a.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},a.prototype.clear=function(){return this._root=null,this._size=0,this},a.prototype.toList=function(){return function(t){for(var n=t,r=[],i=!1,o=new e(null,null),s=o;!i;)n?(r.push(n),n=n.left):r.length>0?n=(n=s=s.next=r.pop()).right:i=!0;return s.next=null,o.next}(this._root)},a.prototype.load=function(t,n,r){void 0===n&&(n=[]),void 0===r&&(r=!1);var i=t.length,o=this._comparator;if(r&&c(t,n,0,i-1,o),null===this._root)this._root=l(t,n,0,i),this._size=i;else{var s=function(t,n,r){for(var i=new e(null,null),o=i,s=t,a=n;null!==s&&null!==a;)r(s.key,a.key)<0?(o.next=s,s=s.next):(o.next=a,a=a.next),o=o.next;return null!==s?o.next=s:null!==a&&(o.next=a),i.next}(this.toList(),function(t,n){for(var r=new e(null,null),i=r,o=0;o<t.length;o++)i=i.next=new e(t[o],n[o]);return i.next=null,r.next}(t,n),o);i=this._size+i,this._root=u({head:s},0,i)}return this},a.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(a.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),a.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return s(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},a.prototype.update=function(t,e,n){var s=this._comparator,a=o(t,this._root,s),l=a.left,u=a.right;s(t,e)<0?u=i(e,n,u,s):l=i(e,n,l,s),this._root=function(t,e,n){return null===e?t:(null===t||((e=r(t.key,e,n)).left=t),e)}(l,u,s)},a.prototype.split=function(t){return o(t,this._root,this._comparator)},a.prototype[Symbol.iterator]=function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:e=this._root,n=[],r=!1,t.label=1;case 1:return r?[3,6]:null===e?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return 0===n.length?[3,4]:[4,e=n.pop()];case 3:return t.sent(),e=e.right,[3,5];case 4:r=!0,t.label=5;case 5:return[3,1];case 6:return[2]}}))},a}();function l(t,n,r,i){var o=i-r;if(o>0){var s=r+Math.floor(o/2),a=t[s],u=n[s],c=new e(a,u);return c.left=l(t,n,r,s),c.right=l(t,n,s+1,i),c}return null}function u(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=u(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=u(t,i+1,n),s}return null}function c(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var l=t[s];t[s]=t[a],t[a]=l,l=e[s],e[s]=e[a],e[a]=l}c(t,e,n,a,i),c(t,e,a+1,r,i)}}const h=(t,e)=>t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y,p=(t,e)=>{if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;const n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}};let f=Number.EPSILON;void 0===f&&(f=Math.pow(2,-52));const d=f*f,g=(t,e)=>{if(-f<t&&t<f&&-f<e&&e<f)return 0;const n=t-e;return n*n<d*t*e?0:t<e?-1:1};class m{constructor(){this.tree=new a,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===g(e.key,n.key))return this.tree.remove(t),n.key;const r=this.tree.next(e);return null!==r&&0===g(e.key,r.key)?(this.tree.remove(t),r.key):t}}const y=new class{constructor(){this.reset()}reset(){this.xRounder=new m,this.yRounder=new m}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}},_=11102230246251565e-32,v=134217729,x=(3+8*_)*_;function b(t,e,n,r,i){let o,s,a,l,u=e[0],c=r[0],h=0,p=0;c>u==c>-u?(o=u,u=e[++h]):(o=c,c=r[++p]);let f=0;if(h<t&&p<n)for(c>u==c>-u?(s=u+o,a=o-(s-u),u=e[++h]):(s=c+o,a=o-(s-c),c=r[++p]),o=s,0!==a&&(i[f++]=a);h<t&&p<n;)c>u==c>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++h]):(s=o+c,l=s-o,a=o-(s-l)+(c-l),c=r[++p]),o=s,0!==a&&(i[f++]=a);for(;h<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++h],o=s,0!==a&&(i[f++]=a);for(;p<n;)s=o+c,l=s-o,a=o-(s-l)+(c-l),c=r[++p],o=s,0!==a&&(i[f++]=a);return 0===o&&0!==f||(i[f++]=o),f}function w(t){return new Float64Array(t)}const E=22204460492503146e-32,S=11093356479670487e-47,I=w(4),C=w(8),T=w(12),P=w(16),M=w(4);function L(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),l=s-a,u=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*u?l:-function(t,e,n,r,i,o,s){let a,l,u,c,h,p,f,d,g,m,y,_,w,L,A,k,N,D;const R=t-i,O=n-i,z=e-o,F=r-o;L=R*F,p=v*R,f=p-(p-R),d=R-f,p=v*F,g=p-(p-F),m=F-g,A=d*m-(L-f*g-d*g-f*m),k=z*O,p=v*z,f=p-(p-z),d=z-f,p=v*O,g=p-(p-O),m=O-g,N=d*m-(k-f*g-d*g-f*m),y=A-N,h=A-y,I[0]=A-(y+h)+(h-N),_=L+y,h=_-L,w=L-(_-h)+(y-h),y=w-k,h=w-y,I[1]=w-(y+h)+(h-k),D=_+y,h=D-_,I[2]=_-(D-h)+(y-h),I[3]=D;let B=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,I),U=E*s;if(B>=U||-B>=U)return B;if(h=t-R,a=t-(R+h)+(h-i),h=n-O,u=n-(O+h)+(h-i),h=e-z,l=e-(z+h)+(h-o),h=r-F,c=r-(F+h)+(h-o),0===a&&0===l&&0===u&&0===c)return B;if(U=S*s+x*Math.abs(B),B+=R*c+F*a-(z*u+O*l),B>=U||-B>=U)return B;L=a*F,p=v*a,f=p-(p-a),d=a-f,p=v*F,g=p-(p-F),m=F-g,A=d*m-(L-f*g-d*g-f*m),k=l*O,p=v*l,f=p-(p-l),d=l-f,p=v*O,g=p-(p-O),m=O-g,N=d*m-(k-f*g-d*g-f*m),y=A-N,h=A-y,M[0]=A-(y+h)+(h-N),_=L+y,h=_-L,w=L-(_-h)+(y-h),y=w-k,h=w-y,M[1]=w-(y+h)+(h-k),D=_+y,h=D-_,M[2]=_-(D-h)+(y-h),M[3]=D;const V=b(4,I,4,M,C);L=R*c,p=v*R,f=p-(p-R),d=R-f,p=v*c,g=p-(p-c),m=c-g,A=d*m-(L-f*g-d*g-f*m),k=z*u,p=v*z,f=p-(p-z),d=z-f,p=v*u,g=p-(p-u),m=u-g,N=d*m-(k-f*g-d*g-f*m),y=A-N,h=A-y,M[0]=A-(y+h)+(h-N),_=L+y,h=_-L,w=L-(_-h)+(y-h),y=w-k,h=w-y,M[1]=w-(y+h)+(h-k),D=_+y,h=D-_,M[2]=_-(D-h)+(y-h),M[3]=D;const j=b(V,C,4,M,T);L=a*c,p=v*a,f=p-(p-a),d=a-f,p=v*c,g=p-(p-c),m=c-g,A=d*m-(L-f*g-d*g-f*m),k=l*u,p=v*l,f=p-(p-l),d=l-f,p=v*u,g=p-(p-u),m=u-g,N=d*m-(k-f*g-d*g-f*m),y=A-N,h=A-y,M[0]=A-(y+h)+(h-N),_=L+y,h=_-L,w=L-(_-h)+(y-h),y=w-k,h=w-y,M[1]=w-(y+h)+(h-k),D=_+y,h=D-_,M[2]=_-(D-h)+(y-h),M[3]=D;const G=b(j,T,4,M,P);return P[G-1]}(t,e,n,r,i,o,u)}const A=(t,e)=>t.x*e.y-t.y*e.x,k=(t,e)=>t.x*e.x+t.y*e.y,N=(t,e,n)=>{const r=L(t.x,t.y,e.x,e.y,n.x,n.y);return r>0?-1:r<0?1:0},D=t=>Math.sqrt(k(t,t)),R=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return A(i,r)/D(i)/D(r)},O=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return k(i,r)/D(i)/D(r)},z=(t,e,n)=>0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n},F=(t,e,n)=>0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)};class B{static compare(t,e){const n=B.comparePoints(t.point,e.point);return 0!==n?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:V.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){void 0===t.events?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(void 0===n.segment.consumedBy)for(let r=e+1;r<t;r++){const t=this.point.events[r];void 0===t.consumedBy&&n.otherSE.point.events===t.otherSE.point.events&&n.segment.consume(t.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}getLeftmostComparator(t){const e=new Map,n=n=>{const r=n.otherSE;e.set(n,{sine:R(this.point,t.point,r.point),cosine:O(this.point,t.point,r.point)})};return(t,r)=>{e.has(t)||n(t),e.has(r)||n(r);const{sine:i,cosine:o}=e.get(t),{sine:s,cosine:a}=e.get(r);return i>=0&&s>=0?o<a?1:o>a?-1:0:i<0&&s<0?o<a?-1:o>a?1:0:s<i?-1:s>i?1:0}}}let U=0;class V{static compare(t,e){const n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;const s=t.leftSE.point.y,a=e.leftSE.point.y,l=t.rightSE.point.y,u=e.rightSE.point.y;if(n<r){if(a<s&&a<l)return 1;if(a>s&&a>l)return-1;const n=t.comparePoint(e.leftSE.point);if(n<0)return 1;if(n>0)return-1;const r=e.comparePoint(t.rightSE.point);return 0!==r?r:-1}if(n>r){if(s<a&&s<u)return-1;if(s>a&&s>u)return 1;const n=e.comparePoint(t.leftSE.point);if(0!==n)return n;const r=t.comparePoint(e.rightSE.point);return r<0?1:r>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){const n=e.comparePoint(t.rightSE.point);if(0!==n)return n}if(i>o){const n=t.comparePoint(e.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(i!==o){const t=l-s,e=i-n,c=u-a,h=o-r;if(t>e&&c<h)return 1;if(t<e&&c>h)return-1}return i>o?1:i<o||l<u?-1:l>u?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,r){this.id=++U,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=r}static fromRing(t,e,n){let r,i,o;const s=B.comparePoints(t,e);if(s<0)r=t,i=e,o=1;else{if(!(s>0))throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);r=e,i=t,o=-1}const a=new B(r,!0),l=new B(i,!1);return new V(a,l,[n],[o])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;const s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),r=p(e,n);if(null===r)return null;const i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,l=h(e,s)&&0===this.comparePoint(s),u=h(n,i)&&0===t.comparePoint(i),c=h(e,a)&&0===this.comparePoint(a),f=h(n,o)&&0===t.comparePoint(o);if(u&&l)return f&&!c?o:!f&&c?a:null;if(u)return c&&i.x===a.x&&i.y===a.y?null:i;if(l)return f&&o.x===s.x&&o.y===s.y?null:s;if(f&&c)return null;if(f)return o;if(c)return a;const d=((t,e,n,r)=>{if(0===e.x)return F(n,r,t.x);if(0===r.x)return F(t,e,n.x);if(0===e.y)return z(n,r,t.y);if(0===r.y)return z(t,e,n.y);const i=A(e,r);if(0==i)return null;const o={x:n.x-t.x,y:n.y-t.y},s=A(o,e)/i,a=A(o,r)/i;return{x:(t.x+a*e.x+(n.x+s*r.x))/2,y:(t.y+a*e.y+(n.y+s*r.y))/2}})(i,this.vector(),s,t.vector());return null===d?null:h(r,d)?y.round(d.x,d.y):null}split(t){const e=[],n=void 0!==t.events,r=new B(t,!0),i=new B(t,!1),o=this.rightSE;this.replaceRightSE(i),e.push(i),e.push(r);const s=new V(r,o,this.rings.slice(),this.windings.slice());return B.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),B.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),i.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let t=0,e=this.windings.length;t<e;t++)this.windings[t]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const r=V.compare(e,n);if(0!==r){if(r>0){const t=e;e=n,n=t}if(e.prev===n){const t=e;e=n,n=t}for(let t=0,r=n.rings.length;t<r;t++){const r=n.rings[t],i=n.windings[t],o=e.rings.indexOf(r);-1===o?(e.rings.push(r),e.windings.push(i)):e.windings[o]+=i}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}beforeState(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}afterState(){if(void 0!==this._afterState)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let t=0,r=this.rings.length;t<r;t++){const r=this.rings[t],i=this.windings[t],o=e.indexOf(r);-1===o?(e.push(r),n.push(i)):n[o]+=i}const i=[],o=[];for(let t=0,r=e.length;t<r;t++){if(0===n[t])continue;const r=e[t],s=r.poly;if(-1===o.indexOf(s))if(r.isExterior)i.push(s);else{-1===o.indexOf(s)&&o.push(s);const t=i.indexOf(r.poly);-1!==t&&i.splice(t,1)}}for(let t=0,e=i.length;t<e;t++){const e=i[t].multiPoly;-1===r.indexOf(e)&&r.push(e)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(K.type){case"union":{const n=0===t.length,r=0===e.length;this._isInResult=n!==r;break}case"intersection":{let n,r;t.length<e.length?(n=t.length,r=e.length):(n=e.length,r=t.length),this._isInResult=r===K.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2==1;break}case"difference":{const n=t=>1===t.length&&t[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${K.type}`)}return this._isInResult}}class j{constructor(t,e,n){if(!Array.isArray(t)||0===t.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],"number"!=typeof t[0][0]||"number"!=typeof t[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=y.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let e=1,n=t.length;e<n;e++){if("number"!=typeof t[e][0]||"number"!=typeof t[e][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let n=y.round(t[e][0],t[e][1]);n.x===i.x&&n.y===i.y||(this.segments.push(V.fromRing(i,n,this)),n.x<this.bbox.ll.x&&(this.bbox.ll.x=n.x),n.y<this.bbox.ll.y&&(this.bbox.ll.y=n.y),n.x>this.bbox.ur.x&&(this.bbox.ur.x=n.x),n.y>this.bbox.ur.y&&(this.bbox.ur.y=n.y),i=n)}r.x===i.x&&r.y===i.y||this.segments.push(V.fromRing(i,r,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}class G{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new j(t[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let e=1,n=t.length;e<n;e++){const n=new j(t[e],this,!1);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class q{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof t[0][0][0]&&(t=[t])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let e=0,n=t.length;e<n;e++){const n=new G(t[e],this);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class ${static factory(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.isInResult()||r.ringOut)continue;let i=null,o=r.leftSE,s=r.rightSE;const a=[o],l=o.point,u=[];for(;i=o,o=s,a.push(o),o.point!==l;)for(;;){const t=o.getAvailableLinkedEvents();if(0===t.length){const t=a[0].point,e=a[a.length-1].point;throw new Error(`Unable to complete output ring starting at [${t.x}, ${t.y}]. Last matching segment found ends at [${e.x}, ${e.y}].`)}if(1===t.length){s=t[0].otherSE;break}let n=null;for(let t=0,e=u.length;t<e;t++)if(u[t].point===o.point){n=t;break}if(null!==n){const t=u.splice(n)[0],r=a.splice(t.index);r.unshift(r[0].otherSE),e.push(new $(r.reverse()));continue}u.push({index:a.length,point:o.point});const r=o.getLeftmostComparator(i);s=t.sort(r)[0].otherSE;break}e.push(new $(a))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let n=1,r=this.events.length-1;n<r;n++){const r=this.events[n].point,i=this.events[n+1].point;0!==N(r,t,i)&&(e.push(r),t=r)}if(1===e.length)return null;const n=e[0],r=e[1];0===N(n,t,r)&&e.shift(),e.push(e[0]);const i=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,a=[];for(let t=o;t!=s;t+=i)a.push([e[t].x,e[t].y]);return a}isExteriorRing(){if(void 0===this._isExteriorRing){const t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}enclosingRing(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let e=1,n=this.events.length;e<n;e++){const n=this.events[e];B.compare(t,n)>0&&(t=n)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class X{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}class Z{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}_composePolys(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.poly)if(r.isExteriorRing())e.push(new X(r));else{const t=r.enclosingRing();t.poly||e.push(new X(t)),t.poly.addInterior(r)}}return e}}class Y{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:V.compare;this.queue=t,this.tree=new a(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const r=t.isLeft?this.tree.add(e):this.tree.find(e);if(!r)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let i,o,s=r,a=r;for(;void 0===i;)s=this.tree.prev(s),null===s?i=null:void 0===s.key.consumedBy&&(i=s.key);for(;void 0===o;)a=this.tree.next(a),null===a?o=null:void 0===a.key.consumedBy&&(o=a.key);if(t.isLeft){let r=null;if(i){const t=i.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(r=t),!i.isAnEndpoint(t))){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}let s=null;if(o){const t=o.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(s=t),!o.isAnEndpoint(t))){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}if(null!==r||null!==s){let t=null;t=null===r?s:null===s||B.comparePoints(r,s)<=0?r:s,this.queue.remove(e.rightSE),n.push(e.rightSE);const i=e.split(t);for(let t=0,e=i.length;t<e;t++)n.push(i[t])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=i)}else{if(i&&o){const t=i.getIntersection(o);if(null!==t){if(!i.isAnEndpoint(t)){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}if(!o.isAnEndpoint(t)){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.add(t),r}}const W="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,H="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;const K=new class{run(t,e,n){K.type=t,y.reset();const r=[new q(e,!0)];for(let t=0,e=n.length;t<e;t++)r.push(new q(n[t],!1));if(K.numMultiPolys=r.length,"difference"===K.type){const t=r[0];let e=1;for(;e<r.length;)null!==p(r[e].bbox,t.bbox)?e++:r.splice(e,1)}if("intersection"===K.type)for(let t=0,e=r.length;t<e;t++){const e=r[t];for(let n=t+1,i=r.length;n<i;n++)if(null===p(e.bbox,r[n].bbox))return[]}const i=new a(B.compare);for(let t=0,e=r.length;t<e;t++){const e=r[t].getSweepEvents();for(let t=0,n=e.length;t<n;t++)if(i.insert(e[t]),i.size>W)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const o=new Y(i);let s=i.size,l=i.pop();for(;l;){const t=l.key;if(i.size===s){const e=t.segment;throw new Error(`Unable to pop() ${t.isLeft?"left":"right"} SweepEvent [${t.point.x}, ${t.point.y}] from segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] from queue.`)}if(i.size>W)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(o.segments.length>H)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const e=o.process(t);for(let t=0,n=e.length;t<n;t++){const n=e[t];void 0===n.consumedBy&&i.insert(n)}s=i.size,l=i.pop()}y.reset();const u=$.factory(o.segments);return new Z(u).getGeom()}};return{union:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return K.run("union",t,n)},intersection:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return K.run("intersection",t,n)},xor:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return K.run("xor",t,n)},difference:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return K.run("difference",t,n)}}}()},4026:(t,e,n)=>{t.exports=i,t.exports.default=i;var r=n(8982);function i(t,e){if(!(this instanceof i))return new i(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function o(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function s(t,e){a(t,0,t.children.length,e,t)}function a(t,e,n,r,i){i||(i=g(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s<n;s++)o=t.children[s],l(i,t.leaf?r(o):o);return i}function l(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function u(t,e){return t.minX-e.minX}function c(t,e){return t.minY-e.minY}function h(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function p(t){return t.maxX-t.minX+(t.maxY-t.minY)}function f(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function d(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function g(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function m(t,e,n,i,o){for(var s,a=[e,n];a.length;)(n=a.pop())-(e=a.pop())<=i||(s=e+Math.ceil((n-e)/i/2)*i,r(t,s,e,n,o),a.push(e,s,s,n))}i.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!d(t,e))return n;for(var i,o,s,a,l=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],d(t,a=e.leaf?r(s):s)&&(e.leaf?n.push(s):f(t,a)?this._all(s,n):l.push(s));e=l.pop()}return n},collides:function(t){var e=this.data,n=this.toBBox;if(!d(t,e))return!1;for(var r,i,o,s,a=[];e;){for(r=0,i=e.children.length;r<i;r++)if(o=e.children[r],d(t,s=e.leaf?n(o):o)){if(e.leaf||f(t,s))return!0;a.push(o)}e=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,n=t.length;e<n;e++)this.insert(t[e]);return this}var r=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var i=this.data;this.data=r,r=i}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=g([]),this},remove:function(t,e){if(!t)return this;for(var n,r,i,s,a=this.data,l=this.toBBox(t),u=[],c=[];a||u.length;){if(a||(a=u.pop(),r=u[u.length-1],n=c.pop(),s=!0),a.leaf&&-1!==(i=o(t,a.children,e)))return a.children.splice(i,1),u.push(a),this._condense(u),this;s||a.leaf||!f(a,l)?r?(n++,a=r.children[n],s=!1):a=null:(u.push(a),c.push(n),n=0,r=a,a=a.children[0])}return this},toBBox:function(t){return t},compareMinX:u,compareMinY:c,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},_build:function(t,e,n,r){var i,o=n-e+1,a=this._maxEntries;if(o<=a)return s(i=g(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,r-1))),(i=g([])).leaf=!1,i.height=r;var l,u,c,h,p=Math.ceil(o/a),f=p*Math.ceil(Math.sqrt(a));for(m(t,e,n,f,this.compareMinX),l=e;l<=n;l+=f)for(m(t,l,c=Math.min(l+f-1,n),p,this.compareMinY),u=l;u<=c;u+=p)h=Math.min(u+p-1,c),i.children.push(this._build(t,u,h,r-1));return s(i,this.toBBox),i},_chooseSubtree:function(t,e,n,r){for(var i,o,s,a,l,u,c,p,f,d;r.push(e),!e.leaf&&r.length-1!==n;){for(c=p=1/0,i=0,o=e.children.length;i<o;i++)l=h(s=e.children[i]),f=t,d=s,(u=(Math.max(d.maxX,f.maxX)-Math.min(d.minX,f.minX))*(Math.max(d.maxY,f.maxY)-Math.min(d.minY,f.minY))-l)<p?(p=u,c=l<c?l:c,a=s):u===p&&l<c&&(c=l,a=s);e=a||e.children[0]}return e},_insert:function(t,e,n){var r=this.toBBox,i=n?t:r(t),o=[],s=this._chooseSubtree(i,this.data,e,o);for(s.children.push(t),l(s,i);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),a=g(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,s(n,this.toBBox),s(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)},_splitRoot:function(t,e){this.data=g([t,e]),this.data.height=t.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,l,u,c,p,f,d,g,m,y,_;for(u=c=1/0,r=e;r<=n-e;r++)f=i=a(t,0,r,this.toBBox),d=o=a(t,r,n,this.toBBox),void 0,void 0,void 0,void 0,g=Math.max(f.minX,d.minX),m=Math.max(f.minY,d.minY),y=Math.min(f.maxX,d.maxX),_=Math.min(f.maxY,d.maxY),s=Math.max(0,y-g)*Math.max(0,_-m),l=h(i)+h(o),s<u?(u=s,p=r,c=l<c?l:c):s===u&&l<c&&(c=l,p=r);return p},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:u,i=t.leaf?this.compareMinY:c;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},_allDistMargin:function(t,e,n,r){t.children.sort(r);var i,o,s=this.toBBox,u=a(t,0,e,s),c=a(t,n-e,n,s),h=p(u)+p(c);for(i=e;i<n-e;i++)o=t.children[i],l(u,t.leaf?s(o):o),h+=p(u);for(i=n-e-1;i>=e;i--)o=t.children[i],l(c,t.leaf?s(o):o),h+=p(c);return h},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r--)l(e[r],t)},_condense:function(t){for(var e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():s(t[n],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}},8982:function(t){t.exports=function(){function t(n,r,i,o,s){for(;o>i;){if(o-i>600){var a=o-i+1,l=r-i+1,u=Math.log(a),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(a-c)/a)*(l-a/2<0?-1:1);t(n,r,Math.max(i,Math.floor(r-l*c/a+h)),Math.min(o,Math.floor(r+(a-l)*c/a+h)),s)}var p=n[r],f=i,d=o;for(e(n,i,r),s(n[o],p)>0&&e(n,i,o);f<d;){for(e(n,f,d),f++,d--;s(n[f],p)<0;)f++;for(;s(n[d],p)>0;)d--}0===s(n[i],p)?e(n,i,d):e(n,++d,o),d<=r&&(i=d+1),r<=d&&(o=d-1)}}function e(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function n(t,e){return t<e?-1:t>e?1:0}return function(e,r,i,o,s){t(e,r,i||0,o||e.length-1,s||n)}}()},7400:(t,e,n)=>{var r=n(4041),i=n(7967);function o(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function l(t,e){u(t,e),u(t+"Capture",e)}function u(t,e){for(a[t]=e,t=0;t<e.length;t++)s.add(e[t])}var c=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),h=Object.prototype.hasOwnProperty,p=/^[: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]*$/,f={},d={};function g(t,e,n,r,i,o,s){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var m={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(t){m[t]=new g(t,0,!1,t,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(t){var e=t[0];m[e]=new g(e,1,!1,t[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(t){m[t]=new g(t,2,!1,t.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(t){m[t]=new g(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){m[t]=new g(t,3,!1,t.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(t){m[t]=new g(t,3,!0,t,null,!1,!1)})),["capture","download"].forEach((function(t){m[t]=new g(t,4,!1,t,null,!1,!1)})),["cols","rows","size","span"].forEach((function(t){m[t]=new g(t,6,!1,t,null,!1,!1)})),["rowSpan","start"].forEach((function(t){m[t]=new g(t,5,!1,t.toLowerCase(),null,!1,!1)}));var y=/[\-:]([a-z])/g;function _(t){return t[1].toUpperCase()}function v(t,e,n,r){var i=m.hasOwnProperty(e)?m[e]:null;(null!==i?0!==i.type:r||!(2<e.length)||"o"!==e[0]&&"O"!==e[0]||"n"!==e[1]&&"N"!==e[1])&&(function(t,e,n,r){if(null==e||function(t,e,n,r){if(null!==n&&0===n.type)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(t=t.toLowerCase().slice(0,5))&&"aria-"!==t);default:return!1}}(t,e,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!e;case 4:return!1===e;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}(e,n,i,r)&&(n=null),r||null===i?function(t){return!!h.call(d,t)||!h.call(f,t)&&(p.test(t)?d[t]=!0:(f[t]=!0,!1))}(e)&&(null===n?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=null===n?3!==i.type&&"":n:(e=i.attributeName,r=i.attributeNamespace,null===n?t.removeAttribute(e):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}"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(y,_);m[e]=new g(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(y,_);m[e]=new g(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(y,_);m[e]=new g(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(t){m[t]=new g(t,1,!1,t.toLowerCase(),null,!1,!1)})),m.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(t){m[t]=new g(t,1,!1,t.toLowerCase(),null,!0,!0)}));var x=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,b=Symbol.for("react.element"),w=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),T=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),k=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var N=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var D=Symbol.iterator;function R(t){return null===t||"object"!=typeof t?null:"function"==typeof(t=D&&t[D]||t["@@iterator"])?t:null}var O,z=Object.assign;function F(t){if(void 0===O)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);O=e&&e[1]||""}return"\n"+O+t}var B=!1;function U(t,e){if(!t||B)return"";B=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(e,[])}catch(t){var r=t}Reflect.construct(t,[],e)}else{try{e.call()}catch(t){r=t}t.call(e.prototype)}else{try{throw Error()}catch(t){r=t}t()}}catch(e){if(e&&r&&"string"==typeof e.stack){for(var i=e.stack.split("\n"),o=r.stack.split("\n"),s=i.length-1,a=o.length-1;1<=s&&0<=a&&i[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(i[s]!==o[a]){if(1!==s||1!==a)do{if(s--,0>--a||i[s]!==o[a]){var l="\n"+i[s].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}}while(1<=s&&0<=a);break}}}finally{B=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?F(t):""}function V(t){switch(t.tag){case 5:return F(t.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return U(t.type,!1);case 11:return U(t.type.render,!1);case 1:return U(t.type,!0);default:return""}}function j(t){if(null==t)return null;if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case E:return"Fragment";case w:return"Portal";case I:return"Profiler";case S:return"StrictMode";case M:return"Suspense";case L:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case T:return(t.displayName||"Context")+".Consumer";case C:return(t._context.displayName||"Context")+".Provider";case P:var e=t.render;return(t=t.displayName)||(t=""!==(t=e.displayName||e.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case A:return null!==(e=t.displayName||null)?e:j(t.type)||"Memo";case k:e=t._payload,t=t._init;try{return j(t(e))}catch(t){}}return null}function G(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=(t=e.render).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 j(e);case 8:return e===S?"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("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e}return null}function q(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":case"object":return t;default:return""}}function $(t){var e=t.type;return(t=t.nodeName)&&"input"===t.toLowerCase()&&("checkbox"===e||"radio"===e)}function X(t){t._valueTracker||(t._valueTracker=function(t){var e=$(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(t){r=""+t,o.call(this,t)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(t){r=""+t},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}(t))}function Z(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=$(t)?t.checked?"true":"false":t.value),(t=r)!==n&&(e.setValue(t),!0)}function Y(t){if(void 0===(t=t||("undefined"!=typeof document?document:void 0)))return null;try{return t.activeElement||t.body}catch(e){return t.body}}function W(t,e){var n=e.checked;return z({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:t._wrapperState.initialChecked})}function H(t,e){var n=null==e.defaultValue?"":e.defaultValue,r=null!=e.checked?e.checked:e.defaultChecked;n=q(null!=e.value?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}}function K(t,e){null!=(e=e.checked)&&v(t,"checked",e,!1)}function J(t,e){K(t,e);var n=q(e.value),r=e.type;if(null!=n)"number"===r?(0===n&&""===t.value||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if("submit"===r||"reset"===r)return void t.removeAttribute("value");e.hasOwnProperty("value")?tt(t,e.type,n):e.hasOwnProperty("defaultValue")&&tt(t,e.type,q(e.defaultValue)),null==e.checked&&null!=e.defaultChecked&&(t.defaultChecked=!!e.defaultChecked)}function Q(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!("submit"!==r&&"reset"!==r||void 0!==e.value&&null!==e.value))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}""!==(n=t.name)&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,""!==n&&(t.name=n)}function tt(t,e,n){"number"===e&&Y(t.ownerDocument)===t||(null==n?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var et=Array.isArray;function nt(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+q(n),e=null,i=0;i<t.length;i++){if(t[i].value===n)return t[i].selected=!0,void(r&&(t[i].defaultSelected=!0));null!==e||t[i].disabled||(e=t[i])}null!==e&&(e.selected=!0)}}function rt(t,e){if(null!=e.dangerouslySetInnerHTML)throw Error(o(91));return z({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function it(t,e){var n=e.value;if(null==n){if(n=e.children,e=e.defaultValue,null!=n){if(null!=e)throw Error(o(92));if(et(n)){if(1<n.length)throw Error(o(93));n=n[0]}e=n}null==e&&(e=""),n=e}t._wrapperState={initialValue:q(n)}}function ot(t,e){var n=q(e.value),r=q(e.defaultValue);null!=n&&((n=""+n)!==t.value&&(t.value=n),null==e.defaultValue&&t.defaultValue!==n&&(t.defaultValue=n)),null!=r&&(t.defaultValue=""+r)}function st(t){var e=t.textContent;e===t._wrapperState.initialValue&&""!==e&&null!==e&&(t.value=e)}function at(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function lt(t,e){return null==t||"http://www.w3.org/1999/xhtml"===t?at(e):"http://www.w3.org/2000/svg"===t&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":t}var ut,ct,ht=(ct=function(t,e){if("http://www.w3.org/2000/svg"!==t.namespaceURI||"innerHTML"in t)t.innerHTML=e;else{for((ut=ut||document.createElement("div")).innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=ut.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,e,n,r){MSApp.execUnsafeLocalFunction((function(){return ct(t,e)}))}:ct);function pt(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&3===n.nodeType)return void(n.nodeValue=e)}t.textContent=e}var ft={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},dt=["Webkit","ms","Moz","O"];function gt(t,e,n){return null==e||"boolean"==typeof e||""===e?"":n||"number"!=typeof e||0===e||ft.hasOwnProperty(t)&&ft[t]?(""+e).trim():e+"px"}function mt(t,e){for(var n in t=t.style,e)if(e.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=gt(n,e[n],r);"float"===n&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}Object.keys(ft).forEach((function(t){dt.forEach((function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ft[e]=ft[t]}))}));var yt=z({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 _t(t,e){if(e){if(yt[t]&&(null!=e.children||null!=e.dangerouslySetInnerHTML))throw Error(o(137,t));if(null!=e.dangerouslySetInnerHTML){if(null!=e.children)throw Error(o(60));if("object"!=typeof e.dangerouslySetInnerHTML||!("__html"in e.dangerouslySetInnerHTML))throw Error(o(61))}if(null!=e.style&&"object"!=typeof e.style)throw Error(o(62))}}function vt(t,e){if(-1===t.indexOf("-"))return"string"==typeof e.is;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 xt=null;function bt(t){return(t=t.target||t.srcElement||window).correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}var wt=null,Et=null,St=null;function It(t){if(t=_i(t)){if("function"!=typeof wt)throw Error(o(280));var e=t.stateNode;e&&(e=xi(e),wt(t.stateNode,t.type,e))}}function Ct(t){Et?St?St.push(t):St=[t]:Et=t}function Tt(){if(Et){var t=Et,e=St;if(St=Et=null,It(t),e)for(t=0;t<e.length;t++)It(e[t])}}function Pt(t,e){return t(e)}function Mt(){}var Lt=!1;function At(t,e,n){if(Lt)return t(e,n);Lt=!0;try{return Pt(t,e,n)}finally{Lt=!1,(null!==Et||null!==St)&&(Mt(),Tt())}}function kt(t,e){var n=t.stateNode;if(null===n)return null;var r=xi(n);if(null===r)return null;n=r[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(t=t.type)||"input"===t||"select"===t||"textarea"===t)),t=!r;break t;default:t=!1}if(t)return null;if(n&&"function"!=typeof n)throw Error(o(231,e,typeof n));return n}var Nt=!1;if(c)try{var Dt={};Object.defineProperty(Dt,"passive",{get:function(){Nt=!0}}),window.addEventListener("test",Dt,Dt),window.removeEventListener("test",Dt,Dt)}catch(ct){Nt=!1}function Rt(t,e,n,r,i,o,s,a,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(t){this.onError(t)}}var Ot=!1,zt=null,Ft=!1,Bt=null,Ut={onError:function(t){Ot=!0,zt=t}};function Vt(t,e,n,r,i,o,s,a,l){Ot=!1,zt=null,Rt.apply(Ut,arguments)}function jt(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do{0!=(4098&(e=t).flags)&&(n=e.return),t=e.return}while(t)}return 3===e.tag?n:null}function Gt(t){if(13===t.tag){var e=t.memoizedState;if(null===e&&null!==(t=t.alternate)&&(e=t.memoizedState),null!==e)return e.dehydrated}return null}function qt(t){if(jt(t)!==t)throw Error(o(188))}function $t(t){return null!==(t=function(t){var e=t.alternate;if(!e){if(null===(e=jt(t)))throw Error(o(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(null===i)break;var s=i.alternate;if(null===s){if(null!==(r=i.return)){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return qt(i),t;if(s===r)return qt(i),e;s=s.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=s;else{for(var a=!1,l=i.child;l;){if(l===n){a=!0,n=i,r=s;break}if(l===r){a=!0,r=i,n=s;break}l=l.sibling}if(!a){for(l=s.child;l;){if(l===n){a=!0,n=s,r=i;break}if(l===r){a=!0,r=s,n=i;break}l=l.sibling}if(!a)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(3!==n.tag)throw Error(o(188));return n.stateNode.current===n?t:e}(t))?Xt(t):null}function Xt(t){if(5===t.tag||6===t.tag)return t;for(t=t.child;null!==t;){var e=Xt(t);if(null!==e)return e;t=t.sibling}return null}var Zt=i.unstable_scheduleCallback,Yt=i.unstable_cancelCallback,Wt=i.unstable_shouldYield,Ht=i.unstable_requestPaint,Kt=i.unstable_now,Jt=i.unstable_getCurrentPriorityLevel,Qt=i.unstable_ImmediatePriority,te=i.unstable_UserBlockingPriority,ee=i.unstable_NormalPriority,ne=i.unstable_LowPriority,re=i.unstable_IdlePriority,ie=null,oe=null,se=Math.clz32?Math.clz32:function(t){return 0===(t>>>=0)?32:31-(ae(t)/le|0)|0},ae=Math.log,le=Math.LN2,ue=64,ce=4194304;function he(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 4194240&t;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&t;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function pe(t,e){var n=t.pendingLanes;if(0===n)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=268435455&n;if(0!==s){var a=s&~i;0!==a?r=he(a):0!=(o&=s)&&(r=he(o))}else 0!=(s=n&~i)?r=he(s):0!==o&&(r=he(o));if(0===r)return 0;if(0!==e&&e!==r&&0==(e&i)&&((i=r&-r)>=(o=e&-e)||16===i&&0!=(4194240&o)))return e;if(0!=(4&r)&&(r|=16&n),0!==(e=t.entangledLanes))for(t=t.entanglements,e&=r;0<e;)i=1<<(n=31-se(e)),r|=t[n],e&=~i;return r}function fe(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;default:return-1}}function de(t){return 0!=(t=-1073741825&t.pendingLanes)?t:1073741824&t?1073741824:0}function ge(){var t=ue;return 0==(4194240&(ue<<=1))&&(ue=64),t}function me(t,e,n){t.pendingLanes|=e,536870912!==e&&(t.suspendedLanes=0,t.pingedLanes=0),(t=t.eventTimes)[e=31-se(e)]=n}function ye(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-se(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var _e=0;function ve(t){return 1<(t&=-t)?4<t?0!=(268435455&t)?16:536870912:4:1}var xe,be,we,Ee,Se,Ie=!1,Ce=[],Te=null,Pe=null,Me=null,Le=new Map,Ae=new Map,ke=[],Ne="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function De(t,e){switch(t){case"focusin":case"focusout":Te=null;break;case"dragenter":case"dragleave":Pe=null;break;case"mouseover":case"mouseout":Me=null;break;case"pointerover":case"pointerout":Le.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ae.delete(e.pointerId)}}function Re(t,e,n,r,i,o){return null===t||t.nativeEvent!==o?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},null!==e&&null!==(e=_i(e))&&be(e),t):(t.eventSystemFlags|=r,e=t.targetContainers,null!==i&&-1===e.indexOf(i)&&e.push(i),t)}function Oe(t){var e=yi(t.target);if(null!==e){var n=jt(e);if(null!==n)if(13===(e=n.tag)){if(null!==(e=Gt(n)))return t.blockedOn=e,void Se(t.priority,(function(){we(n)}))}else if(3===e&&n.stateNode.current.memoizedState.isDehydrated)return void(t.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}t.blockedOn=null}function ze(t){if(null!==t.blockedOn)return!1;for(var e=t.targetContainers;0<e.length;){var n=Ye(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(null!==n)return null!==(e=_i(n))&&be(e),t.blockedOn=n,!1;var r=new(n=t.nativeEvent).constructor(n.type,n);xt=r,n.target.dispatchEvent(r),xt=null,e.shift()}return!0}function Fe(t,e,n){ze(t)&&n.delete(e)}function Be(){Ie=!1,null!==Te&&ze(Te)&&(Te=null),null!==Pe&&ze(Pe)&&(Pe=null),null!==Me&&ze(Me)&&(Me=null),Le.forEach(Fe),Ae.forEach(Fe)}function Ue(t,e){t.blockedOn===e&&(t.blockedOn=null,Ie||(Ie=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Be)))}function Ve(t){function e(e){return Ue(e,t)}if(0<Ce.length){Ue(Ce[0],t);for(var n=1;n<Ce.length;n++){var r=Ce[n];r.blockedOn===t&&(r.blockedOn=null)}}for(null!==Te&&Ue(Te,t),null!==Pe&&Ue(Pe,t),null!==Me&&Ue(Me,t),Le.forEach(e),Ae.forEach(e),n=0;n<ke.length;n++)(r=ke[n]).blockedOn===t&&(r.blockedOn=null);for(;0<ke.length&&null===(n=ke[0]).blockedOn;)Oe(n),null===n.blockedOn&&ke.shift()}var je=x.ReactCurrentBatchConfig,Ge=!0;function qe(t,e,n,r){var i=_e,o=je.transition;je.transition=null;try{_e=1,Xe(t,e,n,r)}finally{_e=i,je.transition=o}}function $e(t,e,n,r){var i=_e,o=je.transition;je.transition=null;try{_e=4,Xe(t,e,n,r)}finally{_e=i,je.transition=o}}function Xe(t,e,n,r){if(Ge){var i=Ye(t,e,n,r);if(null===i)Gr(t,e,r,Ze,n),De(t,r);else if(function(t,e,n,r,i){switch(e){case"focusin":return Te=Re(Te,t,e,n,r,i),!0;case"dragenter":return Pe=Re(Pe,t,e,n,r,i),!0;case"mouseover":return Me=Re(Me,t,e,n,r,i),!0;case"pointerover":var o=i.pointerId;return Le.set(o,Re(Le.get(o)||null,t,e,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,Ae.set(o,Re(Ae.get(o)||null,t,e,n,r,i)),!0}return!1}(i,t,e,n,r))r.stopPropagation();else if(De(t,r),4&e&&-1<Ne.indexOf(t)){for(;null!==i;){var o=_i(i);if(null!==o&&xe(o),null===(o=Ye(t,e,n,r))&&Gr(t,e,r,Ze,n),o===i)break;i=o}null!==i&&r.stopPropagation()}else Gr(t,e,r,null,n)}}var Ze=null;function Ye(t,e,n,r){if(Ze=null,null!==(t=yi(t=bt(r))))if(null===(e=jt(t)))t=null;else if(13===(n=e.tag)){if(null!==(t=Gt(e)))return t;t=null}else if(3===n){if(e.stateNode.current.memoizedState.isDehydrated)return 3===e.tag?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Ze=t,null}function We(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Jt()){case Qt:return 1;case te:return 4;case ee:case ne:return 16;case re:return 536870912;default:return 16}default:return 16}}var He=null,Ke=null,Je=null;function Qe(){if(Je)return Je;var t,e,n=Ke,r=n.length,i="value"in He?He.value:He.textContent,o=i.length;for(t=0;t<r&&n[t]===i[t];t++);var s=r-t;for(e=1;e<=s&&n[r-e]===i[o-e];e++);return Je=i.slice(t,1<e?1-e:void 0)}function tn(t){var e=t.keyCode;return"charCode"in t?0===(t=t.charCode)&&13===e&&(t=13):t=e,10===t&&(t=13),32<=t||13===t?t:0}function en(){return!0}function nn(){return!1}function rn(t){function e(e,n,r,i,o){for(var s in this._reactName=e,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null,t)t.hasOwnProperty(s)&&(e=t[s],this[s]=e?e(i):i[s]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?en:nn,this.isPropagationStopped=nn,this}return z(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():"unknown"!=typeof t.returnValue&&(t.returnValue=!1),this.isDefaultPrevented=en)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():"unknown"!=typeof t.cancelBubble&&(t.cancelBubble=!0),this.isPropagationStopped=en)},persist:function(){},isPersistent:en}),e}var on,sn,an,ln={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},un=rn(ln),cn=z({},ln,{view:0,detail:0}),hn=rn(cn),pn=z({},cn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sn,button:0,buttons:0,relatedTarget:function(t){return void 0===t.relatedTarget?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==an&&(an&&"mousemove"===t.type?(on=t.screenX-an.screenX,sn=t.screenY-an.screenY):sn=on=0,an=t),on)},movementY:function(t){return"movementY"in t?t.movementY:sn}}),fn=rn(pn),dn=rn(z({},pn,{dataTransfer:0})),gn=rn(z({},cn,{relatedTarget:0})),mn=rn(z({},ln,{animationName:0,elapsedTime:0,pseudoElement:0})),yn=z({},ln,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),_n=rn(yn),vn=rn(z({},ln,{data:0})),xn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},wn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function En(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):!!(t=wn[t])&&!!e[t]}function Sn(){return En}var In=z({},cn,{key:function(t){if(t.key){var e=xn[t.key]||t.key;if("Unidentified"!==e)return e}return"keypress"===t.type?13===(t=tn(t))?"Enter":String.fromCharCode(t):"keydown"===t.type||"keyup"===t.type?bn[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sn,charCode:function(t){return"keypress"===t.type?tn(t):0},keyCode:function(t){return"keydown"===t.type||"keyup"===t.type?t.keyCode:0},which:function(t){return"keypress"===t.type?tn(t):"keydown"===t.type||"keyup"===t.type?t.keyCode:0}}),Cn=rn(In),Tn=rn(z({},pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=rn(z({},cn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sn})),Mn=rn(z({},ln,{propertyName:0,elapsedTime:0,pseudoElement:0})),Ln=z({},pn,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),An=rn(Ln),kn=[9,13,27,32],Nn=c&&"CompositionEvent"in window,Dn=null;c&&"documentMode"in document&&(Dn=document.documentMode);var Rn=c&&"TextEvent"in window&&!Dn,On=c&&(!Nn||Dn&&8<Dn&&11>=Dn),zn=String.fromCharCode(32),Fn=!1;function Bn(t,e){switch(t){case"keyup":return-1!==kn.indexOf(e.keyCode);case"keydown":return 229!==e.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Un(t){return"object"==typeof(t=t.detail)&&"data"in t?t.data:null}var Vn=!1,jn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Gn(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return"input"===e?!!jn[t.type]:"textarea"===e}function qn(t,e,n,r){Ct(r),0<(e=$r(e,"onChange")).length&&(n=new un("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var $n=null,Xn=null;function Zn(t){zr(t,0)}function Yn(t){if(Z(vi(t)))return t}function Wn(t,e){if("change"===t)return e}var Hn=!1;if(c){var Kn;if(c){var Jn="oninput"in document;if(!Jn){var Qn=document.createElement("div");Qn.setAttribute("oninput","return;"),Jn="function"==typeof Qn.oninput}Kn=Jn}else Kn=!1;Hn=Kn&&(!document.documentMode||9<document.documentMode)}function tr(){$n&&($n.detachEvent("onpropertychange",er),Xn=$n=null)}function er(t){if("value"===t.propertyName&&Yn(Xn)){var e=[];qn(e,Xn,t,bt(t)),At(Zn,e)}}function nr(t,e,n){"focusin"===t?(tr(),Xn=n,($n=e).attachEvent("onpropertychange",er)):"focusout"===t&&tr()}function rr(t){if("selectionchange"===t||"keyup"===t||"keydown"===t)return Yn(Xn)}function ir(t,e){if("click"===t)return Yn(e)}function or(t,e){if("input"===t||"change"===t)return Yn(e)}var sr="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e};function ar(t,e){if(sr(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!h.call(e,i)||!sr(t[i],e[i]))return!1}return!0}function lr(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ur(t,e){var n,r=lr(t);for(t=0;r;){if(3===r.nodeType){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}t:{for(;r;){if(r.nextSibling){r=r.nextSibling;break t}r=r.parentNode}r=void 0}r=lr(r)}}function cr(t,e){return!(!t||!e)&&(t===e||(!t||3!==t.nodeType)&&(e&&3===e.nodeType?cr(t,e.parentNode):"contains"in t?t.contains(e):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(e))))}function hr(){for(var t=window,e=Y();e instanceof t.HTMLIFrameElement;){try{var n="string"==typeof e.contentWindow.location.href}catch(t){n=!1}if(!n)break;e=Y((t=e.contentWindow).document)}return e}function pr(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&("text"===t.type||"search"===t.type||"tel"===t.type||"url"===t.type||"password"===t.type)||"textarea"===e||"true"===t.contentEditable)}function fr(t){var e=hr(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&cr(n.ownerDocument.documentElement,n)){if(null!==r&&pr(n))if(e=r.start,void 0===(t=r.end)&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if((t=(e=n.ownerDocument||document)&&e.defaultView||window).getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=void 0===r.end?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=ur(n,o);var s=ur(n,r);i&&s&&(1!==t.rangeCount||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&((e=e.createRange()).setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}for(e=[],t=n;t=t.parentNode;)1===t.nodeType&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<e.length;n++)(t=e[n]).element.scrollLeft=t.left,t.element.scrollTop=t.top}}var dr=c&&"documentMode"in document&&11>=document.documentMode,gr=null,mr=null,yr=null,_r=!1;function vr(t,e,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;_r||null==gr||gr!==Y(r)||(r="selectionStart"in(r=gr)&&pr(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},yr&&ar(yr,r)||(yr=r,0<(r=$r(mr,"onSelect")).length&&(e=new un("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=gr)))}function xr(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var br={animationend:xr("Animation","AnimationEnd"),animationiteration:xr("Animation","AnimationIteration"),animationstart:xr("Animation","AnimationStart"),transitionend:xr("Transition","TransitionEnd")},wr={},Er={};function Sr(t){if(wr[t])return wr[t];if(!br[t])return t;var e,n=br[t];for(e in n)if(n.hasOwnProperty(e)&&e in Er)return wr[t]=n[e];return t}c&&(Er=document.createElement("div").style,"AnimationEvent"in window||(delete br.animationend.animation,delete br.animationiteration.animation,delete br.animationstart.animation),"TransitionEvent"in window||delete br.transitionend.transition);var Ir=Sr("animationend"),Cr=Sr("animationiteration"),Tr=Sr("animationstart"),Pr=Sr("transitionend"),Mr=new Map,Lr="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ar(t,e){Mr.set(t,e),l(e,[t])}for(var kr=0;kr<Lr.length;kr++){var Nr=Lr[kr];Ar(Nr.toLowerCase(),"on"+(Nr[0].toUpperCase()+Nr.slice(1)))}Ar(Ir,"onAnimationEnd"),Ar(Cr,"onAnimationIteration"),Ar(Tr,"onAnimationStart"),Ar("dblclick","onDoubleClick"),Ar("focusin","onFocus"),Ar("focusout","onBlur"),Ar(Pr,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Rr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Dr));function Or(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,function(t,e,n,r,i,s,a,l,u){if(Vt.apply(this,arguments),Ot){if(!Ot)throw Error(o(198));var c=zt;Ot=!1,zt=null,Ft||(Ft=!0,Bt=c)}}(r,e,void 0,t),t.currentTarget=null}function zr(t,e){e=0!=(4&e);for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;t:{var o=void 0;if(e)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==o&&i.isPropagationStopped())break t;Or(i,a,u),o=l}else for(s=0;s<r.length;s++){if(l=(a=r[s]).instance,u=a.currentTarget,a=a.listener,l!==o&&i.isPropagationStopped())break t;Or(i,a,u),o=l}}}if(Ft)throw t=Bt,Ft=!1,Bt=null,t}function Fr(t,e){var n=e[di];void 0===n&&(n=e[di]=new Set);var r=t+"__bubble";n.has(r)||(jr(e,t,2,!1),n.add(r))}function Br(t,e,n){var r=0;e&&(r|=4),jr(n,t,r,e)}var Ur="_reactListening"+Math.random().toString(36).slice(2);function Vr(t){if(!t[Ur]){t[Ur]=!0,s.forEach((function(e){"selectionchange"!==e&&(Rr.has(e)||Br(e,!1,t),Br(e,!0,t))}));var e=9===t.nodeType?t:t.ownerDocument;null===e||e[Ur]||(e[Ur]=!0,Br("selectionchange",!1,e))}}function jr(t,e,n,r){switch(We(e)){case 1:var i=qe;break;case 4:i=$e;break;default:i=Xe}n=i.bind(null,e,n,t),i=void 0,!Nt||"touchstart"!==e&&"touchmove"!==e&&"wheel"!==e||(i=!0),r?void 0!==i?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):void 0!==i?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function Gr(t,e,n,r,i){var o=r;if(0==(1&e)&&0==(2&e)&&null!==r)t:for(;;){if(null===r)return;var s=r.tag;if(3===s||4===s){var a=r.stateNode.containerInfo;if(a===i||8===a.nodeType&&a.parentNode===i)break;if(4===s)for(s=r.return;null!==s;){var l=s.tag;if((3===l||4===l)&&((l=s.stateNode.containerInfo)===i||8===l.nodeType&&l.parentNode===i))return;s=s.return}for(;null!==a;){if(null===(s=yi(a)))return;if(5===(l=s.tag)||6===l){r=o=s;continue t}a=a.parentNode}}r=r.return}At((function(){var r=o,i=bt(n),s=[];t:{var a=Mr.get(t);if(void 0!==a){var l=un,u=t;switch(t){case"keypress":if(0===tn(n))break t;case"keydown":case"keyup":l=Cn;break;case"focusin":u="focus",l=gn;break;case"focusout":u="blur",l=gn;break;case"beforeblur":case"afterblur":l=gn;break;case"click":if(2===n.button)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=fn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=dn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=Pn;break;case Ir:case Cr:case Tr:l=mn;break;case Pr:l=Mn;break;case"scroll":l=hn;break;case"wheel":l=An;break;case"copy":case"cut":case"paste":l=_n;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=Tn}var c=0!=(4&e),h=!c&&"scroll"===t,p=c?null!==a?a+"Capture":null:a;c=[];for(var f,d=r;null!==d;){var g=(f=d).stateNode;if(5===f.tag&&null!==g&&(f=g,null!==p&&null!=(g=kt(d,p))&&c.push(qr(d,g,f))),h)break;d=d.return}0<c.length&&(a=new l(a,u,null,n,i),s.push({event:a,listeners:c}))}}if(0==(7&e)){if(l="mouseout"===t||"pointerout"===t,(!(a="mouseover"===t||"pointerover"===t)||n===xt||!(u=n.relatedTarget||n.fromElement)||!yi(u)&&!u[fi])&&(l||a)&&(a=i.window===i?i:(a=i.ownerDocument)?a.defaultView||a.parentWindow:window,l?(l=r,null!==(u=(u=n.relatedTarget||n.toElement)?yi(u):null)&&(u!==(h=jt(u))||5!==u.tag&&6!==u.tag)&&(u=null)):(l=null,u=r),l!==u)){if(c=fn,g="onMouseLeave",p="onMouseEnter",d="mouse","pointerout"!==t&&"pointerover"!==t||(c=Tn,g="onPointerLeave",p="onPointerEnter",d="pointer"),h=null==l?a:vi(l),f=null==u?a:vi(u),(a=new c(g,d+"leave",l,n,i)).target=h,a.relatedTarget=f,g=null,yi(i)===r&&((c=new c(p,d+"enter",u,n,i)).target=f,c.relatedTarget=h,g=c),h=g,l&&u)t:{for(p=u,d=0,f=c=l;f;f=Xr(f))d++;for(f=0,g=p;g;g=Xr(g))f++;for(;0<d-f;)c=Xr(c),d--;for(;0<f-d;)p=Xr(p),f--;for(;d--;){if(c===p||null!==p&&c===p.alternate)break t;c=Xr(c),p=Xr(p)}c=null}else c=null;null!==l&&Zr(s,a,l,c,!1),null!==u&&null!==h&&Zr(s,h,u,c,!0)}if("select"===(l=(a=r?vi(r):window).nodeName&&a.nodeName.toLowerCase())||"input"===l&&"file"===a.type)var m=Wn;else if(Gn(a))if(Hn)m=or;else{m=rr;var y=nr}else(l=a.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(m=ir);switch(m&&(m=m(t,r))?qn(s,m,n,i):(y&&y(t,a,r),"focusout"===t&&(y=a._wrapperState)&&y.controlled&&"number"===a.type&&tt(a,"number",a.value)),y=r?vi(r):window,t){case"focusin":(Gn(y)||"true"===y.contentEditable)&&(gr=y,mr=r,yr=null);break;case"focusout":yr=mr=gr=null;break;case"mousedown":_r=!0;break;case"contextmenu":case"mouseup":case"dragend":_r=!1,vr(s,n,i);break;case"selectionchange":if(dr)break;case"keydown":case"keyup":vr(s,n,i)}var _;if(Nn)t:{switch(t){case"compositionstart":var v="onCompositionStart";break t;case"compositionend":v="onCompositionEnd";break t;case"compositionupdate":v="onCompositionUpdate";break t}v=void 0}else Vn?Bn(t,n)&&(v="onCompositionEnd"):"keydown"===t&&229===n.keyCode&&(v="onCompositionStart");v&&(On&&"ko"!==n.locale&&(Vn||"onCompositionStart"!==v?"onCompositionEnd"===v&&Vn&&(_=Qe()):(Ke="value"in(He=i)?He.value:He.textContent,Vn=!0)),0<(y=$r(r,v)).length&&(v=new vn(v,t,null,n,i),s.push({event:v,listeners:y}),(_||null!==(_=Un(n)))&&(v.data=_))),(_=Rn?function(t,e){switch(t){case"compositionend":return Un(e);case"keypress":return 32!==e.which?null:(Fn=!0,zn);case"textInput":return(t=e.data)===zn&&Fn?null:t;default:return null}}(t,n):function(t,e){if(Vn)return"compositionend"===t||!Nn&&Bn(t,e)?(t=Qe(),Je=Ke=He=null,Vn=!1,t):null;switch(t){case"paste":default:return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return On&&"ko"!==e.locale?null:e.data}}(t,n))&&0<(r=$r(r,"onBeforeInput")).length&&(i=new vn("onBeforeInput","beforeinput",null,n,i),s.push({event:i,listeners:r}),i.data=_)}zr(s,e)}))}function qr(t,e,n){return{instance:t,listener:e,currentTarget:n}}function $r(t,e){for(var n=e+"Capture",r=[];null!==t;){var i=t,o=i.stateNode;5===i.tag&&null!==o&&(i=o,null!=(o=kt(t,n))&&r.unshift(qr(t,o,i)),null!=(o=kt(t,e))&&r.push(qr(t,o,i))),t=t.return}return r}function Xr(t){if(null===t)return null;do{t=t.return}while(t&&5!==t.tag);return t||null}function Zr(t,e,n,r,i){for(var o=e._reactName,s=[];null!==n&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(null!==l&&l===r)break;5===a.tag&&null!==u&&(a=u,i?null!=(l=kt(n,o))&&s.unshift(qr(n,l,a)):i||null!=(l=kt(n,o))&&s.push(qr(n,l,a))),n=n.return}0!==s.length&&t.push({event:e,listeners:s})}var Yr=/\r\n?/g,Wr=/\u0000|\uFFFD/g;function Hr(t){return("string"==typeof t?t:""+t).replace(Yr,"\n").replace(Wr,"")}function Kr(t,e,n){if(e=Hr(e),Hr(t)!==e&&n)throw Error(o(425))}function Jr(){}var Qr=null,ti=null;function ei(t,e){return"textarea"===t||"noscript"===t||"string"==typeof e.children||"number"==typeof e.children||"object"==typeof e.dangerouslySetInnerHTML&&null!==e.dangerouslySetInnerHTML&&null!=e.dangerouslySetInnerHTML.__html}var ni="function"==typeof setTimeout?setTimeout:void 0,ri="function"==typeof clearTimeout?clearTimeout:void 0,ii="function"==typeof Promise?Promise:void 0,oi="function"==typeof queueMicrotask?queueMicrotask:void 0!==ii?function(t){return ii.resolve(null).then(t).catch(si)}:ni;function si(t){setTimeout((function(){throw t}))}function ai(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&8===i.nodeType)if("/$"===(n=i.data)){if(0===r)return t.removeChild(i),void Ve(e);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=i}while(n);Ve(e)}function li(t){for(;null!=t;t=t.nextSibling){var e=t.nodeType;if(1===e||3===e)break;if(8===e){if("$"===(e=t.data)||"$!"===e||"$?"===e)break;if("/$"===e)return null}}return t}function ui(t){t=t.previousSibling;for(var e=0;t;){if(8===t.nodeType){var n=t.data;if("$"===n||"$!"===n||"$?"===n){if(0===e)return t;e--}else"/$"===n&&e++}t=t.previousSibling}return null}var ci=Math.random().toString(36).slice(2),hi="__reactFiber$"+ci,pi="__reactProps$"+ci,fi="__reactContainer$"+ci,di="__reactEvents$"+ci,gi="__reactListeners$"+ci,mi="__reactHandles$"+ci;function yi(t){var e=t[hi];if(e)return e;for(var n=t.parentNode;n;){if(e=n[fi]||n[hi]){if(n=e.alternate,null!==e.child||null!==n&&null!==n.child)for(t=ui(t);null!==t;){if(n=t[hi])return n;t=ui(t)}return e}n=(t=n).parentNode}return null}function _i(t){return!(t=t[hi]||t[fi])||5!==t.tag&&6!==t.tag&&13!==t.tag&&3!==t.tag?null:t}function vi(t){if(5===t.tag||6===t.tag)return t.stateNode;throw Error(o(33))}function xi(t){return t[pi]||null}var bi=[],wi=-1;function Ei(t){return{current:t}}function Si(t){0>wi||(t.current=bi[wi],bi[wi]=null,wi--)}function Ii(t,e){wi++,bi[wi]=t.current,t.current=e}var Ci={},Ti=Ei(Ci),Pi=Ei(!1),Mi=Ci;function Li(t,e){var n=t.type.contextTypes;if(!n)return Ci;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=e[i];return r&&((t=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function Ai(t){return null!=t.childContextTypes}function ki(){Si(Pi),Si(Ti)}function Ni(t,e,n){if(Ti.current!==Ci)throw Error(o(168));Ii(Ti,e),Ii(Pi,n)}function Di(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in e))throw Error(o(108,G(t)||"Unknown",i));return z({},n,r)}function Ri(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ci,Mi=Ti.current,Ii(Ti,t),Ii(Pi,Pi.current),!0}function Oi(t,e,n){var r=t.stateNode;if(!r)throw Error(o(169));n?(t=Di(t,e,Mi),r.__reactInternalMemoizedMergedChildContext=t,Si(Pi),Si(Ti),Ii(Ti,t)):Si(Pi),Ii(Pi,n)}var zi=null,Fi=!1,Bi=!1;function Ui(t){null===zi?zi=[t]:zi.push(t)}function Vi(){if(!Bi&&null!==zi){Bi=!0;var t=0,e=_e;try{var n=zi;for(_e=1;t<n.length;t++){var r=n[t];do{r=r(!0)}while(null!==r)}zi=null,Fi=!1}catch(e){throw null!==zi&&(zi=zi.slice(t+1)),Zt(Qt,Vi),e}finally{_e=e,Bi=!1}}return null}var ji=[],Gi=0,qi=null,$i=0,Xi=[],Zi=0,Yi=null,Wi=1,Hi="";function Ki(t,e){ji[Gi++]=$i,ji[Gi++]=qi,qi=t,$i=e}function Ji(t,e,n){Xi[Zi++]=Wi,Xi[Zi++]=Hi,Xi[Zi++]=Yi,Yi=t;var r=Wi;t=Hi;var i=32-se(r)-1;r&=~(1<<i),n+=1;var o=32-se(e)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,Wi=1<<32-se(e)+i|n<<i|r,Hi=o+t}else Wi=1<<o|n<<i|r,Hi=t}function Qi(t){null!==t.return&&(Ki(t,1),Ji(t,1,0))}function to(t){for(;t===qi;)qi=ji[--Gi],ji[Gi]=null,$i=ji[--Gi],ji[Gi]=null;for(;t===Yi;)Yi=Xi[--Zi],Xi[Zi]=null,Hi=Xi[--Zi],Xi[Zi]=null,Wi=Xi[--Zi],Xi[Zi]=null}var eo=null,no=null,ro=!1,io=null;function oo(t,e){var n=Au(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,null===(e=t.deletions)?(t.deletions=[n],t.flags|=16):e.push(n)}function so(t,e){switch(t.tag){case 5:var n=t.type;return null!==(e=1!==e.nodeType||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e)&&(t.stateNode=e,eo=t,no=li(e.firstChild),!0);case 6:return null!==(e=""===t.pendingProps||3!==e.nodeType?null:e)&&(t.stateNode=e,eo=t,no=null,!0);case 13:return null!==(e=8!==e.nodeType?null:e)&&(n=null!==Yi?{id:Wi,overflow:Hi}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},(n=Au(18,null,null,0)).stateNode=e,n.return=t,t.child=n,eo=t,no=null,!0);default:return!1}}function ao(t){return 0!=(1&t.mode)&&0==(128&t.flags)}function lo(t){if(ro){var e=no;if(e){var n=e;if(!so(t,e)){if(ao(t))throw Error(o(418));e=li(n.nextSibling);var r=eo;e&&so(t,e)?oo(r,n):(t.flags=-4097&t.flags|2,ro=!1,eo=t)}}else{if(ao(t))throw Error(o(418));t.flags=-4097&t.flags|2,ro=!1,eo=t}}}function uo(t){for(t=t.return;null!==t&&5!==t.tag&&3!==t.tag&&13!==t.tag;)t=t.return;eo=t}function co(t){if(t!==eo)return!1;if(!ro)return uo(t),ro=!0,!1;var e;if((e=3!==t.tag)&&!(e=5!==t.tag)&&(e="head"!==(e=t.type)&&"body"!==e&&!ei(t.type,t.memoizedProps)),e&&(e=no)){if(ao(t))throw ho(),Error(o(418));for(;e;)oo(t,e),e=li(e.nextSibling)}if(uo(t),13===t.tag){if(!(t=null!==(t=t.memoizedState)?t.dehydrated:null))throw Error(o(317));t:{for(t=t.nextSibling,e=0;t;){if(8===t.nodeType){var n=t.data;if("/$"===n){if(0===e){no=li(t.nextSibling);break t}e--}else"$"!==n&&"$!"!==n&&"$?"!==n||e++}t=t.nextSibling}no=null}}else no=eo?li(t.stateNode.nextSibling):null;return!0}function ho(){for(var t=no;t;)t=li(t.nextSibling)}function po(){no=eo=null,ro=!1}function fo(t){null===io?io=[t]:io.push(t)}var go=x.ReactCurrentBatchConfig;function mo(t,e){if(t&&t.defaultProps){for(var n in e=z({},e),t=t.defaultProps)void 0===e[n]&&(e[n]=t[n]);return e}return e}var yo=Ei(null),_o=null,vo=null,xo=null;function bo(){xo=vo=_o=null}function wo(t){var e=yo.current;Si(yo),t._currentValue=e}function Eo(t,e,n){for(;null!==t;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,null!==r&&(r.childLanes|=e)):null!==r&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function So(t,e){_o=t,xo=vo=null,null!==(t=t.dependencies)&&null!==t.firstContext&&(0!=(t.lanes&e)&&(va=!0),t.firstContext=null)}function Io(t){var e=t._currentValue;if(xo!==t)if(t={context:t,memoizedValue:e,next:null},null===vo){if(null===_o)throw Error(o(308));vo=t,_o.dependencies={lanes:0,firstContext:t}}else vo=vo.next=t;return e}var Co=null;function To(t){null===Co?Co=[t]:Co.push(t)}function Po(t,e,n,r){var i=e.interleaved;return null===i?(n.next=n,To(e)):(n.next=i.next,i.next=n),e.interleaved=n,Mo(t,r)}function Mo(t,e){t.lanes|=e;var n=t.alternate;for(null!==n&&(n.lanes|=e),n=t,t=t.return;null!==t;)t.childLanes|=e,null!==(n=t.alternate)&&(n.childLanes|=e),n=t,t=t.return;return 3===n.tag?n.stateNode:null}var Lo=!1;function Ao(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ko(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 No(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Do(t,e,n){var r=t.updateQueue;if(null===r)return null;if(r=r.shared,0!=(2&Pl)){var i=r.pending;return null===i?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Mo(t,n)}return null===(i=r.interleaved)?(e.next=e,To(r)):(e.next=i.next,i.next=e),r.interleaved=e,Mo(t,n)}function Ro(t,e,n){if(null!==(e=e.updateQueue)&&(e=e.shared,0!=(4194240&n))){var r=e.lanes;n|=r&=t.pendingLanes,e.lanes=n,ye(t,n)}}function Oo(t,e){var n=t.updateQueue,r=t.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?i=o=s:o=o.next=s,n=n.next}while(null!==n);null===o?i=o=e:o=o.next=e}else i=o=e;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(t.updateQueue=n)}null===(t=n.lastBaseUpdate)?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function zo(t,e,n,r){var i=t.updateQueue;Lo=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(null!==a){i.shared.pending=null;var l=a,u=l.next;l.next=null,null===s?o=u:s.next=u,s=l;var c=t.alternate;null!==c&&(a=(c=c.updateQueue).lastBaseUpdate)!==s&&(null===a?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l)}if(null!==o){var h=i.baseState;for(s=0,c=u=l=null,a=o;;){var p=a.lane,f=a.eventTime;if((r&p)===p){null!==c&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});t:{var d=t,g=a;switch(p=e,f=n,g.tag){case 1:if("function"==typeof(d=g.payload)){h=d.call(f,h,p);break t}h=d;break t;case 3:d.flags=-65537&d.flags|128;case 0:if(null==(p="function"==typeof(d=g.payload)?d.call(f,h,p):d))break t;h=z({},h,p);break t;case 2:Lo=!0}}null!==a.callback&&0!==a.lane&&(t.flags|=64,null===(p=i.effects)?i.effects=[a]:p.push(a))}else f={eventTime:f,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===c?(u=c=f,l=h):c=c.next=f,s|=p;if(null===(a=a.next)){if(null===(a=i.shared.pending))break;a=(p=a).next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}if(null===c&&(l=h),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,null!==(e=i.shared.interleaved)){i=e;do{s|=i.lane,i=i.next}while(i!==e)}else null===o&&(i.shared.lanes=0);Ol|=s,t.lanes=s,t.memoizedState=h}}function Fo(t,e,n){if(t=e.effects,e.effects=null,null!==t)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(null!==i){if(r.callback=null,r=n,"function"!=typeof i)throw Error(o(191,i));i.call(r)}}}var Bo=(new r.Component).refs;function Uo(t,e,n,r){n=null==(n=n(r,e=t.memoizedState))?e:z({},e,n),t.memoizedState=n,0===t.lanes&&(t.updateQueue.baseState=n)}var Vo={isMounted:function(t){return!!(t=t._reactInternals)&&jt(t)===t},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=tu(),i=eu(t),o=No(r,i);o.payload=e,null!=n&&(o.callback=n),null!==(e=Do(t,o,i))&&(nu(e,t,i,r),Ro(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=tu(),i=eu(t),o=No(r,i);o.tag=1,o.payload=e,null!=n&&(o.callback=n),null!==(e=Do(t,o,i))&&(nu(e,t,i,r),Ro(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=tu(),r=eu(t),i=No(n,r);i.tag=2,null!=e&&(i.callback=e),null!==(e=Do(t,i,r))&&(nu(e,t,r,n),Ro(e,t,r))}};function jo(t,e,n,r,i,o,s){return"function"==typeof(t=t.stateNode).shouldComponentUpdate?t.shouldComponentUpdate(r,o,s):!(e.prototype&&e.prototype.isPureReactComponent&&ar(n,r)&&ar(i,o))}function Go(t,e,n){var r=!1,i=Ci,o=e.contextType;return"object"==typeof o&&null!==o?o=Io(o):(i=Ai(e)?Mi:Ti.current,o=(r=null!=(r=e.contextTypes))?Li(t,i):Ci),e=new e(n,o),t.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,e.updater=Vo,t.stateNode=e,e._reactInternals=t,r&&((t=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=o),e}function qo(t,e,n,r){t=e.state,"function"==typeof e.componentWillReceiveProps&&e.componentWillReceiveProps(n,r),"function"==typeof e.UNSAFE_componentWillReceiveProps&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&Vo.enqueueReplaceState(e,e.state,null)}function $o(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs=Bo,Ao(t);var o=e.contextType;"object"==typeof o&&null!==o?i.context=Io(o):(o=Ai(e)?Mi:Ti.current,i.context=Li(t,o)),i.state=t.memoizedState,"function"==typeof(o=e.getDerivedStateFromProps)&&(Uo(t,e,o,n),i.state=t.memoizedState),"function"==typeof e.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(e=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),e!==i.state&&Vo.enqueueReplaceState(i,i.state,null),zo(t,n,i,r),i.state=t.memoizedState),"function"==typeof i.componentDidMount&&(t.flags|=4194308)}function Xo(t,e,n){if(null!==(t=n.ref)&&"function"!=typeof t&&"object"!=typeof t){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(o(309));var r=n.stateNode}if(!r)throw Error(o(147,t));var i=r,s=""+t;return null!==e&&null!==e.ref&&"function"==typeof e.ref&&e.ref._stringRef===s?e.ref:(e=function(t){var e=i.refs;e===Bo&&(e=i.refs={}),null===t?delete e[s]:e[s]=t},e._stringRef=s,e)}if("string"!=typeof t)throw Error(o(284));if(!n._owner)throw Error(o(290,t))}return t}function Zo(t,e){throw t=Object.prototype.toString.call(e),Error(o(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Yo(t){return(0,t._init)(t._payload)}function Wo(t){function e(e,n){if(t){var r=e.deletions;null===r?(e.deletions=[n],e.flags|=16):r.push(n)}}function n(n,r){if(!t)return null;for(;null!==r;)e(n,r),r=r.sibling;return null}function r(t,e){for(t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function i(t,e){return(t=Nu(t,e)).index=0,t.sibling=null,t}function s(e,n,r){return e.index=r,t?null!==(r=e.alternate)?(r=r.index)<n?(e.flags|=2,n):r:(e.flags|=2,n):(e.flags|=1048576,n)}function a(e){return t&&null===e.alternate&&(e.flags|=2),e}function l(t,e,n,r){return null===e||6!==e.tag?((e=zu(n,t.mode,r)).return=t,e):((e=i(e,n)).return=t,e)}function u(t,e,n,r){var o=n.type;return o===E?h(t,e,n.props.children,r,n.key):null!==e&&(e.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===k&&Yo(o)===e.type)?((r=i(e,n.props)).ref=Xo(t,e,n),r.return=t,r):((r=Du(n.type,n.key,n.props,null,t.mode,r)).ref=Xo(t,e,n),r.return=t,r)}function c(t,e,n,r){return null===e||4!==e.tag||e.stateNode.containerInfo!==n.containerInfo||e.stateNode.implementation!==n.implementation?((e=Fu(n,t.mode,r)).return=t,e):((e=i(e,n.children||[])).return=t,e)}function h(t,e,n,r,o){return null===e||7!==e.tag?((e=Ru(n,t.mode,r,o)).return=t,e):((e=i(e,n)).return=t,e)}function p(t,e,n){if("string"==typeof e&&""!==e||"number"==typeof e)return(e=zu(""+e,t.mode,n)).return=t,e;if("object"==typeof e&&null!==e){switch(e.$$typeof){case b:return(n=Du(e.type,e.key,e.props,null,t.mode,n)).ref=Xo(t,null,e),n.return=t,n;case w:return(e=Fu(e,t.mode,n)).return=t,e;case k:return p(t,(0,e._init)(e._payload),n)}if(et(e)||R(e))return(e=Ru(e,t.mode,n,null)).return=t,e;Zo(t,e)}return null}function f(t,e,n,r){var i=null!==e?e.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==i?null:l(t,e,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case b:return n.key===i?u(t,e,n,r):null;case w:return n.key===i?c(t,e,n,r):null;case k:return f(t,e,(i=n._init)(n._payload),r)}if(et(n)||R(n))return null!==i?null:h(t,e,n,r,null);Zo(t,n)}return null}function d(t,e,n,r,i){if("string"==typeof r&&""!==r||"number"==typeof r)return l(e,t=t.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case b:return u(e,t=t.get(null===r.key?n:r.key)||null,r,i);case w:return c(e,t=t.get(null===r.key?n:r.key)||null,r,i);case k:return d(t,e,n,(0,r._init)(r._payload),i)}if(et(r)||R(r))return h(e,t=t.get(n)||null,r,i,null);Zo(e,r)}return null}function g(i,o,a,l){for(var u=null,c=null,h=o,g=o=0,m=null;null!==h&&g<a.length;g++){h.index>g?(m=h,h=null):m=h.sibling;var y=f(i,h,a[g],l);if(null===y){null===h&&(h=m);break}t&&h&&null===y.alternate&&e(i,h),o=s(y,o,g),null===c?u=y:c.sibling=y,c=y,h=m}if(g===a.length)return n(i,h),ro&&Ki(i,g),u;if(null===h){for(;g<a.length;g++)null!==(h=p(i,a[g],l))&&(o=s(h,o,g),null===c?u=h:c.sibling=h,c=h);return ro&&Ki(i,g),u}for(h=r(i,h);g<a.length;g++)null!==(m=d(h,i,g,a[g],l))&&(t&&null!==m.alternate&&h.delete(null===m.key?g:m.key),o=s(m,o,g),null===c?u=m:c.sibling=m,c=m);return t&&h.forEach((function(t){return e(i,t)})),ro&&Ki(i,g),u}function m(i,a,l,u){var c=R(l);if("function"!=typeof c)throw Error(o(150));if(null==(l=c.call(l)))throw Error(o(151));for(var h=c=null,g=a,m=a=0,y=null,_=l.next();null!==g&&!_.done;m++,_=l.next()){g.index>m?(y=g,g=null):y=g.sibling;var v=f(i,g,_.value,u);if(null===v){null===g&&(g=y);break}t&&g&&null===v.alternate&&e(i,g),a=s(v,a,m),null===h?c=v:h.sibling=v,h=v,g=y}if(_.done)return n(i,g),ro&&Ki(i,m),c;if(null===g){for(;!_.done;m++,_=l.next())null!==(_=p(i,_.value,u))&&(a=s(_,a,m),null===h?c=_:h.sibling=_,h=_);return ro&&Ki(i,m),c}for(g=r(i,g);!_.done;m++,_=l.next())null!==(_=d(g,i,m,_.value,u))&&(t&&null!==_.alternate&&g.delete(null===_.key?m:_.key),a=s(_,a,m),null===h?c=_:h.sibling=_,h=_);return t&&g.forEach((function(t){return e(i,t)})),ro&&Ki(i,m),c}return function t(r,o,s,l){if("object"==typeof s&&null!==s&&s.type===E&&null===s.key&&(s=s.props.children),"object"==typeof s&&null!==s){switch(s.$$typeof){case b:t:{for(var u=s.key,c=o;null!==c;){if(c.key===u){if((u=s.type)===E){if(7===c.tag){n(r,c.sibling),(o=i(c,s.props.children)).return=r,r=o;break t}}else if(c.elementType===u||"object"==typeof u&&null!==u&&u.$$typeof===k&&Yo(u)===c.type){n(r,c.sibling),(o=i(c,s.props)).ref=Xo(r,c,s),o.return=r,r=o;break t}n(r,c);break}e(r,c),c=c.sibling}s.type===E?((o=Ru(s.props.children,r.mode,l,s.key)).return=r,r=o):((l=Du(s.type,s.key,s.props,null,r.mode,l)).ref=Xo(r,o,s),l.return=r,r=l)}return a(r);case w:t:{for(c=s.key;null!==o;){if(o.key===c){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){n(r,o.sibling),(o=i(o,s.children||[])).return=r,r=o;break t}n(r,o);break}e(r,o),o=o.sibling}(o=Fu(s,r.mode,l)).return=r,r=o}return a(r);case k:return t(r,o,(c=s._init)(s._payload),l)}if(et(s))return g(r,o,s,l);if(R(s))return m(r,o,s,l);Zo(r,s)}return"string"==typeof s&&""!==s||"number"==typeof s?(s=""+s,null!==o&&6===o.tag?(n(r,o.sibling),(o=i(o,s)).return=r,r=o):(n(r,o),(o=zu(s,r.mode,l)).return=r,r=o),a(r)):n(r,o)}}var Ho=Wo(!0),Ko=Wo(!1),Jo={},Qo=Ei(Jo),ts=Ei(Jo),es=Ei(Jo);function ns(t){if(t===Jo)throw Error(o(174));return t}function rs(t,e){switch(Ii(es,e),Ii(ts,t),Ii(Qo,Jo),t=e.nodeType){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:lt(null,"");break;default:e=lt(e=(t=8===t?e.parentNode:e).namespaceURI||null,t=t.tagName)}Si(Qo),Ii(Qo,e)}function is(){Si(Qo),Si(ts),Si(es)}function os(t){ns(es.current);var e=ns(Qo.current),n=lt(e,t.type);e!==n&&(Ii(ts,t),Ii(Qo,n))}function ss(t){ts.current===t&&(Si(Qo),Si(ts))}var as=Ei(0);function ls(t){for(var e=t;null!==e;){if(13===e.tag){var n=e.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return e}else if(19===e.tag&&void 0!==e.memoizedProps.revealOrder){if(0!=(128&e.flags))return e}else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var us=[];function cs(){for(var t=0;t<us.length;t++)us[t]._workInProgressVersionPrimary=null;us.length=0}var hs=x.ReactCurrentDispatcher,ps=x.ReactCurrentBatchConfig,fs=0,ds=null,gs=null,ms=null,ys=!1,_s=!1,vs=0,xs=0;function bs(){throw Error(o(321))}function ws(t,e){if(null===e)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!sr(t[n],e[n]))return!1;return!0}function Es(t,e,n,r,i,s){if(fs=s,ds=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,hs.current=null===t||null===t.memoizedState?sa:aa,t=n(r,i),_s){s=0;do{if(_s=!1,vs=0,25<=s)throw Error(o(301));s+=1,ms=gs=null,e.updateQueue=null,hs.current=la,t=n(r,i)}while(_s)}if(hs.current=oa,e=null!==gs&&null!==gs.next,fs=0,ms=gs=ds=null,ys=!1,e)throw Error(o(300));return t}function Ss(){var t=0!==vs;return vs=0,t}function Is(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ms?ds.memoizedState=ms=t:ms=ms.next=t,ms}function Cs(){if(null===gs){var t=ds.alternate;t=null!==t?t.memoizedState:null}else t=gs.next;var e=null===ms?ds.memoizedState:ms.next;if(null!==e)ms=e,gs=t;else{if(null===t)throw Error(o(310));t={memoizedState:(gs=t).memoizedState,baseState:gs.baseState,baseQueue:gs.baseQueue,queue:gs.queue,next:null},null===ms?ds.memoizedState=ms=t:ms=ms.next=t}return ms}function Ts(t,e){return"function"==typeof e?e(t):e}function Ps(t){var e=Cs(),n=e.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=t;var r=gs,i=r.baseQueue,s=n.pending;if(null!==s){if(null!==i){var a=i.next;i.next=s.next,s.next=a}r.baseQueue=i=s,n.pending=null}if(null!==i){s=i.next,r=r.baseState;var l=a=null,u=null,c=s;do{var h=c.lane;if((fs&h)===h)null!==u&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var p={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===u?(l=u=p,a=r):u=u.next=p,ds.lanes|=h,Ol|=h}c=c.next}while(null!==c&&c!==s);null===u?a=r:u.next=l,sr(r,e.memoizedState)||(va=!0),e.memoizedState=r,e.baseState=a,e.baseQueue=u,n.lastRenderedState=r}if(null!==(t=n.interleaved)){i=t;do{s=i.lane,ds.lanes|=s,Ol|=s,i=i.next}while(i!==t)}else null===i&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Ms(t){var e=Cs(),n=e.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{s=t(s,a.action),a=a.next}while(a!==i);sr(s,e.memoizedState)||(va=!0),e.memoizedState=s,null===e.baseQueue&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function Ls(){}function As(t,e){var n=ds,r=Cs(),i=e(),s=!sr(r.memoizedState,i);if(s&&(r.memoizedState=i,va=!0),r=r.queue,Gs(Ds.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||null!==ms&&1&ms.memoizedState.tag){if(n.flags|=2048,Fs(9,Ns.bind(null,n,r,i,e),void 0,null),null===Ml)throw Error(o(349));0!=(30&fs)||ks(n,e,i)}return i}function ks(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},null===(e=ds.updateQueue)?(e={lastEffect:null,stores:null},ds.updateQueue=e,e.stores=[t]):null===(n=e.stores)?e.stores=[t]:n.push(t)}function Ns(t,e,n,r){e.value=n,e.getSnapshot=r,Rs(e)&&Os(t)}function Ds(t,e,n){return n((function(){Rs(e)&&Os(t)}))}function Rs(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!sr(t,n)}catch(t){return!0}}function Os(t){var e=Mo(t,1);null!==e&&nu(e,t,1,-1)}function zs(t){var e=Is();return"function"==typeof t&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ts,lastRenderedState:t},e.queue=t,t=t.dispatch=ea.bind(null,ds,t),[e.memoizedState,t]}function Fs(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},null===(e=ds.updateQueue)?(e={lastEffect:null,stores:null},ds.updateQueue=e,e.lastEffect=t.next=t):null===(n=e.lastEffect)?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t),t}function Bs(){return Cs().memoizedState}function Us(t,e,n,r){var i=Is();ds.flags|=t,i.memoizedState=Fs(1|e,n,void 0,void 0===r?null:r)}function Vs(t,e,n,r){var i=Cs();r=void 0===r?null:r;var o=void 0;if(null!==gs){var s=gs.memoizedState;if(o=s.destroy,null!==r&&ws(r,s.deps))return void(i.memoizedState=Fs(e,n,o,r))}ds.flags|=t,i.memoizedState=Fs(1|e,n,o,r)}function js(t,e){return Us(8390656,8,t,e)}function Gs(t,e){return Vs(2048,8,t,e)}function qs(t,e){return Vs(4,2,t,e)}function $s(t,e){return Vs(4,4,t,e)}function Xs(t,e){return"function"==typeof e?(t=t(),e(t),function(){e(null)}):null!=e?(t=t(),e.current=t,function(){e.current=null}):void 0}function Zs(t,e,n){return n=null!=n?n.concat([t]):null,Vs(4,4,Xs.bind(null,e,t),n)}function Ys(){}function Ws(t,e){var n=Cs();e=void 0===e?null:e;var r=n.memoizedState;return null!==r&&null!==e&&ws(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function Hs(t,e){var n=Cs();e=void 0===e?null:e;var r=n.memoizedState;return null!==r&&null!==e&&ws(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function Ks(t,e,n){return 0==(21&fs)?(t.baseState&&(t.baseState=!1,va=!0),t.memoizedState=n):(sr(n,e)||(n=ge(),ds.lanes|=n,Ol|=n,t.baseState=!0),e)}function Js(t,e){var n=_e;_e=0!==n&&4>n?n:4,t(!0);var r=ps.transition;ps.transition={};try{t(!1),e()}finally{_e=n,ps.transition=r}}function Qs(){return Cs().memoizedState}function ta(t,e,n){var r=eu(t);n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},na(t)?ra(e,n):null!==(n=Po(t,e,n,r))&&(nu(n,t,r,tu()),ia(n,e,r))}function ea(t,e,n){var r=eu(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(na(t))ra(e,i);else{var o=t.alternate;if(0===t.lanes&&(null===o||0===o.lanes)&&null!==(o=e.lastRenderedReducer))try{var s=e.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,sr(a,s)){var l=e.interleaved;return null===l?(i.next=i,To(e)):(i.next=l.next,l.next=i),void(e.interleaved=i)}}catch(t){}null!==(n=Po(t,e,i,r))&&(nu(n,t,r,i=tu()),ia(n,e,r))}}function na(t){var e=t.alternate;return t===ds||null!==e&&e===ds}function ra(t,e){_s=ys=!0;var n=t.pending;null===n?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function ia(t,e,n){if(0!=(4194240&n)){var r=e.lanes;n|=r&=t.pendingLanes,e.lanes=n,ye(t,n)}}var oa={readContext:Io,useCallback:bs,useContext:bs,useEffect:bs,useImperativeHandle:bs,useInsertionEffect:bs,useLayoutEffect:bs,useMemo:bs,useReducer:bs,useRef:bs,useState:bs,useDebugValue:bs,useDeferredValue:bs,useTransition:bs,useMutableSource:bs,useSyncExternalStore:bs,useId:bs,unstable_isNewReconciler:!1},sa={readContext:Io,useCallback:function(t,e){return Is().memoizedState=[t,void 0===e?null:e],t},useContext:Io,useEffect:js,useImperativeHandle:function(t,e,n){return n=null!=n?n.concat([t]):null,Us(4194308,4,Xs.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Us(4194308,4,t,e)},useInsertionEffect:function(t,e){return Us(4,2,t,e)},useMemo:function(t,e){var n=Is();return e=void 0===e?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Is();return e=void 0!==n?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=ta.bind(null,ds,t),[r.memoizedState,t]},useRef:function(t){return t={current:t},Is().memoizedState=t},useState:zs,useDebugValue:Ys,useDeferredValue:function(t){return Is().memoizedState=t},useTransition:function(){var t=zs(!1),e=t[0];return t=Js.bind(null,t[1]),Is().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ds,i=Is();if(ro){if(void 0===n)throw Error(o(407));n=n()}else{if(n=e(),null===Ml)throw Error(o(349));0!=(30&fs)||ks(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,js(Ds.bind(null,r,s,t),[t]),r.flags|=2048,Fs(9,Ns.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=Is(),e=Ml.identifierPrefix;if(ro){var n=Hi;e=":"+e+"R"+(n=(Wi&~(1<<32-se(Wi)-1)).toString(32)+n),0<(n=vs++)&&(e+="H"+n.toString(32)),e+=":"}else e=":"+e+"r"+(n=xs++).toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},aa={readContext:Io,useCallback:Ws,useContext:Io,useEffect:Gs,useImperativeHandle:Zs,useInsertionEffect:qs,useLayoutEffect:$s,useMemo:Hs,useReducer:Ps,useRef:Bs,useState:function(){return Ps(Ts)},useDebugValue:Ys,useDeferredValue:function(t){return Ks(Cs(),gs.memoizedState,t)},useTransition:function(){return[Ps(Ts)[0],Cs().memoizedState]},useMutableSource:Ls,useSyncExternalStore:As,useId:Qs,unstable_isNewReconciler:!1},la={readContext:Io,useCallback:Ws,useContext:Io,useEffect:Gs,useImperativeHandle:Zs,useInsertionEffect:qs,useLayoutEffect:$s,useMemo:Hs,useReducer:Ms,useRef:Bs,useState:function(){return Ms(Ts)},useDebugValue:Ys,useDeferredValue:function(t){var e=Cs();return null===gs?e.memoizedState=t:Ks(e,gs.memoizedState,t)},useTransition:function(){return[Ms(Ts)[0],Cs().memoizedState]},useMutableSource:Ls,useSyncExternalStore:As,useId:Qs,unstable_isNewReconciler:!1};function ua(t,e){try{var n="",r=e;do{n+=V(r),r=r.return}while(r);var i=n}catch(t){i="\nError generating stack: "+t.message+"\n"+t.stack}return{value:t,source:e,stack:i,digest:null}}function ca(t,e,n){return{value:t,source:null,stack:null!=n?n:null,digest:null!=e?e:null}}function ha(t,e){try{console.error(e.value)}catch(t){setTimeout((function(){throw t}))}}var pa="function"==typeof WeakMap?WeakMap:Map;function fa(t,e,n){(n=No(-1,n)).tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){ql||(ql=!0,$l=r),ha(0,e)},n}function da(t,e,n){(n=No(-1,n)).tag=3;var r=t.type.getDerivedStateFromError;if("function"==typeof r){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){ha(0,e)}}var o=t.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){ha(0,e),"function"!=typeof r&&(null===Xl?Xl=new Set([this]):Xl.add(this));var t=e.stack;this.componentDidCatch(e.value,{componentStack:null!==t?t:""})}),n}function ga(t,e,n){var r=t.pingCache;if(null===r){r=t.pingCache=new pa;var i=new Set;r.set(e,i)}else void 0===(i=r.get(e))&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=Iu.bind(null,t,e,n),e.then(t,t))}function ma(t){do{var e;if((e=13===t.tag)&&(e=null===(e=t.memoizedState)||null!==e.dehydrated),e)return t;t=t.return}while(null!==t);return null}function ya(t,e,n,r,i){return 0==(1&t.mode)?(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((e=No(-1,1)).tag=2,Do(n,e,1))),n.lanes|=1),t):(t.flags|=65536,t.lanes=i,t)}var _a=x.ReactCurrentOwner,va=!1;function xa(t,e,n,r){e.child=null===t?Ko(e,null,n,r):Ho(e,t.child,n,r)}function ba(t,e,n,r,i){n=n.render;var o=e.ref;return So(e,i),r=Es(t,e,n,r,o,i),n=Ss(),null===t||va?(ro&&n&&Qi(e),e.flags|=1,xa(t,e,r,i),e.child):(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,qa(t,e,i))}function wa(t,e,n,r,i){if(null===t){var o=n.type;return"function"!=typeof o||ku(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((t=Du(n.type,null,r,e,e.mode,i)).ref=e.ref,t.return=e,e.child=t):(e.tag=15,e.type=o,Ea(t,e,o,r,i))}if(o=t.child,0==(t.lanes&i)){var s=o.memoizedProps;if((n=null!==(n=n.compare)?n:ar)(s,r)&&t.ref===e.ref)return qa(t,e,i)}return e.flags|=1,(t=Nu(o,r)).ref=e.ref,t.return=e,e.child=t}function Ea(t,e,n,r,i){if(null!==t){var o=t.memoizedProps;if(ar(o,r)&&t.ref===e.ref){if(va=!1,e.pendingProps=r=o,0==(t.lanes&i))return e.lanes=t.lanes,qa(t,e,i);0!=(131072&t.flags)&&(va=!0)}}return Ca(t,e,n,r,i)}function Sa(t,e,n){var r=e.pendingProps,i=r.children,o=null!==t?t.memoizedState:null;if("hidden"===r.mode)if(0==(1&e.mode))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ii(Nl,kl),kl|=n;else{if(0==(1073741824&n))return t=null!==o?o.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Ii(Nl,kl),kl|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,Ii(Nl,kl),kl|=r}else null!==o?(r=o.baseLanes|n,e.memoizedState=null):r=n,Ii(Nl,kl),kl|=r;return xa(t,e,i,n),e.child}function Ia(t,e){var n=e.ref;(null===t&&null!==n||null!==t&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Ca(t,e,n,r,i){var o=Ai(n)?Mi:Ti.current;return o=Li(e,o),So(e,i),n=Es(t,e,n,r,o,i),r=Ss(),null===t||va?(ro&&r&&Qi(e),e.flags|=1,xa(t,e,n,i),e.child):(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,qa(t,e,i))}function Ta(t,e,n,r,i){if(Ai(n)){var o=!0;Ri(e)}else o=!1;if(So(e,i),null===e.stateNode)Ga(t,e),Go(e,n,r),$o(e,n,r,i),r=!0;else if(null===t){var s=e.stateNode,a=e.memoizedProps;s.props=a;var l=s.context,u=n.contextType;u="object"==typeof u&&null!==u?Io(u):Li(e,u=Ai(n)?Mi:Ti.current);var c=n.getDerivedStateFromProps,h="function"==typeof c||"function"==typeof s.getSnapshotBeforeUpdate;h||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(a!==r||l!==u)&&qo(e,s,r,u),Lo=!1;var p=e.memoizedState;s.state=p,zo(e,r,s,i),l=e.memoizedState,a!==r||p!==l||Pi.current||Lo?("function"==typeof c&&(Uo(e,n,c,r),l=e.memoizedState),(a=Lo||jo(e,n,a,r,p,l,u))?(h||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(e.flags|=4194308)):("function"==typeof s.componentDidMount&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),s.props=r,s.state=l,s.context=u,r=a):("function"==typeof s.componentDidMount&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,ko(t,e),a=e.memoizedProps,u=e.type===e.elementType?a:mo(e.type,a),s.props=u,h=e.pendingProps,p=s.context,l="object"==typeof(l=n.contextType)&&null!==l?Io(l):Li(e,l=Ai(n)?Mi:Ti.current);var f=n.getDerivedStateFromProps;(c="function"==typeof f||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(a!==h||p!==l)&&qo(e,s,r,l),Lo=!1,p=e.memoizedState,s.state=p,zo(e,r,s,i);var d=e.memoizedState;a!==h||p!==d||Pi.current||Lo?("function"==typeof f&&(Uo(e,n,f,r),d=e.memoizedState),(u=Lo||jo(e,n,u,r,p,d,l)||!1)?(c||"function"!=typeof s.UNSAFE_componentWillUpdate&&"function"!=typeof s.componentWillUpdate||("function"==typeof s.componentWillUpdate&&s.componentWillUpdate(r,d,l),"function"==typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(r,d,l)),"function"==typeof s.componentDidUpdate&&(e.flags|=4),"function"==typeof s.getSnapshotBeforeUpdate&&(e.flags|=1024)):("function"!=typeof s.componentDidUpdate||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=d),s.props=r,s.state=d,s.context=l,r=u):("function"!=typeof s.componentDidUpdate||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),r=!1)}return Pa(t,e,n,r,o,i)}function Pa(t,e,n,r,i,o){Ia(t,e);var s=0!=(128&e.flags);if(!r&&!s)return i&&Oi(e,n,!1),qa(t,e,o);r=e.stateNode,_a.current=e;var a=s&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return e.flags|=1,null!==t&&s?(e.child=Ho(e,t.child,null,o),e.child=Ho(e,null,a,o)):xa(t,e,a,o),e.memoizedState=r.state,i&&Oi(e,n,!0),e.child}function Ma(t){var e=t.stateNode;e.pendingContext?Ni(0,e.pendingContext,e.pendingContext!==e.context):e.context&&Ni(0,e.context,!1),rs(t,e.containerInfo)}function La(t,e,n,r,i){return po(),fo(i),e.flags|=256,xa(t,e,n,r),e.child}var Aa,ka,Na,Da,Ra={dehydrated:null,treeContext:null,retryLane:0};function Oa(t){return{baseLanes:t,cachePool:null,transitions:null}}function za(t,e,n){var r,i=e.pendingProps,s=as.current,a=!1,l=0!=(128&e.flags);if((r=l)||(r=(null===t||null!==t.memoizedState)&&0!=(2&s)),r?(a=!0,e.flags&=-129):null!==t&&null===t.memoizedState||(s|=1),Ii(as,1&s),null===t)return lo(e),null!==(t=e.memoizedState)&&null!==(t=t.dehydrated)?(0==(1&e.mode)?e.lanes=1:"$!"===t.data?e.lanes=8:e.lanes=1073741824,null):(l=i.children,t=i.fallback,a?(i=e.mode,a=e.child,l={mode:"hidden",children:l},0==(1&i)&&null!==a?(a.childLanes=0,a.pendingProps=l):a=Ou(l,i,0,null),t=Ru(t,i,n,null),a.return=e,t.return=e,a.sibling=t,e.child=a,e.child.memoizedState=Oa(n),e.memoizedState=Ra,t):Fa(e,l));if(null!==(s=t.memoizedState)&&null!==(r=s.dehydrated))return function(t,e,n,r,i,s,a){if(n)return 256&e.flags?(e.flags&=-257,Ba(t,e,a,r=ca(Error(o(422))))):null!==e.memoizedState?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=Ou({mode:"visible",children:r.children},i,0,null),(s=Ru(s,i,a,null)).flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,0!=(1&e.mode)&&Ho(e,t.child,null,a),e.child.memoizedState=Oa(a),e.memoizedState=Ra,s);if(0==(1&e.mode))return Ba(t,e,a,null);if("$!"===i.data){if(r=i.nextSibling&&i.nextSibling.dataset)var l=r.dgst;return r=l,Ba(t,e,a,r=ca(s=Error(o(419)),r,void 0))}if(l=0!=(a&t.childLanes),va||l){if(null!==(r=Ml)){switch(a&-a){case 4:i=2;break;case 16:i=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}0!==(i=0!=(i&(r.suspendedLanes|a))?0:i)&&i!==s.retryLane&&(s.retryLane=i,Mo(t,i),nu(r,t,i,-1))}return gu(),Ba(t,e,a,r=ca(Error(o(421))))}return"$?"===i.data?(e.flags|=128,e.child=t.child,e=Tu.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,no=li(i.nextSibling),eo=e,ro=!0,io=null,null!==t&&(Xi[Zi++]=Wi,Xi[Zi++]=Hi,Xi[Zi++]=Yi,Wi=t.id,Hi=t.overflow,Yi=e),(e=Fa(e,r.children)).flags|=4096,e)}(t,e,l,i,r,s,n);if(a){a=i.fallback,l=e.mode,r=(s=t.child).sibling;var u={mode:"hidden",children:i.children};return 0==(1&l)&&e.child!==s?((i=e.child).childLanes=0,i.pendingProps=u,e.deletions=null):(i=Nu(s,u)).subtreeFlags=14680064&s.subtreeFlags,null!==r?a=Nu(r,a):(a=Ru(a,l,n,null)).flags|=2,a.return=e,i.return=e,i.sibling=a,e.child=i,i=a,a=e.child,l=null===(l=t.child.memoizedState)?Oa(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},a.memoizedState=l,a.childLanes=t.childLanes&~n,e.memoizedState=Ra,i}return t=(a=t.child).sibling,i=Nu(a,{mode:"visible",children:i.children}),0==(1&e.mode)&&(i.lanes=n),i.return=e,i.sibling=null,null!==t&&(null===(n=e.deletions)?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=i,e.memoizedState=null,i}function Fa(t,e){return(e=Ou({mode:"visible",children:e},t.mode,0,null)).return=t,t.child=e}function Ba(t,e,n,r){return null!==r&&fo(r),Ho(e,t.child,null,n),(t=Fa(e,e.pendingProps.children)).flags|=2,e.memoizedState=null,t}function Ua(t,e,n){t.lanes|=e;var r=t.alternate;null!==r&&(r.lanes|=e),Eo(t.return,e,n)}function Va(t,e,n,r,i){var o=t.memoizedState;null===o?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function ja(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(xa(t,e,r.children,n),0!=(2&(r=as.current)))r=1&r|2,e.flags|=128;else{if(null!==t&&0!=(128&t.flags))t:for(t=e.child;null!==t;){if(13===t.tag)null!==t.memoizedState&&Ua(t,n,e);else if(19===t.tag)Ua(t,n,e);else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break t;for(;null===t.sibling;){if(null===t.return||t.return===e)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Ii(as,r),0==(1&e.mode))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;null!==n;)null!==(t=n.alternate)&&null===ls(t)&&(i=n),n=n.sibling;null===(n=i)?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),Va(e,!1,i,n,o);break;case"backwards":for(n=null,i=e.child,e.child=null;null!==i;){if(null!==(t=i.alternate)&&null===ls(t)){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}Va(e,!0,n,null,o);break;case"together":Va(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ga(t,e){0==(1&e.mode)&&null!==t&&(t.alternate=null,e.alternate=null,e.flags|=2)}function qa(t,e,n){if(null!==t&&(e.dependencies=t.dependencies),Ol|=e.lanes,0==(n&e.childLanes))return null;if(null!==t&&e.child!==t.child)throw Error(o(153));if(null!==e.child){for(n=Nu(t=e.child,t.pendingProps),e.child=n,n.return=e;null!==t.sibling;)t=t.sibling,(n=n.sibling=Nu(t,t.pendingProps)).return=e;n.sibling=null}return e.child}function $a(t,e){if(!ro)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;null!==e;)null!==e.alternate&&(n=e),e=e.sibling;null===n?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?e||null===t.tail?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Xa(t){var e=null!==t.alternate&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=t,i=i.sibling;else for(i=t.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function Za(t,e,n){var r=e.pendingProps;switch(to(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xa(e),null;case 1:case 17:return Ai(e.type)&&ki(),Xa(e),null;case 3:return r=e.stateNode,is(),Si(Pi),Si(Ti),cs(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==t&&null!==t.child||(co(e)?e.flags|=4:null===t||t.memoizedState.isDehydrated&&0==(256&e.flags)||(e.flags|=1024,null!==io&&(su(io),io=null))),ka(t,e),Xa(e),null;case 5:ss(e);var i=ns(es.current);if(n=e.type,null!==t&&null!=e.stateNode)Na(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(null===e.stateNode)throw Error(o(166));return Xa(e),null}if(t=ns(Qo.current),co(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[hi]=e,r[pi]=s,t=0!=(1&e.mode),n){case"dialog":Fr("cancel",r),Fr("close",r);break;case"iframe":case"object":case"embed":Fr("load",r);break;case"video":case"audio":for(i=0;i<Dr.length;i++)Fr(Dr[i],r);break;case"source":Fr("error",r);break;case"img":case"image":case"link":Fr("error",r),Fr("load",r);break;case"details":Fr("toggle",r);break;case"input":H(r,s),Fr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Fr("invalid",r);break;case"textarea":it(r,s),Fr("invalid",r)}for(var l in _t(n,s),i=null,s)if(s.hasOwnProperty(l)){var u=s[l];"children"===l?"string"==typeof u?r.textContent!==u&&(!0!==s.suppressHydrationWarning&&Kr(r.textContent,u,t),i=["children",u]):"number"==typeof u&&r.textContent!==""+u&&(!0!==s.suppressHydrationWarning&&Kr(r.textContent,u,t),i=["children",""+u]):a.hasOwnProperty(l)&&null!=u&&"onScroll"===l&&Fr("scroll",r)}switch(n){case"input":X(r),Q(r,s,!0);break;case"textarea":X(r),st(r);break;case"select":case"option":break;default:"function"==typeof s.onClick&&(r.onclick=Jr)}r=i,e.updateQueue=r,null!==r&&(e.flags|=4)}else{l=9===i.nodeType?i:i.ownerDocument,"http://www.w3.org/1999/xhtml"===t&&(t=at(n)),"http://www.w3.org/1999/xhtml"===t?"script"===n?((t=l.createElement("div")).innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):"string"==typeof r.is?t=l.createElement(n,{is:r.is}):(t=l.createElement(n),"select"===n&&(l=t,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):t=l.createElementNS(t,n),t[hi]=e,t[pi]=r,Aa(t,e,!1,!1),e.stateNode=t;t:{switch(l=vt(n,r),n){case"dialog":Fr("cancel",t),Fr("close",t),i=r;break;case"iframe":case"object":case"embed":Fr("load",t),i=r;break;case"video":case"audio":for(i=0;i<Dr.length;i++)Fr(Dr[i],t);i=r;break;case"source":Fr("error",t),i=r;break;case"img":case"image":case"link":Fr("error",t),Fr("load",t),i=r;break;case"details":Fr("toggle",t),i=r;break;case"input":H(t,r),i=W(t,r),Fr("invalid",t);break;case"option":default:i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=z({},r,{value:void 0}),Fr("invalid",t);break;case"textarea":it(t,r),i=rt(t,r),Fr("invalid",t)}for(s in _t(n,i),u=i)if(u.hasOwnProperty(s)){var c=u[s];"style"===s?mt(t,c):"dangerouslySetInnerHTML"===s?null!=(c=c?c.__html:void 0)&&ht(t,c):"children"===s?"string"==typeof c?("textarea"!==n||""!==c)&&pt(t,c):"number"==typeof c&&pt(t,""+c):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(a.hasOwnProperty(s)?null!=c&&"onScroll"===s&&Fr("scroll",t):null!=c&&v(t,s,c,l))}switch(n){case"input":X(t),Q(t,r,!1);break;case"textarea":X(t),st(t);break;case"option":null!=r.value&&t.setAttribute("value",""+q(r.value));break;case"select":t.multiple=!!r.multiple,null!=(s=r.value)?nt(t,!!r.multiple,s,!1):null!=r.defaultValue&&nt(t,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof i.onClick&&(t.onclick=Jr)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break t;case"img":r=!0;break t;default:r=!1}}r&&(e.flags|=4)}null!==e.ref&&(e.flags|=512,e.flags|=2097152)}return Xa(e),null;case 6:if(t&&null!=e.stateNode)Da(t,e,t.memoizedProps,r);else{if("string"!=typeof r&&null===e.stateNode)throw Error(o(166));if(n=ns(es.current),ns(Qo.current),co(e)){if(r=e.stateNode,n=e.memoizedProps,r[hi]=e,(s=r.nodeValue!==n)&&null!==(t=eo))switch(t.tag){case 3:Kr(r.nodeValue,n,0!=(1&t.mode));break;case 5:!0!==t.memoizedProps.suppressHydrationWarning&&Kr(r.nodeValue,n,0!=(1&t.mode))}s&&(e.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[hi]=e,e.stateNode=r}return Xa(e),null;case 13:if(Si(as),r=e.memoizedState,null===t||null!==t.memoizedState&&null!==t.memoizedState.dehydrated){if(ro&&null!==no&&0!=(1&e.mode)&&0==(128&e.flags))ho(),po(),e.flags|=98560,s=!1;else if(s=co(e),null!==r&&null!==r.dehydrated){if(null===t){if(!s)throw Error(o(318));if(!(s=null!==(s=e.memoizedState)?s.dehydrated:null))throw Error(o(317));s[hi]=e}else po(),0==(128&e.flags)&&(e.memoizedState=null),e.flags|=4;Xa(e),s=!1}else null!==io&&(su(io),io=null),s=!0;if(!s)return 65536&e.flags?e:null}return 0!=(128&e.flags)?(e.lanes=n,e):((r=null!==r)!=(null!==t&&null!==t.memoizedState)&&r&&(e.child.flags|=8192,0!=(1&e.mode)&&(null===t||0!=(1&as.current)?0===Dl&&(Dl=3):gu())),null!==e.updateQueue&&(e.flags|=4),Xa(e),null);case 4:return is(),ka(t,e),null===t&&Vr(e.stateNode.containerInfo),Xa(e),null;case 10:return wo(e.type._context),Xa(e),null;case 19:if(Si(as),null===(s=e.memoizedState))return Xa(e),null;if(r=0!=(128&e.flags),null===(l=s.rendering))if(r)$a(s,!1);else{if(0!==Dl||null!==t&&0!=(128&t.flags))for(t=e.child;null!==t;){if(null!==(l=ls(t))){for(e.flags|=128,$a(s,!1),null!==(r=l.updateQueue)&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;null!==n;)t=r,(s=n).flags&=14680066,null===(l=s.alternate)?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,t=l.dependencies,s.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Ii(as,1&as.current|2),e.child}t=t.sibling}null!==s.tail&&Kt()>jl&&(e.flags|=128,r=!0,$a(s,!1),e.lanes=4194304)}else{if(!r)if(null!==(t=ls(l))){if(e.flags|=128,r=!0,null!==(n=t.updateQueue)&&(e.updateQueue=n,e.flags|=4),$a(s,!0),null===s.tail&&"hidden"===s.tailMode&&!l.alternate&&!ro)return Xa(e),null}else 2*Kt()-s.renderingStartTime>jl&&1073741824!==n&&(e.flags|=128,r=!0,$a(s,!1),e.lanes=4194304);s.isBackwards?(l.sibling=e.child,e.child=l):(null!==(n=s.last)?n.sibling=l:e.child=l,s.last=l)}return null!==s.tail?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Kt(),e.sibling=null,n=as.current,Ii(as,r?1&n|2:1&n),e):(Xa(e),null);case 22:case 23:return hu(),r=null!==e.memoizedState,null!==t&&null!==t.memoizedState!==r&&(e.flags|=8192),r&&0!=(1&e.mode)?0!=(1073741824&kl)&&(Xa(e),6&e.subtreeFlags&&(e.flags|=8192)):Xa(e),null;case 24:case 25:return null}throw Error(o(156,e.tag))}function Ya(t,e){switch(to(e),e.tag){case 1:return Ai(e.type)&&ki(),65536&(t=e.flags)?(e.flags=-65537&t|128,e):null;case 3:return is(),Si(Pi),Si(Ti),cs(),0!=(65536&(t=e.flags))&&0==(128&t)?(e.flags=-65537&t|128,e):null;case 5:return ss(e),null;case 13:if(Si(as),null!==(t=e.memoizedState)&&null!==t.dehydrated){if(null===e.alternate)throw Error(o(340));po()}return 65536&(t=e.flags)?(e.flags=-65537&t|128,e):null;case 19:return Si(as),null;case 4:return is(),null;case 10:return wo(e.type._context),null;case 22:case 23:return hu(),null;default:return null}}Aa=function(t,e){for(var n=e.child;null!==n;){if(5===n.tag||6===n.tag)t.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ka=function(){},Na=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,ns(Qo.current);var o,s=null;switch(n){case"input":i=W(t,i),r=W(t,r),s=[];break;case"select":i=z({},i,{value:void 0}),r=z({},r,{value:void 0}),s=[];break;case"textarea":i=rt(t,i),r=rt(t,r),s=[];break;default:"function"!=typeof i.onClick&&"function"==typeof r.onClick&&(t.onclick=Jr)}for(c in _t(n,r),n=null,i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&null!=i[c])if("style"===c){var l=i[c];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(a.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var u=r[c];if(l=null!=i?i[c]:void 0,r.hasOwnProperty(c)&&u!==l&&(null!=u||null!=l))if("style"===c)if(l){for(o in l)!l.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in u)u.hasOwnProperty(o)&&l[o]!==u[o]&&(n||(n={}),n[o]=u[o])}else n||(s||(s=[]),s.push(c,n)),n=u;else"dangerouslySetInnerHTML"===c?(u=u?u.__html:void 0,l=l?l.__html:void 0,null!=u&&l!==u&&(s=s||[]).push(c,u)):"children"===c?"string"!=typeof u&&"number"!=typeof u||(s=s||[]).push(c,""+u):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(a.hasOwnProperty(c)?(null!=u&&"onScroll"===c&&Fr("scroll",t),s||l===u||(s=[])):(s=s||[]).push(c,u))}n&&(s=s||[]).push("style",n);var c=s;(e.updateQueue=c)&&(e.flags|=4)}},Da=function(t,e,n,r){n!==r&&(e.flags|=4)};var Wa=!1,Ha=!1,Ka="function"==typeof WeakSet?WeakSet:Set,Ja=null;function Qa(t,e){var n=t.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){Su(t,e,n)}else n.current=null}function tl(t,e,n){try{n()}catch(n){Su(t,e,n)}}var el=!1;function nl(t,e,n){var r=e.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,void 0!==o&&tl(e,n,o)}i=i.next}while(i!==r)}}function rl(t,e){if(null!==(e=null!==(e=e.updateQueue)?e.lastEffect:null)){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function il(t){var e=t.ref;if(null!==e){var n=t.stateNode;t.tag,t=n,"function"==typeof e?e(t):e.current=t}}function ol(t){var e=t.alternate;null!==e&&(t.alternate=null,ol(e)),t.child=null,t.deletions=null,t.sibling=null,5===t.tag&&null!==(e=t.stateNode)&&(delete e[hi],delete e[pi],delete e[di],delete e[gi],delete e[mi]),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 sl(t){return 5===t.tag||3===t.tag||4===t.tag}function al(t){t:for(;;){for(;null===t.sibling;){if(null===t.return||sl(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;5!==t.tag&&6!==t.tag&&18!==t.tag;){if(2&t.flags)continue t;if(null===t.child||4===t.tag)continue t;t.child.return=t,t=t.child}if(!(2&t.flags))return t.stateNode}}function ll(t,e,n){var r=t.tag;if(5===r||6===r)t=t.stateNode,e?8===n.nodeType?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(8===n.nodeType?(e=n.parentNode).insertBefore(t,n):(e=n).appendChild(t),null!=(n=n._reactRootContainer)||null!==e.onclick||(e.onclick=Jr));else if(4!==r&&null!==(t=t.child))for(ll(t,e,n),t=t.sibling;null!==t;)ll(t,e,n),t=t.sibling}function ul(t,e,n){var r=t.tag;if(5===r||6===r)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(4!==r&&null!==(t=t.child))for(ul(t,e,n),t=t.sibling;null!==t;)ul(t,e,n),t=t.sibling}var cl=null,hl=!1;function pl(t,e,n){for(n=n.child;null!==n;)fl(t,e,n),n=n.sibling}function fl(t,e,n){if(oe&&"function"==typeof oe.onCommitFiberUnmount)try{oe.onCommitFiberUnmount(ie,n)}catch(t){}switch(n.tag){case 5:Ha||Qa(n,e);case 6:var r=cl,i=hl;cl=null,pl(t,e,n),hl=i,null!==(cl=r)&&(hl?(t=cl,n=n.stateNode,8===t.nodeType?t.parentNode.removeChild(n):t.removeChild(n)):cl.removeChild(n.stateNode));break;case 18:null!==cl&&(hl?(t=cl,n=n.stateNode,8===t.nodeType?ai(t.parentNode,n):1===t.nodeType&&ai(t,n),Ve(t)):ai(cl,n.stateNode));break;case 4:r=cl,i=hl,cl=n.stateNode.containerInfo,hl=!0,pl(t,e,n),cl=r,hl=i;break;case 0:case 11:case 14:case 15:if(!Ha&&null!==(r=n.updateQueue)&&null!==(r=r.lastEffect)){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,void 0!==s&&(0!=(2&o)||0!=(4&o))&&tl(n,e,s),i=i.next}while(i!==r)}pl(t,e,n);break;case 1:if(!Ha&&(Qa(n,e),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(t){Su(n,e,t)}pl(t,e,n);break;case 21:pl(t,e,n);break;case 22:1&n.mode?(Ha=(r=Ha)||null!==n.memoizedState,pl(t,e,n),Ha=r):pl(t,e,n);break;default:pl(t,e,n)}}function dl(t){var e=t.updateQueue;if(null!==e){t.updateQueue=null;var n=t.stateNode;null===n&&(n=t.stateNode=new Ka),e.forEach((function(e){var r=Pu.bind(null,t,e);n.has(e)||(n.add(e),e.then(r,r))}))}}function gl(t,e){var n=e.deletions;if(null!==n)for(var r=0;r<n.length;r++){var i=n[r];try{var s=t,a=e,l=a;t:for(;null!==l;){switch(l.tag){case 5:cl=l.stateNode,hl=!1;break t;case 3:case 4:cl=l.stateNode.containerInfo,hl=!0;break t}l=l.return}if(null===cl)throw Error(o(160));fl(s,a,i),cl=null,hl=!1;var u=i.alternate;null!==u&&(u.return=null),i.return=null}catch(t){Su(i,e,t)}}if(12854&e.subtreeFlags)for(e=e.child;null!==e;)ml(e,t),e=e.sibling}function ml(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(gl(e,t),yl(t),4&r){try{nl(3,t,t.return),rl(3,t)}catch(e){Su(t,t.return,e)}try{nl(5,t,t.return)}catch(e){Su(t,t.return,e)}}break;case 1:gl(e,t),yl(t),512&r&&null!==n&&Qa(n,n.return);break;case 5:if(gl(e,t),yl(t),512&r&&null!==n&&Qa(n,n.return),32&t.flags){var i=t.stateNode;try{pt(i,"")}catch(e){Su(t,t.return,e)}}if(4&r&&null!=(i=t.stateNode)){var s=t.memoizedProps,a=null!==n?n.memoizedProps:s,l=t.type,u=t.updateQueue;if(t.updateQueue=null,null!==u)try{"input"===l&&"radio"===s.type&&null!=s.name&&K(i,s),vt(l,a);var c=vt(l,s);for(a=0;a<u.length;a+=2){var h=u[a],p=u[a+1];"style"===h?mt(i,p):"dangerouslySetInnerHTML"===h?ht(i,p):"children"===h?pt(i,p):v(i,h,p,c)}switch(l){case"input":J(i,s);break;case"textarea":ot(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var d=s.value;null!=d?nt(i,!!s.multiple,d,!1):f!==!!s.multiple&&(null!=s.defaultValue?nt(i,!!s.multiple,s.defaultValue,!0):nt(i,!!s.multiple,s.multiple?[]:"",!1))}i[pi]=s}catch(e){Su(t,t.return,e)}}break;case 6:if(gl(e,t),yl(t),4&r){if(null===t.stateNode)throw Error(o(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(e){Su(t,t.return,e)}}break;case 3:if(gl(e,t),yl(t),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Ve(e.containerInfo)}catch(e){Su(t,t.return,e)}break;case 4:default:gl(e,t),yl(t);break;case 13:gl(e,t),yl(t),8192&(i=t.child).flags&&(s=null!==i.memoizedState,i.stateNode.isHidden=s,!s||null!==i.alternate&&null!==i.alternate.memoizedState||(Vl=Kt())),4&r&&dl(t);break;case 22:if(h=null!==n&&null!==n.memoizedState,1&t.mode?(Ha=(c=Ha)||h,gl(e,t),Ha=c):gl(e,t),yl(t),8192&r){if(c=null!==t.memoizedState,(t.stateNode.isHidden=c)&&!h&&0!=(1&t.mode))for(Ja=t,h=t.child;null!==h;){for(p=Ja=h;null!==Ja;){switch(d=(f=Ja).child,f.tag){case 0:case 11:case 14:case 15:nl(4,f,f.return);break;case 1:Qa(f,f.return);var g=f.stateNode;if("function"==typeof g.componentWillUnmount){r=f,n=f.return;try{e=r,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(t){Su(r,n,t)}}break;case 5:Qa(f,f.return);break;case 22:if(null!==f.memoizedState){bl(p);continue}}null!==d?(d.return=f,Ja=d):bl(p)}h=h.sibling}t:for(h=null,p=t;;){if(5===p.tag){if(null===h){h=p;try{i=p.stateNode,c?"function"==typeof(s=i.style).setProperty?s.setProperty("display","none","important"):s.display="none":(l=p.stateNode,a=null!=(u=p.memoizedProps.style)&&u.hasOwnProperty("display")?u.display:null,l.style.display=gt("display",a))}catch(e){Su(t,t.return,e)}}}else if(6===p.tag){if(null===h)try{p.stateNode.nodeValue=c?"":p.memoizedProps}catch(e){Su(t,t.return,e)}}else if((22!==p.tag&&23!==p.tag||null===p.memoizedState||p===t)&&null!==p.child){p.child.return=p,p=p.child;continue}if(p===t)break t;for(;null===p.sibling;){if(null===p.return||p.return===t)break t;h===p&&(h=null),p=p.return}h===p&&(h=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:gl(e,t),yl(t),4&r&&dl(t);case 21:}}function yl(t){var e=t.flags;if(2&e){try{t:{for(var n=t.return;null!==n;){if(sl(n)){var r=n;break t}n=n.return}throw Error(o(160))}switch(r.tag){case 5:var i=r.stateNode;32&r.flags&&(pt(i,""),r.flags&=-33),ul(t,al(t),i);break;case 3:case 4:var s=r.stateNode.containerInfo;ll(t,al(t),s);break;default:throw Error(o(161))}}catch(e){Su(t,t.return,e)}t.flags&=-3}4096&e&&(t.flags&=-4097)}function _l(t,e,n){Ja=t,vl(t,e,n)}function vl(t,e,n){for(var r=0!=(1&t.mode);null!==Ja;){var i=Ja,o=i.child;if(22===i.tag&&r){var s=null!==i.memoizedState||Wa;if(!s){var a=i.alternate,l=null!==a&&null!==a.memoizedState||Ha;a=Wa;var u=Ha;if(Wa=s,(Ha=l)&&!u)for(Ja=i;null!==Ja;)l=(s=Ja).child,22===s.tag&&null!==s.memoizedState?wl(i):null!==l?(l.return=s,Ja=l):wl(i);for(;null!==o;)Ja=o,vl(o,e,n),o=o.sibling;Ja=i,Wa=a,Ha=u}xl(t)}else 0!=(8772&i.subtreeFlags)&&null!==o?(o.return=i,Ja=o):xl(t)}}function xl(t){for(;null!==Ja;){var e=Ja;if(0!=(8772&e.flags)){var n=e.alternate;try{if(0!=(8772&e.flags))switch(e.tag){case 0:case 11:case 15:Ha||rl(5,e);break;case 1:var r=e.stateNode;if(4&e.flags&&!Ha)if(null===n)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:mo(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;null!==s&&Fo(e,s,r);break;case 3:var a=e.updateQueue;if(null!==a){if(n=null,null!==e.child)switch(e.child.tag){case 5:case 1:n=e.child.stateNode}Fo(e,a,n)}break;case 5:var l=e.stateNode;if(null===n&&4&e.flags){n=l;var u=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===e.memoizedState){var c=e.alternate;if(null!==c){var h=c.memoizedState;if(null!==h){var p=h.dehydrated;null!==p&&Ve(p)}}}break;default:throw Error(o(163))}Ha||512&e.flags&&il(e)}catch(t){Su(e,e.return,t)}}if(e===t){Ja=null;break}if(null!==(n=e.sibling)){n.return=e.return,Ja=n;break}Ja=e.return}}function bl(t){for(;null!==Ja;){var e=Ja;if(e===t){Ja=null;break}var n=e.sibling;if(null!==n){n.return=e.return,Ja=n;break}Ja=e.return}}function wl(t){for(;null!==Ja;){var e=Ja;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{rl(4,e)}catch(t){Su(e,n,t)}break;case 1:var r=e.stateNode;if("function"==typeof r.componentDidMount){var i=e.return;try{r.componentDidMount()}catch(t){Su(e,i,t)}}var o=e.return;try{il(e)}catch(t){Su(e,o,t)}break;case 5:var s=e.return;try{il(e)}catch(t){Su(e,s,t)}}}catch(t){Su(e,e.return,t)}if(e===t){Ja=null;break}var a=e.sibling;if(null!==a){a.return=e.return,Ja=a;break}Ja=e.return}}var El,Sl=Math.ceil,Il=x.ReactCurrentDispatcher,Cl=x.ReactCurrentOwner,Tl=x.ReactCurrentBatchConfig,Pl=0,Ml=null,Ll=null,Al=0,kl=0,Nl=Ei(0),Dl=0,Rl=null,Ol=0,zl=0,Fl=0,Bl=null,Ul=null,Vl=0,jl=1/0,Gl=null,ql=!1,$l=null,Xl=null,Zl=!1,Yl=null,Wl=0,Hl=0,Kl=null,Jl=-1,Ql=0;function tu(){return 0!=(6&Pl)?Kt():-1!==Jl?Jl:Jl=Kt()}function eu(t){return 0==(1&t.mode)?1:0!=(2&Pl)&&0!==Al?Al&-Al:null!==go.transition?(0===Ql&&(Ql=ge()),Ql):0!==(t=_e)?t:t=void 0===(t=window.event)?16:We(t.type)}function nu(t,e,n,r){if(50<Hl)throw Hl=0,Kl=null,Error(o(185));me(t,n,r),0!=(2&Pl)&&t===Ml||(t===Ml&&(0==(2&Pl)&&(zl|=n),4===Dl&&au(t,Al)),ru(t,r),1===n&&0===Pl&&0==(1&e.mode)&&(jl=Kt()+500,Fi&&Vi()))}function ru(t,e){var n=t.callbackNode;!function(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,o=t.pendingLanes;0<o;){var s=31-se(o),a=1<<s,l=i[s];-1===l?0!=(a&n)&&0==(a&r)||(i[s]=fe(a,e)):l<=e&&(t.expiredLanes|=a),o&=~a}}(t,e);var r=pe(t,t===Ml?Al:0);if(0===r)null!==n&&Yt(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(null!=n&&Yt(n),1===e)0===t.tag?function(t){Fi=!0,Ui(t)}(lu.bind(null,t)):Ui(lu.bind(null,t)),oi((function(){0==(6&Pl)&&Vi()})),n=null;else{switch(ve(r)){case 1:n=Qt;break;case 4:n=te;break;case 16:default:n=ee;break;case 536870912:n=re}n=Mu(n,iu.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function iu(t,e){if(Jl=-1,Ql=0,0!=(6&Pl))throw Error(o(327));var n=t.callbackNode;if(wu()&&t.callbackNode!==n)return null;var r=pe(t,t===Ml?Al:0);if(0===r)return null;if(0!=(30&r)||0!=(r&t.expiredLanes)||e)e=mu(t,r);else{e=r;var i=Pl;Pl|=2;var s=du();for(Ml===t&&Al===e||(Gl=null,jl=Kt()+500,pu(t,e));;)try{_u();break}catch(e){fu(t,e)}bo(),Il.current=s,Pl=i,null!==Ll?e=0:(Ml=null,Al=0,e=Dl)}if(0!==e){if(2===e&&0!==(i=de(t))&&(r=i,e=ou(t,i)),1===e)throw n=Rl,pu(t,0),au(t,r),ru(t,Kt()),n;if(6===e)au(t,r);else{if(i=t.current.alternate,0==(30&r)&&!function(t){for(var e=t;;){if(16384&e.flags){var n=e.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!sr(o(),i))return!1}catch(t){return!1}}}if(n=e.child,16384&e.subtreeFlags&&null!==n)n.return=e,e=n;else{if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}(i)&&(2===(e=mu(t,r))&&0!==(s=de(t))&&(r=s,e=ou(t,s)),1===e))throw n=Rl,pu(t,0),au(t,r),ru(t,Kt()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(o(345));case 2:case 5:bu(t,Ul,Gl);break;case 3:if(au(t,r),(130023424&r)===r&&10<(e=Vl+500-Kt())){if(0!==pe(t,0))break;if(((i=t.suspendedLanes)&r)!==r){tu(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=ni(bu.bind(null,t,Ul,Gl),e);break}bu(t,Ul,Gl);break;case 4:if(au(t,r),(4194240&r)===r)break;for(e=t.eventTimes,i=-1;0<r;){var a=31-se(r);s=1<<a,(a=e[a])>i&&(i=a),r&=~s}if(r=i,10<(r=(120>(r=Kt()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Sl(r/1960))-r)){t.timeoutHandle=ni(bu.bind(null,t,Ul,Gl),r);break}bu(t,Ul,Gl);break;default:throw Error(o(329))}}}return ru(t,Kt()),t.callbackNode===n?iu.bind(null,t):null}function ou(t,e){var n=Bl;return t.current.memoizedState.isDehydrated&&(pu(t,e).flags|=256),2!==(t=mu(t,e))&&(e=Ul,Ul=n,null!==e&&su(e)),t}function su(t){null===Ul?Ul=t:Ul.push.apply(Ul,t)}function au(t,e){for(e&=~Fl,e&=~zl,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-se(e),r=1<<n;t[n]=-1,e&=~r}}function lu(t){if(0!=(6&Pl))throw Error(o(327));wu();var e=pe(t,0);if(0==(1&e))return ru(t,Kt()),null;var n=mu(t,e);if(0!==t.tag&&2===n){var r=de(t);0!==r&&(e=r,n=ou(t,r))}if(1===n)throw n=Rl,pu(t,0),au(t,e),ru(t,Kt()),n;if(6===n)throw Error(o(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,bu(t,Ul,Gl),ru(t,Kt()),null}function uu(t,e){var n=Pl;Pl|=1;try{return t(e)}finally{0===(Pl=n)&&(jl=Kt()+500,Fi&&Vi())}}function cu(t){null!==Yl&&0===Yl.tag&&0==(6&Pl)&&wu();var e=Pl;Pl|=1;var n=Tl.transition,r=_e;try{if(Tl.transition=null,_e=1,t)return t()}finally{_e=r,Tl.transition=n,0==(6&(Pl=e))&&Vi()}}function hu(){kl=Nl.current,Si(Nl)}function pu(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(-1!==n&&(t.timeoutHandle=-1,ri(n)),null!==Ll)for(n=Ll.return;null!==n;){var r=n;switch(to(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&ki();break;case 3:is(),Si(Pi),Si(Ti),cs();break;case 5:ss(r);break;case 4:is();break;case 13:case 19:Si(as);break;case 10:wo(r.type._context);break;case 22:case 23:hu()}n=n.return}if(Ml=t,Ll=t=Nu(t.current,null),Al=kl=e,Dl=0,Rl=null,Fl=zl=Ol=0,Ul=Bl=null,null!==Co){for(e=0;e<Co.length;e++)if(null!==(r=(n=Co[e]).interleaved)){n.interleaved=null;var i=r.next,o=n.pending;if(null!==o){var s=o.next;o.next=i,r.next=s}n.pending=r}Co=null}return t}function fu(t,e){for(;;){var n=Ll;try{if(bo(),hs.current=oa,ys){for(var r=ds.memoizedState;null!==r;){var i=r.queue;null!==i&&(i.pending=null),r=r.next}ys=!1}if(fs=0,ms=gs=ds=null,_s=!1,vs=0,Cl.current=null,null===n||null===n.return){Dl=1,Rl=e,Ll=null;break}t:{var s=t,a=n.return,l=n,u=e;if(e=Al,l.flags|=32768,null!==u&&"object"==typeof u&&"function"==typeof u.then){var c=u,h=l,p=h.tag;if(0==(1&h.mode)&&(0===p||11===p||15===p)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var d=ma(a);if(null!==d){d.flags&=-257,ya(d,a,l,0,e),1&d.mode&&ga(s,c,e),u=c;var g=(e=d).updateQueue;if(null===g){var m=new Set;m.add(u),e.updateQueue=m}else g.add(u);break t}if(0==(1&e)){ga(s,c,e),gu();break t}u=Error(o(426))}else if(ro&&1&l.mode){var y=ma(a);if(null!==y){0==(65536&y.flags)&&(y.flags|=256),ya(y,a,l,0,e),fo(ua(u,l));break t}}s=u=ua(u,l),4!==Dl&&(Dl=2),null===Bl?Bl=[s]:Bl.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e,Oo(s,fa(0,u,e));break t;case 1:l=u;var _=s.type,v=s.stateNode;if(0==(128&s.flags)&&("function"==typeof _.getDerivedStateFromError||null!==v&&"function"==typeof v.componentDidCatch&&(null===Xl||!Xl.has(v)))){s.flags|=65536,e&=-e,s.lanes|=e,Oo(s,da(s,l,e));break t}}s=s.return}while(null!==s)}xu(n)}catch(t){e=t,Ll===n&&null!==n&&(Ll=n=n.return);continue}break}}function du(){var t=Il.current;return Il.current=oa,null===t?oa:t}function gu(){0!==Dl&&3!==Dl&&2!==Dl||(Dl=4),null===Ml||0==(268435455&Ol)&&0==(268435455&zl)||au(Ml,Al)}function mu(t,e){var n=Pl;Pl|=2;var r=du();for(Ml===t&&Al===e||(Gl=null,pu(t,e));;)try{yu();break}catch(e){fu(t,e)}if(bo(),Pl=n,Il.current=r,null!==Ll)throw Error(o(261));return Ml=null,Al=0,Dl}function yu(){for(;null!==Ll;)vu(Ll)}function _u(){for(;null!==Ll&&!Wt();)vu(Ll)}function vu(t){var e=El(t.alternate,t,kl);t.memoizedProps=t.pendingProps,null===e?xu(t):Ll=e,Cl.current=null}function xu(t){var e=t;do{var n=e.alternate;if(t=e.return,0==(32768&e.flags)){if(null!==(n=Za(n,e,kl)))return void(Ll=n)}else{if(null!==(n=Ya(n,e)))return n.flags&=32767,void(Ll=n);if(null===t)return Dl=6,void(Ll=null);t.flags|=32768,t.subtreeFlags=0,t.deletions=null}if(null!==(e=e.sibling))return void(Ll=e);Ll=e=t}while(null!==e);0===Dl&&(Dl=5)}function bu(t,e,n){var r=_e,i=Tl.transition;try{Tl.transition=null,_e=1,function(t,e,n,r){do{wu()}while(null!==Yl);if(0!=(6&Pl))throw Error(o(327));n=t.finishedWork;var i=t.finishedLanes;if(null===n)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(o(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(function(t,e){var n=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 r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-se(n),o=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~o}}(t,s),t===Ml&&(Ll=Ml=null,Al=0),0==(2064&n.subtreeFlags)&&0==(2064&n.flags)||Zl||(Zl=!0,Mu(ee,(function(){return wu(),null}))),s=0!=(15990&n.flags),0!=(15990&n.subtreeFlags)||s){s=Tl.transition,Tl.transition=null;var a=_e;_e=1;var l=Pl;Pl|=4,Cl.current=null,function(t,e){if(Qr=Ge,pr(t=hr())){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else t:{var r=(n=(n=t.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch(t){n=null;break t}var a=0,l=-1,u=-1,c=0,h=0,p=t,f=null;e:for(;;){for(var d;p!==n||0!==i&&3!==p.nodeType||(l=a+i),p!==s||0!==r&&3!==p.nodeType||(u=a+r),3===p.nodeType&&(a+=p.nodeValue.length),null!==(d=p.firstChild);)f=p,p=d;for(;;){if(p===t)break e;if(f===n&&++c===i&&(l=a),f===s&&++h===r&&(u=a),null!==(d=p.nextSibling))break;f=(p=f).parentNode}p=d}n=-1===l||-1===u?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(ti={focusedElem:t,selectionRange:n},Ge=!1,Ja=e;null!==Ja;)if(t=(e=Ja).child,0!=(1028&e.subtreeFlags)&&null!==t)t.return=e,Ja=t;else for(;null!==Ja;){e=Ja;try{var g=e.alternate;if(0!=(1024&e.flags))switch(e.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==g){var m=g.memoizedProps,y=g.memoizedState,_=e.stateNode,v=_.getSnapshotBeforeUpdate(e.elementType===e.type?m:mo(e.type,m),y);_.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var x=e.stateNode.containerInfo;1===x.nodeType?x.textContent="":9===x.nodeType&&x.documentElement&&x.removeChild(x.documentElement);break;default:throw Error(o(163))}}catch(t){Su(e,e.return,t)}if(null!==(t=e.sibling)){t.return=e.return,Ja=t;break}Ja=e.return}g=el,el=!1}(t,n),ml(n,t),fr(ti),Ge=!!Qr,ti=Qr=null,t.current=n,_l(n,t,i),Ht(),Pl=l,_e=a,Tl.transition=s}else t.current=n;if(Zl&&(Zl=!1,Yl=t,Wl=i),0===(s=t.pendingLanes)&&(Xl=null),function(t){if(oe&&"function"==typeof oe.onCommitFiberRoot)try{oe.onCommitFiberRoot(ie,t,void 0,128==(128&t.current.flags))}catch(t){}}(n.stateNode),ru(t,Kt()),null!==e)for(r=t.onRecoverableError,n=0;n<e.length;n++)r((i=e[n]).value,{componentStack:i.stack,digest:i.digest});if(ql)throw ql=!1,t=$l,$l=null,t;0!=(1&Wl)&&0!==t.tag&&wu(),0!=(1&(s=t.pendingLanes))?t===Kl?Hl++:(Hl=0,Kl=t):Hl=0,Vi()}(t,e,n,r)}finally{Tl.transition=i,_e=r}return null}function wu(){if(null!==Yl){var t=ve(Wl),e=Tl.transition,n=_e;try{if(Tl.transition=null,_e=16>t?16:t,null===Yl)var r=!1;else{if(t=Yl,Yl=null,Wl=0,0!=(6&Pl))throw Error(o(331));var i=Pl;for(Pl|=4,Ja=t.current;null!==Ja;){var s=Ja,a=s.child;if(0!=(16&Ja.flags)){var l=s.deletions;if(null!==l){for(var u=0;u<l.length;u++){var c=l[u];for(Ja=c;null!==Ja;){var h=Ja;switch(h.tag){case 0:case 11:case 15:nl(8,h,s)}var p=h.child;if(null!==p)p.return=h,Ja=p;else for(;null!==Ja;){var f=(h=Ja).sibling,d=h.return;if(ol(h),h===c){Ja=null;break}if(null!==f){f.return=d,Ja=f;break}Ja=d}}}var g=s.alternate;if(null!==g){var m=g.child;if(null!==m){g.child=null;do{var y=m.sibling;m.sibling=null,m=y}while(null!==m)}}Ja=s}}if(0!=(2064&s.subtreeFlags)&&null!==a)a.return=s,Ja=a;else t:for(;null!==Ja;){if(0!=(2048&(s=Ja).flags))switch(s.tag){case 0:case 11:case 15:nl(9,s,s.return)}var _=s.sibling;if(null!==_){_.return=s.return,Ja=_;break t}Ja=s.return}}var v=t.current;for(Ja=v;null!==Ja;){var x=(a=Ja).child;if(0!=(2064&a.subtreeFlags)&&null!==x)x.return=a,Ja=x;else t:for(a=v;null!==Ja;){if(0!=(2048&(l=Ja).flags))try{switch(l.tag){case 0:case 11:case 15:rl(9,l)}}catch(t){Su(l,l.return,t)}if(l===a){Ja=null;break t}var b=l.sibling;if(null!==b){b.return=l.return,Ja=b;break t}Ja=l.return}}if(Pl=i,Vi(),oe&&"function"==typeof oe.onPostCommitFiberRoot)try{oe.onPostCommitFiberRoot(ie,t)}catch(t){}r=!0}return r}finally{_e=n,Tl.transition=e}}return!1}function Eu(t,e,n){t=Do(t,e=fa(0,e=ua(n,e),1),1),e=tu(),null!==t&&(me(t,1,e),ru(t,e))}function Su(t,e,n){if(3===t.tag)Eu(t,t,n);else for(;null!==e;){if(3===e.tag){Eu(e,t,n);break}if(1===e.tag){var r=e.stateNode;if("function"==typeof e.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Xl||!Xl.has(r))){e=Do(e,t=da(e,t=ua(n,t),1),1),t=tu(),null!==e&&(me(e,1,t),ru(e,t));break}}e=e.return}}function Iu(t,e,n){var r=t.pingCache;null!==r&&r.delete(e),e=tu(),t.pingedLanes|=t.suspendedLanes&n,Ml===t&&(Al&n)===n&&(4===Dl||3===Dl&&(130023424&Al)===Al&&500>Kt()-Vl?pu(t,0):Fl|=n),ru(t,e)}function Cu(t,e){0===e&&(0==(1&t.mode)?e=1:(e=ce,0==(130023424&(ce<<=1))&&(ce=4194304)));var n=tu();null!==(t=Mo(t,e))&&(me(t,e,n),ru(t,n))}function Tu(t){var e=t.memoizedState,n=0;null!==e&&(n=e.retryLane),Cu(t,n)}function Pu(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(o(314))}null!==r&&r.delete(e),Cu(t,n)}function Mu(t,e){return Zt(t,e)}function Lu(t,e,n,r){this.tag=t,this.key=n,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Au(t,e,n,r){return new Lu(t,e,n,r)}function ku(t){return!(!(t=t.prototype)||!t.isReactComponent)}function Nu(t,e){var n=t.alternate;return null===n?((n=Au(t.tag,e,t.key,t.mode)).elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&t.flags,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Du(t,e,n,r,i,s){var a=2;if(r=t,"function"==typeof t)ku(t)&&(a=1);else if("string"==typeof t)a=5;else t:switch(t){case E:return Ru(n.children,i,s,e);case S:a=8,i|=8;break;case I:return(t=Au(12,n,e,2|i)).elementType=I,t.lanes=s,t;case M:return(t=Au(13,n,e,i)).elementType=M,t.lanes=s,t;case L:return(t=Au(19,n,e,i)).elementType=L,t.lanes=s,t;case N:return Ou(n,i,s,e);default:if("object"==typeof t&&null!==t)switch(t.$$typeof){case C:a=10;break t;case T:a=9;break t;case P:a=11;break t;case A:a=14;break t;case k:a=16,r=null;break t}throw Error(o(130,null==t?t:typeof t,""))}return(e=Au(a,n,e,i)).elementType=t,e.type=r,e.lanes=s,e}function Ru(t,e,n,r){return(t=Au(7,t,r,e)).lanes=n,t}function Ou(t,e,n,r){return(t=Au(22,t,r,e)).elementType=N,t.lanes=n,t.stateNode={isHidden:!1},t}function zu(t,e,n){return(t=Au(6,t,null,e)).lanes=n,t}function Fu(t,e,n){return(e=Au(4,null!==t.children?t.children:[],t.key,e)).lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Bu(t){if(!t)return Ci;t:{if(jt(t=t._reactInternals)!==t||1!==t.tag)throw Error(o(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break t;case 1:if(Ai(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break t}}e=e.return}while(null!==e);throw Error(o(171))}if(1===t.tag){var n=t.type;if(Ai(n))return Di(t,n,e)}return e}function Uu(t,e,n,r){var i=e.current,o=tu(),s=eu(i);return n=Bu(n),null===e.context?e.context=n:e.pendingContext=n,(e=No(o,s)).payload={element:t},null!==(r=void 0===r?null:r)&&(e.callback=r),null!==(t=Do(i,e,s))&&(nu(t,i,s,o),Ro(t,i,s)),s}function Vu(t,e){if(null!==(t=t.memoizedState)&&null!==t.dehydrated){var n=t.retryLane;t.retryLane=0!==n&&n<e?n:e}}function ju(t,e){Vu(t,e),(t=t.alternate)&&Vu(t,e)}El=function(t,e,n){if(null!==t)if(t.memoizedProps!==e.pendingProps||Pi.current)va=!0;else{if(0==(t.lanes&n)&&0==(128&e.flags))return va=!1,function(t,e,n){switch(e.tag){case 3:Ma(e),po();break;case 5:os(e);break;case 1:Ai(e.type)&&Ri(e);break;case 4:rs(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;Ii(yo,r._currentValue),r._currentValue=i;break;case 13:if(null!==(r=e.memoizedState))return null!==r.dehydrated?(Ii(as,1&as.current),e.flags|=128,null):0!=(n&e.child.childLanes)?za(t,e,n):(Ii(as,1&as.current),null!==(t=qa(t,e,n))?t.sibling:null);Ii(as,1&as.current);break;case 19:if(r=0!=(n&e.childLanes),0!=(128&t.flags)){if(r)return ja(t,e,n);e.flags|=128}if(null!==(i=e.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ii(as,as.current),r)break;return null;case 22:case 23:return e.lanes=0,Sa(t,e,n)}return qa(t,e,n)}(t,e,n);va=0!=(131072&t.flags)}else va=!1,ro&&0!=(1048576&e.flags)&&Ji(e,$i,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Ga(t,e),t=e.pendingProps;var i=Li(e,Ti.current);So(e,n),i=Es(null,e,r,t,i,n);var s=Ss();return e.flags|=1,"object"==typeof i&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ai(r)?(s=!0,Ri(e)):s=!1,e.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,Ao(e),i.updater=Vo,e.stateNode=i,i._reactInternals=e,$o(e,r,t,n),e=Pa(null,e,r,!0,s,n)):(e.tag=0,ro&&s&&Qi(e),xa(null,e,i,n),e=e.child),e;case 16:r=e.elementType;t:{switch(Ga(t,e),t=e.pendingProps,r=(i=r._init)(r._payload),e.type=r,i=e.tag=function(t){if("function"==typeof t)return ku(t)?1:0;if(null!=t){if((t=t.$$typeof)===P)return 11;if(t===A)return 14}return 2}(r),t=mo(r,t),i){case 0:e=Ca(null,e,r,t,n);break t;case 1:e=Ta(null,e,r,t,n);break t;case 11:e=ba(null,e,r,t,n);break t;case 14:e=wa(null,e,r,mo(r.type,t),n);break t}throw Error(o(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,Ca(t,e,r,i=e.elementType===r?i:mo(r,i),n);case 1:return r=e.type,i=e.pendingProps,Ta(t,e,r,i=e.elementType===r?i:mo(r,i),n);case 3:t:{if(Ma(e),null===t)throw Error(o(387));r=e.pendingProps,i=(s=e.memoizedState).element,ko(t,e),zo(e,r,null,n);var a=e.memoizedState;if(r=a.element,s.isDehydrated){if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,256&e.flags){e=La(t,e,r,n,i=ua(Error(o(423)),e));break t}if(r!==i){e=La(t,e,r,n,i=ua(Error(o(424)),e));break t}for(no=li(e.stateNode.containerInfo.firstChild),eo=e,ro=!0,io=null,n=Ko(e,null,r,n),e.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(po(),r===i){e=qa(t,e,n);break t}xa(t,e,r,n)}e=e.child}return e;case 5:return os(e),null===t&&lo(e),r=e.type,i=e.pendingProps,s=null!==t?t.memoizedProps:null,a=i.children,ei(r,i)?a=null:null!==s&&ei(r,s)&&(e.flags|=32),Ia(t,e),xa(t,e,a,n),e.child;case 6:return null===t&&lo(e),null;case 13:return za(t,e,n);case 4:return rs(e,e.stateNode.containerInfo),r=e.pendingProps,null===t?e.child=Ho(e,null,r,n):xa(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,ba(t,e,r,i=e.elementType===r?i:mo(r,i),n);case 7:return xa(t,e,e.pendingProps,n),e.child;case 8:case 12:return xa(t,e,e.pendingProps.children,n),e.child;case 10:t:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,a=i.value,Ii(yo,r._currentValue),r._currentValue=a,null!==s)if(sr(s.value,a)){if(s.children===i.children&&!Pi.current){e=qa(t,e,n);break t}}else for(null!==(s=e.child)&&(s.return=e);null!==s;){var l=s.dependencies;if(null!==l){a=s.child;for(var u=l.firstContext;null!==u;){if(u.context===r){if(1===s.tag){(u=No(-1,n&-n)).tag=2;var c=s.updateQueue;if(null!==c){var h=(c=c.shared).pending;null===h?u.next=u:(u.next=h.next,h.next=u),c.pending=u}}s.lanes|=n,null!==(u=s.alternate)&&(u.lanes|=n),Eo(s.return,n,e),l.lanes|=n;break}u=u.next}}else if(10===s.tag)a=s.type===e.type?null:s.child;else if(18===s.tag){if(null===(a=s.return))throw Error(o(341));a.lanes|=n,null!==(l=a.alternate)&&(l.lanes|=n),Eo(a,n,e),a=s.sibling}else a=s.child;if(null!==a)a.return=s;else for(a=s;null!==a;){if(a===e){a=null;break}if(null!==(s=a.sibling)){s.return=a.return,a=s;break}a=a.return}s=a}xa(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,So(e,n),r=r(i=Io(i)),e.flags|=1,xa(t,e,r,n),e.child;case 14:return i=mo(r=e.type,e.pendingProps),wa(t,e,r,i=mo(r.type,i),n);case 15:return Ea(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:mo(r,i),Ga(t,e),e.tag=1,Ai(r)?(t=!0,Ri(e)):t=!1,So(e,n),Go(e,r,i),$o(e,r,i,n),Pa(null,e,r,!0,t,n);case 19:return ja(t,e,n);case 22:return Sa(t,e,n)}throw Error(o(156,e.tag))};"function"==typeof reportError&&reportError;function Gu(t){this._internalRoot=t}function qu(t){this._internalRoot=t}qu.prototype.render=Gu.prototype.render=function(t){var e=this._internalRoot;if(null===e)throw Error(o(409));Uu(t,e,null,null)},qu.prototype.unmount=Gu.prototype.unmount=function(){var t=this._internalRoot;if(null!==t){this._internalRoot=null;var e=t.containerInfo;cu((function(){Uu(null,t,null,null)})),e[fi]=null}},qu.prototype.unstable_scheduleHydration=function(t){if(t){var e=Ee();t={blockedOn:null,target:t,priority:e};for(var n=0;n<ke.length&&0!==e&&e<ke[n].priority;n++);ke.splice(n,0,t),0===n&&Oe(t)}},xe=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=he(e.pendingLanes);0!==n&&(ye(e,1|n),ru(e,Kt()),0==(6&Pl)&&(jl=Kt()+500,Vi()))}break;case 13:cu((function(){var e=Mo(t,1);if(null!==e){var n=tu();nu(e,t,1,n)}})),ju(t,1)}},be=function(t){if(13===t.tag){var e=Mo(t,134217728);null!==e&&nu(e,t,134217728,tu()),ju(t,134217728)}},we=function(t){if(13===t.tag){var e=eu(t),n=Mo(t,e);null!==n&&nu(n,t,e,tu()),ju(t,e)}},Ee=function(){return _e},Se=function(t,e){var n=_e;try{return _e=t,e()}finally{_e=n}},wt=function(t,e,n){switch(e){case"input":if(J(t,n),e=n.name,"radio"===n.type&&null!=e){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=xi(r);if(!i)throw Error(o(90));Z(r),J(r,i)}}}break;case"textarea":ot(t,n);break;case"select":null!=(e=n.value)&&nt(t,!!n.multiple,e,!1)}},Pt=uu,Mt=cu;var $u={findFiberByHostInstance:yi,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},Xu={bundleType:$u.bundleType,version:$u.version,rendererPackageName:$u.rendererPackageName,rendererConfig:$u.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:x.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return null===(t=$t(t))?null:t.stateNode},findFiberByHostInstance:$u.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var Zu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zu.isDisabled&&Zu.supportsFiber)try{ie=Zu.inject(Xu),oe=Zu}catch(ct){}}e.createPortal=function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!function(t){return!(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)}(e))throw Error(o(200));return function(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:w,key:null==r?null:""+r,children:t,containerInfo:e,implementation:n}}(t,e,null,n)}},3144:(t,e,n)=>{!function t(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(t){console.error(t)}}(),t.exports=n(7400)},4304:(t,e)=>{var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.iterator,d={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,m={};function y(t,e,n){this.props=t,this.context=e,this.refs=m,this.updater=n||d}function _(){}function v(t,e,n){this.props=t,this.context=e,this.refs=m,this.updater=n||d}y.prototype.isReactComponent={},y.prototype.setState=function(t,e){if("object"!=typeof t&&"function"!=typeof t&&null!=t)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")},y.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},_.prototype=y.prototype;var x=v.prototype=new _;x.constructor=v,g(x,y.prototype),x.isPureReactComponent=!0;var b=Array.isArray,w=Object.prototype.hasOwnProperty,E={current:null},S={key:!0,ref:!0,__self:!0,__source:!0};function I(t,e,r){var i,o={},s=null,a=null;if(null!=e)for(i in void 0!==e.ref&&(a=e.ref),void 0!==e.key&&(s=""+e.key),e)w.call(e,i)&&!S.hasOwnProperty(i)&&(o[i]=e[i]);var l=arguments.length-2;if(1===l)o.children=r;else if(1<l){for(var u=Array(l),c=0;c<l;c++)u[c]=arguments[c+2];o.children=u}if(t&&t.defaultProps)for(i in l=t.defaultProps)void 0===o[i]&&(o[i]=l[i]);return{$$typeof:n,type:t,key:s,ref:a,props:o,_owner:E.current}}function C(t){return"object"==typeof t&&null!==t&&t.$$typeof===n}var T=/\/+/g;function P(t,e){return"object"==typeof t&&null!==t&&null!=t.key?function(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,(function(t){return e[t]}))}(""+t.key):e.toString(36)}function M(t,e,i,o,s){var a=typeof t;"undefined"!==a&&"boolean"!==a||(t=null);var l=!1;if(null===t)l=!0;else switch(a){case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case n:case r:l=!0}}if(l)return s=s(l=t),t=""===o?"."+P(l,0):o,b(s)?(i="",null!=t&&(i=t.replace(T,"$&/")+"/"),M(s,e,i,"",(function(t){return t}))):null!=s&&(C(s)&&(s=function(t,e){return{$$typeof:n,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}(s,i+(!s.key||l&&l.key===s.key?"":(""+s.key).replace(T,"$&/")+"/")+t)),e.push(s)),1;if(l=0,o=""===o?".":o+":",b(t))for(var u=0;u<t.length;u++){var c=o+P(a=t[u],u);l+=M(a,e,i,c,s)}else if(c=function(t){return null===t||"object"!=typeof t?null:"function"==typeof(t=f&&t[f]||t["@@iterator"])?t:null}(t),"function"==typeof c)for(t=c.call(t),u=0;!(a=t.next()).done;)l+=M(a=a.value,e,i,c=o+P(a,u++),s);else if("object"===a)throw e=String(t),Error("Objects are not valid as a React child (found: "+("[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return l}function L(t,e,n){if(null==t)return t;var r=[],i=0;return M(t,r,"","",(function(t){return e.call(n,t,i++)})),r}function A(t){if(-1===t._status){var e=t._result;(e=e()).then((function(e){0!==t._status&&-1!==t._status||(t._status=1,t._result=e)}),(function(e){0!==t._status&&-1!==t._status||(t._status=2,t._result=e)})),-1===t._status&&(t._status=0,t._result=e)}if(1===t._status)return t._result.default;throw t._result}var k={current:null},N={transition:null},D={ReactCurrentDispatcher:k,ReactCurrentBatchConfig:N,ReactCurrentOwner:E};e.Children={map:L,forEach:function(t,e,n){L(t,(function(){e.apply(this,arguments)}),n)},count:function(t){var e=0;return L(t,(function(){e++})),e},toArray:function(t){return L(t,(function(t){return t}))||[]},only:function(t){if(!C(t))throw Error("React.Children.only expected to receive a single React element child.");return t}},e.Component=y,e.Fragment=i,e.Profiler=s,e.PureComponent=v,e.StrictMode=o,e.Suspense=c,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=D,e.cloneElement=function(t,e,r){if(null==t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var i=g({},t.props),o=t.key,s=t.ref,a=t._owner;if(null!=e){if(void 0!==e.ref&&(s=e.ref,a=E.current),void 0!==e.key&&(o=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(u in e)w.call(e,u)&&!S.hasOwnProperty(u)&&(i[u]=void 0===e[u]&&void 0!==l?l[u]:e[u])}var u=arguments.length-2;if(1===u)i.children=r;else if(1<u){l=Array(u);for(var c=0;c<u;c++)l[c]=arguments[c+2];i.children=l}return{$$typeof:n,type:t.type,key:o,ref:s,props:i,_owner:a}},e.createContext=function(t){return(t={$$typeof:l,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:t},t.Consumer=t},e.createElement=I,e.createFactory=function(t){var e=I.bind(null,t);return e.type=t,e},e.createRef=function(){return{current:null}},e.forwardRef=function(t){return{$$typeof:u,render:t}},e.isValidElement=C,e.lazy=function(t){return{$$typeof:p,_payload:{_status:-1,_result:t},_init:A}},e.memo=function(t,e){return{$$typeof:h,type:t,compare:void 0===e?null:e}},e.startTransition=function(t){var e=N.transition;N.transition={};try{t()}finally{N.transition=e}},e.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},e.useCallback=function(t,e){return k.current.useCallback(t,e)},e.useContext=function(t){return k.current.useContext(t)},e.useDebugValue=function(){},e.useDeferredValue=function(t){return k.current.useDeferredValue(t)},e.useEffect=function(t,e){return k.current.useEffect(t,e)},e.useId=function(){return k.current.useId()},e.useImperativeHandle=function(t,e,n){return k.current.useImperativeHandle(t,e,n)},e.useInsertionEffect=function(t,e){return k.current.useInsertionEffect(t,e)},e.useLayoutEffect=function(t,e){return k.current.useLayoutEffect(t,e)},e.useMemo=function(t,e){return k.current.useMemo(t,e)},e.useReducer=function(t,e,n){return k.current.useReducer(t,e,n)},e.useRef=function(t){return k.current.useRef(t)},e.useState=function(t){return k.current.useState(t)},e.useSyncExternalStore=function(t,e,n){return k.current.useSyncExternalStore(t,e,n)},e.useTransition=function(){return k.current.useTransition()},e.version="18.2.0"},4041:(t,e,n)=>{t.exports=n(4304)},8394:(t,e,n)=>{var r=n(9343),i=Object,o=TypeError;t.exports=r((function(){if(null!=this&&this!==i(this))throw new o("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t}),"get flags",!0)},1026:(t,e,n)=>{var r=n(1857),i=n(8498),o=n(8394),s=n(243),a=n(9669),l=i(s());r(l,{getPolyfill:s,implementation:o,shim:a}),t.exports=l},243:(t,e,n)=>{var r=n(8394),i=n(1857).supportsDescriptors,o=Object.getOwnPropertyDescriptor;t.exports=function(){if(i&&"gim"===/a/gim.flags){var t=o(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof RegExp.prototype.dotAll&&"boolean"==typeof RegExp.prototype.hasIndices){var e="",n={};if(Object.defineProperty(n,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(n,"sticky",{get:function(){e+="y"}}),"dy"===e)return t.get}}return r}},9669:(t,e,n)=>{var r=n(1857).supportsDescriptors,i=n(243),o=Object.getOwnPropertyDescriptor,s=Object.defineProperty,a=TypeError,l=Object.getPrototypeOf,u=/a/;t.exports=function(){if(!r||!l)throw new a("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=i(),e=l(u),n=o(e,"flags");return n&&n.get===t||s(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}},5168:function(t,e){!function(t){const e=134217729;function n(t,e,n,r,i){let o,s,a,l,u=e[0],c=r[0],h=0,p=0;c>u==c>-u?(o=u,u=e[++h]):(o=c,c=r[++p]);let f=0;if(h<t&&p<n)for(c>u==c>-u?(a=o-((s=u+o)-u),u=e[++h]):(a=o-((s=c+o)-c),c=r[++p]),o=s,0!==a&&(i[f++]=a);h<t&&p<n;)c>u==c>-u?(a=o-((s=o+u)-(l=s-o))+(u-l),u=e[++h]):(a=o-((s=o+c)-(l=s-o))+(c-l),c=r[++p]),o=s,0!==a&&(i[f++]=a);for(;h<t;)a=o-((s=o+u)-(l=s-o))+(u-l),u=e[++h],o=s,0!==a&&(i[f++]=a);for(;p<n;)a=o-((s=o+c)-(l=s-o))+(c-l),c=r[++p],o=s,0!==a&&(i[f++]=a);return 0===o&&0!==f||(i[f++]=o),f}function r(t){return new Float64Array(t)}const i=r(4),o=r(8),s=r(12),a=r(16),l=r(4);t.orient2d=function(t,r,u,c,h,p){const f=(r-p)*(u-h),d=(t-h)*(c-p),g=f-d;if(0===f||0===d||f>0!=d>0)return g;const m=Math.abs(f+d);return Math.abs(g)>=33306690738754716e-32*m?g:-function(t,r,u,c,h,p,f){let d,g,m,y,_,v,x,b,w,E,S,I,C,T,P,M,L,A;const k=t-h,N=u-h,D=r-p,R=c-p;_=(P=(b=k-(x=(v=e*k)-(v-k)))*(E=R-(w=(v=e*R)-(v-R)))-((T=k*R)-x*w-b*w-x*E))-(S=P-(L=(b=D-(x=(v=e*D)-(v-D)))*(E=N-(w=(v=e*N)-(v-N)))-((M=D*N)-x*w-b*w-x*E))),i[0]=P-(S+_)+(_-L),_=(C=T-((I=T+S)-(_=I-T))+(S-_))-(S=C-M),i[1]=C-(S+_)+(_-M),_=(A=I+S)-I,i[2]=I-(A-_)+(S-_),i[3]=A;let O=function(t,e){let n=e[0];for(let t=1;t<4;t++)n+=e[t];return n}(0,i),z=22204460492503146e-32*f;if(O>=z||-O>=z)return O;if(d=t-(k+(_=t-k))+(_-h),m=u-(N+(_=u-N))+(_-h),g=r-(D+(_=r-D))+(_-p),y=c-(R+(_=c-R))+(_-p),0===d&&0===g&&0===m&&0===y)return O;if(z=11093356479670487e-47*f+33306690738754706e-32*Math.abs(O),(O+=k*y+R*d-(D*m+N*g))>=z||-O>=z)return O;_=(P=(b=d-(x=(v=e*d)-(v-d)))*(E=R-(w=(v=e*R)-(v-R)))-((T=d*R)-x*w-b*w-x*E))-(S=P-(L=(b=g-(x=(v=e*g)-(v-g)))*(E=N-(w=(v=e*N)-(v-N)))-((M=g*N)-x*w-b*w-x*E))),l[0]=P-(S+_)+(_-L),_=(C=T-((I=T+S)-(_=I-T))+(S-_))-(S=C-M),l[1]=C-(S+_)+(_-M),_=(A=I+S)-I,l[2]=I-(A-_)+(S-_),l[3]=A;const F=n(4,i,4,l,o);_=(P=(b=k-(x=(v=e*k)-(v-k)))*(E=y-(w=(v=e*y)-(v-y)))-((T=k*y)-x*w-b*w-x*E))-(S=P-(L=(b=D-(x=(v=e*D)-(v-D)))*(E=m-(w=(v=e*m)-(v-m)))-((M=D*m)-x*w-b*w-x*E))),l[0]=P-(S+_)+(_-L),_=(C=T-((I=T+S)-(_=I-T))+(S-_))-(S=C-M),l[1]=C-(S+_)+(_-M),_=(A=I+S)-I,l[2]=I-(A-_)+(S-_),l[3]=A;const B=n(F,o,4,l,s);_=(P=(b=d-(x=(v=e*d)-(v-d)))*(E=y-(w=(v=e*y)-(v-y)))-((T=d*y)-x*w-b*w-x*E))-(S=P-(L=(b=g-(x=(v=e*g)-(v-g)))*(E=m-(w=(v=e*m)-(v-m)))-((M=g*m)-x*w-b*w-x*E))),l[0]=P-(S+_)+(_-L),_=(C=T-((I=T+S)-(_=I-T))+(S-_))-(S=C-M),l[1]=C-(S+_)+(_-M),_=(A=I+S)-I,l[2]=I-(A-_)+(S-_),l[3]=A;const U=n(B,s,4,l,a);return a[U-1]}(t,r,u,c,h,p,m)},t.orient2dfast=function(t,e,n,r,i,o){return(e-o)*(n-i)-(t-i)*(r-o)},Object.defineProperty(t,"__esModule",{value:!0})}(e)},2568:(t,e)=>{function n(t,e){var n=t.length;t.push(e);t:for(;0<n;){var r=n-1>>>1,i=t[r];if(!(0<o(i,e)))break t;t[r]=e,t[n]=i,n=r}}function r(t){return 0===t.length?null:t[0]}function i(t){if(0===t.length)return null;var e=t[0],n=t.pop();if(n!==e){t[0]=n;t:for(var r=0,i=t.length,s=i>>>1;r<s;){var a=2*(r+1)-1,l=t[a],u=a+1,c=t[u];if(0>o(l,n))u<i&&0>o(c,l)?(t[r]=c,t[u]=n,r=u):(t[r]=l,t[a]=n,r=a);else{if(!(u<i&&0>o(c,n)))break t;t[r]=c,t[u]=n,r=u}}}return e}function o(t,e){var n=t.sortIndex-e.sortIndex;return 0!==n?n:t.id-e.id}if("object"==typeof performance&&"function"==typeof performance.now){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var u=[],c=[],h=1,p=null,f=3,d=!1,g=!1,m=!1,y="function"==typeof setTimeout?setTimeout:null,_="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function x(t){for(var e=r(c);null!==e;){if(null===e.callback)i(c);else{if(!(e.startTime<=t))break;i(c),e.sortIndex=e.expirationTime,n(u,e)}e=r(c)}}function b(t){if(m=!1,x(t),!g)if(null!==r(u))g=!0,N(w);else{var e=r(c);null!==e&&D(b,e.startTime-t)}}function w(t,n){g=!1,m&&(m=!1,_(C),C=-1),d=!0;var o=f;try{for(x(n),p=r(u);null!==p&&(!(p.expirationTime>n)||t&&!M());){var s=p.callback;if("function"==typeof s){p.callback=null,f=p.priorityLevel;var a=s(p.expirationTime<=n);n=e.unstable_now(),"function"==typeof a?p.callback=a:p===r(u)&&i(u),x(n)}else i(u);p=r(u)}if(null!==p)var l=!0;else{var h=r(c);null!==h&&D(b,h.startTime-n),l=!1}return l}finally{p=null,f=o,d=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var E,S=!1,I=null,C=-1,T=5,P=-1;function M(){return!(e.unstable_now()-P<T)}function L(){if(null!==I){var t=e.unstable_now();P=t;var n=!0;try{n=I(!0,t)}finally{n?E():(S=!1,I=null)}}else S=!1}if("function"==typeof v)E=function(){v(L)};else if("undefined"!=typeof MessageChannel){var A=new MessageChannel,k=A.port2;A.port1.onmessage=L,E=function(){k.postMessage(null)}}else E=function(){y(L,0)};function N(t){I=t,S||(S=!0,E())}function D(t,n){C=y((function(){t(e.unstable_now())}),n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(t){t.callback=null},e.unstable_continueExecution=function(){g||d||(g=!0,N(w))},e.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<t?Math.floor(1e3/t):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(u)},e.unstable_next=function(t){switch(f){case 1:case 2:case 3:var e=3;break;default:e=f}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_scheduleCallback=function(t,i,o){var s=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?s+o:s,t){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return t={id:h++,callback:i,priorityLevel:t,startTime:o,expirationTime:a=o+a,sortIndex:-1},o>s?(t.sortIndex=o,n(c,t),null===r(u)&&t===r(c)&&(m?(_(C),C=-1):m=!0,D(b,o-s))):(t.sortIndex=a,n(u,t),g||d||(g=!0,N(w))),t},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(t){var e=f;return function(){var n=f;f=e;try{return t.apply(this,arguments)}finally{f=n}}}},7967:(t,e,n)=>{t.exports=n(2568)},6108:(t,e,n)=>{var r=n(528),i=n(686),o=n(7239)(),s=n(9336),a=r("%TypeError%"),l=r("%Math.floor%");t.exports=function(t,e){if("function"!=typeof t)throw new a("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||l(e)!==e)throw new a("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],r=!0,u=!0;if("length"in t&&s){var c=s(t,"length");c&&!c.configurable&&(r=!1),c&&!c.writable&&(u=!1)}return(r||u||!n)&&(o?i(t,"length",e,!0,!0):i(t,"length",e)),t}},9343:(t,e,n)=>{var r=n(686),i=n(7239)(),o=n(8993).functionsHaveConfigurableNames(),s=TypeError;t.exports=function(t,e){if("function"!=typeof t)throw new s("`fn` is not a function");return arguments.length>2&&!!arguments[2]&&!o||(i?r(t,"name",e,!0,!0):r(t,"name",e)),t}},7449:t=>{t.exports={eudist:function(t,e,n){for(var r=t.length,i=0,o=0;o<r;o++){var s=(t[o]||0)-(e[o]||0);i+=s*s}return n?Math.sqrt(i):i},mandist:function(t,e,n){for(var r=t.length,i=0,o=0;o<r;o++)i+=Math.abs((t[o]||0)-(e[o]||0));return n?Math.sqrt(i):i},dist:function(t,e,n){var r=Math.abs(t-e);return n?r:r*r}}},339:(t,e,n)=>{var r=n(7449),i=r.eudist,o=r.dist;t.exports={kmrand:function(t,e){for(var n={},r=[],i=e<<2,o=t.length,s=t[0].length>0;r.length<e&&i-- >0;){var a=t[Math.floor(Math.random()*o)],l=s?a.join("_"):""+a;n[l]||(n[l]=!0,r.push(a))}if(r.length<e)throw new Error("Error initializating clusters");return r},kmpp:function(t,e){var n=t[0].length?i:o,r=[],s=t.length,a=t[0].length>0,l=t[Math.floor(Math.random()*s)];for(a&&l.join("_"),r.push(l);r.length<e;){for(var u=[],c=r.length,h=0,p=[],f=0;f<s;f++){for(var d=1/0,g=0;g<c;g++){var m=n(t[f],r[g]);m<=d&&(d=m)}u[f]=d}for(var y=0;y<s;y++)h+=u[y];for(var _=0;_<s;_++)p[_]={i:_,v:t[_],pr:u[_]/h,cs:0};p.sort((function(t,e){return t.pr-e.pr})),p[0].cs=p[0].pr;for(var v=1;v<s;v++)p[v].cs=p[v-1].cs+p[v].pr;for(var x=Math.random(),b=0;b<s-1&&p[b++].cs<x;);r.push(p[b-1].v)}return r}}},3883:(t,e,n)=>{var r=n(7449),i=n(339),o=r.eudist,s=(r.mandist,r.dist,i.kmrand),a=i.kmpp;function l(t,e,n){n=n||[];for(var r=0;r<t;r++)n[r]=e;return n}t.exports=function(t,e,n,r){var i=[],u=[],c=[],h=[],p=!1,f=r||1e4,d=t.length,g=t[0].length,m=g>0,y=[];if(n)i="kmrand"==n?s(t,e):"kmpp"==n?a(t,e):n;else for(var _={};i.length<e;){var v=Math.floor(Math.random()*d);_[v]||(_[v]=!0,i.push(t[v]))}do{l(e,0,y);for(var x=0;x<d;x++){for(var b=1/0,w=0,E=0;E<e;E++)(h=m?o(t[x],i[E]):Math.abs(t[x]-i[E]))<=b&&(b=h,w=E);c[x]=w,y[w]++}for(var S=[],I=(u=[],0);I<e;I++)S[I]=m?l(g,0,S[I]):0,u[I]=i[I];if(m){for(var C=0;C<e;C++)i[C]=[];for(var T=0;T<d;T++)for(var P=S[c[T]],M=t[T],L=0;L<g;L++)P[L]+=M[L];p=!0;for(var A=0;A<e;A++){for(var k=i[A],N=S[A],D=u[A],R=y[A],O=0;O<g;O++)k[O]=N[O]/R||0;if(p)for(var z=0;z<g;z++)if(D[z]!=k[z]){p=!1;break}}}else{for(var F=0;F<d;F++)S[c[F]]+=t[F];for(var B=0;B<e;B++)i[B]=S[B]/y[B]||0;p=!0;for(var U=0;U<e;U++)if(u[U]!=i[U]){p=!1;break}}p=p||--f<=0}while(!p);return{it:1e4-f,k:e,idxs:c,centroids:i}}},7803:(t,e,n)=>{n.r(e),n.d(e,{default:()=>r});class r{constructor(t=[],e=i){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,r=e[t];for(;t>0;){const i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}_down(t){const{data:e,compare:n}=this,r=this.length>>1,i=e[t];for(;t<r;){let r=1+(t<<1),o=e[r];const s=r+1;if(s<this.length&&n(e[s],o)<0&&(r=s,o=e[s]),n(o,i)>=0)break;e[t]=o,t=r}e[t]=i}}function i(t,e){return t<e?-1:t>e?1:0}},4712:function(t,e){!function(t){function e(){}function n(t){this.message=t||""}function r(t){this.message=t||""}function i(t){this.message=t||""}function o(){}function s(t){return null===t?Dt:t.color}function a(t){return null===t?null:t.parent}function l(t,e){null!==t&&(t.color=e)}function u(t){return null===t?null:t.left}function c(t){return null===t?null:t.right}function h(){this.root_=null,this.size_=0}function p(){}function f(){this.array_=[],arguments[0]instanceof xt&&this.addAll(arguments[0])}function d(){}function g(t){this.message=t||""}function m(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,r=1 in arguments&&parseInt(Number(arguments[1]),10)||0;r=r<0?Math.max(n+r,0):Math.min(r,n);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n;for(i=i<0?Math.max(n+arguments[2],0):Math.min(i,n);r<i;)e[r]=t,++r;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var y=function(){};y.prototype.interfaces_=function(){return[]},y.prototype.getClass=function(){return y},y.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var _=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),v=function(){},x={MAX_VALUE:{configurable:!0}};v.isNaN=function(t){return Number.isNaN(t)},v.doubleToLongBits=function(t){return t},v.longBitsToDouble=function(t){return t},v.isInfinite=function(t){return!Number.isFinite(t)},x.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(v,x);var b=function(){},w=function(){},E=function(){},S=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},I={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};S.prototype.setOrdinate=function(t,e){switch(t){case S.X:this.x=e;break;case S.Y:this.y=e;break;case S.Z:this.z=e;break;default:throw new _("Invalid ordinate index: "+t)}},S.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!y.equalsWithTolerance(this.x,e.x,n)&&!!y.equalsWithTolerance(this.y,e.y,n)}},S.prototype.getOrdinate=function(t){switch(t){case S.X:return this.x;case S.Y:return this.y;case S.Z:return this.z}throw new _("Invalid ordinate index: "+t)},S.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||v.isNaN(this.z))&&v.isNaN(t.z)},S.prototype.equals=function(t){return t instanceof S&&this.equals2D(t)},S.prototype.equalInZ=function(t,e){return y.equalsWithTolerance(this.z,t.z,e)},S.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},S.prototype.clone=function(){},S.prototype.copy=function(){return new S(this)},S.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},S.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)},S.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},S.prototype.hashCode=function(){var t=17;return 37*(t=37*t+S.hashCode(this.x))+S.hashCode(this.y)},S.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},S.prototype.interfaces_=function(){return[b,w,e]},S.prototype.getClass=function(){return S},S.hashCode=function(){if(1===arguments.length){var t=v.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},I.DimensionalComparator.get=function(){return C},I.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},I.NULL_ORDINATE.get=function(){return v.NaN},I.X.get=function(){return 0},I.Y.get=function(){return 1},I.Z.get=function(){return 2},Object.defineProperties(S,I);var C=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new _("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};C.prototype.compare=function(t,e){var n=t,r=e,i=C.compare(n.x,r.x);if(0!==i)return i;var o=C.compare(n.y,r.y);return 0!==o?o:this._dimensionsToTest<=2?0:C.compare(n.z,r.z)},C.prototype.interfaces_=function(){return[E]},C.prototype.getClass=function(){return C},C.compare=function(t,e){return t<e?-1:t>e?1:v.isNaN(t)?v.isNaN(e)?0:-1:v.isNaN(e)?1:0};var T=function(){};T.prototype.create=function(){},T.prototype.interfaces_=function(){return[]},T.prototype.getClass=function(){return T};var P=function(){},M={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};P.prototype.interfaces_=function(){return[]},P.prototype.getClass=function(){return P},P.toLocationSymbol=function(t){switch(t){case P.EXTERIOR:return"e";case P.BOUNDARY:return"b";case P.INTERIOR:return"i";case P.NONE:return"-"}throw new _("Unknown location value: "+t)},M.INTERIOR.get=function(){return 0},M.BOUNDARY.get=function(){return 1},M.EXTERIOR.get=function(){return 2},M.NONE.get=function(){return-1},Object.defineProperties(P,M);var L=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},A=function(){},k={LOG_10:{configurable:!0}};A.prototype.interfaces_=function(){return[]},A.prototype.getClass=function(){return A},A.log10=function(t){var e=Math.log(t);return v.isInfinite(e)||v.isNaN(e)?e:e/A.LOG_10},A.min=function(t,e,n,r){var i=t;return e<i&&(i=e),n<i&&(i=n),r<i&&(i=r),i},A.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],o=arguments[2];return r<i?i:r>o?o:r}},A.wrap=function(t,e){return t<0?e- -t%e:t%e},A.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[0];return t>n&&(n=t),e>n&&(n=e),n}if(4===arguments.length){var r=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return r>s&&(s=r),i>s&&(s=i),o>s&&(s=o),s}},A.average=function(t,e){return(t+e)/2},k.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(A,k);var N=function(t){this.str=t};N.prototype.append=function(t){this.str+=t},N.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},N.prototype.toString=function(t){return this.str};var D=function(t){this.value=t};D.prototype.intValue=function(){return this.value},D.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},D.isNaN=function(t){return Number.isNaN(t)};var R=function(){};R.isWhitespace=function(t){return t<=32&&t>=0||127===t},R.toUpperCase=function(t){return t.toUpperCase()};var O=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length)if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else"string"==typeof arguments[0]&&t.call(this,t.parse(arguments[0]));else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r,i)}},z={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};O.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},O.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=O.magnitude(n._hi),i=O.TEN.pow(r);(n=n.divide(i)).gt(O.TEN)?(n=n.divide(O.TEN),r+=1):n.lt(O.ONE)&&(n=n.multiply(O.TEN),r-=1);for(var o=r+1,s=new N,a=O.MAX_PRINT_DIGITS-1,l=0;l<=a;l++){t&&l===o&&s.append(".");var u=Math.trunc(n._hi);if(u<0)break;var c=!1,h=0;u>9?(c=!0,h="9"):h="0"+u,s.append(h),n=n.subtract(O.valueOf(u)).multiply(O.TEN),c&&n.selfAdd(O.TEN);var p=!0,f=O.magnitude(n._hi);if(f<0&&Math.abs(f)>=a-l&&(p=!1),!p)break}return e[0]=r,s.toString()},O.prototype.sqr=function(){return this.multiply(this)},O.prototype.doubleValue=function(){return this._hi+this._lo},O.prototype.subtract=function(){if(arguments[0]instanceof O){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},O.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},O.prototype.isZero=function(){return 0===this._hi&&0===this._lo},O.prototype.selfSubtract=function(){if(arguments[0]instanceof O){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},O.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},O.prototype.min=function(t){return this.le(t)?this:t},O.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof O){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var n,r,i,o,s=arguments[0],a=arguments[1],l=null,u=null,c=null,h=null;return i=this._hi/s,h=(l=(c=O.SPLIT*i)-(l=c-i))*(u=(h=O.SPLIT*s)-(u=h-s))-(o=i*s)+l*(r=s-u)+(n=i-l)*u+n*r,h=i+(c=(this._hi-o-h+this._lo-i*a)/s),this._hi=h,this._lo=i-h+c,this}},O.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},O.prototype.divide=function(){if(arguments[0]instanceof O){var t,e,n,r,i=arguments[0],o=null,s=null,a=null,l=null;return t=(n=this._hi/i._hi)-(o=(a=O.SPLIT*n)-(o=a-n)),l=o*(s=(l=O.SPLIT*i._hi)-(s=l-i._hi))-(r=n*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-r-l+this._lo-n*i._lo)/i._hi,new O(l=n+a,n-l+a)}if("number"==typeof arguments[0]){var u=arguments[0];return v.isNaN(u)?O.createNaN():O.copy(this).selfDivide(u,0)}},O.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},O.prototype.pow=function(t){if(0===t)return O.valueOf(1);var e=new O(this),n=O.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&n.selfMultiply(e),(r/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},O.prototype.ceil=function(){if(this.isNaN())return O.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new O(t,e)},O.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},O.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},O.prototype.setValue=function(){if(arguments[0]instanceof O){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},O.prototype.max=function(t){return this.ge(t)?this:t},O.prototype.sqrt=function(){if(this.isZero())return O.valueOf(0);if(this.isNegative())return O.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=O.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)},O.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof O){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,n,r,i,o,s=arguments[0],a=null;return a=(r=this._hi+s)-(i=r-this._hi),n=(o=(a=s-i+(this._hi-a))+this._lo)+(r-(e=r+o)),this._hi=e+n,this._lo=n+(e-this._hi),this}}else if(2===arguments.length){var l,u,c,h,p=arguments[0],f=arguments[1],d=null,g=null,m=null;c=this._hi+p,u=this._lo+f,g=c-(m=c-this._hi),d=u-(h=u-this._lo);var y=(l=c+(m=(g=p-m+(this._hi-g))+u))+(m=(d=f-h+(this._lo-d))+(m+(c-l))),_=m+(l-y);return this._hi=y,this._lo=_,this}},O.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof O){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var n,r,i=arguments[0],o=arguments[1],s=null,a=null,l=null,u=null;s=(l=O.SPLIT*this._hi)-this._hi,u=O.SPLIT*i,s=l-s,n=this._hi-s,a=u-i;var c=(l=this._hi*i)+(u=s*(a=u-a)-l+s*(r=i-a)+n*a+n*r+(this._hi*o+this._lo*i)),h=u+(s=l-c);return this._hi=c,this._lo=h,this}},O.prototype.selfSqr=function(){return this.selfMultiply(this)},O.prototype.floor=function(){if(this.isNaN())return O.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new O(t,e)},O.prototype.negate=function(){return this.isNaN()?this:new O(-this._hi,-this._lo)},O.prototype.clone=function(){},O.prototype.multiply=function(){if(arguments[0]instanceof O){var t=arguments[0];return t.isNaN()?O.createNaN():O.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return v.isNaN(e)?O.createNaN():O.copy(this).selfMultiply(e,0)}},O.prototype.isNaN=function(){return v.isNaN(this._hi)},O.prototype.intValue=function(){return Math.trunc(this._hi)},O.prototype.toString=function(){var t=O.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},O.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if("."===n.charAt(0))i="0"+n;else if(r<0)i="0."+O.stringOfChar("0",-r)+n;else if(-1===n.indexOf(".")){var o=r-n.length;i=n+O.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},O.prototype.reciprocal=function(){var t,e,n,r,i=null,o=null,s=null,a=null;t=(n=1/this._hi)-(i=(s=O.SPLIT*n)-(i=s-n)),o=(a=O.SPLIT*this._hi)-this._hi;var l=n+(s=(1-(r=n*this._hi)-(a=i*(o=a-o)-r+i*(e=this._hi-o)+t*o+t*e)-n*this._lo)/this._hi);return new O(l,n-l+s)},O.prototype.toSciNotation=function(){if(this.isZero())return O.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=O.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var o=n.charAt(0)+"."+i;return this.isNegative()?"-"+o+r:o+r},O.prototype.abs=function(){return this.isNaN()?O.NaN:this.isNegative()?this.negate():new O(this)},O.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},O.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},O.prototype.add=function(){if(arguments[0]instanceof O){var t=arguments[0];return O.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return O.copy(this).selfAdd(e)}},O.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof O){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._hi=n,this._lo=r}},O.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},O.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},O.prototype.trunc=function(){return this.isNaN()?O.NaN:this.isPositive()?this.floor():this.ceil()},O.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},O.prototype.interfaces_=function(){return[e,b,w]},O.prototype.getClass=function(){return O},O.sqr=function(t){return O.valueOf(t).selfMultiply(t)},O.valueOf=function(){return"string"==typeof arguments[0]?O.parse(arguments[0]):"number"==typeof arguments[0]?new O(arguments[0]):void 0},O.sqrt=function(t){return O.valueOf(t).sqrt()},O.parse=function(t){for(var e=0,n=t.length;R.isWhitespace(t.charAt(e));)e++;var r=!1;if(e<n){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(r=!0))}for(var o=new O,s=0,a=0,l=0;!(e>=n);){var u=t.charAt(e);if(e++,R.isDigit(u)){var c=u-"0";o.selfMultiply(O.TEN),o.selfAdd(c),s++}else{if("."!==u){if("e"===u||"E"===u){var h=t.substring(e);try{l=D.parseInt(h)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+h+" in string "+t):e}break}throw new Error("Unexpected character '"+u+"' at position "+e+" in string "+t)}a=s}}var p=o,f=s-a-l;if(0===f)p=o;else if(f>0){var d=O.TEN.pow(f);p=o.divide(d)}else if(f<0){var g=O.TEN.pow(-f);p=o.multiply(g)}return r?p.negate():p},O.createNaN=function(){return new O(v.NaN,v.NaN)},O.copy=function(t){return new O(t)},O.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r},O.stringOfChar=function(t,e){for(var n=new N,r=0;r<e;r++)n.append(t);return n.toString()},z.PI.get=function(){return new O(3.141592653589793,12246467991473532e-32)},z.TWO_PI.get=function(){return new O(6.283185307179586,24492935982947064e-32)},z.PI_2.get=function(){return new O(1.5707963267948966,6123233995736766e-32)},z.E.get=function(){return new O(2.718281828459045,14456468917292502e-32)},z.NaN.get=function(){return new O(v.NaN,v.NaN)},z.EPS.get=function(){return 123259516440783e-46},z.SPLIT.get=function(){return 134217729},z.MAX_PRINT_DIGITS.get=function(){return 32},z.TEN.get=function(){return O.valueOf(10)},z.ONE.get=function(){return O.valueOf(1)},z.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},z.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(O,z);var F=function(){},B={DP_SAFE_EPSILON:{configurable:!0}};F.prototype.interfaces_=function(){return[]},F.prototype.getClass=function(){return F},F.orientationIndex=function(t,e,n){var r=F.orientationIndexFilter(t,e,n);if(r<=1)return r;var i=O.valueOf(e.x).selfAdd(-t.x),o=O.valueOf(e.y).selfAdd(-t.y),s=O.valueOf(n.x).selfAdd(-e.x),a=O.valueOf(n.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},F.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},F.intersection=function(t,e,n,r){var i=O.valueOf(r.y).selfSubtract(n.y).selfMultiply(O.valueOf(e.x).selfSubtract(t.x)),o=O.valueOf(r.x).selfSubtract(n.x).selfMultiply(O.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=O.valueOf(r.x).selfSubtract(n.x).selfMultiply(O.valueOf(t.y).selfSubtract(n.y)),l=O.valueOf(r.y).selfSubtract(n.y).selfMultiply(O.valueOf(t.x).selfSubtract(n.x)),u=a.subtract(l).selfDivide(s).doubleValue(),c=O.valueOf(t.x).selfAdd(O.valueOf(e.x).selfSubtract(t.x).selfMultiply(u)).doubleValue(),h=O.valueOf(e.x).selfSubtract(t.x).selfMultiply(O.valueOf(t.y).selfSubtract(n.y)),p=O.valueOf(e.y).selfSubtract(t.y).selfMultiply(O.valueOf(t.x).selfSubtract(n.x)),f=h.subtract(p).selfDivide(s).doubleValue(),d=O.valueOf(n.y).selfAdd(O.valueOf(r.y).selfSubtract(n.y).selfMultiply(f)).doubleValue();return new S(c,d)},F.orientationIndexFilter=function(t,e,n){var r=null,i=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),s=i-o;if(i>0){if(o<=0)return F.signum(s);r=i+o}else{if(!(i<0))return F.signum(s);if(o>=0)return F.signum(s);r=-i-o}var a=F.DP_SAFE_EPSILON*r;return s>=a||-s>=a?F.signum(s):2},F.signum=function(t){return t>0?1:t<0?-1:0},B.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(F,B);var U=function(){},V={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};V.X.get=function(){return 0},V.Y.get=function(){return 1},V.Z.get=function(){return 2},V.M.get=function(){return 3},U.prototype.setOrdinate=function(t,e,n){},U.prototype.size=function(){},U.prototype.getOrdinate=function(t,e){},U.prototype.getCoordinate=function(){},U.prototype.getCoordinateCopy=function(t){},U.prototype.getDimension=function(){},U.prototype.getX=function(t){},U.prototype.clone=function(){},U.prototype.expandEnvelope=function(t){},U.prototype.copy=function(){},U.prototype.getY=function(t){},U.prototype.toCoordinateArray=function(){},U.prototype.interfaces_=function(){return[w]},U.prototype.getClass=function(){return U},Object.defineProperties(U,V);var j=function(){},G=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(j),q=function(){};q.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},q.getProperty=function(t){return{"line.separator":"\n"}[t]};var $=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1];this.x=n,this.y=r,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof S&&arguments[1]instanceof S){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var l=arguments[0],u=arguments[1],c=arguments[2];this.x=l,this.y=u,this.w=c}else if(4===arguments.length){var h=arguments[0],p=arguments[1],f=arguments[2],d=arguments[3],g=h.y-p.y,m=p.x-h.x,y=h.x*p.y-p.x*h.y,_=f.y-d.y,v=d.x-f.x,x=f.x*d.y-d.x*f.y;this.x=m*x-v*y,this.y=_*y-g*x,this.w=g*v-_*m}};$.prototype.getY=function(){var t=this.y/this.w;if(v.isNaN(t)||v.isInfinite(t))throw new G;return t},$.prototype.getX=function(){var t=this.x/this.w;if(v.isNaN(t)||v.isInfinite(t))throw new G;return t},$.prototype.getCoordinate=function(){var t=new S;return t.x=this.getX(),t.y=this.getY(),t},$.prototype.interfaces_=function(){return[]},$.prototype.getClass=function(){return $},$.intersection=function(t,e,n,r){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=n.y-r.y,l=r.x-n.x,u=n.x*r.y-r.x*n.y,c=i*l-a*o,h=(o*u-l*s)/c,p=(a*s-i*u)/c;if(v.isNaN(h)||v.isInfinite(h)||v.isNaN(p)||v.isInfinite(p))throw new G;return new S(h,p)};var X=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof S){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],l=arguments[3];this.init(o,s,a,l)}},Z={serialVersionUID:{configurable:!0}};X.prototype.getArea=function(){return this.getWidth()*this.getHeight()},X.prototype.equals=function(t){if(!(t instanceof X))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},X.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new X;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new X(e,r,n,i)},X.prototype.isNull=function(){return this._maxx<this._minx},X.prototype.getMaxX=function(){return this._maxx},X.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof S){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof X){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}},X.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof X){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof S){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&!(n>this._maxx||n<this._minx||r>this._maxy||r<this._miny)}},X.prototype.getMinY=function(){return this._miny},X.prototype.getMinX=function(){return this._minx},X.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof S){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof X){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),r<this._miny&&(this._miny=r),r>this._maxy&&(this._maxy=r))}},X.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},X.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},X.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},X.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},X.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},X.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},X.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},X.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},X.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},X.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof X){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof S){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.covers(n,r)}},X.prototype.centre=function(){return this.isNull()?null:new S((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},X.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof S){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof X){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},X.prototype.getMaxY=function(){return this._maxy},X.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},X.prototype.hashCode=function(){var t=17;return 37*(t=37*(t=37*(t=37*t+S.hashCode(this._minx))+S.hashCode(this._maxx))+S.hashCode(this._miny))+S.hashCode(this._maxy)},X.prototype.interfaces_=function(){return[b,e]},X.prototype.getClass=function(){return X},X.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),l=Math.max(o.x,s.x),u=Math.min(r.x,i.x),c=Math.max(r.x,i.x);return!(u>l||c<a||(a=Math.min(o.y,s.y),l=Math.max(o.y,s.y),u=Math.min(r.y,i.y),c=Math.max(r.y,i.y),u>l||c<a))}},Z.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(X,Z);var Y={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},W=function(t){this.geometryFactory=t||new ye};W.prototype.read=function(t){var e,n,r;t=t.replace(/[\n\r]/g," ");var i=Y.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=Y.emptyTypeStr.exec(t))[2]=void 0),i&&(n=i[1].toLowerCase(),r=i[2],K[n]&&(e=K[n].apply(this,[r]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},W.prototype.write=function(t){return this.extractGeometry(t)},W.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!H[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+H[e].apply(this,[t])+")"};var H={coordinate:function(t){return t.x+" "+t.y},point:function(t){return H.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+H.point.apply(this,[t._geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(H.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},linearring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(H.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+H.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+H.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+H.linestring.apply(this,[t._holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+H.polygon.apply(this,[t._geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push(this.extractGeometry(t._geometries[n]));return e.join(",")}},K={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(Y.spaces);return this.geometryFactory.createPoint(new S(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){if(void 0===t)return this.geometryFactory.createMultiPoint();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(Y.trimParens,"$1"),r.push(K.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(r)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(Y.spaces),r.push(new S(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(r)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(Y.spaces),r.push(new S(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(r)},multilinestring:function(t){if(void 0===t)return this.geometryFactory.createMultiLineString();for(var e,n=t.trim().split(Y.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(Y.trimParens,"$1"),r.push(K.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){if(void 0===t)return this.geometryFactory.createPolygon();for(var e,n,r,i,o=t.trim().split(Y.parenComma),s=[],a=0,l=o.length;a<l;++a)e=o[a].replace(Y.trimParens,"$1"),n=K.linestring.apply(this,[e]),r=this.geometryFactory.createLinearRing(n._points),0===a?i=r:s.push(r);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var e,n=t.trim().split(Y.doubleParenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(Y.trimParens,"$1"),r.push(K.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(r)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),n=[],r=0,i=e.length;r<i;++r)n.push(this.read(e[r]));return this.geometryFactory.createGeometryCollection(n)}},J=function(t){this.parser=new W(t)};J.prototype.write=function(t){return this.parser.write(t)},J.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var Q=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),tt=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments[0];t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Q),et=function(){};et.prototype.interfaces_=function(){return[]},et.prototype.getClass=function(){return et},et.shouldNeverReachHere=function(){if(0===arguments.length)et.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new tt("Should never reach here"+(null!==t?": "+t:""))}},et.isTrue=function(){var t;if(1===arguments.length)et.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new tt:new tt(t)},et.equals=function(){var t,e,n;if(2===arguments.length)et.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],n=arguments[2],!(e=arguments[1]).equals(t)))throw new tt("Expected "+t+" but encountered "+e+(null!==n?": "+n:""))};var nt=function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new S,this._intPt[1]=new S,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},rt={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};nt.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},nt.prototype.getTopologySummary=function(){var t=new N;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},nt.prototype.computeIntersection=function(t,e,n,r){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=r,this._result=this.computeIntersect(t,e,n,r)},nt.prototype.getIntersectionNum=function(){return this._result},nt.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},nt.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},nt.prototype.setPrecisionModel=function(t){this._precisionModel=t},nt.prototype.isInteriorIntersection=function(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var t=arguments[0],e=0;e<this._result;e++)if(!this._intPt[e].equals2D(this._inputLines[t][0])&&!this._intPt[e].equals2D(this._inputLines[t][1]))return!0;return!1}},nt.prototype.getIntersection=function(t){return this._intPt[t]},nt.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},nt.prototype.hasIntersection=function(){return this._result!==nt.NO_INTERSECTION},nt.prototype.getEdgeDistance=function(t,e){return nt.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},nt.prototype.isCollinear=function(){return this._result===nt.COLLINEAR_INTERSECTION},nt.prototype.toString=function(){return J.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+J.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},nt.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},nt.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},nt.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},nt.prototype.interfaces_=function(){return[]},nt.prototype.getClass=function(){return nt},nt.computeEdgeDistance=function(t,e,n){var r=Math.abs(n.x-e.x),i=Math.abs(n.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(n))o=r>i?r:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=r>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return et.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},nt.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return et.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},rt.DONT_INTERSECT.get=function(){return 0},rt.DO_INTERSECT.get=function(){return 1},rt.COLLINEAR.get=function(){return 2},rt.NO_INTERSECTION.get=function(){return 0},rt.POINT_INTERSECTION.get=function(){return 1},rt.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(nt,rt);var it=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new X(this._inputLines[0][0],this._inputLines[0][1]),n=new X(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],n=arguments[1],r=arguments[2];if(this._isProper=!1,X.intersects(n,r,e)&&0===at.orientationIndex(n,r,e)&&0===at.orientationIndex(r,n,e))return this._isProper=!0,(e.equals(n)||e.equals(r))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,n,r,i){i.x=this.smallestInAbsValue(t.x,e.x,n.x,r.x),i.y=this.smallestInAbsValue(t.y,e.y,n.y,r.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,n,r,i){var o=null;try{o=$.intersection(t,n,r,i)}catch(s){if(!(s instanceof G))throw s;o=e.nearestEndpoint(t,n,r,i)}return o},e.prototype.intersection=function(t,n,r,i){var o=this.intersectionWithNormalization(t,n,r,i);return this.isInSegmentEnvelopes(o)||(o=new S(e.nearestEndpoint(t,n,r,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,n,r){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(n)<o&&(i=n,o=Math.abs(n)),Math.abs(r)<o&&(i=r),i},e.prototype.checkDD=function(t,e,n,r,i){var o=F.intersection(t,e,n,r),s=this.isInSegmentEnvelopes(o);q.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&q.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,n,r){var i=new S(t),o=new S(e),s=new S(n),a=new S(r),l=new S;this.normalizeToEnvCentre(i,o,s,a,l);var u=this.safeHCoordinateIntersection(i,o,s,a);return u.x+=l.x,u.y+=l.y,u},e.prototype.computeCollinearIntersection=function(e,n,r,i){var o=X.intersects(e,n,r),s=X.intersects(e,n,i),a=X.intersects(r,i,e),l=X.intersects(r,i,n);return o&&s?(this._intPt[0]=r,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&l?(this._intPt[0]=e,this._intPt[1]=n,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||s||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&l?(this._intPt[0]=r,this._intPt[1]=n,!r.equals(n)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&l?(this._intPt[0]=i,this._intPt[1]=n,!i.equals(n)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,n,r,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,l=t.y>e.y?t.y:e.y,u=n.x<r.x?n.x:r.x,c=n.y<r.y?n.y:r.y,h=n.x>r.x?n.x:r.x,p=n.y>r.y?n.y:r.y,f=((o>u?o:u)+(a<h?a:h))/2,d=((s>c?s:c)+(l<p?l:p))/2;i.x=f,i.y=d,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.computeIntersect=function(e,n,r,i){if(this._isProper=!1,!X.intersects(e,n,r,i))return t.NO_INTERSECTION;var o=at.orientationIndex(e,n,r),s=at.orientationIndex(e,n,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=at.orientationIndex(r,i,e),l=at.orientationIndex(r,i,n);return a>0&&l>0||a<0&&l<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===l?this.computeCollinearIntersection(e,n,r,i):(0===o||0===s||0===a||0===l?(this._isProper=!1,e.equals2D(r)||e.equals2D(i)?this._intPt[0]=e:n.equals2D(r)||n.equals2D(i)?this._intPt[0]=n:0===o?this._intPt[0]=new S(r):0===s?this._intPt[0]=new S(i):0===a?this._intPt[0]=new S(e):0===l&&(this._intPt[0]=new S(n))):(this._isProper=!0,this._intPt[0]=this.intersection(e,n,r,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,n,r){var i=t,o=at.distancePointLine(t,n,r),s=at.distancePointLine(e,n,r);return s<o&&(o=s,i=e),(s=at.distancePointLine(n,t,e))<o&&(o=s,i=n),(s=at.distancePointLine(r,t,e))<o&&(o=s,i=r),i},e}(nt),ot=function(){};ot.prototype.interfaces_=function(){return[]},ot.prototype.getClass=function(){return ot},ot.orientationIndex=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=n.x-e.x,s=n.y-e.y;return ot.signOfDet2x2(r,i,o,s)},ot.signOfDet2x2=function(t,e,n,r){var i=null,o=null,s=null;if(i=1,0===t||0===r)return 0===e||0===n?0:e>0?n>0?-i:i:n>0?i:-i;if(0===e||0===n)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,o=t,t=n,n=o,o=e,e=r,r=o):e<=-r?(i=-i,n=-n,r=-r):(o=t,t=-n,n=o,o=e,e=-r,r=o):r>0?-e<=r?(i=-i,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=r,r=o):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,o=-t,t=-n,n=o,o=-e,e=-r,r=o),t>0){if(!(n>0))return i;if(!(t<=n))return i}else{if(n>0)return-i;if(!(t>=n))return-i;i=-i,t=-t,n=-n}for(;;){if((r-=(s=Math.floor(n/t))*e)<0)return-i;if(r>e)return i;if(t>(n-=s*t)+n){if(e<r+r)return i}else{if(e>r+r)return-i;n=t-n,r=e-r,i=-i}if(0===r)return 0===n?0:-i;if(0===n)return i;if((e-=(s=Math.floor(t/n))*r)<0)return i;if(e>r)return-i;if(n>(t-=s*n)+t){if(r<e+e)return-i}else{if(r>e+e)return i;t=n-t,e=r-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var st=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};st.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var n=t.x,r=e.x;return n>r&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,l=ot.signOfDet2x2(i,o,s,a);if(0===l)return this._isPointOnSegment=!0,null;a<o&&(l=-l),l>0&&this._crossingCount++}},st.prototype.isPointInPolygon=function(){return this.getLocation()!==P.EXTERIOR},st.prototype.getLocation=function(){return this._isPointOnSegment?P.BOUNDARY:this._crossingCount%2==1?P.INTERIOR:P.EXTERIOR},st.prototype.isOnSegment=function(){return this._isPointOnSegment},st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.locatePointInRing=function(){if(arguments[0]instanceof S&&L(arguments[1],U)){for(var t=arguments[1],e=new st(arguments[0]),n=new S,r=new S,i=1;i<t.size();i++)if(t.getCoordinate(i,n),t.getCoordinate(i-1,r),e.countSegment(n,r),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof S&&arguments[1]instanceof Array){for(var o=arguments[1],s=new st(arguments[0]),a=1;a<o.length;a++){var l=o[a],u=o[a-1];if(s.countSegment(l,u),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var at=function(){},lt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.orientationIndex=function(t,e,n){return F.orientationIndex(t,e,n)},at.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,r=1;r<t.length-1;r++){var i=t[r].x-n,o=t[r+1].y;e+=i*(t[r-1].y-o)}return e/2}if(L(arguments[0],U)){var s=arguments[0],a=s.size();if(a<3)return 0;var l=new S,u=new S,c=new S;s.getCoordinate(0,u),s.getCoordinate(1,c);var h=u.x;c.x-=h;for(var p=0,f=1;f<a-1;f++)l.y=u.y,u.x=c.x,u.y=c.y,s.getCoordinate(f+1,c),c.x-=h,p+=u.x*(l.y-c.y);return p/2}},at.distanceLineLine=function(t,e,n,r){if(t.equals(e))return at.distancePointLine(t,n,r);if(n.equals(r))return at.distancePointLine(r,t,e);var i=!1;if(X.intersects(t,e,n,r)){var o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(0===o)i=!0;else{var s=(t.y-n.y)*(r.x-n.x)-(t.x-n.x)*(r.y-n.y),a=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/o,l=s/o;(l<0||l>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?A.min(at.distancePointLine(t,n,r),at.distancePointLine(e,n,r),at.distancePointLine(n,t,e),at.distancePointLine(r,t,e)):0},at.isPointInRing=function(t,e){return at.locatePointInRing(t,e)!==P.EXTERIOR},at.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new S;t.getCoordinate(0,r);for(var i=r.x,o=r.y,s=1;s<e;s++){t.getCoordinate(s,r);var a=r.x,l=r.y,u=a-i,c=l-o;n+=Math.sqrt(u*u+c*c),i=a,o=l}return n},at.isCCW=function(t){var e=t.length-1;if(e<3)throw new _("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,i=1;i<=e;i++){var o=t[i];o.y>n.y&&(n=o,r=i)}var s=r;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(n)&&s!==r);var a=r;do{a=(a+1)%e}while(t[a].equals2D(n)&&a!==r);var l=t[s],u=t[a];if(l.equals2D(n)||u.equals2D(n)||l.equals2D(u))return!1;var c=at.computeOrientation(l,n,u);return 0===c?l.x>u.x:c>0},at.locatePointInRing=function(t,e){return st.locatePointInRing(t,e)},at.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)},at.computeOrientation=function(t,e,n){return at.orientationIndex(t,e,n)},at.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new _("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var i=at.distancePointLine(t,e[r],e[r+1]);i<n&&(n=i)}return n}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var l=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),u=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/l;if(u<=0)return o.distance(s);if(u>=1)return o.distance(a);var c=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/l;return Math.abs(c)*Math.sqrt(l)}},at.isOnLine=function(t,e){for(var n=new it,r=1;r<e.length;r++){var i=e[r-1],o=e[r];if(n.computeIntersection(t,i,o),n.hasIntersection())return!0}return!1},lt.CLOCKWISE.get=function(){return-1},lt.RIGHT.get=function(){return at.CLOCKWISE},lt.COUNTERCLOCKWISE.get=function(){return 1},lt.LEFT.get=function(){return at.COUNTERCLOCKWISE},lt.COLLINEAR.get=function(){return 0},lt.STRAIGHT.get=function(){return at.COLLINEAR},Object.defineProperties(at,lt);var ut=function(){};ut.prototype.filter=function(t){},ut.prototype.interfaces_=function(){return[]},ut.prototype.getClass=function(){return ut};var ct=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},ht={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};ct.prototype.isGeometryCollection=function(){return this.getSortIndex()===ct.SORTINDEX_GEOMETRYCOLLECTION},ct.prototype.getFactory=function(){return this._factory},ct.prototype.getGeometryN=function(t){return this},ct.prototype.getArea=function(){return 0},ct.prototype.isRectangle=function(){return!1},ct.prototype.equals=function(){if(arguments[0]instanceof ct){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof ct))return!1;var n=e;return this.equalsExact(n)}},ct.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},ct.prototype.geometryChanged=function(){this.apply(ct.geometryChangedFilter)},ct.prototype.geometryChangedAction=function(){this._envelope=null},ct.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},ct.prototype.getLength=function(){return 0},ct.prototype.getNumGeometries=function(){return 1},ct.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,r)}},ct.prototype.getUserData=function(){return this._userData},ct.prototype.getSRID=function(){return this._SRID},ct.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},ct.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===ct.SORTINDEX_GEOMETRYCOLLECTION)throw new _("This method does not support GeometryCollection arguments")},ct.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},ct.prototype.norm=function(){var t=this.copy();return t.normalize(),t},ct.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},ct.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new X(this._envelope)},ct.prototype.setSRID=function(t){this._SRID=t},ct.prototype.setUserData=function(t){this._userData=t},ct.prototype.compare=function(t,e){for(var n=t.iterator(),r=e.iterator();n.hasNext()&&r.hasNext();){var i=n.next(),o=r.next(),s=i.compareTo(o);if(0!==s)return s}return n.hasNext()?1:r.hasNext()?-1:0},ct.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},ct.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===ct.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===ct.SORTINDEX_MULTIPOINT||this.getSortIndex()===ct.SORTINDEX_MULTILINESTRING||this.getSortIndex()===ct.SORTINDEX_MULTIPOLYGON},ct.prototype.interfaces_=function(){return[w,b,e]},ct.prototype.getClass=function(){return ct},ct.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},ct.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},ht.serialVersionUID.get=function(){return 0x799ea46522854c00},ht.SORTINDEX_POINT.get=function(){return 0},ht.SORTINDEX_MULTIPOINT.get=function(){return 1},ht.SORTINDEX_LINESTRING.get=function(){return 2},ht.SORTINDEX_LINEARRING.get=function(){return 3},ht.SORTINDEX_MULTILINESTRING.get=function(){return 4},ht.SORTINDEX_POLYGON.get=function(){return 5},ht.SORTINDEX_MULTIPOLYGON.get=function(){return 6},ht.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},ht.geometryChangedFilter.get=function(){return pt},Object.defineProperties(ct,ht);var pt=function(){};pt.interfaces_=function(){return[ut]},pt.filter=function(t){t.geometryChangedAction()};var ft=function(){};ft.prototype.filter=function(t){},ft.prototype.interfaces_=function(){return[]},ft.prototype.getClass=function(){return ft};var dt=function(){},gt={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};dt.prototype.isInBoundary=function(t){},dt.prototype.interfaces_=function(){return[]},dt.prototype.getClass=function(){return dt},gt.Mod2BoundaryNodeRule.get=function(){return mt},gt.EndPointBoundaryNodeRule.get=function(){return yt},gt.MultiValentEndPointBoundaryNodeRule.get=function(){return _t},gt.MonoValentEndPointBoundaryNodeRule.get=function(){return vt},gt.MOD2_BOUNDARY_RULE.get=function(){return new mt},gt.ENDPOINT_BOUNDARY_RULE.get=function(){return new yt},gt.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new _t},gt.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new vt},gt.OGC_SFS_BOUNDARY_RULE.get=function(){return dt.MOD2_BOUNDARY_RULE},Object.defineProperties(dt,gt);var mt=function(){};mt.prototype.isInBoundary=function(t){return t%2==1},mt.prototype.interfaces_=function(){return[dt]},mt.prototype.getClass=function(){return mt};var yt=function(){};yt.prototype.isInBoundary=function(t){return t>0},yt.prototype.interfaces_=function(){return[dt]},yt.prototype.getClass=function(){return yt};var _t=function(){};_t.prototype.isInBoundary=function(t){return t>1},_t.prototype.interfaces_=function(){return[dt]},_t.prototype.getClass=function(){return _t};var vt=function(){};vt.prototype.isInBoundary=function(t){return 1===t},vt.prototype.interfaces_=function(){return[dt]},vt.prototype.getClass=function(){return vt};var xt=function(){};xt.prototype.add=function(){},xt.prototype.addAll=function(){},xt.prototype.isEmpty=function(){},xt.prototype.iterator=function(){},xt.prototype.size=function(){},xt.prototype.toArray=function(){},xt.prototype.remove=function(){},(n.prototype=new Error).name="IndexOutOfBoundsException";var bt=function(){};bt.prototype.hasNext=function(){},bt.prototype.next=function(){},bt.prototype.remove=function(){};var wt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(xt);(r.prototype=new Error).name="NoSuchElementException";var Et=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof xt&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,xt]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},e.prototype.iterator=function(){return new St(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new n;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,n=0,r=this.array_.length;n<r;n++)if(this.array_[n]===t){this.array_.splice(n,1),e=!0;break}return e},e}(wt),St=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new r;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(bt),It=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.ensureCapacity(n.length),this.add(n,r)}}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={coordArrayType:{configurable:!0}};return n.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],n=!1,r=arguments[0].iterator();r.hasNext();)this.add(r.next(),e),n=!0;return n}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),n=0;n<this.size();n++)e.add(n,this.get(n).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){if(1===arguments.length){var e=arguments[0];t.prototype.add.call(this,e)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],r=arguments[1];return this.add(n,r,!0),!0}if(arguments[0]instanceof S&&"boolean"==typeof arguments[1]){var i=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(i))return null;t.prototype.add.call(this,i)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var o=arguments[0],s=arguments[1];return this.add(o,s),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var a=arguments[0],l=arguments[1];if(arguments[2])for(var u=0;u<a.length;u++)this.add(a[u],l);else for(var c=a.length-1;c>=0;c--)this.add(a[c],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof S){var h=arguments[0],p=arguments[1];if(!arguments[2]){var f=this.size();if(f>0){if(h>0&&this.get(h-1).equals2D(p))return null;if(h<f&&this.get(h).equals2D(p))return null}}t.prototype.add.call(this,h,p)}}else if(4===arguments.length){var d=arguments[0],g=arguments[1],m=arguments[2],y=arguments[3],_=1;m>y&&(_=-1);for(var v=m;v!==y;v+=_)this.add(d[v],g);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new S(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(Et),Ct=function(){},Tt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Tt.ForwardComparator.get=function(){return Pt},Tt.BidirectionalComparator.get=function(){return Mt},Tt.coordArrayType.get=function(){return new Array(0).fill(null)},Ct.prototype.interfaces_=function(){return[]},Ct.prototype.getClass=function(){return Ct},Ct.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},Ct.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(Ct.indexOf(r,e)<0)return r}return null},Ct.scroll=function(t,e){var n=Ct.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);q.arraycopy(t,n,r,0,t.length-n),q.arraycopy(t,0,r,t.length-n,n),q.arraycopy(r,0,t,0,t.length)},Ct.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];if(r===i)return!0;if(null===r||null===i)return!1;if(r.length!==i.length)return!1;for(var s=0;s<r.length;s++)if(0!==o.compare(r[s],i[s]))return!1;return!0}},Ct.intersection=function(t,e){for(var n=new It,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()},Ct.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},Ct.removeRepeatedPoints=function(t){return Ct.hasRepeatedPoints(t)?new It(t,!1).toCoordinateArray():t},Ct.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),r=0;r<=n;r++){var i=t[r];t[r]=t[e-r],t[e-r]=i}},Ct.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var r=new Array(e).fill(null);if(0===e)return r;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(r[i++]=t[o]);return r},Ct.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new S(t[n]);return e}if(5===arguments.length)for(var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],l=0;l<a;l++)o[s+l]=new S(r[i+l])},Ct.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=e[t.length-n-1];if(0!==r.compareTo(i))return!1}return!0},Ct.envelope=function(t){for(var e=new X,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},Ct.toCoordinateArray=function(t){return t.toArray(Ct.coordArrayType)},Ct.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},Ct.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},Ct.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,r=t[e].compareTo(t[n]);if(0!==r)return r}return 1},Ct.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var r=t[n].compareTo(e[n]);if(0!==r)return r;n++}return n<e.length?-1:n<t.length?1:0},Ct.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(null===e||e.compareTo(t[n])>0)&&(e=t[n]);return e},Ct.extract=function(t,e,n){e=A.clamp(e,0,t.length);var r=(n=A.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var i=new Array(r).fill(null);if(0===r)return i;for(var o=0,s=e;s<=n;s++)i[o++]=t[s];return i},Object.defineProperties(Ct,Tt);var Pt=function(){};Pt.prototype.compare=function(t,e){return Ct.compare(t,e)},Pt.prototype.interfaces_=function(){return[E]},Pt.prototype.getClass=function(){return Pt};var Mt=function(){};Mt.prototype.compare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;var i=Ct.compare(n,r);return Ct.isEqualReversed(n,r)?0:i},Mt.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;for(var i=Ct.increasingDirection(n),o=Ct.increasingDirection(r),s=i>0?0:n.length-1,a=o>0?0:n.length-1,l=0;l<n.length;l++){var u=n[s].compareTo(r[a]);if(0!==u)return u;s+=i,a+=o}return 0},Mt.prototype.interfaces_=function(){return[E]},Mt.prototype.getClass=function(){return Mt};var Lt=function(){};Lt.prototype.get=function(){},Lt.prototype.put=function(){},Lt.prototype.size=function(){},Lt.prototype.values=function(){},Lt.prototype.entrySet=function(){};var At=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Lt);(i.prototype=new Error).name="OperationNotSupported",(o.prototype=new xt).contains=function(){};var kt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof xt&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++)if(this.array_[e]===t)return!0;return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new Nt(this)},e}(o),Nt=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new r;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new i},e}(bt),Dt=0;(h.prototype=new At).get=function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null},h.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:Dt,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,r,i=this.root_;do{if(n=i,(r=t.compareTo(i.key))<0)i=i.left;else{if(!(r>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:n,color:Dt,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},h.prototype.fixAfterInsertion=function(t){for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(a(t)===u(a(a(t)))){var e=c(a(a(t)));1===s(e)?(l(a(t),Dt),l(e,Dt),l(a(a(t)),1),t=a(a(t))):(t===c(a(t))&&(t=a(t),this.rotateLeft(t)),l(a(t),Dt),l(a(a(t)),1),this.rotateRight(a(a(t))))}else{var n=u(a(a(t)));1===s(n)?(l(a(t),Dt),l(n,Dt),l(a(a(t)),1),t=a(a(t))):(t===u(a(t))&&(t=a(t),this.rotateRight(t)),l(a(t),Dt),l(a(a(t)),1),this.rotateLeft(a(a(t))))}this.root_.color=Dt},h.prototype.values=function(){var t=new Et,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=h.successor(e));)t.add(e.value);return t},h.prototype.entrySet=function(){var t=new kt,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=h.successor(e));)t.add(e);return t},h.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},h.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},h.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},h.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var n=t.parent,r=t;null!==n&&r===n.right;)r=n,n=n.parent;return n},h.prototype.size=function(){return this.size_};var Rt=function(){};Rt.prototype.interfaces_=function(){return[]},Rt.prototype.getClass=function(){return Rt},p.prototype=new o,(f.prototype=new p).contains=function(t){for(var e=0,n=this.array_.length;e<n;e++)if(0===this.array_[e].compareTo(t))return!0;return!1},f.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.array_.length;e<n;e++)if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0;return this.array_.push(t),!0},f.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},f.prototype.remove=function(t){throw new i},f.prototype.size=function(){return this.array_.length},f.prototype.isEmpty=function(){return 0===this.array_.length},f.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},f.prototype.iterator=function(){return new Ot(this)};var Ot=function(t){this.treeSet_=t,this.position_=0};Ot.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new r;return this.treeSet_.array_[this.position_++]},Ot.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Ot.prototype.remove=function(){throw new i};var zt=function(){};zt.sort=function(){var t,e,n,r,i=arguments[0];if(1===arguments.length)r=function(t,e){return t.compareTo(e)},i.sort(r);else if(2===arguments.length)n=arguments[1],r=function(t,e){return n.compare(t,e)},i.sort(r);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),n=arguments[3],r=function(t,e){return n.compare(t,e)},e.sort(r),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},zt.asList=function(t){for(var e=new Et,n=0,r=t.length;n<r;n++)e.add(t[n]);return e};var Ft=function(){},Bt={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};Bt.P.get=function(){return 0},Bt.L.get=function(){return 1},Bt.A.get=function(){return 2},Bt.FALSE.get=function(){return-1},Bt.TRUE.get=function(){return-2},Bt.DONTCARE.get=function(){return-3},Bt.SYM_FALSE.get=function(){return"F"},Bt.SYM_TRUE.get=function(){return"T"},Bt.SYM_DONTCARE.get=function(){return"*"},Bt.SYM_P.get=function(){return"0"},Bt.SYM_L.get=function(){return"1"},Bt.SYM_A.get=function(){return"2"},Ft.prototype.interfaces_=function(){return[]},Ft.prototype.getClass=function(){return Ft},Ft.toDimensionSymbol=function(t){switch(t){case Ft.FALSE:return Ft.SYM_FALSE;case Ft.TRUE:return Ft.SYM_TRUE;case Ft.DONTCARE:return Ft.SYM_DONTCARE;case Ft.P:return Ft.SYM_P;case Ft.L:return Ft.SYM_L;case Ft.A:return Ft.SYM_A}throw new _("Unknown dimension value: "+t)},Ft.toDimensionValue=function(t){switch(R.toUpperCase(t)){case Ft.SYM_FALSE:return Ft.FALSE;case Ft.SYM_TRUE:return Ft.TRUE;case Ft.SYM_DONTCARE:return Ft.DONTCARE;case Ft.SYM_P:return Ft.P;case Ft.SYM_L:return Ft.L;case Ft.SYM_A:return Ft.A}throw new _("Unknown dimension symbol: "+t)},Object.defineProperties(Ft,Bt);var Ut=function(){};Ut.prototype.filter=function(t){},Ut.prototype.interfaces_=function(){return[]},Ut.prototype.getClass=function(){return Ut};var Vt=function(){};Vt.prototype.filter=function(t,e){},Vt.prototype.isDone=function(){},Vt.prototype.isGeometryChanged=function(){},Vt.prototype.interfaces_=function(){return[]},Vt.prototype.getClass=function(){return Vt};var jt=function(t){function e(e,n){if(t.call(this,n),this._geometries=e||[],t.hasNullElements(this._geometries))throw new _("geometries must not contain null elements")}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new X,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this._geometries.length;n++)for(var r=this._geometries[n].getCoordinates(),i=0;i<r.length;i++)t[++e]=r[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._geometries.length!==r._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(r._geometries[i],n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();zt.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=Ft.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=Ft.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new f(zt.asList(this._geometries)),n=new f(zt.asList(t._geometries));return this.compare(e,n)}if(2===arguments.length){for(var r=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var l=this.getGeometryN(a),u=i.getGeometryN(a),c=l.compareToSameClass(u,r);if(0!==c)return c;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){if(L(arguments[0],ft))for(var t=arguments[0],e=0;e<this._geometries.length;e++)this._geometries[e].apply(t);else if(L(arguments[0],Vt)){var n=arguments[0];if(0===this._geometries.length)return null;for(var r=0;r<this._geometries.length&&(this._geometries[r].apply(n),!n.isDone());r++);n.isGeometryChanged()&&this.geometryChanged()}else if(L(arguments[0],Ut)){var i=arguments[0];i.filter(this);for(var o=0;o<this._geometries.length;o++)this._geometries[o].apply(i)}else if(L(arguments[0],ut)){var s=arguments[0];s.filter(this);for(var a=0;a<this._geometries.length;a++)this._geometries[a].apply(s)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),et.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var n=0;n<this._geometries.length;n++)e._geometries[n]=this._geometries[n].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,n),e}(ct),Gt=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ct.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Ft.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[t-1-n]=this._geometries[n].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new qt(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Rt]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,n),e}(jt),qt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=dt.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._geom=n,this._geomFact=n.getFactory(),this._bnRule=r}};qt.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},qt.prototype.getBoundary=function(){return this._geom instanceof Wt?this.boundaryLineString(this._geom):this._geom instanceof Gt?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},qt.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},qt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},qt.prototype.computeBoundaryCoordinates=function(t){var e=new Et;this._endpointMap=new h;for(var n=0;n<t.getNumGeometries();n++){var r=t.getGeometryN(n);0!==r.getNumPoints()&&(this.addEndpoint(r.getCoordinateN(0)),this.addEndpoint(r.getCoordinateN(r.getNumPoints()-1)))}for(var i=this._endpointMap.entrySet().iterator();i.hasNext();){var o=i.next(),s=o.getValue().count;this._bnRule.isInBoundary(s)&&e.add(o.getKey())}return Ct.toCoordinateArray(e)},qt.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new $t,this._endpointMap.put(t,e)),e.count++},qt.prototype.interfaces_=function(){return[]},qt.prototype.getClass=function(){return qt},qt.getBoundary=function(){return 1===arguments.length?new qt(arguments[0]).getBoundary():2===arguments.length?new qt(arguments[0],arguments[1]).getBoundary():void 0};var $t=function(){this.count=null};$t.prototype.interfaces_=function(){return[]},$t.prototype.getClass=function(){return $t};var Xt=function(){},Zt={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Xt.prototype.interfaces_=function(){return[]},Xt.prototype.getClass=function(){return Xt},Xt.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r<e;r++)n[r]=t;return String(n)},Xt.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new function(){},n=new function(){}(e);return t.printStackTrace(n),e.toString()}if(2===arguments.length){for(var r=arguments[1],i="",o=new function(){}(new function(){}(Xt.getStackTrace(arguments[0]))),s=0;s<r;s++)try{i+=o.readLine()+Xt.NEWLINE}catch(t){if(!(t instanceof d))throw t;et.shouldNeverReachHere()}return i}},Xt.split=function(t,e){for(var n=e.length,r=new Et,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);r.add(s),o=(i=i.substring(o+n)).indexOf(e)}i.length>0&&r.add(i);for(var a=new Array(r.size()).fill(null),l=0;l<a.length;l++)a[l]=r.get(l);return a},Xt.toString=function(){if(1===arguments.length){var t=arguments[0];return Xt.SIMPLE_ORDINATE_FORMAT.format(t)}},Xt.spaces=function(t){return Xt.chars(" ",t)},Zt.NEWLINE.get=function(){return q.getProperty("line.separator")},Zt.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(Xt,Zt);var Yt=function(){};Yt.prototype.interfaces_=function(){return[]},Yt.prototype.getClass=function(){return Yt},Yt.copyCoord=function(t,e,n,r){for(var i=Math.min(t.getDimension(),n.getDimension()),o=0;o<i;o++)n.setOrdinate(r,o,t.getOrdinate(e,o))},Yt.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,U.X)===t.getOrdinate(e-1,U.X)&&t.getOrdinate(0,U.Y)===t.getOrdinate(e-1,U.Y)},Yt.isEqual=function(t,e){var n=t.size();if(n!==e.size())return!1;for(var r=Math.min(t.getDimension(),e.getDimension()),i=0;i<n;i++)for(var o=0;o<r;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(!(t.getOrdinate(i,o)===e.getOrdinate(i,o)||v.isNaN(s)&&v.isNaN(a)))return!1}return!0},Yt.extend=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();if(Yt.copy(e,0,r,0,i),i>0)for(var o=i;o<n;o++)Yt.copy(e,i-1,r,o,1);return r},Yt.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)Yt.swap(t,r,e-r)},Yt.swap=function(t,e,n){if(e===n)return null;for(var r=0;r<t.getDimension();r++){var i=t.getOrdinate(e,r);t.setOrdinate(e,r,t.getOrdinate(n,r)),t.setOrdinate(n,r,i)}},Yt.copy=function(t,e,n,r,i){for(var o=0;o<i;o++)Yt.copyCoord(t,e+o,n,r+o)},Yt.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),r=new N;r.append("(");for(var i=0;i<e;i++){i>0&&r.append(" ");for(var o=0;o<n;o++)o>0&&r.append(","),r.append(Xt.toString(t.getOrdinate(i,o)))}return r.append(")"),r.toString()}},Yt.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Yt.createClosedRing(t,e,4):e.getOrdinate(0,U.X)===e.getOrdinate(n-1,U.X)&&e.getOrdinate(0,U.Y)===e.getOrdinate(n-1,U.Y)?e:Yt.createClosedRing(t,e,n+1)},Yt.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Yt.copy(e,0,r,0,i);for(var o=i;o<n;o++)Yt.copy(e,0,r,o,1);return r};var Wt=function(t){function e(e,n){t.call(this,n),this._points=null,this.init(e)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new X:this._points.expandEnvelope(new X)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._points.size()!==r._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),r._points.getCoordinate(i),n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<Math.trunc(this._points.size()/2);t++){var e=this._points.size()-1-t;if(!this._points.getCoordinate(t).equals(this._points.getCoordinate(e)))return this._points.getCoordinate(t).compareTo(this._points.getCoordinate(e))>0&&Yt.reverse(this._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Ft.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return at.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return Yt.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e<this._points.size()&&n<t._points.size();){var r=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));if(0!==r)return r;e++,n++}return e<this._points.size()?1:n<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(L(arguments[0],ft))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(L(arguments[0],Vt)){var n=arguments[0];if(0===this._points.size())return null;for(var r=0;r<this._points.size()&&(n.filter(this._points,r),!n.isDone());r++);n.isGeometryChanged()&&this.geometryChanged()}else(L(arguments[0],Ut)||L(arguments[0],ut))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return new qt(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new _("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[Rt]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,n),e}(ct),Ht=function(){};Ht.prototype.interfaces_=function(){return[]},Ht.prototype.getClass=function(){return Ht};var Kt=function(t){function e(e,n){t.call(this,n),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new X;var t=new X;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),n))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return Ft.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(L(arguments[0],ft)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(L(arguments[0],Vt)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else(L(arguments[0],Ut)||L(arguments[0],ut))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),et.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[Ht]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,n),e}(ct),Jt=function(){};Jt.prototype.interfaces_=function(){return[]},Jt.prototype.getClass=function(){return Jt};var Qt=function(t){function e(e,n,r){if(t.call(this,r),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===n&&(n=[]),t.hasNullElements(n))throw new _("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(n))throw new _("shell is empty but holes are not");this._shell=e,this._holes=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=this._shell.getCoordinates(),r=0;r<n.length;r++)t[++e]=n[r];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(at.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(at.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),n=0;n<5;n++){var r=t.getX(n);if(r!==e.getMinX()&&r!==e.getMaxX())return!1;var i=t.getY(n);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var l=t.getX(a),u=t.getY(a);if(l!==o==(u!==s))return!1;o=l,s=u}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e,i=this._shell,o=r._shell;if(!i.equalsExact(o,n))return!1;if(this._holes.length!==r._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(r._holes[s],n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);zt.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(e.isEmpty())return null;var r=new Array(e.getCoordinates().length-1).fill(null);q.arraycopy(e.getCoordinates(),0,r,0,r.length);var i=Ct.minCoordinate(e.getCoordinates());Ct.scroll(r,i),q.arraycopy(r,0,e.getCoordinates(),0,r.length),e.getCoordinates()[r.length]=r[0],at.isCCW(e.getCoordinates())===n&&Ct.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,n=t._shell;return e.compareToSameClass(n)}if(2===arguments.length){var r=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,r);if(0!==a)return a;for(var l=this.getNumInteriorRing(),u=i.getNumInteriorRing(),c=0;c<l&&c<u;){var h=this.getInteriorRingN(c),p=i.getInteriorRingN(c),f=h.compareToSameClass(p,r);if(0!==f)return f;c++}return c<l?1:c<u?-1:0}},e.prototype.apply=function(t){if(L(t,ft)){this._shell.apply(t);for(var e=0;e<this._holes.length;e++)this._holes[e].apply(t)}else if(L(t,Vt)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(this._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(L(t,Ut))t.filter(this);else if(L(t,ut)){t.filter(this),this._shell.apply(t);for(var r=0;r<this._holes.length;r++)this._holes[r].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var n=0;n<this._holes.length;n++)e._holes[n]=this._holes[n].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),n=new Array(this._holes.length).fill(null),r=0;r<n.length;r++)n[r]=this._holes[r].copy();return new e(t,n,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[Jt]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,n),e}(ct),te=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ct.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return Ft.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Ht]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,n),e}(jt),ee=function(t){function e(e,n){e instanceof S&&n instanceof ye&&(e=n.getCoordinateSequenceFactory().create(e)),t.call(this,e,n),this.validateConstruction()}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ct.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return Ft.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return Yt.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new _("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new _("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(Wt),ne=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return ct.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new Et,e=0;e<this._geometries.length;e++)for(var n=this._geometries[e].getBoundary(),r=0;r<n.getNumGeometries();r++)t.add(n.getGeometryN(r));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Jt]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,n),e}(jt),re=function(t){this._factory=t||null,this._isUserDataCopied=!1},ie={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};re.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},re.prototype.edit=function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},re.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof jt?this.editGeometryCollection(t,e):t instanceof Qt?this.editPolygon(t,e):t instanceof Kt||t instanceof Wt?e.edit(t,this._factory):(et.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},re.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new Et,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);null===o||o.isEmpty()||r.add(o)}return n.getClass()===te?this._factory.createMultiPoint(r.toArray([])):n.getClass()===Gt?this._factory.createMultiLineString(r.toArray([])):n.getClass()===ne?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray([]))},re.prototype.editPolygon=function(t,e){var n=e.edit(t,this._factory);if(null===n&&(n=this._factory.createPolygon(null)),n.isEmpty())return n;var r=this.edit(n.getExteriorRing(),e);if(null===r||r.isEmpty())return this._factory.createPolygon();for(var i=new Et,o=0;o<n.getNumInteriorRing();o++){var s=this.edit(n.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(r,i.toArray([]))},re.prototype.interfaces_=function(){return[]},re.prototype.getClass=function(){return re},re.GeometryEditorOperation=function(){},ie.NoOpGeometryOperation.get=function(){return oe},ie.CoordinateOperation.get=function(){return se},ie.CoordinateSequenceOperation.get=function(){return ae},Object.defineProperties(re,ie);var oe=function(){};oe.prototype.edit=function(t,e){return t},oe.prototype.interfaces_=function(){return[re.GeometryEditorOperation]},oe.prototype.getClass=function(){return oe};var se=function(){};se.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof ee?e.createLinearRing(n):t instanceof Wt?e.createLineString(n):t instanceof Kt?n.length>0?e.createPoint(n[0]):e.createPoint():t},se.prototype.interfaces_=function(){return[re.GeometryEditorOperation]},se.prototype.getClass=function(){return se};var ae=function(){};ae.prototype.edit=function(t,e){return t instanceof ee?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Wt?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Kt?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},ae.prototype.interfaces_=function(){return[re.GeometryEditorOperation]},ae.prototype.getClass=function(){return ae};var le=function(){if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var e=0;e<t;e++)this._coordinates[e]=new S}else if(L(arguments[0],U)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var r=0;r<this._coordinates.length;r++)this._coordinates[r]=n.getCoordinateCopy(r)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var i=arguments[0],o=arguments[1];this._coordinates=i,this._dimension=o,null===i&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var s=arguments[0],a=arguments[1];this._coordinates=new Array(s).fill(null),this._dimension=a;for(var l=0;l<s;l++)this._coordinates[l]=new S}},ue={serialVersionUID:{configurable:!0}};le.prototype.setOrdinate=function(t,e,n){switch(e){case U.X:this._coordinates[t].x=n;break;case U.Y:this._coordinates[t].y=n;break;case U.Z:this._coordinates[t].z=n;break;default:throw new _("invalid ordinateIndex")}},le.prototype.size=function(){return this._coordinates.length},le.prototype.getOrdinate=function(t,e){switch(e){case U.X:return this._coordinates[t].x;case U.Y:return this._coordinates[t].y;case U.Z:return this._coordinates[t].z}return v.NaN},le.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],n=arguments[1];n.x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z}},le.prototype.getCoordinateCopy=function(t){return new S(this._coordinates[t])},le.prototype.getDimension=function(){return this._dimension},le.prototype.getX=function(t){return this._coordinates[t].x},le.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new le(t,this._dimension)},le.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},le.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new le(t,this._dimension)},le.prototype.toString=function(){if(this._coordinates.length>0){var t=new N(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},le.prototype.getY=function(t){return this._coordinates[t].y},le.prototype.toCoordinateArray=function(){return this._coordinates},le.prototype.interfaces_=function(){return[U,e]},le.prototype.getClass=function(){return le},ue.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(le,ue);var ce=function(){},he={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ce.prototype.readResolve=function(){return ce.instance()},ce.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new le(arguments[0]);if(L(arguments[0],U))return new le(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new le(t):new le(t,e)}},ce.prototype.interfaces_=function(){return[T,e]},ce.prototype.getClass=function(){return ce},ce.instance=function(){return ce.instanceObject},he.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},he.instanceObject.get=function(){return new ce},Object.defineProperties(ce,he);var pe=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new Et,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},e.prototype.entrySet=function(){var t=new kt;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(Lt),fe=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof ge){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}},de={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};fe.prototype.equals=function(t){if(!(t instanceof fe))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},fe.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new D(n).compareTo(new D(r))},fe.prototype.getScale=function(){return this._scale},fe.prototype.isFloating=function(){return this._modelType===fe.FLOATING||this._modelType===fe.FLOATING_SINGLE},fe.prototype.getType=function(){return this._modelType},fe.prototype.toString=function(){var t="UNKNOWN";return this._modelType===fe.FLOATING?t="Floating":this._modelType===fe.FLOATING_SINGLE?t="Floating-Single":this._modelType===fe.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},fe.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return v.isNaN(t)||this._modelType===fe.FLOATING_SINGLE?t:this._modelType===fe.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof S){var e=arguments[0];if(this._modelType===fe.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},fe.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===fe.FLOATING?t=16:this._modelType===fe.FLOATING_SINGLE?t=6:this._modelType===fe.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},fe.prototype.setScale=function(t){this._scale=Math.abs(t)},fe.prototype.interfaces_=function(){return[e,b]},fe.prototype.getClass=function(){return fe},fe.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},de.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},de.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(fe,de);var ge=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},me={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ge.prototype.readResolve=function(){return ge.nameToTypeMap.get(this._name)},ge.prototype.toString=function(){return this._name},ge.prototype.interfaces_=function(){return[e]},ge.prototype.getClass=function(){return ge},me.serialVersionUID.get=function(){return-552860263173159e4},me.nameToTypeMap.get=function(){return new pe},Object.defineProperties(ge,me),fe.Type=ge,fe.FIXED=new ge("FIXED"),fe.FLOATING=new ge("FLOATING"),fe.FLOATING_SINGLE=new ge("FLOATING SINGLE");var ye=function t(){this._precisionModel=new fe,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?L(arguments[0],T)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof fe&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},_e={serialVersionUID:{configurable:!0}};ye.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new S(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new S(t.getMinX(),t.getMinY()),new S(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new S(t.getMinX(),t.getMinY()),new S(t.getMinX(),t.getMaxY()),new S(t.getMaxX(),t.getMaxY()),new S(t.getMaxX(),t.getMinY()),new S(t.getMinX(),t.getMinY())]),null)},ye.prototype.createLineString=function(t){return t?t instanceof Array?new Wt(this.getCoordinateSequenceFactory().create(t),this):L(t,U)?new Wt(t,this):void 0:new Wt(this.getCoordinateSequenceFactory().create([]),this)},ye.prototype.createMultiLineString=function(){return 0===arguments.length?new Gt(null,this):1===arguments.length?new Gt(arguments[0],this):void 0},ye.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(r=!0)}if(null===e)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(ye.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Qt)return this.createMultiPolygon(ye.toPolygonArray(t));if(a instanceof Wt)return this.createMultiLineString(ye.toLineStringArray(t));if(a instanceof Kt)return this.createMultiPoint(ye.toPointArray(t));et.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},ye.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},ye.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof S){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(L(arguments[0],U))return new Kt(arguments[0],this)}},ye.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},ye.prototype.createPolygon=function(){if(0===arguments.length)return new Qt(null,null,this);if(1===arguments.length){if(L(arguments[0],U)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof ee){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length)return new Qt(arguments[0],arguments[1],this)},ye.prototype.getSRID=function(){return this._SRID},ye.prototype.createGeometryCollection=function(){return 0===arguments.length?new jt(null,this):1===arguments.length?new jt(arguments[0],this):void 0},ye.prototype.createGeometry=function(t){return new re(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},ye.prototype.getPrecisionModel=function(){return this._precisionModel},ye.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(L(arguments[0],U))return new ee(arguments[0],this)}},ye.prototype.createMultiPolygon=function(){return 0===arguments.length?new ne(null,this):1===arguments.length?new ne(arguments[0],this):void 0},ye.prototype.createMultiPoint=function(){if(0===arguments.length)return new te(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new te(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(L(arguments[0],U)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var n=new Array(e.size()).fill(null),r=0;r<e.size();r++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());Yt.copy(e,r,i,0,1),n[r]=this.createPoint(i)}return this.createMultiPoint(n)}}},ye.prototype.interfaces_=function(){return[e]},ye.prototype.getClass=function(){return ye},ye.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.getDefaultCoordinateSequenceFactory=function(){return ce.instance()},ye.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},_e.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(ye,_e);var ve=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],xe=function(t){this.geometryFactory=t||new ye};xe.prototype.read=function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!be[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==ve.indexOf(n)?be[n].apply(this,[e.coordinates]):"GeometryCollection"===n?be[n].apply(this,[e.geometries]):be[n].apply(this,[e])},xe.prototype.write=function(t){var e=t.getGeometryType();if(!we[e])throw new Error("Geometry is not supported");return we[e].apply(this,[t])};var be={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var r=t.geometry.type;if(!be[r])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=be.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n<t.features.length;++n)e.features.push(this.read(t.features[n]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(new S(r[0],r[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new S(t[0],t[1]),new S(t[2],t[1]),new S(t[2],t[3]),new S(t[0],t[3]),new S(t[0],t[1])])},Point:function(t){var e=new S(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(be.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=be.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(be.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=be.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),r=[],i=1;i<t.length;++i){var o=t[i],s=be.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);r.push(a)}return this.geometryFactory.createPolygon(n,r)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(be.Polygon.apply(this,[r]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(this.read(r))}return this.geometryFactory.createGeometryCollection(e)}},we={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:we.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=we.Point.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),r=0;r<n.length;++r){var i=n[r];e.push(we.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=we.LineString.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=we.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes[r],o=we.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=we.Polygon.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=r.getGeometryType();e.push(we[i].apply(this,[r]))}return{type:"GeometryCollection",geometries:e}}},Ee=function(t){this.geometryFactory=t||new ye,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new xe(this.geometryFactory)};Ee.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===fe.FIXED&&this.reducePrecision(e),e},Ee.prototype.reducePrecision=function(t){var e,n;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,n=t.points.length;e<n;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,n=t.geometries.length;e<n;e++)this.reducePrecision(t.geometries[e])};var Se=function(){this.parser=new xe(this.geometryFactory)};Se.prototype.write=function(t){return this.parser.write(t)};var Ie=function(){},Ce={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Ie.prototype.interfaces_=function(){return[]},Ie.prototype.getClass=function(){return Ie},Ie.opposite=function(t){return t===Ie.LEFT?Ie.RIGHT:t===Ie.RIGHT?Ie.LEFT:t},Ce.ON.get=function(){return 0},Ce.LEFT.get=function(){return 1},Ce.RIGHT.get=function(){return 2},Object.defineProperties(Ie,Ce),(g.prototype=new Error).name="EmptyStackException",(m.prototype=new wt).add=function(t){return this.array_.push(t),!0},m.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},m.prototype.push=function(t){return this.array_.push(t),t},m.prototype.pop=function(t){if(0===this.array_.length)throw new g;return this.array_.pop()},m.prototype.peek=function(){if(0===this.array_.length)throw new g;return this.array_[this.array_.length-1]},m.prototype.empty=function(){return 0===this.array_.length},m.prototype.isEmpty=function(){return this.empty()},m.prototype.search=function(t){return this.array_.indexOf(t)},m.prototype.size=function(){return this.array_.length},m.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t};var Te=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Te.prototype.getCoordinate=function(){return this._minCoord},Te.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n},Te.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();et.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],r=at.computeOrientation(this._minCoord,n,e),i=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&r===at.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&r===at.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},Te.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var r=Ie.LEFT;return n[e].y<n[e+1].y&&(r=Ie.RIGHT),r},Te.prototype.getEdge=function(){return this._orientedDe},Te.prototype.checkForRightmostCoordinate=function(t){for(var e=t.getEdge().getCoordinates(),n=0;n<e.length-1;n++)(null===this._minCoord||e[n].x>this._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])},Te.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Te.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}et.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===Ie.LEFT&&(this._orientedDe=this._minDe.getSym())},Te.prototype.interfaces_=function(){return[]},Te.prototype.getClass=function(){return Te};var Pe=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new S(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(Q),Me=function(){this.array_=[]};Me.prototype.addLast=function(t){this.array_.push(t)},Me.prototype.removeFirst=function(){return this.array_.shift()},Me.prototype.isEmpty=function(){return 0===this.array_.length};var Le=function(){this._finder=null,this._dirEdgeList=new Et,this._nodes=new Et,this._rightMostCoord=null,this._env=null,this._finder=new Te};Le.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},Le.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Le.prototype.computeNodeDepth=function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var r=n.next();if(r.isVisited()||r.getSym().isVisited()){e=r;break}}if(null===e)throw new Pe("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},Le.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(Ie.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},Le.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Le.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(Ie.RIGHT)>=1&&e.getDepth(Ie.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},Le.prototype.computeDepths=function(t){var e=new kt,n=new Me,r=t.getNode();for(n.addLast(r),e.add(r),t.setVisited(!0);!n.isEmpty();){var i=n.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},Le.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},Le.prototype.getEnvelope=function(){if(null===this._env){for(var t=new X,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;r<n.length-1;r++)t.expandToInclude(n[r]);this._env=t}return this._env},Le.prototype.addReachable=function(t){var e=new m;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},Le.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(Ie.LEFT,t.getDepth(Ie.RIGHT)),e.setDepth(Ie.RIGHT,t.getDepth(Ie.LEFT))},Le.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var r=n.next();this._dirEdgeList.add(r);var i=r.getSym().getNode();i.isVisited()||e.push(i)}},Le.prototype.getNodes=function(){return this._nodes},Le.prototype.getDirectedEdges=function(){return this._dirEdgeList},Le.prototype.interfaces_=function(){return[b]},Le.prototype.getClass=function(){return Le};var Ae=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var n=arguments[0];this.init(1),this.location[Ie.ON]=n}else if(arguments[0]instanceof t){var r=arguments[0];if(this.init(r.location.length),null!==r)for(var i=0;i<this.location.length;i++)this.location[i]=r.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[Ie.ON]=o,this.location[Ie.LEFT]=s,this.location[Ie.RIGHT]=a}};Ae.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},Ae.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==P.NONE)return!1;return!0},Ae.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===P.NONE&&(this.location[e]=t)},Ae.prototype.isLine=function(){return 1===this.location.length},Ae.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[Ie.ON]=this.location[Ie.ON],e[Ie.LEFT]=P.NONE,e[Ie.RIGHT]=P.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===P.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},Ae.prototype.getLocations=function(){return this.location},Ae.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[Ie.LEFT];this.location[Ie.LEFT]=this.location[Ie.RIGHT],this.location[Ie.RIGHT]=t},Ae.prototype.toString=function(){var t=new N;return this.location.length>1&&t.append(P.toLocationSymbol(this.location[Ie.LEFT])),t.append(P.toLocationSymbol(this.location[Ie.ON])),this.location.length>1&&t.append(P.toLocationSymbol(this.location[Ie.RIGHT])),t.toString()},Ae.prototype.setLocations=function(t,e,n){this.location[Ie.ON]=t,this.location[Ie.LEFT]=e,this.location[Ie.RIGHT]=n},Ae.prototype.get=function(t){return t<this.location.length?this.location[t]:P.NONE},Ae.prototype.isArea=function(){return this.location.length>1},Ae.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===P.NONE)return!0;return!1},Ae.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(Ie.ON,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.location[e]=n}},Ae.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(P.NONE)},Ae.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},Ae.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},Ae.prototype.interfaces_=function(){return[]},Ae.prototype.getClass=function(){return Ae};var ke=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new Ae(e),this.elt[1]=new Ae(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.elt[0]=new Ae(n.elt[0]),this.elt[1]=new Ae(n.elt[1])}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.elt[0]=new Ae(P.NONE),this.elt[1]=new Ae(P.NONE),this.elt[r].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new Ae(o,s,a),this.elt[1]=new Ae(o,s,a)}else if(4===arguments.length){var l=arguments[0],u=arguments[1],c=arguments[2],h=arguments[3];this.elt[0]=new Ae(P.NONE,P.NONE,P.NONE),this.elt[1]=new Ae(P.NONE,P.NONE,P.NONE),this.elt[l].setLocations(u,c,h)}};ke.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},ke.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},ke.prototype.isNull=function(t){return this.elt[t].isNull()},ke.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},ke.prototype.isLine=function(t){return this.elt[t].isLine()},ke.prototype.merge=function(t){for(var e=0;e<2;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new Ae(t.elt[e]):this.elt[e].merge(t.elt[e])},ke.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},ke.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(Ie.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},ke.prototype.toString=function(){var t=new N;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},ke.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},ke.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},ke.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(Ie.ON,e)}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this.elt[n].setLocation(r,i)}},ke.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},ke.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},ke.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new Ae(this.elt[t].location[0]))},ke.prototype.interfaces_=function(){return[]},ke.prototype.getClass=function(){return ke},ke.toLineLabel=function(t){for(var e=new ke(P.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var Ne=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new Et,this._pts=new Et,this._label=new ke(P.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Et,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};Ne.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=at.isCCW(this._ring.getCoordinates())},Ne.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},Ne.prototype.computePoints=function(t){this._startDe=t;var e=t,n=!0;do{if(null===e)throw new Pe("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new Pe("Directed Edge visited twice during ring-building at "+e.getCoordinate());this._edges.add(e);var r=e.getLabel();et.isTrue(r.isArea()),this.mergeLabel(r),this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this._startDe)},Ne.prototype.getLinearRing=function(){return this._ring},Ne.prototype.getCoordinate=function(t){return this._pts.get(t)},Ne.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var t=this._startDe;do{var e=t.getNode().getEdges().getOutgoingDegree(this);e>this._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2},Ne.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o<r.length;o++)this._pts.add(r[o])}else{var s=r.length-2;n&&(s=r.length-1);for(var a=s;a>=0;a--)this._pts.add(r[a])}},Ne.prototype.isHole=function(){return this._isHole},Ne.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},Ne.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!at.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0},Ne.prototype.addHole=function(t){this._holes.add(t)},Ne.prototype.isShell=function(){return null===this._shell},Ne.prototype.getLabel=function(){return this._label},Ne.prototype.getEdges=function(){return this._edges},Ne.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Ne.prototype.getShell=function(){return this._shell},Ne.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],n=arguments[0].getLocation(e,Ie.RIGHT);if(n===P.NONE)return null;if(this._label.getLocation(e)===P.NONE)return this._label.setLocation(e,n),null}},Ne.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},Ne.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)e[n]=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},Ne.prototype.interfaces_=function(){return[]},Ne.prototype.getClass=function(){return Ne};var De=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ne),Re=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new Et,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new De(e,this._geometryFactory);t.add(n)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ne),Oe=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};Oe.prototype.setVisited=function(t){this._isVisited=t},Oe.prototype.setInResult=function(t){this._isInResult=t},Oe.prototype.isCovered=function(){return this._isCovered},Oe.prototype.isCoveredSet=function(){return this._isCoveredSet},Oe.prototype.setLabel=function(t){this._label=t},Oe.prototype.getLabel=function(){return this._label},Oe.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},Oe.prototype.updateIM=function(t){et.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},Oe.prototype.isInResult=function(){return this._isInResult},Oe.prototype.isVisited=function(){return this._isVisited},Oe.prototype.interfaces_=function(){return[]},Oe.prototype.getClass=function(){return Oe};var ze=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new ke(0,P.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var n=P.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var r=t.getLocation(e);n!==P.BOUNDARY&&(n=r)}return n},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],n=arguments[1];null===this._label?this._label=new ke(e,n):this._label.setLocation(e,n)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){if(arguments[0]instanceof e){var t=arguments[0];this.mergeLabel(t._label)}else if(arguments[0]instanceof ke)for(var n=arguments[0],r=0;r<2;r++){var i=this.computeMergedLocation(n,r);this._label.getLocation(r)===P.NONE&&this._label.setLocation(r,i)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=P.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;if(e===P.BOUNDARY)n=P.INTERIOR;else n=P.BOUNDARY;this._label.setLocation(t,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Oe),Fe=function(){this.nodeMap=new h,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};Fe.prototype.find=function(t){return this.nodeMap.get(t)},Fe.prototype.addNode=function(){if(arguments[0]instanceof S){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof ze){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return null===r?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}},Fe.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},Fe.prototype.iterator=function(){return this.nodeMap.values().iterator()},Fe.prototype.values=function(){return this.nodeMap.values()},Fe.prototype.getBoundaryNodes=function(t){for(var e=new Et,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===P.BOUNDARY&&e.add(r)}return e},Fe.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},Fe.prototype.interfaces_=function(){return[]},Fe.prototype.getClass=function(){return Fe};var Be=function(){},Ue={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Be.prototype.interfaces_=function(){return[]},Be.prototype.getClass=function(){return Be},Be.isNorthern=function(t){return t===Be.NE||t===Be.NW},Be.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},Be.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var n=t<e?t:e;return 0===n&&3===(t>e?t:e)?3:n},Be.isInHalfPlane=function(t,e){return e===Be.SE?t===Be.SE||t===Be.SW:t===e||t===e+1},Be.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new _("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Be.NE:Be.SE:e>=0?Be.NW:Be.SW}if(arguments[0]instanceof S&&arguments[1]instanceof S){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new _("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?Be.NE:Be.SE:r.y>=n.y?Be.NW:Be.SW}},Ue.NE.get=function(){return 0},Ue.NW.get=function(){return 1},Ue.SW.get=function(){return 2},Ue.SE.get=function(){return 3},Object.defineProperties(Be,Ue);var Ve=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];this._edge=e,this.init(n,r),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};Ve.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:at.computeOrientation(t._p0,t._p1,this._p1)},Ve.prototype.getDy=function(){return this._dy},Ve.prototype.getCoordinate=function(){return this._p0},Ve.prototype.setNode=function(t){this._node=t},Ve.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),r=n.lastIndexOf("."),i=n.substring(r+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},Ve.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},Ve.prototype.getDirectedCoordinate=function(){return this._p1},Ve.prototype.getDx=function(){return this._dx},Ve.prototype.getLabel=function(){return this._label},Ve.prototype.getEdge=function(){return this._edge},Ve.prototype.getQuadrant=function(){return this._quadrant},Ve.prototype.getNode=function(){return this._node},Ve.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return" "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},Ve.prototype.computeLabel=function(t){},Ve.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=Be.quadrant(this._dx,this._dy),et.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},Ve.prototype.interfaces_=function(){return[b]},Ve.prototype.getClass=function(){return Ve};var je=function(t){function e(){var e=arguments[0],n=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var r=e.getNumPoints()-1;this.init(e.getCoordinate(r),e.getCoordinate(r-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new ke(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new Pe("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=!0,e=0;e<2;e++)this._label.isArea(e)&&this._label.getLocation(e,Ie.LEFT)===P.INTERIOR&&this._label.getLocation(e,Ie.RIGHT)===P.INTERIOR||(t=!1);return t},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[Ie.LEFT]+"/"+this._depth[Ie.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,P.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,P.EXTERIOR);return t&&e&&n},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var r=1;t===Ie.LEFT&&(r=-1);var i=Ie.opposite(t),o=e+n*r;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===P.EXTERIOR&&e===P.INTERIOR?1:t===P.INTERIOR&&e===P.EXTERIOR?-1:0},e}(Ve),Ge=function(){};Ge.prototype.createNode=function(t){return new ze(t,null)},Ge.prototype.interfaces_=function(){return[]},Ge.prototype.getClass=function(){return Ge};var qe=function(){if(this._edges=new Et,this._nodes=null,this._edgeEndList=new Et,0===arguments.length)this._nodes=new Fe(new Ge);else if(1===arguments.length){var t=arguments[0];this._nodes=new Fe(t)}};qe.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var n=this._edges.get(e);n.print(t),n.eiList.print(t)}},qe.prototype.find=function(t){return this._nodes.find(t)},qe.prototype.addNode=function(){if(arguments[0]instanceof ze){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof S){var e=arguments[0];return this._nodes.addNode(e)}},qe.prototype.getNodeIterator=function(){return this._nodes.iterator()},qe.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},qe.prototype.debugPrintln=function(t){q.out.println(t)},qe.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(null===n)return!1;var r=n.getLabel();return null!==r&&r.getLocation(t)===P.BOUNDARY},qe.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},qe.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&at.computeOrientation(t,e,r)===at.COLLINEAR&&Be.quadrant(t,e)===Be.quadrant(n,r)},qe.prototype.getEdgeEnds=function(){return this._edgeEndList},qe.prototype.debugPrint=function(t){q.out.print(t)},qe.prototype.getEdgeIterator=function(){return this._edges.iterator()},qe.prototype.findEdgeInSameDirection=function(t,e){for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n),i=r.getCoordinates();if(this.matchInSameDirection(t,e,i[0],i[1]))return r;if(this.matchInSameDirection(t,e,i[i.length-1],i[i.length-2]))return r}return null},qe.prototype.insertEdge=function(t){this._edges.add(t)},qe.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},qe.prototype.addEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._edges.add(n);var r=new je(n,!0),i=new je(n,!1);r.setSym(i),i.setSym(r),this.add(r),this.add(i)}},qe.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},qe.prototype.getNodes=function(){return this._nodes.values()},qe.prototype.findEdge=function(t,e){for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n),i=r.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return r}return null},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe},qe.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var $e=function(){this._geometryFactory=null,this._shellList=new Et;var t=arguments[0];this._geometryFactory=t};$e.prototype.sortShellsAndHoles=function(t,e,n){for(var r=t.iterator();r.hasNext();){var i=r.next();i.isHole()?n.add(i):e.add(i)}},$e.prototype.computePolygons=function(t){for(var e=new Et,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e},$e.prototype.placeFreeHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(null===r.getShell()){var i=this.findEdgeRingContaining(r,t);if(null===i)throw new Pe("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(i)}}},$e.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new Et,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):n.addAll(s)}else r.add(o)}return r},$e.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},$e.prototype.buildMaximalEdgeRings=function(t){for(var e=new Et,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()){var i=new Re(r,this._geometryFactory);e.add(i),i.setInResult()}}return e},$e.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},$e.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},$e.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var l=a.next(),u=l.getLinearRing(),c=u.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(r)&&at.isPointInRing(i,u.getCoordinates())&&(h=!0),h&&(null===o||s.contains(c))&&(o=l)}return o},$e.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return et.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},$e.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0];qe.linkResultDirectedEdges(arguments[1]);var n=this.buildMaximalEdgeRings(e),r=new Et,i=this.buildMinimalEdgeRings(n,this._shellList,r);this.sortShellsAndHoles(i,this._shellList,r),this.placeFreeHoles(this._shellList,r)}},$e.prototype.interfaces_=function(){return[]},$e.prototype.getClass=function(){return $e};var Xe=function(){};Xe.prototype.getBounds=function(){},Xe.prototype.interfaces_=function(){return[]},Xe.prototype.getClass=function(){return Xe};var Ze=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Ze.prototype.getItem=function(){return this._item},Ze.prototype.getBounds=function(){return this._bounds},Ze.prototype.interfaces_=function(){return[Xe,e]},Ze.prototype.getClass=function(){return Ze};var Ye=function(){this._size=null,this._items=null,this._size=0,this._items=new Et,this._items.add(null)};Ye.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},Ye.prototype.size=function(){return this._size},Ye.prototype.reorder=function(t){for(var e=null,n=this._items.get(t);2*t<=this._size&&((e=2*t)!==this._size&&this._items.get(e+1).compareTo(this._items.get(e))<0&&e++,this._items.get(e).compareTo(n)<0);t=e)this._items.set(t,this._items.get(e));this._items.set(t,n)},Ye.prototype.clear=function(){this._size=0,this._items.clear()},Ye.prototype.isEmpty=function(){return 0===this._size},Ye.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},Ye.prototype.interfaces_=function(){return[]},Ye.prototype.getClass=function(){return Ye};var We=function(){};We.prototype.visitItem=function(t){},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We};var He=function(){};He.prototype.insert=function(t,e){},He.prototype.remove=function(t,e){},He.prototype.query=function(){},He.prototype.interfaces_=function(){return[]},He.prototype.getClass=function(){return He};var Ke=function(){if(this._childBoundables=new Et,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},Je={serialVersionUID:{configurable:!0}};Ke.prototype.getLevel=function(){return this._level},Ke.prototype.size=function(){return this._childBoundables.size()},Ke.prototype.getChildBoundables=function(){return this._childBoundables},Ke.prototype.addChildBoundable=function(t){et.isTrue(null===this._bounds),this._childBoundables.add(t)},Ke.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ke.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Ke.prototype.interfaces_=function(){return[Xe,e]},Ke.prototype.getClass=function(){return Ke},Je.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Ke,Je);var Qe=function(){};Qe.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Qe.min=function(t){return Qe.sort(t),t.get(0)},Qe.sort=function(t,e){var n=t.toArray();e?zt.sort(n,e):zt.sort(n);for(var r=t.iterator(),i=0,o=n.length;i<o;i++)r.next(),r.set(n[i])},Qe.singletonList=function(t){var e=new Et;return e.add(t),e};var tn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};tn.prototype.expandToQueue=function(t,e){var n=tn.isComposite(this._boundable1),r=tn.isComposite(this._boundable2);if(n&&r)return tn.area(this._boundable1)>tn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new _("neither boundable is composite")},tn.prototype.isLeaves=function(){return!(tn.isComposite(this._boundable1)||tn.isComposite(this._boundable2))},tn.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},tn.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new tn(o,e,this._itemDistance);s.getDistance()<r&&n.add(s)}},tn.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},tn.prototype.getDistance=function(){return this._distance},tn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},tn.prototype.interfaces_=function(){return[b]},tn.prototype.getClass=function(){return tn},tn.area=function(t){return t.getBounds().getArea()},tn.isComposite=function(t){return t instanceof Ke};var en=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new Et,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var n=arguments[0];et.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},nn={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};en.prototype.getNodeCapacity=function(){return this._nodeCapacity},en.prototype.lastNode=function(t){return t.get(t.size()-1)},en.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof Ke?t+=this.size(n):n instanceof Ze&&(t+=1)}return t}},en.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Ze&&i.getItem()===e&&(n=i)}return null!==n&&(t.getChildBoundables().remove(n),!0)},en.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new Et:t}if(1===arguments.length){for(var e=arguments[0],n=new Et,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();if(i instanceof Ke){var o=this.itemsTree(i);null!==o&&n.add(o)}else i instanceof Ze?n.add(i.getItem()):et.shouldNeverReachHere()}return n.size()<=0?null:n}},en.prototype.insert=function(t,e){et.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ze(t,e))},en.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new Et;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];if(et.isTrue(n>-2),r.getLevel()===n)return i.add(r),null;for(var o=r.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof Ke?this.boundablesAtLevel(n,s,i):(et.isTrue(s instanceof Ze),-1===n&&i.add(s))}return null}},en.prototype.query=function(){if(1===arguments.length){var t=arguments[0];this.build();var e=new Et;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,e),e}if(2===arguments.length){var n=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,r)}else if(3===arguments.length)if(L(arguments[2],We)&&arguments[0]instanceof Object&&arguments[1]instanceof Ke)for(var i=arguments[0],o=arguments[2],s=arguments[1].getChildBoundables(),a=0;a<s.size();a++){var l=s.get(a);this.getIntersectsOp().intersects(l.getBounds(),i)&&(l instanceof Ke?this.query(i,l,o):l instanceof Ze?o.visitItem(l.getItem()):et.shouldNeverReachHere())}else if(L(arguments[2],wt)&&arguments[0]instanceof Object&&arguments[1]instanceof Ke)for(var u=arguments[0],c=arguments[2],h=arguments[1].getChildBoundables(),p=0;p<h.size();p++){var f=h.get(p);this.getIntersectsOp().intersects(f.getBounds(),u)&&(f instanceof Ke?this.query(u,f,c):f instanceof Ze?c.add(f.getItem()):et.shouldNeverReachHere())}},en.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},en.prototype.getRoot=function(){return this.build(),this._root},en.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=this.removeItem(r,i);if(o)return!0;for(var s=null,a=r.getChildBoundables().iterator();a.hasNext();){var l=a.next();if(this.getIntersectsOp().intersects(l.getBounds(),n)&&l instanceof Ke&&(o=this.remove(n,l,i))){s=l;break}}return null!==s&&s.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(s),o}},en.prototype.createHigherLevels=function(t,e){et.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},en.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof Ke){var r=this.depth(n);r>t&&(t=r)}}return t+1}},en.prototype.createParentBoundables=function(t,e){et.isTrue(!t.isEmpty());var n=new Et;n.add(this.createNode(e));var r=new Et(t);Qe.sort(r,this.getComparator());for(var i=r.iterator();i.hasNext();){var o=i.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(o)}return n},en.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},en.prototype.interfaces_=function(){return[e]},en.prototype.getClass=function(){return en},en.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},nn.IntersectsOp.get=function(){return rn},nn.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},nn.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(en,nn);var rn=function(){},on=function(){};on.prototype.distance=function(t,e){},on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on};var sn=function(t){function n(e){e=e||n.DEFAULT_NODE_CAPACITY,t.call(this,e)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var r={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return n.prototype.createParentBoundablesFromVerticalSlices=function(t,e){et.isTrue(t.length>0);for(var n=new Et,r=0;r<t.length;r++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[r],e));return n},n.prototype.createNode=function(t){return new an(t)},n.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},n.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],n=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,n)},n.prototype.getIntersectsOp=function(){return n.intersectsOp},n.prototype.verticalSlices=function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),r=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){r[o]=new Et;for(var s=0;i.hasNext()&&s<n;){var a=i.next();r[o].add(a),s++}}return r},n.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var n=arguments[0],r=arguments[1];t.prototype.query.call(this,n,r)}else if(3===arguments.length)if(L(arguments[2],We)&&arguments[0]instanceof Object&&arguments[1]instanceof Ke){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(L(arguments[2],wt)&&arguments[0]instanceof Object&&arguments[1]instanceof Ke){var a=arguments[0],l=arguments[1],u=arguments[2];t.prototype.query.call(this,a,l,u)}},n.prototype.getComparator=function(){return n.yComparator},n.prototype.createParentBoundablesFromVerticalSlice=function(e,n){return t.prototype.createParentBoundables.call(this,e,n)},n.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return t.prototype.remove.call(this,e,n)}return t.prototype.remove.apply(this,arguments)},n.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},n.prototype.createParentBoundables=function(t,e){et.isTrue(!t.isEmpty());var r=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new Et(t);Qe.sort(i,n.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(r))));return this.createParentBoundablesFromVerticalSlices(o,e)},n.prototype.nearestNeighbour=function(){if(1===arguments.length){if(L(arguments[0],on)){var t=arguments[0],e=new tn(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(e)}if(arguments[0]instanceof tn){var r=arguments[0];return this.nearestNeighbour(r,v.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof n&&L(arguments[1],on)){var i=arguments[0],o=arguments[1],s=new tn(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof tn&&"number"==typeof arguments[1]){var a=arguments[0],l=arguments[1],u=null,c=new Ye;for(c.add(a);!c.isEmpty()&&l>0;){var h=c.poll(),p=h.getDistance();if(p>=l)break;h.isLeaves()?(l=p,u=h):h.expandToQueue(c,l)}return[u.getBoundable(0).getItem(),u.getBoundable(1).getItem()]}}else if(3===arguments.length){var f=arguments[2],d=new Ze(arguments[0],arguments[1]),g=new tn(this.getRoot(),d,f);return this.nearestNeighbour(g)[0]}},n.prototype.interfaces_=function(){return[He,e]},n.prototype.getClass=function(){return n},n.centreX=function(t){return n.avg(t.getMinX(),t.getMaxX())},n.avg=function(t,e){return(t+e)/2},n.centreY=function(t){return n.avg(t.getMinY(),t.getMaxY())},r.STRtreeNode.get=function(){return an},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[E]},compare:function(e,r){return t.compareDoubles(n.centreX(e.getBounds()),n.centreX(r.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[E]},compare:function(e,r){return t.compareDoubles(n.centreY(e.getBounds()),n.centreY(r.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(n,r),n}(en),an=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new X(n.getBounds()):t.expandToInclude(n.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ke),ln=function(){};ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ln.relativeSign=function(t,e){return t<e?-1:t>e?1:0},ln.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=ln.relativeSign(e.x,n.x),i=ln.relativeSign(e.y,n.y);switch(t){case 0:return ln.compareValue(r,i);case 1:return ln.compareValue(i,r);case 2:return ln.compareValue(i,-r);case 3:return ln.compareValue(-r,i);case 4:return ln.compareValue(-r,-i);case 5:return ln.compareValue(-i,-r);case 6:return ln.compareValue(-i,r);case 7:return ln.compareValue(r,-i)}return et.shouldNeverReachHere("invalid octant value"),0},ln.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var un=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new S(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};un.prototype.getCoordinate=function(){return this.coord},un.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},un.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:ln.compare(this._segmentOctant,this.coord,e.coord)},un.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},un.prototype.isInterior=function(){return this._isInterior},un.prototype.interfaces_=function(){return[b]},un.prototype.getClass=function(){return un};var cn=function(){this._nodeMap=new h,this._edge=null;var t=arguments[0];this._edge=t};cn.prototype.getSplitCoordinates=function(){var t=new It;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next();this.addEdgeCoordinates(n,r,t),n=r}return t.toCoordinateArray()},cn.prototype.addCollapsedNodes=function(){var t=new Et;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}},cn.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},cn.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e),r=this._edge.getCoordinate(e+2);n.equals2D(r)&&t.add(new D(e+1))}},cn.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);n.add(new S(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));i&&n.add(new S(e.coord))},cn.prototype.iterator=function(){return this._nodeMap.values().iterator()},cn.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},cn.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var r=e.segmentIndex-t.segmentIndex;return e.isInterior()||r--,1===r&&(n[0]=t.segmentIndex+1,!0)},cn.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();this.findCollapseIndex(r,i,e)&&t.add(new D(e[0])),r=i}},cn.prototype.getEdge=function(){return this._edge},cn.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},cn.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new S(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new S(e.coord)),new dn(o,this._edge.getData())},cn.prototype.add=function(t,e){var n=new un(this._edge,t,e,this._edge.getSegmentOctant(e)),r=this._nodeMap.get(n);return null!==r?(et.isTrue(r.coord.equals2D(t),"Found equal nodes with different coordinates"),r):(this._nodeMap.put(n,n),n)},cn.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new Q("bad split edge start point at "+n);var r=t.get(t.size()-1).getCoordinates(),i=r[r.length-1];if(!i.equals2D(e[e.length-1]))throw new Q("bad split edge end point at "+i)},cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn};var hn=function(){};hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn},hn.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new _("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof S&&arguments[1]instanceof S){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new _("Cannot compute the octant for two identical points "+i);return hn.octant(s,a)}};var pn=function(){};pn.prototype.getCoordinates=function(){},pn.prototype.size=function(){},pn.prototype.getCoordinate=function(t){},pn.prototype.isClosed=function(){},pn.prototype.setData=function(t){},pn.prototype.getData=function(){},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn};var fn=function(){};fn.prototype.addIntersection=function(t,e){},fn.prototype.interfaces_=function(){return[pn]},fn.prototype.getClass=function(){return fn};var dn=function(){this._nodeList=new cn(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};dn.prototype.getCoordinates=function(){return this._pts},dn.prototype.size=function(){return this._pts.length},dn.prototype.getCoordinate=function(t){return this._pts[t]},dn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},dn.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},dn.prototype.setData=function(t){this._data=t},dn.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:hn.octant(t,e)},dn.prototype.getData=function(){return this._data},dn.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[1],r=arguments[3],i=new S(arguments[0].getIntersection(r));this.addIntersection(i,n)}},dn.prototype.toString=function(){return J.toLineString(new le(this._pts))},dn.prototype.getNodeList=function(){return this._nodeList},dn.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r<this._pts.length){var i=this._pts[r];t.equals2D(i)&&(n=r)}return this._nodeList.add(t,n)},dn.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},dn.prototype.interfaces_=function(){return[fn]},dn.prototype.getClass=function(){return dn},dn.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new Et;return dn.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[1],r=arguments[0].iterator();r.hasNext();)r.next().getNodeList().addSplitEdges(n)};var gn=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new S,this.p1=new S;else if(1===arguments.length){var t=arguments[0];this.p0=new S(t.p0),this.p1=new S(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this.p0=new S(e,n),this.p1=new S(r,i)}},mn={serialVersionUID:{configurable:!0}};gn.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},gn.prototype.orientationIndex=function(){if(arguments[0]instanceof gn){var t=arguments[0],e=at.orientationIndex(this.p0,this.p1,t.p0),n=at.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof S){var r=arguments[0];return at.orientationIndex(this.p0,this.p1,r)}},gn.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},gn.prototype.isVertical=function(){return this.p0.x===this.p1.x},gn.prototype.equals=function(t){if(!(t instanceof gn))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},gn.prototype.intersection=function(t){var e=new it;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},gn.prototype.project=function(){if(arguments[0]instanceof S){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new S(t);var e=this.projectionFactor(t),n=new S;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof gn){var r=arguments[0],i=this.projectionFactor(r.p0),o=this.projectionFactor(r.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(r.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(r.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new gn(s,a)}},gn.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},gn.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},gn.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},gn.prototype.distancePerpendicular=function(t){return at.distancePointLinePerpendicular(t,this.p0,this.p1)},gn.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},gn.prototype.midPoint=function(){return gn.midPoint(this.p0,this.p1)},gn.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;return r<=0?v.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},gn.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=v.MAX_VALUE,i=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<r&&(r=i,n[0]=s,n[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<r&&(r=i,n[0]=this.p0,n[1]=a);var l=t.closestPoint(this.p1);return(i=l.distance(this.p1))<r&&(r=i,n[0]=this.p1,n[1]=l),n},gn.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},gn.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},gn.prototype.getLength=function(){return this.p0.distance(this.p1)},gn.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},gn.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},gn.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},gn.prototype.lineIntersection=function(t){try{return $.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof G))throw t}return null},gn.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},gn.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),r=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,l=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,l=e*o/s}return new S(n-l,r+a)},gn.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},gn.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||v.isNaN(e))&&(e=1),e},gn.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},gn.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},gn.prototype.distance=function(){if(arguments[0]instanceof gn){var t=arguments[0];return at.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof S){var e=arguments[0];return at.distancePointLine(e,this.p0,this.p1)}},gn.prototype.pointAlong=function(t){var e=new S;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},gn.prototype.hashCode=function(){var t=v.doubleToLongBits(this.p0.x);t^=31*v.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=v.doubleToLongBits(this.p1.x);return n^=31*v.doubleToLongBits(this.p1.y),e^Math.trunc(n)^Math.trunc(n>>32)},gn.prototype.interfaces_=function(){return[b,e]},gn.prototype.getClass=function(){return gn},gn.midPoint=function(t,e){return new S((t.x+e.x)/2,(t.y+e.y)/2)},mn.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(gn,mn);var yn=function(){this.tempEnv1=new X,this.tempEnv2=new X,this._overlapSeg1=new gn,this._overlapSeg2=new gn};yn.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(n,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},yn.prototype.interfaces_=function(){return[]},yn.prototype.getClass=function(){return yn};var _n=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};_n.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},_n.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],o=this._pts[n];if(r.tempEnv1.init(i,o),n-e==1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var s=Math.trunc((e+n)/2);e<s&&this.computeSelect(t,e,s,r),s<n&&this.computeSelect(t,s,n,r)},_n.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,n=this._start;n<=this._end;n++)t[e++]=this._pts[n];return t},_n.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},_n.prototype.setId=function(t){this._id=t},_n.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},_n.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new X(t,e)}return this._env},_n.prototype.getEndIndex=function(){return this._end},_n.prototype.getStartIndex=function(){return this._start},_n.prototype.getContext=function(){return this._context},_n.prototype.getId=function(){return this._id},_n.prototype.computeOverlapsInternal=function(t,e,n,r,i,o){var s=this._pts[t],a=this._pts[e],l=n._pts[r],u=n._pts[i];if(e-t==1&&i-r==1)return o.overlap(this,t,n,r),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(l,u),!o.tempEnv1.intersects(o.tempEnv2))return null;var c=Math.trunc((t+e)/2),h=Math.trunc((r+i)/2);t<c&&(r<h&&this.computeOverlapsInternal(t,c,n,r,h,o),h<i&&this.computeOverlapsInternal(t,c,n,h,i,o)),c<e&&(r<h&&this.computeOverlapsInternal(c,e,n,r,h,o),h<i&&this.computeOverlapsInternal(c,e,n,h,i,o))},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n};var vn=function(){};vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn},vn.getChainStartIndices=function(t){var e=0,n=new Et;n.add(new D(e));do{var r=vn.findChainEnd(t,e);n.add(new D(r)),e=r}while(e<t.length-1);return vn.toIntArray(n)},vn.findChainEnd=function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var r=Be.quadrant(t[n],t[n+1]),i=e+1;i<t.length&&(t[i-1].equals2D(t[i])||Be.quadrant(t[i-1],t[i])===r);)i++;return i-1},vn.getChains=function(){if(1===arguments.length)return vn.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],n=new Et,r=vn.getChainStartIndices(t),i=0;i<r.length-1;i++){var o=new _n(t,r[i],r[i+1],e);n.add(o)}return n}},vn.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var xn=function(){};xn.prototype.computeNodes=function(t){},xn.prototype.getNodedSubstrings=function(){},xn.prototype.interfaces_=function(){return[]},xn.prototype.getClass=function(){return xn};var bn=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};bn.prototype.setSegmentIntersector=function(t){this._segInt=t},bn.prototype.interfaces_=function(){return[xn]},bn.prototype.getClass=function(){return bn};var wn=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new Et,this._index=new sn,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return dn.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=vn.getChains(t.getCoordinates(),t).iterator();e.hasNext();){var n=e.next();n.setId(this._idCounter++),this._index.insert(n.getEnvelope(),n),this._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=new En(this._segInt),e=this._monoChains.iterator();e.hasNext();)for(var n=e.next(),r=this._index.query(n.getEnvelope()).iterator();r.hasNext();){var i=r.next();if(i.getId()>n.getId()&&(n.computeOverlaps(i,t),this._nOverlaps++),this._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return En},Object.defineProperties(e,n),e}(bn),En=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],n=arguments[2],r=arguments[3],i=arguments[0].getContext(),o=n.getContext();this._si.processIntersections(i,e,o,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(yn),Sn=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},In={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Sn.prototype.getEndCapStyle=function(){return this._endCapStyle},Sn.prototype.isSingleSided=function(){return this._isSingleSided},Sn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=Sn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Sn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Sn.JOIN_ROUND&&(this._quadrantSegments=Sn.DEFAULT_QUADRANT_SEGMENTS)},Sn.prototype.getJoinStyle=function(){return this._joinStyle},Sn.prototype.setJoinStyle=function(t){this._joinStyle=t},Sn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},Sn.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Sn.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Sn.prototype.setEndCapStyle=function(t){this._endCapStyle=t},Sn.prototype.getMitreLimit=function(){return this._mitreLimit},Sn.prototype.setMitreLimit=function(t){this._mitreLimit=t},Sn.prototype.setSingleSided=function(t){this._isSingleSided=t},Sn.prototype.interfaces_=function(){return[]},Sn.prototype.getClass=function(){return Sn},Sn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},In.CAP_ROUND.get=function(){return 1},In.CAP_FLAT.get=function(){return 2},In.CAP_SQUARE.get=function(){return 3},In.JOIN_ROUND.get=function(){return 1},In.JOIN_MITRE.get=function(){return 2},In.JOIN_BEVEL.get=function(){return 3},In.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},In.DEFAULT_MITRE_LIMIT.get=function(){return 5},In.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(Sn,In);var Cn=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=at.COUNTERCLOCKWISE,this._inputLine=t||null},Tn={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Cn.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(i,o,s)&&!!this.isShallow(i,o,s,r)&&this.isShallowSampled(i,o,t,n,r)},Cn.prototype.deleteShallowConcavities=function(){for(var t=1,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e),r=!1;n<this._inputLine.length;){var i=!1;this.isDeletable(t,e,n,this._distanceTol)&&(this._isDeleted[e]=Cn.DELETE,i=!0,r=!0),t=i?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return r},Cn.prototype.isShallowConcavity=function(t,e,n,r){return at.computeOrientation(t,e,n)===this._angleOrientation&&at.distancePointLine(e,t,n)<r},Cn.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/Cn.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=n;s<r;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},Cn.prototype.isConcave=function(t,e,n){return at.computeOrientation(t,e,n)===this._angleOrientation},Cn.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=at.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},Cn.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===Cn.DELETE;)e++;return e},Cn.prototype.isShallow=function(t,e,n,r){return at.distancePointLine(e,t,n)<r},Cn.prototype.collapseLine=function(){for(var t=new It,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==Cn.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn},Cn.simplify=function(t,e){return new Cn(t).simplify(e)},Tn.INIT.get=function(){return 0},Tn.DELETE.get=function(){return 1},Tn.KEEP.get=function(){return 1},Tn.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Cn,Tn);var Pn=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Et},Mn={COORDINATE_ARRAY_TYPE:{configurable:!0}};Pn.prototype.getCoordinates=function(){return this._ptList.toArray(Pn.COORDINATE_ARRAY_TYPE)},Pn.prototype.setPrecisionModel=function(t){this._precisionModel=t},Pn.prototype.addPt=function(t){var e=new S(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},Pn.prototype.revere=function(){},Pn.prototype.addPts=function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var r=t.length-1;r>=0;r--)this.addPt(t[r])},Pn.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},Pn.prototype.toString=function(){return(new ye).createLineString(this.getCoordinates()).toString()},Pn.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new S(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},Pn.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},Pn.prototype.interfaces_=function(){return[]},Pn.prototype.getClass=function(){return Pn},Mn.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Pn,Mn);var Ln=function(){},An={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Ln.prototype.interfaces_=function(){return[]},Ln.prototype.getClass=function(){return Ln},Ln.toDegrees=function(t){return 180*t/Math.PI},Ln.normalize=function(t){for(;t>Math.PI;)t-=Ln.PI_TIMES_2;for(;t<=-Math.PI;)t+=Ln.PI_TIMES_2;return t},Ln.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}},Ln.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)>0},Ln.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)<0},Ln.interiorAngle=function(t,e,n){var r=Ln.angle(e,t),i=Ln.angle(e,n);return Math.abs(i-r)},Ln.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Ln.PI_TIMES_2;t>=Ln.PI_TIMES_2&&(t=0)}else{for(;t>=Ln.PI_TIMES_2;)t-=Ln.PI_TIMES_2;t<0&&(t=0)}return t},Ln.angleBetween=function(t,e,n){var r=Ln.angle(e,t),i=Ln.angle(e,n);return Ln.diff(r,i)},Ln.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},Ln.toRadians=function(t){return t*Math.PI/180},Ln.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?Ln.COUNTERCLOCKWISE:n<0?Ln.CLOCKWISE:Ln.NONE},Ln.angleBetweenOriented=function(t,e,n){var r=Ln.angle(e,t),i=Ln.angle(e,n)-r;return i<=-Math.PI?i+Ln.PI_TIMES_2:i>Math.PI?i-Ln.PI_TIMES_2:i},An.PI_TIMES_2.get=function(){return 2*Math.PI},An.PI_OVER_2.get=function(){return Math.PI/2},An.PI_OVER_4.get=function(){return Math.PI/4},An.COUNTERCLOCKWISE.get=function(){return at.COUNTERCLOCKWISE},An.CLOCKWISE.get=function(){return at.CLOCKWISE},An.NONE.get=function(){return at.COLLINEAR},Object.defineProperties(Ln,An);var kn=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new gn,this._seg1=new gn,this._offset0=new gn,this._offset1=new gn,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new it,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Sn.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Nn={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};kn.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=at.computeOrientation(this._s0,this._s1,this._s2),r=n===at.CLOCKWISE&&this._side===Ie.LEFT||n===at.COUNTERCLOCKWISE&&this._side===Ie.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},kn.prototype.addLineEndCap=function(t,e){var n=new gn(t,e),r=new gn;this.computeOffsetSegment(n,Ie.LEFT,this._distance,r);var i=new gn;this.computeOffsetSegment(n,Ie.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case Sn.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,at.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Sn.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Sn.CAP_SQUARE:var l=new S;l.x=Math.abs(this._distance)*Math.cos(a),l.y=Math.abs(this._distance)*Math.sin(a);var u=new S(r.p1.x+l.x,r.p1.y+l.y),c=new S(i.p1.x+l.x,i.p1.y+l.y);this._segList.addPt(u),this._segList.addPt(c)}},kn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},kn.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=$.intersection(e.p0,e.p1,n.p0,n.p1),(r<=0?1:o.distance(t)/Math.abs(r))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof G))throw t;o=new S(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},kn.prototype.addFilletCorner=function(t,e,n,r,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),l=n.x-t.x,u=n.y-t.y,c=Math.atan2(u,l);r===at.CLOCKWISE?a<=c&&(a+=2*Math.PI):a>=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,r,i),this._segList.addPt(n)},kn.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*kn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Sn.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Sn.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},kn.prototype.createSquare=function(t){this._segList.addPt(new S(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new S(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new S(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new S(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},kn.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},kn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},kn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},kn.prototype.initSideSegments=function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)},kn.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=Ln.angle(i,this._seg0.p0),s=Ln.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=Ln.normalize(o+s),l=Ln.normalize(a+Math.PI),u=r*n,c=n-u*Math.abs(Math.sin(s)),h=i.x+u*Math.cos(l),p=i.y+u*Math.sin(l),f=new S(h,p),d=new gn(i,f),g=d.pointAlongOffset(1,c),m=d.pointAlongOffset(1,-c);this._side===Ie.LEFT?(this._segList.addPt(g),this._segList.addPt(m)):(this._segList.addPt(m),this._segList.addPt(g))},kn.prototype.computeOffsetSegment=function(t,e,n,r){var i=e===Ie.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),l=i*n*o/a,u=i*n*s/a;r.p0.x=t.p0.x-u,r.p0.y=t.p0.y+l,r.p1.x=t.p1.x-u,r.p1.y=t.p1.y+l},kn.prototype.addFilletArc=function(t,e,n,r,i){var o=r===at.CLOCKWISE?-1:1,s=Math.abs(e-n),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var l=s/a,u=0,c=new S;u<s;){var h=e+o*u;c.x=t.x+i*Math.cos(h),c.y=t.y+i*Math.sin(h),this._segList.addPt(c),u+=l}},kn.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*kn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new S((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new S((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},kn.prototype.createCircle=function(t){var e=new S(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},kn.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},kn.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Pn,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*kn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},kn.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Sn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Sn.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,at.CLOCKWISE,this._distance))},kn.prototype.closeRing=function(){this._segList.closeRing()},kn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},Nn.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Nn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Nn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Nn.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(kn,Nn);var Dn=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Dn.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var o=i.getCoordinates();return n&&Ct.reverse(o),o},Dn.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Cn.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],Ie.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{n.addSegments(t,!1);var a=Cn.simplify(t,r),l=a.length-1;n.initSideSegments(a[0],a[1],Ie.LEFT),n.addFirstSegment();for(var u=2;u<=l;u++)n.addNextSegment(a[u],!0)}n.addLastSegment(),n.closeRing()},Dn.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===Ie.RIGHT&&(r=-r);var i=Cn.simplify(t,r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(i[s],a)}n.closeRing()},Dn.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Cn.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],Ie.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=Cn.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],Ie.LEFT);for(var l=a-2;l>=0;l--)e.addNextSegment(s[l],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Dn.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Sn.CAP_ROUND:e.createCircle(t);break;case Sn.CAP_SQUARE:e.createSquare(t)}},Dn.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()},Dn.prototype.getBufferParameters=function(){return this._bufParams},Dn.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Dn.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return Dn.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},Dn.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Cn.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],Ie.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{var a=Cn.simplify(t,r),l=a.length-1;n.initSideSegments(a[0],a[1],Ie.LEFT),n.addFirstSegment();for(var u=2;u<=l;u++)n.addNextSegment(a[u],!0)}n.addLastSegment()},Dn.prototype.getSegGen=function(t){return new kn(this._precisionModel,this._bufParams,t)},Dn.prototype.interfaces_=function(){return[]},Dn.prototype.getClass=function(){return Dn},Dn.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new S(t[n]);return e};var Rn=function(){this._subgraphs=null,this._seg=new gn,this._cga=new at;var t=arguments[0];this._subgraphs=t},On={DepthSegment:{configurable:!0}};Rn.prototype.findStabbedSegments=function(){if(1===arguments.length){for(var t=arguments[0],e=new Et,n=this._subgraphs.iterator();n.hasNext();){var r=n.next(),i=r.getEnvelope();t.y<i.getMinY()||t.y>i.getMaxY()||this.findStabbedSegments(t,r.getDirectedEdges(),e)}return e}if(3===arguments.length)if(L(arguments[2],wt)&&arguments[0]instanceof S&&arguments[1]instanceof je){for(var o=arguments[0],s=arguments[1],a=arguments[2],l=s.getEdge().getCoordinates(),u=0;u<l.length-1;u++)if(this._seg.p0=l[u],this._seg.p1=l[u+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<o.x||this._seg.isHorizontal()||o.y<this._seg.p0.y||o.y>this._seg.p1.y||at.computeOrientation(this._seg.p0,this._seg.p1,o)===at.RIGHT)){var c=s.getDepth(Ie.LEFT);this._seg.p0.equals(l[u])||(c=s.getDepth(Ie.RIGHT));var h=new zn(this._seg,c);a.add(h)}}else if(L(arguments[2],wt)&&arguments[0]instanceof S&&L(arguments[1],wt))for(var p=arguments[0],f=arguments[2],d=arguments[1].iterator();d.hasNext();){var g=d.next();g.isForward()&&this.findStabbedSegments(p,g,f)}},Rn.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Qe.min(e)._leftDepth},Rn.prototype.interfaces_=function(){return[]},Rn.prototype.getClass=function(){return Rn},On.DepthSegment.get=function(){return zn},Object.defineProperties(Rn,On);var zn=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new gn(t),this._leftDepth=e};zn.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==n||0!=(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},zn.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},zn.prototype.toString=function(){return this._upwardSeg.toString()},zn.prototype.interfaces_=function(){return[b]},zn.prototype.getClass=function(){return zn};var Fn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Fn.prototype.area=function(){return Fn.area(this.p0,this.p1,this.p2)},Fn.prototype.signedArea=function(){return Fn.signedArea(this.p0,this.p1,this.p2)},Fn.prototype.interpolateZ=function(t){if(null===t)throw new _("Supplied point is null.");return Fn.interpolateZ(t,this.p0,this.p1,this.p2)},Fn.prototype.longestSideLength=function(){return Fn.longestSideLength(this.p0,this.p1,this.p2)},Fn.prototype.isAcute=function(){return Fn.isAcute(this.p0,this.p1,this.p2)},Fn.prototype.circumcentre=function(){return Fn.circumcentre(this.p0,this.p1,this.p2)},Fn.prototype.area3D=function(){return Fn.area3D(this.p0,this.p1,this.p2)},Fn.prototype.centroid=function(){return Fn.centroid(this.p0,this.p1,this.p2)},Fn.prototype.inCentre=function(){return Fn.inCentre(this.p0,this.p1,this.p2)},Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},Fn.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},Fn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Fn.det=function(t,e,n,r){return t*r-e*n},Fn.interpolateZ=function(t,e,n,r){var i=e.x,o=e.y,s=n.x-i,a=r.x-i,l=n.y-o,u=r.y-o,c=s*u-a*l,h=t.x-i,p=t.y-o,f=(u*h-a*p)/c,d=(-l*h+s*p)/c;return e.z+f*(n.z-e.z)+d*(r.z-e.z)},Fn.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),s=r;return i>s&&(s=i),o>s&&(s=o),s},Fn.isAcute=function(t,e,n){return!!Ln.isAcute(t,e,n)&&!!Ln.isAcute(e,n,t)&&!!Ln.isAcute(n,t,e)},Fn.circumcentre=function(t,e,n){var r=n.x,i=n.y,o=t.x-r,s=t.y-i,a=e.x-r,l=e.y-i,u=2*Fn.det(o,s,a,l),c=Fn.det(s,o*o+s*s,l,a*a+l*l),h=Fn.det(o,o*o+s*s,a,a*a+l*l);return new S(r-c/u,i+h/u)},Fn.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new $(t.x+n/2,t.y+r/2,1),o=new $(t.x-r+n/2,t.y+n+r/2,1);return new $(i,o)},Fn.angleBisector=function(t,e,n){var r=e.distance(t),i=r/(r+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new S(t.x+i*o,t.y+i*s)},Fn.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,l=n.z-t.z,u=i*l-o*a,c=o*s-r*l,h=r*a-i*s,p=u*u+c*c+h*h;return Math.sqrt(p)/2},Fn.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new S(r,i)},Fn.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),o=t.distance(e),s=r+i+o,a=(r*t.x+i*e.x+o*n.x)/s,l=(r*t.y+i*e.y+o*n.y)/s;return new S(a,l)};var Bn=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Et;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Bn.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,P.EXTERIOR,P.INTERIOR)},Bn.prototype.addPolygon=function(t){var e=this._distance,n=Ie.LEFT;this._distance<0&&(e=-this._distance,n=Ie.RIGHT);var r=t.getExteriorRing(),i=Ct.removeRepeatedPoints(r.getCoordinates());if(this._distance<0&&this.isErodedCompletely(r,this._distance))return null;if(this._distance<=0&&i.length<3)return null;this.addPolygonRing(i,e,n,P.EXTERIOR,P.INTERIOR);for(var o=0;o<t.getNumInteriorRing();o++){var s=t.getInteriorRingN(o),a=Ct.removeRepeatedPoints(s.getCoordinates());this._distance>0&&this.isErodedCompletely(s,-this._distance)||this.addPolygonRing(a,e,Ie.opposite(n),P.INTERIOR,P.EXTERIOR)}},Bn.prototype.isTriangleErodedCompletely=function(t,e){var n=new Fn(t[0],t[1],t[2]),r=n.inCentre();return at.distancePointLine(r,n.p0,n.p1)<Math.abs(e)},Bn.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=Ct.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,P.EXTERIOR,P.INTERIOR)},Bn.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;var r=new dn(t,new ke(0,P.BOUNDARY,e,n));this._curveList.add(r)},Bn.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Bn.prototype.addPolygonRing=function(t,e,n,r,i){if(0===e&&t.length<ee.MINIMUM_VALID_SIZE)return null;var o=r,s=i;t.length>=ee.MINIMUM_VALID_SIZE&&at.isCCW(t)&&(o=i,s=r,n=Ie.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},Bn.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Qt?this.addPolygon(t):t instanceof Wt?this.addLineString(t):t instanceof Kt?this.addPoint(t):(t instanceof te||t instanceof Gt||t instanceof ne||t instanceof jt)&&this.addCollection(t)},Bn.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i},Bn.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},Bn.prototype.interfaces_=function(){return[]},Bn.prototype.getClass=function(){return Bn};var Un=function(){};Un.prototype.locate=function(t){},Un.prototype.interfaces_=function(){return[]},Un.prototype.getClass=function(){return Un};var Vn=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};Vn.prototype.next=function(){if(this._atStart)return this._atStart=!1,Vn.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new r;var t=this._parent.getGeometryN(this._index++);return t instanceof jt?(this._subcollectionIterator=new Vn(t),this._subcollectionIterator.next()):t},Vn.prototype.remove=function(){throw new Error(this.getClass().getName())},Vn.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Vn.prototype.interfaces_=function(){return[bt]},Vn.prototype.getClass=function(){return Vn},Vn.isAtomic=function(t){return!(t instanceof jt)};var jn=function(){this._geom=null;var t=arguments[0];this._geom=t};jn.prototype.locate=function(t){return jn.locate(t,this._geom)},jn.prototype.interfaces_=function(){return[Un]},jn.prototype.getClass=function(){return jn},jn.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&at.isPointInRing(t,e.getCoordinates())},jn.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!jn.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN(r);if(jn.isPointInRing(t,i))return!1}return!0},jn.containsPoint=function(t,e){if(e instanceof Qt)return jn.containsPointInPolygon(t,e);if(e instanceof jt)for(var n=new Vn(e);n.hasNext();){var r=n.next();if(r!==e&&jn.containsPoint(t,r))return!0}return!1},jn.locate=function(t,e){return e.isEmpty()?P.EXTERIOR:jn.containsPoint(t,e)?P.INTERIOR:P.EXTERIOR};var Gn=function(){this._edgeMap=new h,this._edgeList=null,this._ptInAreaLocation=[P.NONE,P.NONE]};Gn.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return 0===e&&(n=this._edgeList.size()-1),this._edgeList.get(n)},Gn.prototype.propagateSideLabels=function(t){for(var e=P.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,Ie.LEFT)!==P.NONE&&(e=r.getLocation(t,Ie.LEFT))}if(e===P.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,Ie.ON)===P.NONE&&a.setLocation(t,Ie.ON,i),a.isArea(t)){var l=a.getLocation(t,Ie.LEFT),u=a.getLocation(t,Ie.RIGHT);if(u!==P.NONE){if(u!==i)throw new Pe("side location conflict",s.getCoordinate());l===P.NONE&&et.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=l}else et.isTrue(a.getLocation(t,Ie.LEFT)===P.NONE,"found single null side"),a.setLocation(t,Ie.RIGHT,i),a.setLocation(t,Ie.LEFT,i)}}},Gn.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},Gn.prototype.print=function(t){q.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},Gn.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Gn.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,r=e.get(n).getLabel().getLocation(t,Ie.LEFT);et.isTrue(r!==P.NONE,"Found unlabelled area edge");for(var i=r,o=this.iterator();o.hasNext();){var s=o.next().getLabel();et.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,Ie.LEFT),l=s.getLocation(t,Ie.RIGHT);if(a===l)return!1;if(l!==i)return!1;i=a}return!0},Gn.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++)if(this._edgeList.get(e)===t)return e;return-1},Gn.prototype.iterator=function(){return this.getEdges().iterator()},Gn.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new Et(this._edgeMap.values())),this._edgeList},Gn.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===P.NONE&&(this._ptInAreaLocation[t]=jn.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},Gn.prototype.toString=function(){var t=new N;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append("\n")}return t.toString()},Gn.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},Gn.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],n=this.iterator();n.hasNext();)for(var r=n.next().getLabel(),i=0;i<2;i++)r.isLine(i)&&r.getLocation(i)===P.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),l=0;l<2;l++)if(a.isAnyNull(l)){var u=P.NONE;if(e[l])u=P.EXTERIOR;else{var c=s.getCoordinate();u=this.getLocation(l,c,t)}a.setAllLocationsIfNull(l,u)}},Gn.prototype.getDegree=function(){return this._edgeMap.size()},Gn.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn};var qn=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var t=null,e=null,n=this._SCANNING_FOR_INCOMING,r=0;r<this._resultAreaEdgeList.size();r++){var i=this._resultAreaEdgeList.get(r),o=i.getSym();if(i.getLabel().isArea())switch(null===t&&i.isInResult()&&(t=i),n){case this._SCANNING_FOR_INCOMING:if(!o.isInResult())continue;e=o,n=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!i.isInResult())continue;e.setNext(i),n=this._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===t)throw new Pe("no outgoing dirEdge found",this.getCoordinate());et.isTrue(t.isInResult(),"unable to link last incoming dirEdge"),e.setNext(t)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var n=t.get(0);if(1===e)return n;var r=t.get(e-1),i=n.getQuadrant(),o=r.getQuadrant();return Be.isNorthern(i)&&Be.isNorthern(o)?n:Be.isNorthern(i)||Be.isNorthern(o)?0!==n.getDy()?n:0!==r.getDy()?r:(et.shouldNeverReachHere("found two horizontal edges incident on node"),null):r},e.prototype.print=function(t){q.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print("out "),n.print(t),t.println(),t.print("in "),n.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new Et;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next().getLabel();n.setAllLocationsIfNull(0,t.getLocation(0)),n.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,n=this._edgeList.size()-1;n>=0;n--){var r=this._edgeList.get(n),i=r.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=r}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(Ie.LEFT),r=t.getDepth(Ie.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,i)!==r)throw new Pe("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var l=this._edgeList.get(a);l.setEdgeDepths(Ie.RIGHT,s),s=l.getDepth(Ie.LEFT)}return s}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=null,n=null,r=this._SCANNING_FOR_INCOMING,i=this._resultAreaEdgeList.size()-1;i>=0;i--){var o=this._resultAreaEdgeList.get(i),s=o.getSym();switch(null===e&&o.getEdgeRing()===t&&(e=o),r){case this._SCANNING_FOR_INCOMING:if(s.getEdgeRing()!==t)continue;n=s,r=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(o.getEdgeRing()!==t)continue;n.setNextMin(o),r=this._SCANNING_FOR_INCOMING}}r===this._LINKING_TO_OUTGOING&&(et.isTrue(null!==e,"found null for first outgoing dirEdge"),et.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();)e.next().isInResult()&&t++;return t}if(1===arguments.length){for(var n=arguments[0],r=0,i=this.iterator();i.hasNext();)i.next().getEdgeRing()===n&&r++;return r}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=P.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=P.INTERIOR;break}if(r.isInResult()){t=P.EXTERIOR;break}}}if(t===P.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===P.INTERIOR):(s.isInResult()&&(i=P.EXTERIOR),a.isInResult()&&(i=P.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new ke(P.NONE);for(var n=this.iterator();n.hasNext();)for(var r=n.next().getEdge().getLabel(),i=0;i<2;i++){var o=r.getLocation(i);o!==P.INTERIOR&&o!==P.BOUNDARY||this._label.setLocation(i,P.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Gn),$n=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new ze(t,new qn)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ge),Xn=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Xn.prototype.compareTo=function(t){var e=t;return Xn.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Xn.prototype.interfaces_=function(){return[b]},Xn.prototype.getClass=function(){return Xn},Xn.orientation=function(t){return 1===Ct.increasingDirection(t)},Xn.compareOriented=function(t,e,n,r){for(var i=e?1:-1,o=r?1:-1,s=e?t.length:-1,a=r?n.length:-1,l=e?0:t.length-1,u=r?0:n.length-1;;){var c=t[l].compareTo(n[u]);if(0!==c)return c;var h=(l+=i)===s,p=(u+=o)===a;if(h&&!p)return-1;if(!h&&p)return 1;if(h&&p)return 0}};var Zn=function(){this._edges=new Et,this._ocaMap=new h};Zn.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var r=n.getCoordinates(),i=0;i<r.length;i++)i>0&&t.print(","),t.print(r[i].x+" "+r[i].y);t.println(")")}t.print(") ")},Zn.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Zn.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Zn.prototype.iterator=function(){return this._edges.iterator()},Zn.prototype.getEdges=function(){return this._edges},Zn.prototype.get=function(t){return this._edges.get(t)},Zn.prototype.findEqualEdge=function(t){var e=new Xn(t.getCoordinates());return this._ocaMap.get(e)},Zn.prototype.add=function(t){this._edges.add(t);var e=new Xn(t.getCoordinates());this._ocaMap.put(e,t)},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn};var Yn=function(){};Yn.prototype.processIntersections=function(t,e,n,r){},Yn.prototype.isDone=function(){},Yn.prototype.interfaces_=function(){return[]},Yn.prototype.getClass=function(){return Yn};var Wn=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};Wn.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(Wn.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},Wn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Wn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Wn.prototype.getLineIntersector=function(){return this._li},Wn.prototype.hasProperIntersection=function(){return this._hasProper},Wn.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Wn.prototype.hasIntersection=function(){return this._hasIntersection},Wn.prototype.isDone=function(){return!1},Wn.prototype.hasInteriorIntersection=function(){return this._hasInterior},Wn.prototype.interfaces_=function(){return[Yn]},Wn.prototype.getClass=function(){return Wn},Wn.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Hn=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new S(t),this.segmentIndex=e,this.dist=n};Hn.prototype.getSegmentIndex=function(){return this.segmentIndex},Hn.prototype.getCoordinate=function(){return this.coord},Hn.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Hn.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Hn.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Hn.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Hn.prototype.getDistance=function(){return this.dist},Hn.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Hn.prototype.interfaces_=function(){return[b]},Hn.prototype.getClass=function(){return Hn};var Kn=function(){this._nodeMap=new h,this.edge=null;var t=arguments[0];this.edge=t};Kn.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},Kn.prototype.iterator=function(){return this._nodeMap.values().iterator()},Kn.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},Kn.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Kn.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new S(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new nr(o,new ke(this.edge._label))},Kn.prototype.add=function(t,e,n){var r=new Hn(t,e,n),i=this._nodeMap.get(r);return null!==i?i:(this._nodeMap.put(r,r),r)},Kn.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},Kn.prototype.interfaces_=function(){return[]},Kn.prototype.getClass=function(){return Kn};var Jn=function(){};Jn.prototype.getChainStartIndices=function(t){var e=0,n=new Et;n.add(new D(e));do{var r=this.findChainEnd(t,e);n.add(new D(r)),e=r}while(e<t.length-1);return Jn.toIntArray(n)},Jn.prototype.findChainEnd=function(t,e){for(var n=Be.quadrant(t[e],t[e+1]),r=e+1;r<t.length&&Be.quadrant(t[r-1],t[r])===n;)r++;return r-1},Jn.prototype.interfaces_=function(){return[]},Jn.prototype.getClass=function(){return Jn},Jn.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Qn=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new X,this.env2=new X;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Jn;this.startIndex=e.getChainStartIndices(this.pts)};Qn.prototype.getCoordinates=function(){return this.pts},Qn.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},Qn.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},Qn.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],r)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],l=arguments[4],u=arguments[5],c=this.pts[i],h=this.pts[o],p=s.pts[a],f=s.pts[l];if(o-i==1&&l-a==1)return u.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(c,h),this.env2.init(p,f),!this.env1.intersects(this.env2))return null;var d=Math.trunc((i+o)/2),g=Math.trunc((a+l)/2);i<d&&(a<g&&this.computeIntersectsForChain(i,d,s,a,g,u),g<l&&this.computeIntersectsForChain(i,d,s,g,l,u)),d<o&&(a<g&&this.computeIntersectsForChain(d,o,s,a,g,u),g<l&&this.computeIntersectsForChain(d,o,s,g,l,u))}},Qn.prototype.getStartIndexes=function(){return this.startIndex},Qn.prototype.computeIntersects=function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var r=0;r<t.startIndex.length-1;r++)this.computeIntersectsForChain(n,t,r,e)},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn};var tr=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var n=0;n<3;n++)this._depth[e][n]=t.NULL_VALUE},er={NULL_VALUE:{configurable:!0}};tr.prototype.getDepth=function(t,e){return this._depth[t][e]},tr.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},tr.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==tr.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments[0];return this._depth[n][1]===tr.NULL_VALUE}if(2===arguments.length){var r=arguments[0],i=arguments[1];return this._depth[r][i]===tr.NULL_VALUE}},tr.prototype.normalize=function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(var n=1;n<3;n++){var r=0;this._depth[t][n]>e&&(r=1),this._depth[t][n]=r}}},tr.prototype.getDelta=function(t){return this._depth[t][Ie.RIGHT]-this._depth[t][Ie.LEFT]},tr.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?P.EXTERIOR:P.INTERIOR},tr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},tr.prototype.add=function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<2;e++)for(var n=1;n<3;n++){var r=t.getLocation(e,n);r!==P.EXTERIOR&&r!==P.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=tr.depthAtLocation(r):this._depth[e][n]+=tr.depthAtLocation(r))}else if(3===arguments.length){var i=arguments[0],o=arguments[1];arguments[2]===P.INTERIOR&&this._depth[i][o]++}},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},tr.depthAtLocation=function(t){return t===P.EXTERIOR?0:t===P.INTERIOR?1:tr.NULL_VALUE},er.NULL_VALUE.get=function(){return-1},Object.defineProperties(tr,er);var nr=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Kn(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new tr,this._depthDelta=0,1===arguments.length){var n=arguments[0];e.call(this,n,null)}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,ke.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var n=t;if(this.pts.length!==n.pts.length)return!1;for(var r=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(n.pts[s])||(r=!1),this.pts[s].equals2D(n.pts[--o])||(i=!1),!r&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new Qn(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new X;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,n,r){var i=new S(t.getIntersection(r)),o=e,s=t.getEdgeDistance(n,r),a=o+1;if(a<this.pts.length){var l=this.pts[a];i.equals2D(l)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new N;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],n=arguments[1];n.setAtLeastIfValid(e.getLocation(0,Ie.ON),e.getLocation(1,Ie.ON),1),e.isArea()&&(n.setAtLeastIfValid(e.getLocation(0,Ie.LEFT),e.getLocation(1,Ie.LEFT),2),n.setAtLeastIfValid(e.getLocation(0,Ie.RIGHT),e.getLocation(1,Ie.RIGHT),2))},e}(Oe),rr=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Zn,this._bufParams=t||null};rr.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},rr.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new ke(t.getLabel())).flip(),n.merge(r);var i=rr.depthDelta(r),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(rr.depthDelta(t.getLabel()))},rr.prototype.buildSubgraphs=function(t,e){for(var n=new Et,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),s=new Rn(n).getDepth(o);i.computeDepth(s),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},rr.prototype.createSubgraphs=function(t){for(var e=new Et,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var i=new Le;i.create(r),e.add(i)}}return Qe.sort(e,Qe.reverseOrder()),e},rr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},rr.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new wn,n=new it;return n.setPrecisionModel(t),e.setSegmentIntersector(new Wn(n)),e},rr.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new Dn(n,this._bufParams),i=new Bn(t,e,r).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new qe(new $n),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new $e(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},rr.prototype.computeNodedEdges=function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var r=n.getNodedSubstrings().iterator();r.hasNext();){var i=r.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new nr(i.getCoordinates(),new ke(s));this.insertUniqueEdge(a)}}},rr.prototype.setNoder=function(t){this._workingNoder=t},rr.prototype.interfaces_=function(){return[]},rr.prototype.getClass=function(){return rr},rr.depthDelta=function(t){var e=t.getLocation(0,Ie.LEFT),n=t.getLocation(0,Ie.RIGHT);return e===P.INTERIOR&&n===P.EXTERIOR?1:e===P.EXTERIOR&&n===P.INTERIOR?-1:0},rr.convertSegStrings=function(t){for(var e=new ye,n=new Et;t.hasNext();){var r=t.next(),i=e.createLineString(r.getCoordinates());n.add(i)}return e.buildGeometry(n)};var ir=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=arguments[3];this._noder=n,this._scaleFactor=r,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};ir.prototype.rescale=function(){if(L(arguments[0],xt))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],r=0;r<n.length;r++)n[r].x=n[r].x/this._scaleFactor+this._offsetX,n[r].y=n[r].y/this._scaleFactor+this._offsetY;2===n.length&&n[0].equals2D(n[1])&&q.out.println(n)}},ir.prototype.scale=function(){if(L(arguments[0],xt)){for(var t=arguments[0],e=new Et,n=t.iterator();n.hasNext();){var r=n.next();e.add(new dn(this.scale(r.getCoordinates()),r.getData()))}return e}if(arguments[0]instanceof Array){for(var i=arguments[0],o=new Array(i.length).fill(null),s=0;s<i.length;s++)o[s]=new S(Math.round((i[s].x-this._offsetX)*this._scaleFactor),Math.round((i[s].y-this._offsetY)*this._scaleFactor),i[s].z);return Ct.removeRepeatedPoints(o)}},ir.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},ir.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},ir.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},ir.prototype.interfaces_=function(){return[xn]},ir.prototype.getClass=function(){return ir};var or=function(){this._li=new it,this._segStrings=null;var t=arguments[0];this._segStrings=t},sr={fact:{configurable:!0}};or.prototype.checkEndPtVertexIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next().getCoordinates();this.checkEndPtVertexIntersections(e[0],this._segStrings),this.checkEndPtVertexIntersections(e[e.length-1],this._segStrings)}else if(2===arguments.length)for(var n=arguments[0],r=arguments[1].iterator();r.hasNext();)for(var i=r.next().getCoordinates(),o=1;o<i.length-1;o++)if(i[o].equals(n))throw new Q("found endpt/interior pt intersection at index "+o+" :pt "+n)},or.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var r=n.next();this.checkInteriorIntersections(e,r)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),l=0;l<s.length-1;l++)for(var u=0;u<a.length-1;u++)this.checkInteriorIntersections(i,l,o,u);else if(4===arguments.length){var c=arguments[0],h=arguments[1],p=arguments[2],f=arguments[3];if(c===p&&h===f)return null;var d=c.getCoordinates()[h],g=c.getCoordinates()[h+1],m=p.getCoordinates()[f],y=p.getCoordinates()[f+1];if(this._li.computeIntersection(d,g,m,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,d,g)||this.hasInteriorIntersection(this._li,m,y)))throw new Q("found non-noded intersection at "+d+"-"+g+" and "+m+"-"+y)}},or.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},or.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var n=arguments[0].getCoordinates(),r=0;r<n.length-2;r++)this.checkCollapse(n[r],n[r+1],n[r+2])},or.prototype.hasInteriorIntersection=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++){var i=t.getIntersection(r);if(!i.equals(e)&&!i.equals(n))return!0}return!1},or.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new Q("found non-noded collapse at "+or.fact.createLineString([t,e,n]))},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or},sr.fact.get=function(){return new ye},Object.defineProperties(or,sr);var ar=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new _("Scale factor must be non-zero");1!==e&&(this._pt=new S(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new S,this._p1Scaled=new S),this.initCorners(this._pt)},lr={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};ar.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<n||this._minx>r||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return et.isTrue(!(s&&a),"Found bad envelope test"),a},ar.prototype.initCorners=function(t){this._minx=t.x-.5,this._maxx=t.x+.5,this._miny=t.y-.5,this._maxy=t.y+.5,this._corner[0]=new S(this._maxx,this._maxy),this._corner[1]=new S(this._minx,this._maxy),this._corner[2]=new S(this._minx,this._miny),this._corner[3]=new S(this._maxx,this._miny)},ar.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},ar.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},ar.prototype.getCoordinate=function(){return this._originalPt},ar.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},ar.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=ar.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new X(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},ar.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))))},ar.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||n&&r||t.equals(this._pt)||e.equals(this._pt)))))},ar.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(t.addIntersection(this.getCoordinate(),e),!0)},ar.prototype.interfaces_=function(){return[]},ar.prototype.getClass=function(){return ar},lr.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(ar,lr);var ur=function(){this.tempEnv1=new X,this.selectedSegment=new gn};ur.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur};var cr=function(){this._index=null;var t=arguments[0];this._index=t},hr={HotPixelSnapAction:{configurable:!0}};cr.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),o=new pr(e,n,r);return this._index.query(i,{interfaces_:function(){return[We]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr},hr.HotPixelSnapAction.get=function(){return pr},Object.defineProperties(cr,hr);var pr=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],n=arguments[0].getContext();if(null!==this._parentEdge&&n===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(n,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ur),fr=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new Et};fr.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var l=0;l<this._li.getIntersectionNum();l++)this._interiorIntersections.add(this._li.getIntersection(l));t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)}},fr.prototype.isDone=function(){return!1},fr.prototype.getInteriorIntersections=function(){return this._interiorIntersections},fr.prototype.interfaces_=function(){return[Yn]},fr.prototype.getClass=function(){return fr};var dr=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new it,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};dr.prototype.checkCorrectness=function(t){var e=dn.getNodedSubstrings(t),n=new or(e);try{n.checkValid()}catch(t){if(!(t instanceof j))throw t;t.printStackTrace()}},dr.prototype.getNodedSubstrings=function(){return dn.getNodedSubstrings(this._nodedSegStrings)},dr.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},dr.prototype.findInteriorIntersections=function(t,e){var n=new fr(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},dr.prototype.computeVertexSnaps=function(){if(L(arguments[0],xt))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.computeVertexSnaps(e)}else if(arguments[0]instanceof dn)for(var n=arguments[0],r=n.getCoordinates(),i=0;i<r.length;i++){var o=new ar(r[i],this._scaleFactor,this._li);this._pointSnapper.snap(o,n,i)&&n.addIntersection(r[i],i)}},dr.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new wn,this._pointSnapper=new cr(this._noder.getIndex()),this.snapRound(t,this._li)},dr.prototype.computeIntersectionSnaps=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=new ar(n,this._scaleFactor,this._li);this._pointSnapper.snap(r)}},dr.prototype.interfaces_=function(){return[xn]},dr.prototype.getClass=function(){return dr};var gr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Sn,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}},mr={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};gr.prototype.bufferFixedPrecision=function(t){var e=new ir(new dr(new fe(1)),t.getScale()),n=new rr(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},gr.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=gr.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof Pe))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],r=gr.precisionScaleFactor(this._argGeom,this._distance,n),i=new fe(r);this.bufferFixedPrecision(i)}},gr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===fe.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},gr.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},gr.prototype.bufferOriginalPrecision=function(){try{var t=new rr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof Q))throw t;this._saveException=t}},gr.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},gr.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr},gr.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new gr(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof ct&&"number"==typeof arguments[1]){var e=arguments[1],n=arguments[2],r=new gr(arguments[0]);return r.setQuadrantSegments(n),r.getResultGeometry(e)}if(arguments[2]instanceof Sn&&arguments[0]instanceof ct&&"number"==typeof arguments[1]){var i=arguments[1];return new gr(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],l=new gr(arguments[0]);return l.setQuadrantSegments(s),l.setEndCapStyle(a),l.getResultGeometry(o)}},gr.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=A.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},mr.CAP_ROUND.get=function(){return Sn.CAP_ROUND},mr.CAP_BUTT.get=function(){return Sn.CAP_FLAT},mr.CAP_FLAT.get=function(){return Sn.CAP_FLAT},mr.CAP_SQUARE.get=function(){return Sn.CAP_SQUARE},mr.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(gr,mr);var yr=function(){this._pt=[new S,new S],this._distance=v.NaN,this._isNull=!0};yr.prototype.getCoordinates=function(){return this._pt},yr.prototype.getCoordinate=function(t){return this._pt[t]},yr.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},yr.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},yr.prototype.getDistance=function(){return this._distance},yr.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr};var _r=function(){};_r.prototype.interfaces_=function(){return[]},_r.prototype.getClass=function(){return _r},_r.computeDistance=function(){if(arguments[2]instanceof yr&&arguments[0]instanceof Wt&&arguments[1]instanceof S)for(var t=arguments[1],e=arguments[2],n=arguments[0].getCoordinates(),r=new gn,i=0;i<n.length-1;i++){r.setCoordinates(n[i],n[i+1]);var o=r.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof yr&&arguments[0]instanceof Qt&&arguments[1]instanceof S){var s=arguments[0],a=arguments[1],l=arguments[2];_r.computeDistance(s.getExteriorRing(),a,l);for(var u=0;u<s.getNumInteriorRing();u++)_r.computeDistance(s.getInteriorRingN(u),a,l)}else if(arguments[2]instanceof yr&&arguments[0]instanceof ct&&arguments[1]instanceof S){var c=arguments[0],h=arguments[1],p=arguments[2];if(c instanceof Wt)_r.computeDistance(c,h,p);else if(c instanceof Qt)_r.computeDistance(c,h,p);else if(c instanceof jt)for(var f=c,d=0;d<f.getNumGeometries();d++){var g=f.getGeometryN(d);_r.computeDistance(g,h,p)}else p.setMinimum(c.getCoordinate(),h)}else if(arguments[2]instanceof yr&&arguments[0]instanceof gn&&arguments[1]instanceof S){var m=arguments[1],y=arguments[2],_=arguments[0].closestPoint(m);y.setMinimum(_,m)}};var vr=function(t){this._maxPtDist=new yr,this._inputGeom=t||null},xr={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};vr.prototype.computeMaxMidpointDistance=function(t){var e=new wr(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},vr.prototype.computeMaxVertexDistance=function(t){var e=new br(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},vr.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},vr.prototype.getDistancePoints=function(){return this._maxPtDist},vr.prototype.interfaces_=function(){return[]},vr.prototype.getClass=function(){return vr},xr.MaxPointDistanceFilter.get=function(){return br},xr.MaxMidpointDistanceFilter.get=function(){return wr},Object.defineProperties(vr,xr);var br=function(t){this._maxPtDist=new yr,this._minPtDist=new yr,this._geom=t||null};br.prototype.filter=function(t){this._minPtDist.initialize(),_r.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},br.prototype.getMaxPointDistance=function(){return this._maxPtDist},br.prototype.interfaces_=function(){return[ft]},br.prototype.getClass=function(){return br};var wr=function(t){this._maxPtDist=new yr,this._minPtDist=new yr,this._geom=t||null};wr.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=new S((n.x+r.x)/2,(n.y+r.y)/2);this._minPtDist.initialize(),_r.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},wr.prototype.isDone=function(){return!1},wr.prototype.isGeometryChanged=function(){return!1},wr.prototype.getMaxPointDistance=function(){return this._maxPtDist},wr.prototype.interfaces_=function(){return[Vt]},wr.prototype.getClass=function(){return wr};var Er=function(t){this._comps=t||null};Er.prototype.filter=function(t){t instanceof Qt&&this._comps.add(t)},Er.prototype.interfaces_=function(){return[Ut]},Er.prototype.getClass=function(){return Er},Er.getPolygons=function(){if(1===arguments.length)return Er.getPolygons(arguments[0],new Et);if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof Qt?e.add(t):t instanceof jt&&t.apply(new Er(e)),e}};var Sr=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};Sr.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof ee){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Wt&&this._lines.add(t)},Sr.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},Sr.prototype.interfaces_=function(){return[ut]},Sr.prototype.getClass=function(){return Sr},Sr.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(Sr.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(Sr.getLines(e,n))}},Sr.getLines=function(){if(1===arguments.length)return Sr.getLines(arguments[0],!1);if(2===arguments.length){if(L(arguments[0],xt)&&L(arguments[1],xt)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var n=e.next();Sr.getLines(n,t)}return t}if(arguments[0]instanceof ct&&"boolean"==typeof arguments[1]){var r=arguments[0],i=arguments[1],o=new Et;return r.apply(new Sr(o,i)),o}if(arguments[0]instanceof ct&&L(arguments[1],xt)){var s=arguments[0],a=arguments[1];return s instanceof Wt?a.add(s):s.apply(new Sr(a)),a}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&L(arguments[0],xt)&&L(arguments[1],xt)){for(var l=arguments[1],u=arguments[2],c=arguments[0].iterator();c.hasNext();){var h=c.next();Sr.getLines(h,l,u)}return l}if("boolean"==typeof arguments[2]&&arguments[0]instanceof ct&&L(arguments[1],xt)){var p=arguments[1],f=arguments[2];return arguments[0].apply(new Sr(p,f)),p}}};var Ir=function(){if(this._boundaryRule=dt.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new _("Rule must be non-null");this._boundaryRule=t}};Ir.prototype.locateInternal=function(){if(arguments[0]instanceof S&&arguments[1]instanceof Qt){var t=arguments[0],e=arguments[1];if(e.isEmpty())return P.EXTERIOR;var n=e.getExteriorRing(),r=this.locateInPolygonRing(t,n);if(r===P.EXTERIOR)return P.EXTERIOR;if(r===P.BOUNDARY)return P.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===P.INTERIOR)return P.EXTERIOR;if(s===P.BOUNDARY)return P.BOUNDARY}return P.INTERIOR}if(arguments[0]instanceof S&&arguments[1]instanceof Wt){var a=arguments[0],l=arguments[1];if(!l.getEnvelopeInternal().intersects(a))return P.EXTERIOR;var u=l.getCoordinates();return l.isClosed()||!a.equals(u[0])&&!a.equals(u[u.length-1])?at.isOnLine(a,u)?P.INTERIOR:P.EXTERIOR:P.BOUNDARY}if(arguments[0]instanceof S&&arguments[1]instanceof Kt){var c=arguments[0];return arguments[1].getCoordinate().equals2D(c)?P.INTERIOR:P.EXTERIOR}},Ir.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?at.locatePointInRing(t,e.getCoordinates()):P.EXTERIOR},Ir.prototype.intersects=function(t,e){return this.locate(t,e)!==P.EXTERIOR},Ir.prototype.updateLocationInfo=function(t){t===P.INTERIOR&&(this._isIn=!0),t===P.BOUNDARY&&this._numBoundaries++},Ir.prototype.computeLocation=function(t,e){if(e instanceof Kt&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Wt)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Qt)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Gt)for(var n=e,r=0;r<n.getNumGeometries();r++){var i=n.getGeometryN(r);this.updateLocationInfo(this.locateInternal(t,i))}else if(e instanceof ne)for(var o=e,s=0;s<o.getNumGeometries();s++){var a=o.getGeometryN(s);this.updateLocationInfo(this.locateInternal(t,a))}else if(e instanceof jt)for(var l=new Vn(e);l.hasNext();){var u=l.next();u!==e&&this.computeLocation(t,u)}},Ir.prototype.locate=function(t,e){return e.isEmpty()?P.EXTERIOR:e instanceof Wt||e instanceof Qt?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?P.BOUNDARY:this._numBoundaries>0||this._isIn?P.INTERIOR:P.EXTERIOR)},Ir.prototype.interfaces_=function(){return[]},Ir.prototype.getClass=function(){return Ir};var Cr=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];this._component=e,this._segIndex=n,this._pt=r}},Tr={INSIDE_AREA:{configurable:!0}};Cr.prototype.isInsideArea=function(){return this._segIndex===Cr.INSIDE_AREA},Cr.prototype.getCoordinate=function(){return this._pt},Cr.prototype.getGeometryComponent=function(){return this._component},Cr.prototype.getSegmentIndex=function(){return this._segIndex},Cr.prototype.interfaces_=function(){return[]},Cr.prototype.getClass=function(){return Cr},Tr.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Cr,Tr);var Pr=function(t){this._pts=t||null};Pr.prototype.filter=function(t){t instanceof Kt&&this._pts.add(t)},Pr.prototype.interfaces_=function(){return[Ut]},Pr.prototype.getClass=function(){return Pr},Pr.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Kt?Qe.singletonList(t):Pr.getPoints(t,new Et)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Kt?n.add(e):e instanceof jt&&e.apply(new Pr(n)),n}};var Mr=function(){this._locations=null;var t=arguments[0];this._locations=t};Mr.prototype.filter=function(t){(t instanceof Kt||t instanceof Wt||t instanceof Qt)&&this._locations.add(new Cr(t,0,t.getCoordinate()))},Mr.prototype.interfaces_=function(){return[Ut]},Mr.prototype.getClass=function(){return Mr},Mr.getLocations=function(t){var e=new Et;return t.apply(new Mr(e)),e};var Lr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ir,this._minDistanceLocation=null,this._minDistance=v.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Lr.prototype.computeContainmentDistance=function(){if(0===arguments.length){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=1-e,i=Er.getPolygons(this._geom[e]);if(i.size()>0){var o=Mr.getLocations(this._geom[r]);if(this.computeContainmentDistance(o,i,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=n[0],this._minDistanceLocation[e]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&L(arguments[0],wt)&&L(arguments[1],wt)){for(var s=arguments[0],a=arguments[1],l=arguments[2],u=0;u<s.size();u++)for(var c=s.get(u),h=0;h<a.size();h++)if(this.computeContainmentDistance(c,a.get(h),l),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Cr&&arguments[1]instanceof Qt){var p=arguments[0],f=arguments[1],d=arguments[2],g=p.getCoordinate();if(P.EXTERIOR!==this._ptLocator.locate(g,f))return this._minDistance=0,d[0]=p,d[1]=new Cr(f,g),null}},Lr.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get(r),o=0;o<e.size();o++){var s=e.get(o);if(this.computeMinDistance(i,s,n),this._minDistance<=this._terminateDistance)return null}},Lr.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=Sr.getLines(this._geom[0]),n=Sr.getLines(this._geom[1]),r=Pr.getPoints(this._geom[0]),i=Pr.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,r,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(r,i,t),void this.updateMinDistance(t,!1))))},Lr.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Lr.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},Lr.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Lr.prototype.computeMinDistance=function(){if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof Wt&&arguments[1]instanceof Kt){var t=arguments[0],e=arguments[1],n=arguments[2];if(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>this._minDistance)return null;for(var r=t.getCoordinates(),i=e.getCoordinate(),o=0;o<r.length-1;o++){var s=at.distancePointLine(i,r[o],r[o+1]);if(s<this._minDistance){this._minDistance=s;var a=new gn(r[o],r[o+1]).closestPoint(i);n[0]=new Cr(t,o,a),n[1]=new Cr(e,0,i)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Wt&&arguments[1]instanceof Wt){var l=arguments[0],u=arguments[1],c=arguments[2];if(l.getEnvelopeInternal().distance(u.getEnvelopeInternal())>this._minDistance)return null;for(var h=l.getCoordinates(),p=u.getCoordinates(),f=0;f<h.length-1;f++)for(var d=0;d<p.length-1;d++){var g=at.distanceLineLine(h[f],h[f+1],p[d],p[d+1]);if(g<this._minDistance){this._minDistance=g;var m=new gn(h[f],h[f+1]),y=new gn(p[d],p[d+1]),_=m.closestPoints(y);c[0]=new Cr(l,f,_[0]),c[1]=new Cr(u,d,_[1])}if(this._minDistance<=this._terminateDistance)return null}}},Lr.prototype.computeMinDistancePoints=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get(r),o=0;o<e.size();o++){var s=e.get(o),a=i.getCoordinate().distance(s.getCoordinate());if(a<this._minDistance&&(this._minDistance=a,n[0]=new Cr(i,0,i.getCoordinate()),n[1]=new Cr(s,0,s.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},Lr.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new _("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Lr.prototype.computeMinDistanceLines=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get(r),o=0;o<e.size();o++){var s=e.get(o);if(this.computeMinDistance(i,s,n),this._minDistance<=this._terminateDistance)return null}},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr},Lr.distance=function(t,e){return new Lr(t,e).distance()},Lr.isWithinDistance=function(t,e,n){return new Lr(t,e,n).distance()<=n},Lr.nearestPoints=function(t,e){return new Lr(t,e).nearestPoints()};var Ar=function(){this._pt=[new S,new S],this._distance=v.NaN,this._isNull=!0};Ar.prototype.getCoordinates=function(){return this._pt},Ar.prototype.getCoordinate=function(t){return this._pt[t]},Ar.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},Ar.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},Ar.prototype.toString=function(){return J.toLineString(this._pt[0],this._pt[1])},Ar.prototype.getDistance=function(){return this._distance},Ar.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar};var kr=function(){};kr.prototype.interfaces_=function(){return[]},kr.prototype.getClass=function(){return kr},kr.computeDistance=function(){if(arguments[2]instanceof Ar&&arguments[0]instanceof Wt&&arguments[1]instanceof S)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new gn,i=t.getCoordinates(),o=0;o<i.length-1;o++){r.setCoordinates(i[o],i[o+1]);var s=r.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof Ar&&arguments[0]instanceof Qt&&arguments[1]instanceof S){var a=arguments[0],l=arguments[1],u=arguments[2];kr.computeDistance(a.getExteriorRing(),l,u);for(var c=0;c<a.getNumInteriorRing();c++)kr.computeDistance(a.getInteriorRingN(c),l,u)}else if(arguments[2]instanceof Ar&&arguments[0]instanceof ct&&arguments[1]instanceof S){var h=arguments[0],p=arguments[1],f=arguments[2];if(h instanceof Wt)kr.computeDistance(h,p,f);else if(h instanceof Qt)kr.computeDistance(h,p,f);else if(h instanceof jt)for(var d=h,g=0;g<d.getNumGeometries();g++){var m=d.getGeometryN(g);kr.computeDistance(m,p,f)}else f.setMinimum(h.getCoordinate(),p)}else if(arguments[2]instanceof Ar&&arguments[0]instanceof gn&&arguments[1]instanceof S){var y=arguments[1],_=arguments[2],v=arguments[0].closestPoint(y);_.setMinimum(v,y)}};var Nr=function(){this._g0=null,this._g1=null,this._ptDist=new Ar,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},Dr={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Nr.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Nr.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new _("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Nr.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Nr.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Nr.prototype.computeOrientedDistance=function(t,e,n){var r=new Rr(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new Or(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}},Nr.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr},Nr.distance=function(){if(2===arguments.length)return new Nr(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new Nr(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},Dr.MaxPointDistanceFilter.get=function(){return Rr},Dr.MaxDensifiedByFractionDistanceFilter.get=function(){return Or},Object.defineProperties(Nr,Dr);var Rr=function(){this._maxPtDist=new Ar,this._minPtDist=new Ar,this._euclideanDist=new kr,this._geom=null;var t=arguments[0];this._geom=t};Rr.prototype.filter=function(t){this._minPtDist.initialize(),kr.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Rr.prototype.getMaxPointDistance=function(){return this._maxPtDist},Rr.prototype.interfaces_=function(){return[ft]},Rr.prototype.getClass=function(){return Rr};var Or=function(){this._maxPtDist=new Ar,this._minPtDist=new Ar,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Or.prototype.filter=function(t,e){if(0===e)return null;for(var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=(r.x-n.x)/this._numSubSegs,o=(r.y-n.y)/this._numSubSegs,s=0;s<this._numSubSegs;s++){var a=n.x+s*i,l=n.y+s*o,u=new S(a,l);this._minPtDist.initialize(),kr.computeDistance(this._geom,u,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Or.prototype.isDone=function(){return!1},Or.prototype.isGeometryChanged=function(){return!1},Or.prototype.getMaxPointDistance=function(){return this._maxPtDist},Or.prototype.interfaces_=function(){return[Vt]},Or.prototype.getClass=function(){return Or};var zr=function(t,e,n){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=n||null},Fr={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};zr.prototype.checkMaximumDistance=function(t,e,n){var r=new Nr(e,t);if(r.setDensifyFraction(.25),this._maxDistanceFound=r.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+J.toLineString(i[0],i[1])+")"}},zr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=zr.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),zr.VERBOSE&&q.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},zr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Qt||this._input instanceof ne||this._input instanceof jt))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},zr.prototype.getErrorIndicator=function(){return this._errorIndicator},zr.prototype.checkMinimumDistance=function(t,e,n){var r=new Lr(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound<n){this._isValid=!1;var i=r.nearestPoints();this._errorLocation=r.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+J.toLineString(i[0],i[1])+" )"}},zr.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},zr.prototype.getErrorLocation=function(){return this._errorLocation},zr.prototype.getPolygonLines=function(t){for(var e=new Et,n=new Sr(e),r=Er.getPolygons(t).iterator();r.hasNext();)r.next().apply(n);return t.getFactory().buildGeometry(e)},zr.prototype.getErrorMessage=function(){return this._errMsg},zr.prototype.interfaces_=function(){return[]},zr.prototype.getClass=function(){return zr},Fr.VERBOSE.get=function(){return!1},Fr.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(zr,Fr);var Br=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},Ur={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Br.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Br.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Br.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new X(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new X(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},Br.prototype.checkDistance=function(){var t=new zr(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},Br.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Br.prototype.checkPolygonal=function(){this._result instanceof Qt||this._result instanceof ne||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Br.prototype.getErrorIndicator=function(){return this._errorIndicator},Br.prototype.getErrorLocation=function(){return this._errorLocation},Br.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Br.prototype.report=function(t){if(!Br.VERBOSE)return null;q.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Br.prototype.getErrorMessage=function(){return this._errorMsg},Br.prototype.interfaces_=function(){return[]},Br.prototype.getClass=function(){return Br},Br.isValidMsg=function(t,e,n){var r=new Br(t,e,n);return r.isValid()?null:r.getErrorMessage()},Br.isValid=function(t,e,n){return!!new Br(t,e,n).isValid()},Ur.VERBOSE.get=function(){return!1},Ur.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Br,Ur);var Vr=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Vr.prototype.getCoordinates=function(){return this._pts},Vr.prototype.size=function(){return this._pts.length},Vr.prototype.getCoordinate=function(t){return this._pts[t]},Vr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Vr.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:hn.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Vr.prototype.setData=function(t){this._data=t},Vr.prototype.getData=function(){return this._data},Vr.prototype.toString=function(){return J.toLineString(new le(this._pts))},Vr.prototype.interfaces_=function(){return[pn]},Vr.prototype.getClass=function(){return Vr};var jr=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Et,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};jr.prototype.getInteriorIntersection=function(){return this._interiorIntersection},jr.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},jr.prototype.getIntersectionSegments=function(){return this._intSegments},jr.prototype.count=function(){return this._intersectionCount},jr.prototype.getIntersections=function(){return this._intersections},jr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},jr.prototype.setKeepIntersections=function(t){this._keepIntersections=t},jr.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(t,e)&&!this.isEndSegment(n,r))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},jr.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},jr.prototype.hasIntersection=function(){return null!==this._interiorIntersection},jr.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},jr.prototype.interfaces_=function(){return[Yn]},jr.prototype.getClass=function(){return jr},jr.createAllIntersectionsFinder=function(t){var e=new jr(t);return e.setFindAllIntersections(!0),e},jr.createAnyIntersectionFinder=function(t){return new jr(t)},jr.createIntersectionCounter=function(t){var e=new jr(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Gr=function(){this._li=new it,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Gr.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Gr.prototype.getIntersections=function(){return this._segInt.getIntersections()},Gr.prototype.isValid=function(){return this.execute(),this._isValid},Gr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Gr.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new jr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new wn;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Gr.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Pe(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Gr.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+J.toLineString(t[0],t[1])+" and "+J.toLineString(t[2],t[3])},Gr.prototype.interfaces_=function(){return[]},Gr.prototype.getClass=function(){return Gr},Gr.computeIntersections=function(t){var e=new Gr(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var qr=function t(){this._nv=null;var e=arguments[0];this._nv=new Gr(t.toSegmentStrings(e))};qr.prototype.checkValid=function(){this._nv.checkValid()},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},qr.toSegmentStrings=function(t){for(var e=new Et,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Vr(r.getCoordinates(),r))}return e},qr.checkValid=function(t){new qr(t).checkValid()};var $r=function(t){this._mapOp=t};$r.prototype.map=function(t){for(var e=new Et,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add(r)}return t.getFactory().createGeometryCollection(ye.toGeometryArray(e))},$r.prototype.interfaces_=function(){return[]},$r.prototype.getClass=function(){return $r},$r.map=function(t,e){return new $r(e).map(t)};var Xr=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new Et,this._resultLineList=new Et;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};Xr.prototype.collectLines=function(t){for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next();this.collectLineEdge(n,t,this._lineEdgesList),this.collectBoundaryTouchEdge(n,t,this._lineEdgesList)}},Xr.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Xr.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Xr.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!Ci.isResultOfOp(r,e)||i.isCovered()||(n.add(i),t.setVisitedEdge(!0)))},Xr.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next(),r=n.getEdge();if(n.isLineEdge()&&!r.isCoveredSet()){var i=this._op.isCoveredByA(n.getCoordinate());r.setCovered(i)}}},Xr.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=n.getLabel();n.isIsolated()&&(r.isNull(0)?this.labelIsolatedLine(n,0):this.labelIsolatedLine(n,1))}},Xr.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var n=e.next(),r=this._geometryFactory.createLineString(n.getCoordinates());this._resultLineList.add(r),n.setInResult(!0)}},Xr.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(et.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(Ci.isResultOfOp(r,e)&&e===Ci.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr};var Zr=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new Et;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};Zr.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},Zr.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();if(!(n.isInResult()||n.isIncidentEdgeInResult()||0!==n.getEdges().getDegree()&&t!==Ci.INTERSECTION)){var r=n.getLabel();Ci.isResultOfOp(r,t)&&this.filterCoveredNodeToPoint(n)}}},Zr.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Zr.prototype.interfaces_=function(){return[]},Zr.prototype.getClass=function(){return Zr};var Yr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Yr.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},Yr.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);null!==r&&r instanceof ee&&!r.isEmpty()||(n=!1);for(var i=new Et,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof ee||(n=!1),i.add(s))}if(n)return this._factory.createPolygon(r,i.toArray([]));var a=new Et;return null!==r&&a.add(r),a.addAll(i),this._factory.buildGeometry(a)},Yr.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},Yr.prototype.getInputGeometry=function(){return this._inputGeom},Yr.prototype.transformMultiLineString=function(t,e){for(var n=new Et,r=0;r<t.getNumGeometries();r++){var i=this.transformLineString(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Yr.prototype.transformCoordinates=function(t,e){return this.copy(t)},Yr.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},Yr.prototype.transformMultiPoint=function(t,e){for(var n=new Et,r=0;r<t.getNumGeometries();r++){var i=this.transformPoint(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Yr.prototype.transformMultiPolygon=function(t,e){for(var n=new Et,r=0;r<t.getNumGeometries();r++){var i=this.transformPolygon(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},Yr.prototype.copy=function(t){return t.copy()},Yr.prototype.transformGeometryCollection=function(t,e){for(var n=new Et,r=0;r<t.getNumGeometries();r++){var i=this.transform(t.getGeometryN(r));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||n.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(ye.toGeometryArray(n)):this._factory.buildGeometry(n)},Yr.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Kt)return this.transformPoint(t,null);if(t instanceof te)return this.transformMultiPoint(t,null);if(t instanceof ee)return this.transformLinearRing(t,null);if(t instanceof Wt)return this.transformLineString(t,null);if(t instanceof Gt)return this.transformMultiLineString(t,null);if(t instanceof Qt)return this.transformPolygon(t,null);if(t instanceof ne)return this.transformMultiPolygon(t,null);if(t instanceof jt)return this.transformGeometryCollection(t,null);throw new _("Unknown Geometry subtype: "+t.getClass().getName())},Yr.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===n)return this._factory.createLinearRing(null);var r=n.size();return r>0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr};var Wr=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new gn,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Wt&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1];this._srcPts=n,this._isClosed=t.isClosed(n),this._snapTolerance=r}};Wr.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),r=0;r<n;r++){var i=t.get(r),o=this.findSnapForVertex(i,e);null!==o&&(t.set(r,new S(o)),0===r&&this._isClosed&&t.set(t.size()-1,new S(o)))}},Wr.prototype.findSnapForVertex=function(t,e){for(var n=0;n<e.length;n++){if(t.equals2D(e[n]))return null;if(t.distance(e[n])<this._snapTolerance)return e[n]}return null},Wr.prototype.snapTo=function(t){var e=new It(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},Wr.prototype.snapSegments=function(t,e){if(0===e.length)return null;var n=e.length;e[0].equals2D(e[e.length-1])&&(n=e.length-1);for(var r=0;r<n;r++){var i=e[r],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new S(i),!1)}},Wr.prototype.findSegmentIndexToSnap=function(t,e){for(var n=v.MAX_VALUE,r=-1,i=0;i<e.size()-1;i++){if(this._seg.p0=e.get(i),this._seg.p1=e.get(i+1),this._seg.p0.equals2D(t)||this._seg.p1.equals2D(t)){if(this._allowSnappingToSourceVertices)continue;return-1}var o=this._seg.distance(t);o<this._snapTolerance&&o<n&&(n=o,r=i)}return r},Wr.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr},Wr.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Hr=function(t){this._srcGeom=t||null},Kr={SNAP_PRECISION_FACTOR:{configurable:!0}};Hr.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new Jr(e,n).transform(this._srcGeom)},Hr.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),r=new Jr(t,n,!0).transform(this._srcGeom),i=r;return e&&L(i,Jt)&&(i=r.buffer(0)),i},Hr.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Hr.prototype.extractTargetCoordinates=function(t){for(var e=new f,n=t.getCoordinates(),r=0;r<n.length;r++)e.add(n[r]);return e.toArray(new Array(0).fill(null))},Hr.prototype.computeMinimumSegmentLength=function(t){for(var e=v.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr},Hr.snap=function(t,e,n){var r=new Array(2).fill(null),i=new Hr(t);r[0]=i.snapTo(e,n);var o=new Hr(e);return r[1]=o.snapTo(r[0],n),r},Hr.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=Hr.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===fe.FIXED){var r=1/n.getScale()*2/1.415;r>e&&(e=r)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(Hr.computeOverlaySnapTolerance(i),Hr.computeOverlaySnapTolerance(o))}},Hr.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Hr.SNAP_PRECISION_FACTOR},Hr.snapToSelf=function(t,e,n){return new Hr(t).snapToSelf(e,n)},Kr.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Hr,Kr);var Jr=function(t){function e(e,n,r){t.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=void 0!==r&&r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var n=new Wr(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),r=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Yr),Qr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Qr.prototype.getCommon=function(){return v.longBitsToDouble(this._commonBits)},Qr.prototype.add=function(t){var e=v.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=Qr.signExpBits(this._commonBits),this._isFirst=!1,null):Qr.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=Qr.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=Qr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},Qr.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=v.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+v.toBinaryString(t),r=n.substring(n.length-64);return r.substring(0,1)+" "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+e+" ]"}},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr},Qr.getBit=function(t,e){return 0!=(t&1<<e)?1:0},Qr.signExpBits=function(t){return t>>52},Qr.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},Qr.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;r>=0;r--){if(Qr.getBit(t,r)!==Qr.getBit(e,r))return n;n++}return 52};var ti=function(){this._commonCoord=null,this._ccFilter=new ni},ei={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};ti.prototype.addCommonBits=function(t){var e=new ri(this._commonCoord);t.apply(e),t.geometryChanged()},ti.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new S(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new ri(e);return t.apply(n),t.geometryChanged(),t},ti.prototype.getCommonCoordinate=function(){return this._commonCoord},ti.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti},ei.CommonCoordinateFilter.get=function(){return ni},ei.Translater.get=function(){return ri},Object.defineProperties(ti,ei);var ni=function(){this._commonBitsX=new Qr,this._commonBitsY=new Qr};ni.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},ni.prototype.getCommonCoordinate=function(){return new S(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},ni.prototype.interfaces_=function(){return[ft]},ni.prototype.getClass=function(){return ni};var ri=function(){this.trans=null;var t=arguments[0];this.trans=t};ri.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)},ri.prototype.isDone=function(){return!1},ri.prototype.isGeometryChanged=function(){return!0},ri.prototype.interfaces_=function(){return[Vt]},ri.prototype.getClass=function(){return ri};var ii=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};ii.prototype.selfSnap=function(t){return new Hr(t).snapTo(t,this._snapTolerance)},ii.prototype.removeCommonBits=function(t){this._cbr=new ti,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},ii.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},ii.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=Ci.overlayOp(e[0],e[1],t);return this.prepareResult(n)},ii.prototype.checkValid=function(t){t.isValid()||q.out.println("Snapped geometry is invalid")},ii.prototype.computeSnapTolerance=function(){this._snapTolerance=Hr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},ii.prototype.snap=function(t){var e=this.removeCommonBits(t);return Hr.snap(e[0],e[1],this._snapTolerance)},ii.prototype.interfaces_=function(){return[]},ii.prototype.getClass=function(){return ii},ii.overlayOp=function(t,e,n){return new ii(t,e).getResultGeometry(n)},ii.union=function(t,e){return ii.overlayOp(t,e,Ci.UNION)},ii.intersection=function(t,e){return ii.overlayOp(t,e,Ci.INTERSECTION)},ii.symDifference=function(t,e){return ii.overlayOp(t,e,Ci.SYMDIFFERENCE)},ii.difference=function(t,e){return ii.overlayOp(t,e,Ci.DIFFERENCE)};var oi=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};oi.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=Ci.overlayOp(this._geom[0],this._geom[1],t),n=!0}catch(t){if(!(t instanceof Q))throw t;r=t}if(!n)try{e=ii.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof Q?r:t}return e},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi},oi.overlayOp=function(t,e,n){return new oi(t,e).getResultGeometry(n)},oi.union=function(t,e){return oi.overlayOp(t,e,Ci.UNION)},oi.intersection=function(t,e){return oi.overlayOp(t,e,Ci.INTERSECTION)},oi.symDifference=function(t,e){return oi.overlayOp(t,e,Ci.SYMDIFFERENCE)},oi.difference=function(t,e){return oi.overlayOp(t,e,Ci.DIFFERENCE)};var si=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};si.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},si.prototype.interfaces_=function(){return[]},si.prototype.getClass=function(){return si};var ai=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},li={INSERT:{configurable:!0},DELETE:{configurable:!0}};ai.prototype.isDelete=function(){return this._eventType===ai.DELETE},ai.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},ai.prototype.getObject=function(){return this._obj},ai.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},ai.prototype.getInsertEvent=function(){return this._insertEvent},ai.prototype.isInsert=function(){return this._eventType===ai.INSERT},ai.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},ai.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},ai.prototype.interfaces_=function(){return[b]},ai.prototype.getClass=function(){return ai},li.INSERT.get=function(){return 1},li.DELETE.get=function(){return 2},Object.defineProperties(ai,li);var ui=function(){};ui.prototype.interfaces_=function(){return[]},ui.prototype.getClass=function(){return ui};var ci=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};ci.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(ci.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},ci.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},ci.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},ci.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},ci.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next().getCoordinate();if(t.isIntersection(r))return!0}return!1},ci.prototype.hasProperIntersection=function(){return this._hasProper},ci.prototype.hasIntersection=function(){return this._hasIntersection},ci.prototype.isDone=function(){return this._isDone},ci.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},ci.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},ci.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci},ci.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var hi=function(t){function e(){t.call(this),this.events=new Et,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Qe.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var n=this.events.get(e);if(n.isInsert()&&this.processOverlaps(e,n.getDeleteEventIndex(),n,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof ci&&L(arguments[0],wt)&&L(arguments[1],wt)){var r=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(r,r),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&L(arguments[0],wt)&&arguments[1]instanceof ci){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var n=t.getMonotoneChainEdge(),r=n.getStartIndexes(),i=0;i<r.length-1;i++){var o=new si(n,i),s=new ai(e,n.getMinX(i),o);this.events.add(s),this.events.add(new ai(n.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,n,r){for(var i=n.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();n.isSameLabel(s)||(i.computeIntersections(a,r),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var n=arguments[1],r=arguments[0].iterator();r.hasNext();){var i=r.next();this.addEdge(i,n)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ui),pi=function(){this._min=v.POSITIVE_INFINITY,this._max=v.NEGATIVE_INFINITY},fi={NodeComparator:{configurable:!0}};pi.prototype.getMin=function(){return this._min},pi.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},pi.prototype.getMax=function(){return this._max},pi.prototype.toString=function(){return J.toLineString(new S(this._min,0),new S(this._max,0))},pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi},fi.NodeComparator.get=function(){return di},Object.defineProperties(pi,fi);var di=function(){};di.prototype.compare=function(t,e){var n=t,r=e,i=(n._min+n._max)/2,o=(r._min+r._max)/2;return i<o?-1:i>o?1:0},di.prototype.interfaces_=function(){return[E]},di.prototype.getClass=function(){return di};var gi=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],n=arguments[1],r=arguments[2];this._min=e,this._max=n,this._item=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(pi),mi=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,n),null!==this._node2&&this._node2.query(t,e,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(pi),yi=function(){this._leaves=new Et,this._root=null,this._level=0};yi.prototype.buildTree=function(){Qe.sort(this._leaves,new pi.NodeComparator);for(var t=this._leaves,e=null,n=new Et;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},yi.prototype.insert=function(t,e,n){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new gi(t,e,n))},yi.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},yi.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},yi.prototype.printNode=function(t){q.out.println(J.toLineString(new S(t._min,this._level),new S(t._max,this._level)))},yi.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},yi.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var r=t.get(n);if(null===(n+1<t.size()?t.get(n):null))e.add(r);else{var i=new mi(t.get(n),t.get(n+1));e.add(i)}}},yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi};var _i=function(){this._items=new Et};_i.prototype.visitItem=function(t){this._items.add(t)},_i.prototype.getItems=function(){return this._items},_i.prototype.interfaces_=function(){return[We]},_i.prototype.getClass=function(){return _i};var vi=function(){this._index=null;var t=arguments[0];if(!L(t,Jt))throw new _("Argument must be Polygonal");this._index=new wi(t)},xi={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};vi.prototype.locate=function(t){var e=new st(t),n=new bi(e);return this._index.query(t.y,t.y,n),e.getLocation()},vi.prototype.interfaces_=function(){return[Un]},vi.prototype.getClass=function(){return vi},xi.SegmentVisitor.get=function(){return bi},xi.IntervalIndexedGeometry.get=function(){return wi},Object.defineProperties(vi,xi);var bi=function(){this._counter=null;var t=arguments[0];this._counter=t};bi.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},bi.prototype.interfaces_=function(){return[We]},bi.prototype.getClass=function(){return bi};var wi=function(){this._index=new yi;var t=arguments[0];this.init(t)};wi.prototype.init=function(t){for(var e=Sr.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},wi.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new gn(t[e-1],t[e]),r=Math.min(n.p0.y,n.p1.y),i=Math.max(n.p0.y,n.p1.y);this._index.insert(r,i,n)}},wi.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new _i;return this._index.query(t,e,n),n.getItems()}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._index.query(r,i,o)}},wi.prototype.interfaces_=function(){return[]},wi.prototype.getClass=function(){return wi};var Ei=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new pe,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Ir,2===arguments.length){var e=arguments[0],n=arguments[1],r=dt.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=n,this._boundaryNodeRule=r,null!==n&&this.add(n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,n){var r=this._nodes.addNode(n).getLabel(),i=1;r.getLocation(t,Ie.ON)===P.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);r.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var n=arguments[1],r=arguments[2],i=new ci(arguments[0],!0,!1);i.setIsDoneIfProperInt(r);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof ee||this._parentGeom instanceof Qt||this._parentGeom instanceof ne,a=n||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},e.prototype.computeEdgeIntersections=function(t,e,n){var r=new ci(e,n,!0);return r.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,r),r},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof Kt){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,P.INTERIOR)}else if(arguments[0]instanceof S){var e=arguments[0];this.insertPoint(this._argIndex,e,P.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),P.EXTERIOR,P.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,P.INTERIOR,P.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],P.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],P.BOUNDARY)},e.prototype.addLineString=function(t){var e=Ct.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new nr(e,new ke(this._argIndex,P.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),et.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),n=0,r=t.iterator();r.hasNext();){var i=r.next();e[n++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===P.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},e.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var r=Ct.removeRepeatedPoints(t.getCoordinates());if(r.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=r[0],null;var i=e,o=n;at.isCCW(r)&&(i=n,o=e);var s=new nr(r,new ke(this._argIndex,P.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,r[0],P.BOUNDARY)},e.prototype.insertPoint=function(t,e,n){var r=this._nodes.addNode(e),i=r.getLabel();null===i?r._label=new ke(t,n):i.setLocation(t,n)},e.prototype.createEdgeSetIntersector=function(){return new hi},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var n=e.next(),r=n.getLabel().getLocation(t),i=n.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,r)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof ne&&(this._useBoundaryDeterminationRule=!1),e instanceof Qt)this.addPolygon(e);else if(e instanceof Wt)this.addLineString(e);else if(e instanceof Kt)this.addPoint(e);else if(e instanceof te)this.addCollection(e);else if(e instanceof Gt)this.addCollection(e);else if(e instanceof ne)this.addCollection(e);else{if(!(e instanceof jt))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},e.prototype.locate=function(t){return L(this._parentGeom,Jt)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new vi(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?P.BOUNDARY:P.INTERIOR},e}(qe),Si=function(){if(this._li=new it,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Ei(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=dt.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Ei(0,e,r),this._arg[1]=new Ei(1,n,r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Ei(0,i,s),this._arg[1]=new Ei(1,o,s)}};Si.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Si.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Si.prototype.interfaces_=function(){return[]},Si.prototype.getClass=function(){return Si};var Ii=function(){};Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii},Ii.map=function(){if(arguments[0]instanceof ct&&L(arguments[1],Ii.MapOp)){for(var t=arguments[0],e=arguments[1],n=new Et,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN(r));null!==i&&n.add(i)}return t.getFactory().buildGeometry(n)}if(L(arguments[0],xt)&&L(arguments[1],Ii.MapOp)){for(var o=arguments[0],s=arguments[1],a=new Et,l=o.iterator();l.hasNext();){var u=l.next(),c=s.map(u);null!==c&&a.add(c)}return a}},Ii.MapOp=function(){};var Ci=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n),this._ptLocator=new Ir,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Zn,this._resultPolyList=new Et,this._resultLineList=new Et,this._resultPointList=new Et,this._graph=new qe(new $n),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new ke(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(n),i.add(r),n.merge(r)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),n=e.getSym();e.isInResult()&&n.isInResult()&&(e.setInResult(!1),n.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,n,r,i){var o=new Et;return o.addAll(t),o.addAll(n),o.addAll(r),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},e.prototype.isCovered=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(this._ptLocator.locate(t,r)!==P.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new Et,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new Et;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),qr.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new $e(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var r=new Xr(this,this._geomFact,this._ptLocator);this._resultLineList=r.build(t);var i=new Zr(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,n)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var n=e.next();this._graph.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var r=n.next(),i=r.getLabel();i.isArea()&&!r.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,Ie.RIGHT),i.getLocation(1,Ie.RIGHT),t)&&r.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),n=e.getLabel(),r=e.getDepth();if(!r.isNull()){r.normalize();for(var i=0;i<2;i++)n.isNull(i)||!n.isArea()||r.isNull(i)||(0===r.getDelta(i)?n.toLine(i):(et.isTrue(!r.isNull(i,Ie.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(i,Ie.LEFT,r.getLocation(i,Ie.LEFT)),et.isTrue(!r.isNull(i,Ie.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(i,Ie.RIGHT,r.getLocation(i,Ie.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getLabel();e.isIsolated()&&(n.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(n)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Si);Ci.overlayOp=function(t,e,n){return new Ci(t,e).getResultGeometry(n)},Ci.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return Ci.createEmptyResult(Ci.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return $r.map(t,{interfaces_:function(){return[Ii.MapOp]},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),oi.overlayOp(t,e,Ci.INTERSECTION)},Ci.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Ci.createEmptyResult(Ci.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),oi.overlayOp(t,e,Ci.SYMDIFFERENCE)},Ci.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case Ci.INTERSECTION:o=Math.min(r,i);break;case Ci.UNION:o=Math.max(r,i);break;case Ci.DIFFERENCE:o=r;break;case Ci.SYMDIFFERENCE:o=Math.max(r,i)}return o},Ci.createEmptyResult=function(t,e,n,r){var i=null;switch(Ci.resultDimension(t,e,n)){case-1:i=r.createGeometryCollection(new Array(0).fill(null));break;case 0:i=r.createPoint();break;case 1:i=r.createLineString();break;case 2:i=r.createPolygon()}return i},Ci.difference=function(t,e){return t.isEmpty()?Ci.createEmptyResult(Ci.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),oi.overlayOp(t,e,Ci.DIFFERENCE))},Ci.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),r=t.getLocation(1);return Ci.isResultOfOp(n,r,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===P.BOUNDARY&&(i=P.INTERIOR),o===P.BOUNDARY&&(o=P.INTERIOR),arguments[2]){case Ci.INTERSECTION:return i===P.INTERIOR&&o===P.INTERIOR;case Ci.UNION:return i===P.INTERIOR||o===P.INTERIOR;case Ci.DIFFERENCE:return i===P.INTERIOR&&o!==P.INTERIOR;case Ci.SYMDIFFERENCE:return i===P.INTERIOR&&o!==P.INTERIOR||i!==P.INTERIOR&&o===P.INTERIOR}return!1}},Ci.INTERSECTION=1,Ci.UNION=2,Ci.DIFFERENCE=3,Ci.SYMDIFFERENCE=4;var Ti=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Ir,this._seg=new gn;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};Ti.prototype.isWithinToleranceOfBoundary=function(t){for(var e=0;e<this._linework.getNumGeometries();e++)for(var n=this._linework.getGeometryN(e).getCoordinateSequence(),r=0;r<n.size()-1;r++)if(n.getCoordinate(r,this._seg.p0),n.getCoordinate(r+1,this._seg.p1),this._seg.distance(t)<=this._boundaryDistanceTolerance)return!0;return!1},Ti.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?P.BOUNDARY:this._ptLocator.locate(t,this._g)},Ti.prototype.extractLinework=function(t){var e=new Pi;t.apply(e);var n=e.getLinework(),r=ye.toLineStringArray(n);return t.getFactory().createMultiLineString(r)},Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti};var Pi=function(){this._linework=null,this._linework=new Et};Pi.prototype.getLinework=function(){return this._linework},Pi.prototype.filter=function(t){if(t instanceof Qt){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},Pi.prototype.interfaces_=function(){return[Ut]},Pi.prototype.getClass=function(){return Pi};var Mi=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};Mi.prototype.extractPoints=function(t,e,n){for(var r=t.getCoordinates(),i=0;i<r.length-1;i++)this.computeOffsetPoints(r[i],r[i+1],e,n)},Mi.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},Mi.prototype.getPoints=function(t){for(var e=new Et,n=Sr.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},Mi.prototype.computeOffsetPoints=function(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=n*i/s,l=n*o/s,u=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var h=new S(u-l,c+a);r.add(h)}if(this._doRight){var p=new S(u+l,c-a);r.add(p)}},Mi.prototype.interfaces_=function(){return[]},Mi.prototype.getClass=function(){return Mi};var Li=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new Et;var e=arguments[0],n=arguments[1],r=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,n),this._geom=[e,n,r],this._locFinder=[new Ti(this._geom[0],this._boundaryDistanceTolerance),new Ti(this._geom[1],this._boundaryDistanceTolerance),new Ti(this._geom[2],this._boundaryDistanceTolerance)]},Ai={TOLERANCE:{configurable:!0}};Li.prototype.reportResult=function(t,e,n){q.out.println("Overlay result invalid - A:"+P.toLocationSymbol(e[0])+" B:"+P.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+P.toLocationSymbol(e[2]))},Li.prototype.isValid=function(t){return this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]),this.checkValid(t)},Li.prototype.checkValid=function(){if(1===arguments.length){for(var t=arguments[0],e=0;e<this._testCoords.size();e++){var n=this._testCoords.get(e);if(!this.checkValid(t,n))return this._invalidLocation=n,!1}return!0}if(2===arguments.length){var r=arguments[0],i=arguments[1];return this._location[0]=this._locFinder[0].getLocation(i),this._location[1]=this._locFinder[1].getLocation(i),this._location[2]=this._locFinder[2].getLocation(i),!!Li.hasLocation(this._location,P.BOUNDARY)||this.isValidResult(r,this._location)}},Li.prototype.addTestPts=function(t){var e=new Mi(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},Li.prototype.isValidResult=function(t,e){var n=Ci.isResultOfOp(e[0],e[1],t),r=!(n^e[2]===P.INTERIOR);return r||this.reportResult(t,e,n),r},Li.prototype.getInvalidLocation=function(){return this._invalidLocation},Li.prototype.interfaces_=function(){return[]},Li.prototype.getClass=function(){return Li},Li.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},Li.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Hr.computeSizeBasedSnapTolerance(t),Hr.computeSizeBasedSnapTolerance(e))},Li.isValid=function(t,e,n,r){return new Li(t,e,r).isValid(n)},Ai.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Li,Ai);var ki=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};ki.prototype.extractElements=function(t,e){if(null===t)return null;for(var n=0;n<t.getNumGeometries();n++){var r=t.getGeometryN(n);this._skipEmpty&&r.isEmpty()||e.add(r)}},ki.prototype.combine=function(){for(var t=new Et,e=this._inputGeoms.iterator();e.hasNext();){var n=e.next();this.extractElements(n,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},ki.prototype.interfaces_=function(){return[]},ki.prototype.getClass=function(){return ki},ki.combine=function(){return 1===arguments.length?new ki(arguments[0]).combine():2===arguments.length?new ki(ki.createList(arguments[0],arguments[1])).combine():3===arguments.length?new ki(ki.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},ki.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},ki.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new Et;return n.add(t),n.add(e),n}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=new Et;return s.add(r),s.add(i),s.add(o),s}};var Ni=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new Et)},Di={STRTREE_NODE_CAPACITY:{configurable:!0}};Ni.prototype.reduceToGeometries=function(t){for(var e=new Et,n=t.iterator();n.hasNext();){var r=n.next(),i=null;L(r,wt)?i=this.unionTree(r):r instanceof ct&&(i=r),e.add(i)}return e},Ni.prototype.extractByEnvelope=function(t,e,n){for(var r=new Et,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?r.add(o):n.add(o)}return this._geomFactory.buildGeometry(r)},Ni.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();if(!n.intersects(r))return ki.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=n.intersection(r);return this.unionUsingEnvelopeIntersection(t,e,i)},Ni.prototype.union=function(){if(null===this._inputPolys)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new sn(Ni.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var r=t.itemsTree();return this.unionTree(r)},Ni.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];if(r-n<=1){var i=Ni.getGeometry(e,n);return this.unionSafe(i,null)}if(r-n==2)return this.unionSafe(Ni.getGeometry(e,n),Ni.getGeometry(e,n+1));var o=Math.trunc((r+n)/2),s=this.binaryUnion(e,n,o),a=this.binaryUnion(e,o,r);return this.unionSafe(s,a)}},Ni.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var r=n.next();e=null===e?r.copy():e.union(r)}return e},Ni.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},Ni.prototype.unionActual=function(t,e){return Ni.restrictToPolygons(t.union(e))},Ni.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},Ni.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new Et,i=this.extractByEnvelope(n,t,r),o=this.extractByEnvelope(n,e,r),s=this.unionActual(i,o);return r.add(s),ki.combine(r)},Ni.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().createGeometryCollection([e,n]).buffer(0)}},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni},Ni.restrictToPolygons=function(t){if(L(t,Jt))return t;var e=Er.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(ye.toPolygonArray(e))},Ni.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},Ni.union=function(t){return new Ni(t).union()},Di.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Ni,Di);var Ri=function(){};Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri},Ri.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Ci.createEmptyResult(Ci.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),oi.overlayOp(t,e,Ci.UNION)},t.GeoJSONReader=Ee,t.GeoJSONWriter=Se,t.OverlayOp=Ci,t.UnionOp=Ri,t.BufferOp=gr,Object.defineProperty(t,"__esModule",{value:!0})}(e)},1156:function(t){t.exports=function(){var t,e,n;function r(r,i){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",s={};t(s),n=i(s),"undefined"!=typeof window&&(n.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=i;else t=i}return r(0,(function(t){function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{l(r.next(t))}catch(t){o(t)}}function a(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}))}function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}"function"==typeof SuppressedError&&SuppressedError;var r=i;function i(t,e){this.x=t,this.y=e}i.prototype={clone:function(){return new i(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=n*this.x+e*this.y;return this.x=e*this.x-n*this.y,this.y=r,this},_rotateAround:function(t,e){var n=Math.cos(t),r=Math.sin(t),i=e.y+r*(this.x-e.x)+n*(this.y-e.y);return this.x=e.x+n*(this.x-e.x)-r*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(t){return t instanceof i?t:Array.isArray(t)?new i(t[0],t[1]):t};var o=n(r),s=a;function a(t,e,n,r){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=n,this.p2y=r}a.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var n=t,r=0;r<8;r++){var i=this.sampleCurveX(n)-t;if(Math.abs(i)<e)return n;var o=this.sampleCurveDerivativeX(n);if(Math.abs(o)<1e-6)break;n-=i/o}var s=0,a=1;for(n=t,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-t)<e));r++)t>i?s=n:a=n,n=.5*(a-s)+s;return n},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var l=n(s);let u,c;function h(){return null==u&&(u="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),u}function p(){if(null==c&&(c=!1,h())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let n=0;n<t*t;n++){const r=4*n;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(n%t,Math.floor(n/t),1,1)}const n=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&n[e]!==e){c=!0;break}}}return c||!1}function f(t,e,n,r){const i=new l(t,e,n,r);return function(t){return i.solve(t)}}const d=f(.25,.1,.25,1);function g(t,e,n){return Math.min(n,Math.max(e,t))}function m(t,e,n){const r=n-e,i=((t-e)%r+r)%r+e;return i===e?n:i}function y(t,...e){for(const n of e)for(const e in n)t[e]=n[e];return t}let _=1;function v(t,e,n){const r={};for(const i in t)r[i]=e.call(n||this,t[i],i,t);return r}function x(t,e,n){const r={};for(const i in t)e.call(n||this,t[i],i,t)&&(r[i]=t[i]);return r}function b(t){return Array.isArray(t)?t.map(b):"object"==typeof t&&t?v(t,b):t}const w={};function E(t){w[t]||("undefined"!=typeof console&&console.warn(t),w[t]=!0)}function S(t,e,n){return(n.y-t.y)*(e.x-t.x)>(e.y-t.y)*(n.x-t.x)}function I(t){let e=0;for(let n,r,i=0,o=t.length,s=o-1;i<o;s=i++)n=t[i],r=t[s],e+=(r.x-n.x)*(n.y+r.y);return e}function C(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}let T=null;function P(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const M="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function L(t,n,r,i,o){return e(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const e=new VideoFrame(t,{timestamp:0});try{const s=null==e?void 0:e.format;if(!s||!s.startsWith("BGR")&&!s.startsWith("RGB"))throw new Error(`Unrecognized format ${s}`);const a=s.startsWith("BGR"),l=new Uint8ClampedArray(i*o*4);if(yield e.copyTo(l,function(t,e,n,r,i){const o=4*Math.max(-e,0),s=(Math.max(0,n)-n)*r*4+o,a=4*r,l=Math.max(0,e),u=Math.max(0,n);return{rect:{x:l,y:u,width:Math.min(t.width,e+r)-l,height:Math.min(t.height,n+i)-u},layout:[{offset:s,stride:a}]}}(t,n,r,i,o)),a)for(let t=0;t<l.length;t+=4){const e=l[t];l[t]=l[t+2],l[t+2]=e}return l}finally{e.close()}}))}let A,k,N,D;const R={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),n=e.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,n.drawImage(t,0,0,t.width,t.height),n},resolveURL:t=>(N||(N=document.createElement("a")),N.href=t,N.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==D&&(D=matchMedia("(prefers-reduced-motion: reduce)")),D.matches)}},O={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class z extends Error{constructor(t,e,n,r){super(`AJAXError: ${e} (${t}): ${n}`),this.status=t,this.statusText=e,this.url=n,this.body=r}}const F=C()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href,B=t=>O.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))];function U(t,e){const n=new AbortController,r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:F(),signal:n.signal});let i=!1,o=!1;return"json"===t.type&&r.headers.set("Accept","application/json"),o||fetch(r).then((n=>n.ok?(n=>{("arrayBuffer"===t.type||"image"===t.type?n.arrayBuffer():"json"===t.type?n.json():n.text()).then((t=>{o||(i=!0,e(null,t,n.headers.get("Cache-Control"),n.headers.get("Expires")))})).catch((t=>{o||e(new Error(t.message))}))})(n):n.blob().then((r=>e(new z(n.status,n.statusText,t.url,r)))))).catch((t=>{20!==t.code&&e(new Error(t.message))})),{cancel:()=>{o=!0,i||n.abort()}}}const V=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(C()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!C())return(B(t.url)||U)(t,e)}if(!(/^file:/.test(n=t.url)||/^file:/.test(F())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return U(t,e);if(C()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var n;return function(t,e){const n=new XMLHttpRequest;n.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(n.responseType="arraybuffer");for(const e in t.headers)n.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===t.credentials,n.onerror=()=>{e(new Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let r=n.response;if("json"===t.type)try{r=JSON.parse(n.response)}catch(t){return e(t)}e(null,r,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else{const r=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});e(new z(n.status,n.statusText,t.url,r))}},n.send(t.body),{cancel:()=>n.abort()}}(t,e)},j=function(t,e){return V(y(t,{type:"arrayBuffer"}),e)};function G(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),n=window.location;return e.protocol===n.protocol&&e.host===n.host}function q(t,e,n){n[t]&&-1!==n[t].indexOf(e)||(n[t]=n[t]||[],n[t].push(e))}function $(t,e,n){if(n&&n[t]){const r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}class X{constructor(t,e={}){y(this,e),this.type=t}}class Z extends X{constructor(t,e={}){super("error",y({error:t},e))}}class Y{on(t,e){return this._listeners=this._listeners||{},q(t,e,this._listeners),this}off(t,e){return $(t,e,this._listeners),$(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},q(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new X(t,e||{}));const n=t.type;if(this.listens(n)){t.target=this;const e=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const n of e)n.call(this,t);const r=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const e of r)$(n,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(y(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t))}else t instanceof Z&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var W={$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"}}};const H=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function K(t,e){const n={};for(const e in t)"ref"!==e&&(n[e]=t[e]);return H.forEach((t=>{t in e&&(n[t]=e[t])})),n}function J(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!J(t[n],e[n]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(!J(t[n],e[n]))return!1;return!0}return t===e}const Q={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function tt(t,e,n){n.push({command:Q.addSource,args:[t,e[t]]})}function et(t,e,n){e.push({command:Q.removeSource,args:[t]}),n[t]=!0}function nt(t,e,n,r){et(t,n,r),tt(t,e,n)}function rt(t,e,n){let r;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&"data"!==r&&!J(t[n][r],e[n][r]))return!1;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&"data"!==r&&!J(t[n][r],e[n][r]))return!1;return!0}function it(t,e,n,r,i,o){let s;for(s in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,s)&&(J(t[s],e[s])||n.push({command:o,args:[r,s,e[s],i]}));for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(J(t[s],e[s])||n.push({command:o,args:[r,s,e[s],i]}))}function ot(t){return t.id}function st(t,e){return t[e.id]=e,t}class at{constructor(t,e,n,r){this.message=(t?`${t}: `:"")+n,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__)}}function lt(t,...e){for(const n of e)for(const e in n)t[e]=n[e];return t}class ut extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class ct{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,n]of e)this.bindings[t]=n}concat(t){return new ct(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const ht={kind:"null"},pt={kind:"number"},ft={kind:"string"},dt={kind:"boolean"},gt={kind:"color"},mt={kind:"object"},yt={kind:"value"},_t={kind:"collator"},vt={kind:"formatted"},xt={kind:"padding"},bt={kind:"resolvedImage"},wt={kind:"variableAnchorOffsetCollection"};function Et(t,e){return{kind:"array",itemType:t,N:e}}function St(t){if("array"===t.kind){const e=St(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const It=[ht,pt,ft,dt,gt,vt,mt,Et(yt),xt,bt,wt];function Ct(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Ct(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of It)if(!Ct(t,e))return null}return`Expected ${St(t)} but found ${St(e)} instead.`}function Tt(t,e){return e.some((e=>e.kind===t.kind))}function Pt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function Mt(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Lt=.96422,At=.82521,kt=4/29,Nt=6/29,Dt=3*Nt*Nt,Rt=Nt*Nt*Nt,Ot=Math.PI/180,zt=180/Math.PI;function Ft(t){return(t%=360)<0&&(t+=360),t}function Bt([t,e,n,r]){let i,o;const s=Vt((.2225045*(t=Ut(t))+.7168786*(e=Ut(e))+.0606169*(n=Ut(n)))/1);t===e&&e===n?i=o=s:(i=Vt((.4360747*t+.3850649*e+.1430804*n)/Lt),o=Vt((.0139322*t+.0971045*e+.7141733*n)/At));const a=116*s-16;return[a<0?0:a,500*(i-s),200*(s-o),r]}function Ut(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Vt(t){return t>Rt?Math.pow(t,1/3):t/Dt+kt}function jt([t,e,n,r]){let i=(t+16)/116,o=isNaN(e)?i:i+e/500,s=isNaN(n)?i:i-n/200;return i=1*qt(i),o=Lt*qt(o),s=At*qt(s),[Gt(3.1338561*o-1.6168667*i-.4906146*s),Gt(-.9787684*o+1.9161415*i+.033454*s),Gt(.0719453*o-.2289914*i+1.4052427*s),r]}function Gt(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function qt(t){return t>Nt?t*t*t:Dt*(t-kt)}function $t(t){return parseInt(t.padEnd(2,t),16)/255}function Xt(t,e){return Zt(e?t/100:t,0,1)}function Zt(t,e,n){return Math.min(Math.max(e,t),n)}function Yt(t){return!t.some(Number.isNaN)}const Wt={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 Ht{constructor(t,e,n,r=1,i=!0){this.r=t,this.g=e,this.b=n,this.a=r,i||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,n,r]))}static parse(t){if(t instanceof Ht)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Wt[t];if(e){const[t,n,r]=e;return[t/255,n/255,r/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let n=1;return[$t(t.slice(n,n+=e)),$t(t.slice(n,n+=e)),$t(t.slice(n,n+=e)),$t(t.slice(n,n+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,n,r,i,o,s,a,l,u,c,h,p]=e,f=[i||" ",a||" ",c].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){const t=[r,s,u].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[Zt(+n/e,0,1),Zt(+o/e,0,1),Zt(+l/e,0,1),h?Xt(+h,p):1];if(Yt(t))return t}}return}}const n=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){const[t,e,r,i,o,s,a,l,u]=n,c=[r||" ",o||" ",a].join("");if(" "===c||" /"===c||",,"===c||",,,"===c){const t=[+e,Zt(+i,0,100),Zt(+s,0,100),l?Xt(+l,u):1];if(Yt(t))return function([t,e,n,r]){function i(r){const i=(r+t/30)%12,o=e*Math.min(n,1-n);return n-o*Math.max(-1,Math.min(i-3,9-i,1))}return t=Ft(t),e/=100,n/=100,[i(0),i(8),i(4),r]}(t)}}}(t);return e?new Ht(...e,!1):void 0}get rgb(){const{r:t,g:e,b:n,a:r}=this,i=r||1/0;return this.overwriteGetter("rgb",[t/i,e/i,n/i,r])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,n,r,i]=Bt(t),o=Math.sqrt(n*n+r*r);return[Math.round(1e4*o)?Ft(Math.atan2(r,n)*zt):NaN,o,e,i]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Bt(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,n,r]=this.rgb;return`rgba(${[t,e,n].map((t=>Math.round(255*t))).join(",")},${r})`}}Ht.black=new Ht(0,0,0,1),Ht.white=new Ht(1,1,1,1),Ht.transparent=new Ht(0,0,0,0),Ht.red=new Ht(1,0,0,1);class Kt{constructor(t,e,n){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Jt{constructor(t,e,n,r,i){this.text=t,this.image=e,this.scale=n,this.fontStack=r,this.textColor=i}}class Qt{constructor(t){this.sections=t}static fromString(t){return new Qt([new Jt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Qt?t:Qt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class te{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof te)return t;if("number"==typeof t)return new te([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new te(t)}}toString(){return JSON.stringify(this.values)}}const ee=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ne{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ne)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const n=t[e],r=t[e+1];if("string"!=typeof n||!ee.has(n))return;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new ne(t)}}toString(){return JSON.stringify(this.values)}}class re{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new re({name:t,available:!1}):null}}function ie(t,e,n,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,n,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[t,e,n,r]:[t,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function oe(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Ht||t instanceof Kt||t instanceof Qt||t instanceof te||t instanceof ne||t instanceof re)return!0;if(Array.isArray(t)){for(const e of t)if(!oe(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!oe(t[e]))return!1;return!0}return!1}function se(t){if(null===t)return ht;if("string"==typeof t)return ft;if("boolean"==typeof t)return dt;if("number"==typeof t)return pt;if(t instanceof Ht)return gt;if(t instanceof Kt)return _t;if(t instanceof Qt)return vt;if(t instanceof te)return xt;if(t instanceof ne)return wt;if(t instanceof re)return bt;if(Array.isArray(t)){const e=t.length;let n;for(const e of t){const t=se(e);if(n){if(n===t)continue;n=yt;break}n=t}return Et(n||yt,e)}return mt}function ae(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Ht||t instanceof Qt||t instanceof te||t instanceof ne||t instanceof re?t.toString():JSON.stringify(t)}class le{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!oe(t[1]))return e.error("invalid value");const n=t[1];let r=se(n);const i=e.expectedType;return"array"!==r.kind||0!==r.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(r=i),new le(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ue{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const ce={string:ft,number:pt,boolean:dt,object:mt};class he{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let n,r=1;const i=t[0];if("array"===i){let i,o;if(t.length>2){const n=t[1];if("string"!=typeof n||!(n in ce)||"object"===n)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=ce[n],r++}else i=yt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],r++}n=Et(i,o)}else{if(!ce[i])throw new Error(`Types doesn't contain name = ${i}`);n=ce[i]}const o=[];for(;r<t.length;r++){const n=e.parse(t[r],r,yt);if(!n)return null;o.push(n)}return new he(n,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const n=this.args[e].evaluate(t);if(!Ct(this.type,se(n)))return n;if(e===this.args.length-1)throw new ue(`Expected value to be of type ${St(this.type)}, but found ${St(se(n))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const pe={"to-boolean":dt,"to-color":gt,"to-number":pt,"to-string":ft};class fe{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[0];if(!pe[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if(("to-boolean"===n||"to-string"===n)&&2!==t.length)return e.error("Expected one argument.");const r=pe[n],i=[];for(let n=1;n<t.length;n++){const r=e.parse(t[n],n,yt);if(!r)return null;i.push(r)}return new fe(r,i)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,n;for(const r of this.args){if(e=r.evaluate(t),n=null,e instanceof Ht)return e;if("string"==typeof e){const n=t.parseColor(e);if(n)return n}else if(Array.isArray(e)&&(n=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ie(e[0],e[1],e[2],e[3]),!n))return new Ht(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ue(n||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const n of this.args){e=n.evaluate(t);const r=te.parse(e);if(r)return r}throw new ue(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const n of this.args){e=n.evaluate(t);const r=ne.parse(e);if(r)return r}throw new ue(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const n of this.args){if(e=n.evaluate(t),null===e)return 0;const r=Number(e);if(!isNaN(r))return r}throw new ue(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Qt.fromString(ae(this.args[0].evaluate(t)));case"resolvedImage":return re.fromString(ae(this.args[0].evaluate(t)));default:return ae(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const de=["Unknown","Point","LineString","Polygon"];class ge{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?de[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Ht.parse(t)),e}}class me{constructor(t,e,n=[],r,i=new ct,o=[]){this.registry=t,this.path=n,this.key=n.map((t=>`[${t}]`)).join(""),this.scope=i,this.errors=o,this.expectedType=r,this._isConstant=e}parse(t,e,n,r,i={}){return e?this.concat(e,n,r)._parse(t,i):this._parse(t,i)}_parse(t,e){function n(t,e,n){return"assert"===n?new he(e,[t]):"coerce"===n?new fe(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[r];if(i){let r=i.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,i=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind)if("padding"!==t.kind||"value"!==i.kind&&"number"!==i.kind&&"array"!==i.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==i.kind&&"array"!==i.kind){if(this.checkSubtype(t,i))return null}else r=n(r,t,e.typeAnnotation||"coerce");else r=n(r,t,e.typeAnnotation||"coerce");else r=n(r,t,e.typeAnnotation||"coerce");else r=n(r,t,e.typeAnnotation||"assert")}if(!(r instanceof le)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new ge;try{r=new le(r.type,r.evaluate(e))}catch(t){return this.error(t.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,n){const r="number"==typeof t?this.path.concat(t):this.path,i=n?this.scope.concat(n):this.scope;return new me(this.registry,this._isConstant,r,e||null,i,this.errors)}error(t,...e){const n=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new ut(n,t))}checkSubtype(t,e){const n=Ct(t,e);return n&&this.error(n),n}}class ye{constructor(t,e,n){this.type=_t,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const n=t[1];if("object"!=typeof n||Array.isArray(n))return e.error("Collator options argument must be an object.");const r=e.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,dt);if(!r)return null;const i=e.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,dt);if(!i)return null;let o=null;return n.locale&&(o=e.parse(n.locale,1,ft),!o)?null:new ye(r,i,o)}evaluate(t){return new Kt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}const _e=8192;function ve(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function xe(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function be(t,e){const n=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(n*i*_e),Math.round(r*i*_e)]}function we(t,e,n){const r=t[0]-e[0],i=t[1]-e[1],o=t[0]-n[0],s=t[1]-n[1];return r*s-o*i==0&&r*o<=0&&i*s<=0}function Ee(t,e){let n=!1;for(let s=0,a=e.length;s<a;s++){const a=e[s];for(let e=0,s=a.length;e<s-1;e++){if(we(t,a[e],a[e+1]))return!1;(i=a[e])[1]>(r=t)[1]!=(o=a[e+1])[1]>r[1]&&r[0]<(o[0]-i[0])*(r[1]-i[1])/(o[1]-i[1])+i[0]&&(n=!n)}}var r,i,o;return n}function Se(t,e){for(let n=0;n<e.length;n++)if(Ee(t,e[n]))return!0;return!1}function Ie(t,e,n,r){const i=r[0]-n[0],o=r[1]-n[1],s=(t[0]-n[0])*o-i*(t[1]-n[1]),a=(e[0]-n[0])*o-i*(e[1]-n[1]);return s>0&&a<0||s<0&&a>0}function Ce(t,e,n){for(const u of n)for(let n=0;n<u.length-1;++n)if(0!=(a=[(s=u[n+1])[0]-(o=u[n])[0],s[1]-o[1]])[0]*(l=[(i=e)[0]-(r=t)[0],i[1]-r[1]])[1]-a[1]*l[0]&&Ie(r,i,o,s)&&Ie(o,s,r,i))return!0;var r,i,o,s,a,l;return!1}function Te(t,e){for(let n=0;n<t.length;++n)if(!Ee(t[n],e))return!1;for(let n=0;n<t.length-1;++n)if(Ce(t[n],t[n+1],e))return!1;return!0}function Pe(t,e){for(let n=0;n<e.length;n++)if(Te(t,e[n]))return!0;return!1}function Me(t,e,n){const r=[];for(let i=0;i<t.length;i++){const o=[];for(let r=0;r<t[i].length;r++){const s=be(t[i][r],n);ve(e,s),o.push(s)}r.push(o)}return r}function Le(t,e,n){const r=[];for(let i=0;i<t.length;i++){const o=Me(t[i],e,n);r.push(o)}return r}function Ae(t,e,n,r){if(t[0]<n[0]||t[0]>n[2]){const e=.5*r;let i=t[0]-n[0]>e?-r:n[0]-t[0]>e?r:0;0===i&&(i=t[0]-n[2]>e?-r:n[2]-t[0]>e?r:0),t[0]+=i}ve(e,t)}function ke(t,e,n,r){const i=Math.pow(2,r.z)*_e,o=[r.x*_e,r.y*_e],s=[];for(const r of t)for(const t of r){const r=[t.x+o[0],t.y+o[1]];Ae(r,e,n,i),s.push(r)}return s}function Ne(t,e,n,r){const i=Math.pow(2,r.z)*_e,o=[r.x*_e,r.y*_e],s=[];for(const n of t){const t=[];for(const r of n){const n=[r.x+o[0],r.y+o[1]];ve(e,n),t.push(n)}s.push(t)}if(e[2]-e[0]<=i/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of s)for(const r of t)Ae(r,e,n,i)}var a;return s}class De{constructor(t,e){this.type=dt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(oe(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const n=e.features[t].geometry.type;if("Polygon"===n||"MultiPolygon"===n)return new De(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new De(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new De(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const o=Me(e.coordinates,r,i),s=ke(t.geometry(),n,r,i);if(!xe(n,r))return!1;for(const t of s)if(!Ee(t,o))return!1}if("MultiPolygon"===e.type){const o=Le(e.coordinates,r,i),s=ke(t.geometry(),n,r,i);if(!xe(n,r))return!1;for(const t of s)if(!Se(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const o=Me(e.coordinates,r,i),s=Ne(t.geometry(),n,r,i);if(!xe(n,r))return!1;for(const t of s)if(!Te(t,o))return!1}if("MultiPolygon"===e.type){const o=Le(e.coordinates,r,i),s=Ne(t.geometry(),n,r,i);if(!xe(n,r))return!1;for(const t of s)if(!Pe(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Re{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const n=t[1];return e.scope.has(n)?new Re(n,e.scope.get(n)):e.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Oe{constructor(t,e,n,r){this.name=t,this.type=e,this._evaluate=n,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const n=t[0],r=Oe.definitions[n];if(!r)return e.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=o.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[r,o]of s){a=new me(e.registry,ze,e.path,null,e.scope);const s=[];let l=!1;for(let e=1;e<t.length;e++){const n=t[e],i=Array.isArray(r)?r[e-1]:r.type,o=a.parse(n,1+s.length,i);if(!o){l=!0;break}s.push(o)}if(!l)if(Array.isArray(r)&&r.length!==s.length)a.error(`Expected ${r.length} arguments, but found ${s.length} instead.`);else{for(let t=0;t<s.length;t++){const e=Array.isArray(r)?r[t]:r.type,n=s[t];a.concat(t+1).checkSubtype(e,n.type)}if(0===a.errors.length)return new Oe(n,i,o,s)}}if(1===s.length)e.errors.push(...a.errors);else{const n=(s.length?s:o).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(St).join(", ")})`:`(${St(e.type)}...)`;var e})).join(" | "),r=[];for(let n=1;n<t.length;n++){const i=e.parse(t[n],1+r.length);if(!i)return null;r.push(St(i.type))}e.error(`Expected arguments of type ${n}, but found (${r.join(", ")}) instead.`)}return null}static register(t,e){Oe.definitions=e;for(const n in e)t[n]=Oe}}function ze(t){if(t instanceof Re)return ze(t.boundExpression);if(t instanceof Oe&&"error"===t.name)return!1;if(t instanceof ye)return!1;if(t instanceof De)return!1;const e=t instanceof fe||t instanceof he;let n=!0;return t.eachChild((t=>{n=e?n&&ze(t):n&&t instanceof le})),!!n&&Fe(t)&&Ue(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Fe(t){if(t instanceof Oe){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof De)return!1;let e=!0;return t.eachChild((t=>{e&&!Fe(t)&&(e=!1)})),e}function Be(t){if(t instanceof Oe&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Be(t)&&(e=!1)})),e}function Ue(t,e){if(t instanceof Oe&&e.indexOf(t.name)>=0)return!1;let n=!0;return t.eachChild((t=>{n&&!Ue(t,e)&&(n=!1)})),n}function Ve(t,e){const n=t.length-1;let r,i,o=0,s=n,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=t[a],i=t[a+1],r<=e){if(a===n||e<i)return a;o=a+1}else{if(!(r>e))throw new ue("Input is not a number.");s=a-1}return 0}class je{constructor(t,e,n){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of n)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const n=e.parse(t[1],1,pt);if(!n)return null;const r=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let n=1;n<t.length;n+=2){const o=1===n?-1/0:t[n],s=t[n+1],a=n,l=n+1;if("number"!=typeof o)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const u=e.parse(s,l,i);if(!u)return null;i=i||u.type,r.push([o,u])}return new je(i,n,r)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return n[0].evaluate(t);const i=e.length;return r>=e[i-1]?n[i-1].evaluate(t):n[Ve(e,r)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ge(t,e,n){return t+n*(e-t)}function qe(t,e,n){return t.map(((t,r)=>Ge(t,e[r],n)))}const $e={number:Ge,color:function(t,e,n,r="rgb"){switch(r){case"rgb":{const[r,i,o,s]=qe(t.rgb,e.rgb,n);return new Ht(r,i,o,s,!1)}case"hcl":{const[r,i,o,s]=t.hcl,[a,l,u,c]=e.hcl;let h,p;if(isNaN(r)||isNaN(a))isNaN(r)?isNaN(a)?h=NaN:(h=a,1!==o&&0!==o||(p=l)):(h=r,1!==u&&0!==u||(p=i));else{let t=a-r;a>r&&t>180?t-=360:a<r&&r-a>180&&(t+=360),h=r+n*t}const[f,d,g,m]=function([t,e,n,r]){return t=isNaN(t)?0:t*Ot,jt([n,Math.cos(t)*e,Math.sin(t)*e,r])}([h,null!=p?p:Ge(i,l,n),Ge(o,u,n),Ge(s,c,n)]);return new Ht(f,d,g,m,!1)}case"lab":{const[r,i,o,s]=jt(qe(t.lab,e.lab,n));return new Ht(r,i,o,s,!1)}}},array:qe,padding:function(t,e,n){return new te(qe(t.values,e.values,n))},variableAnchorOffsetCollection:function(t,e,n){const r=t.values,i=e.values;if(r.length!==i.length)throw new ue(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const o=[];for(let t=0;t<r.length;t+=2){if(r[t]!==i[t])throw new ue(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${r[t]}, to[${t}]: ${i[t]}`);o.push(r[t]);const[e,s]=r[t+1],[a,l]=i[t+1];o.push([Ge(e,a,n),Ge(s,l,n)])}return new ne(o)}};class Xe{constructor(t,e,n,r,i){this.type=t,this.operator=e,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,n,r){let i=0;if("exponential"===t.name)i=Ze(e,t.base,n,r);else if("linear"===t.name)i=Ze(e,1,n,r);else if("cubic-bezier"===t.name){const o=t.controlPoints;i=new l(o[0],o[1],o[2],o[3]).solve(Ze(e,1,n,r))}return i}static parse(t,e){let[n,r,i,...o]=t;if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,pt),!i)return null;const s=[];let a=null;"interpolate-hcl"===n||"interpolate-lab"===n?a=gt:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t<o.length;t+=2){const n=o[t],r=o[t+1],i=t+3,l=t+4;if("number"!=typeof n)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(s.length&&s[s.length-1][0]>=n)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(r,l,a);if(!u)return null;a=a||u.type,s.push([n,u])}return Mt(a,pt)||Mt(a,gt)||Mt(a,xt)||Mt(a,wt)||Mt(a,Et(pt))?new Xe(a,n,r,i,s):e.error(`Type ${St(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return n[0].evaluate(t);const i=e.length;if(r>=e[i-1])return n[i-1].evaluate(t);const o=Ve(e,r),s=Xe.interpolationFactor(this.interpolation,r,e[o],e[o+1]),a=n[o].evaluate(t),l=n[o+1].evaluate(t);switch(this.operator){case"interpolate":return $e[this.type.kind](a,l,s);case"interpolate-hcl":return $e.color(a,l,s,"hcl");case"interpolate-lab":return $e.color(a,l,s,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ze(t,e,n,r){const i=r-n,o=t-n;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}class Ye{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let n=null;const r=e.expectedType;r&&"value"!==r.kind&&(n=r);const i=[];for(const r of t.slice(1)){const t=e.parse(r,1+i.length,n,void 0,{typeAnnotation:"omit"});if(!t)return null;n=n||t.type,i.push(t)}if(!n)throw new Error("No output type");const o=r&&i.some((t=>Ct(r,t.type)));return new Ye(o?yt:n,i)}evaluate(t){let e,n=null,r=0;for(const i of this.args)if(r++,n=i.evaluate(t),n&&n instanceof re&&!n.available&&(e||(e=n.name),n=null,r===this.args.length&&(n=e)),null!==n)break;return n}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class We{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const n=[];for(let r=1;r<t.length-1;r+=2){const i=t[r];if("string"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,r);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",r);const o=e.parse(t[r+1],r+1);if(!o)return null;n.push([i,o])}const r=e.parse(t[t.length-1],t.length-1,e.expectedType,n);return r?new We(n,r):null}outputDefined(){return this.result.outputDefined()}}class He{constructor(t,e,n){this.type=t,this.index=e,this.input=n}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,pt),r=e.parse(t[2],2,Et(e.expectedType||yt));return n&&r?new He(r.type.itemType,n,r):null}evaluate(t){const e=this.index.evaluate(t),n=this.input.evaluate(t);if(e<0)throw new ue(`Array index out of bounds: ${e} < 0.`);if(e>=n.length)throw new ue(`Array index out of bounds: ${e} > ${n.length-1}.`);if(e!==Math.floor(e))throw new ue(`Array index must be an integer, but found ${e} instead.`);return n[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ke{constructor(t,e){this.type=dt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,yt),r=e.parse(t[2],2,yt);return n&&r?Tt(n.type,[dt,ft,pt,ht,yt])?new Ke(n,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(n.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!Pt(e,["boolean","string","number","null"]))throw new ue(`Expected first argument to be of type boolean, string, number or null, but found ${St(se(e))} instead.`);if(!Pt(n,["string","array"]))throw new ue(`Expected second argument to be of type array or string, but found ${St(se(n))} instead.`);return n.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Je{constructor(t,e,n){this.type=pt,this.needle=t,this.haystack=e,this.fromIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,yt),r=e.parse(t[2],2,yt);if(!n||!r)return null;if(!Tt(n.type,[dt,ft,pt,ht,yt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(n.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,pt);return i?new Je(n,r,i):null}return new Je(n,r)}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!Pt(e,["boolean","string","number","null"]))throw new ue(`Expected first argument to be of type boolean, string, number or null, but found ${St(se(e))} instead.`);if(!Pt(n,["string","array"]))throw new ue(`Expected second argument to be of type array or string, but found ${St(se(n))} instead.`);if(this.fromIndex){const r=this.fromIndex.evaluate(t);return n.indexOf(e,r)}return n.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Qe{constructor(t,e,n,r,i,o){this.inputType=t,this.type=e,this.input=n,this.cases=r,this.outputs=i,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let n,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const i={},o=[];for(let s=2;s<t.length-1;s+=2){let a=t[s];const l=t[s+1];Array.isArray(a)||(a=[a]);const u=e.concat(s);if(0===a.length)return u.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(n){if(u.checkSubtype(n,se(t)))return null}else n=se(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=o.length}const c=e.parse(l,s,r);if(!c)return null;r=r||c.type,o.push(c)}const s=e.parse(t[1],1,yt);if(!s)return null;const a=e.parse(t[t.length-1],t.length-1,r);return a?"value"!==s.type.kind&&e.concat(1).checkSubtype(n,s.type)?null:new Qe(n,r,s,i,o,a):null}evaluate(t){const e=this.input.evaluate(t);return(se(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class tn{constructor(t,e,n){this.type=t,this.branches=e,this.otherwise=n}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r=[];for(let i=1;i<t.length-1;i+=2){const o=e.parse(t[i],i,dt);if(!o)return null;const s=e.parse(t[i+1],i+1,n);if(!s)return null;r.push([o,s]),n=n||s.type}const i=e.parse(t[t.length-1],t.length-1,n);if(!i)return null;if(!n)throw new Error("Can't infer output type");return new tn(n,r,i)}evaluate(t){for(const[e,n]of this.branches)if(e.evaluate(t))return n.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,n]of this.branches)t(e),t(n);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class en{constructor(t,e,n,r){this.type=t,this.input=e,this.beginIndex=n,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,yt),r=e.parse(t[2],2,pt);if(!n||!r)return null;if(!Tt(n.type,[Et(yt),ft,yt]))return e.error(`Expected first argument to be of type array or string, but found ${St(n.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,pt);return i?new en(n.type,n,r,i):null}return new en(n.type,n,r)}evaluate(t){const e=this.input.evaluate(t),n=this.beginIndex.evaluate(t);if(!Pt(e,["string","array"]))throw new ue(`Expected first argument to be of type array or string, but found ${St(se(e))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(t);return e.slice(n,r)}return e.slice(n)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function nn(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function rn(t,e,n,r){return 0===r.compare(e,n)}function on(t,e,n){const r="=="!==t&&"!="!==t;return class i{constructor(t,e,n){this.type=dt,this.lhs=t,this.rhs=e,this.collator=n,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const n=t[0];let o=e.parse(t[1],1,yt);if(!o)return null;if(!nn(n,o.type))return e.concat(1).error(`"${n}" comparisons are not supported for type '${St(o.type)}'.`);let s=e.parse(t[2],2,yt);if(!s)return null;if(!nn(n,s.type))return e.concat(2).error(`"${n}" comparisons are not supported for type '${St(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return e.error(`Cannot compare types '${St(o.type)}' and '${St(s.type)}'.`);r&&("value"===o.type.kind&&"value"!==s.type.kind?o=new he(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new he(o.type,[s])));let a=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,_t),!a)return null}return new i(o,s,a)}evaluate(i){const o=this.lhs.evaluate(i),s=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){const e=se(o),n=se(s);if(e.kind!==n.kind||"string"!==e.kind&&"number"!==e.kind)throw new ue(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=se(o),n=se(s);if("string"!==t.kind||"string"!==n.kind)return e(i,o,s)}return this.collator?n(i,o,s,this.collator.evaluate(i)):e(i,o,s)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const sn=on("==",(function(t,e,n){return e===n}),rn),an=on("!=",(function(t,e,n){return e!==n}),(function(t,e,n,r){return!rn(0,e,n,r)})),ln=on("<",(function(t,e,n){return e<n}),(function(t,e,n,r){return r.compare(e,n)<0})),un=on(">",(function(t,e,n){return e>n}),(function(t,e,n,r){return r.compare(e,n)>0})),cn=on("<=",(function(t,e,n){return e<=n}),(function(t,e,n,r){return r.compare(e,n)<=0})),hn=on(">=",(function(t,e,n){return e>=n}),(function(t,e,n,r){return r.compare(e,n)>=0}));class pn{constructor(t,e,n,r,i){this.type=ft,this.number=t,this.locale=e,this.currency=n,this.minFractionDigits=r,this.maxFractionDigits=i}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,pt);if(!n)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let i=null;if(r.locale&&(i=e.parse(r.locale,1,ft),!i))return null;let o=null;if(r.currency&&(o=e.parse(r.currency,1,ft),!o))return null;let s=null;if(r["min-fraction-digits"]&&(s=e.parse(r["min-fraction-digits"],1,pt),!s))return null;let a=null;return r["max-fraction-digits"]&&(a=e.parse(r["max-fraction-digits"],1,pt),!a)?null:new pn(n,i,o,s,a)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class fn{constructor(t){this.type=vt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[1];if(!Array.isArray(n)&&"object"==typeof n)return e.error("First argument must be an image or text section.");const r=[];let i=!1;for(let n=1;n<=t.length-1;++n){const o=t[n];if(i&&"object"==typeof o&&!Array.isArray(o)){i=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,pt),!t))return null;let n=null;if(o["text-font"]&&(n=e.parse(o["text-font"],1,Et(ft)),!n))return null;let s=null;if(o["text-color"]&&(s=e.parse(o["text-color"],1,gt),!s))return null;const a=r[r.length-1];a.scale=t,a.font=n,a.textColor=s}else{const o=e.parse(t[n],1,yt);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,r.push({content:o,scale:null,font:null,textColor:null})}}return new fn(r)}evaluate(t){return new Qt(this.sections.map((e=>{const n=e.content.evaluate(t);return se(n)===bt?new Jt("",n,null,null,null):new Jt(ae(n),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}}class dn{constructor(t){this.type=bt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,ft);return n?new dn(n):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),n=re.fromString(e);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(e)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}}class gn{constructor(t){this.type=pt,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=e.parse(t[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?e.error(`Expected argument of type string or array, but found ${St(n.type)} instead.`):new gn(n):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new ue(`Expected value to be of type string or array, but found ${St(se(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const mn={"==":sn,"!=":an,">":un,"<":ln,">=":hn,"<=":cn,array:he,at:He,boolean:he,case:tn,coalesce:Ye,collator:ye,format:fn,image:dn,in:Ke,"index-of":Je,interpolate:Xe,"interpolate-hcl":Xe,"interpolate-lab":Xe,length:gn,let:We,literal:le,match:Qe,number:he,"number-format":pn,object:he,slice:en,step:je,string:he,"to-boolean":fe,"to-color":fe,"to-number":fe,"to-string":fe,var:Re,within:De};function yn(t,[e,n,r,i]){e=e.evaluate(t),n=n.evaluate(t),r=r.evaluate(t);const o=i?i.evaluate(t):1,s=ie(e,n,r,o);if(s)throw new ue(s);return new Ht(e/255,n/255,r/255,o,!1)}function _n(t,e){return t in e}function vn(t,e){const n=e[t];return void 0===n?null:n}function xn(t){return{type:t}}function bn(t){return{result:"success",value:t}}function wn(t){return{result:"error",value:t}}function En(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Sn(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function In(t){return!!t.expression&&t.expression.interpolated}function Cn(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Tn(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Pn(t){return t}function Mn(t,e){const n="color"===e.type,r=t.stops&&"object"==typeof t.stops[0][0],i=r||!(r||void 0!==t.property),o=t.type||(In(e)?"exponential":"interval");if(n||"padding"===e.type){const r=n?Ht.parse:te.parse;(t=lt({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],r(t[1])]))),t.default=r(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(s=t.colorSpace)&&"hcl"!==s&&"lab"!==s)throw new Error(`Unknown color space: "${t.colorSpace}"`);var s;let a,l,u;if("exponential"===o)a=Nn;else if("interval"===o)a=kn;else if("categorical"===o){a=An,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];u=typeof t.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);a=Dn}if(r){const n={},r=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],o=i[0].zoom;void 0===n[o]&&(n[o]={zoom:o,type:t.type,property:t.property,default:t.default,stops:[]},r.push(o)),n[o].stops.push([i[0].value,i[1]])}const i=[];for(const t of r)i.push([n[t].zoom,Mn(n[t],e)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:Xe.interpolationFactor.bind(void 0,o),zoomStops:i.map((t=>t[0])),evaluate:({zoom:n},r)=>Nn({stops:i,base:t.base},e,n).evaluate(n,r)}}if(i){const n="exponential"===o?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:n,interpolationFactor:Xe.interpolationFactor.bind(void 0,n),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:n})=>a(t,e,n,l,u)}}return{kind:"source",evaluate(n,r){const i=r&&r.properties?r.properties[t.property]:void 0;return void 0===i?Ln(t.default,e.default):a(t,e,i,l,u)}}}function Ln(t,e,n){return void 0!==t?t:void 0!==e?e:void 0!==n?n:void 0}function An(t,e,n,r,i){return Ln(typeof n===i?r[n]:void 0,t.default,e.default)}function kn(t,e,n){if("number"!==Cn(n))return Ln(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[r-1][0])return t.stops[r-1][1];const i=Ve(t.stops.map((t=>t[0])),n);return t.stops[i][1]}function Nn(t,e,n){const r=void 0!==t.base?t.base:1;if("number"!==Cn(n))return Ln(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[i-1][0])return t.stops[i-1][1];const o=Ve(t.stops.map((t=>t[0])),n),s=function(t,e,n,r){const i=r-n,o=t-n;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}(n,r,t.stops[o][0],t.stops[o+1][0]),a=t.stops[o][1],l=t.stops[o+1][1],u=$e[e.type]||Pn;return"function"==typeof a.evaluate?{evaluate(...e){const n=a.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==n&&void 0!==r)return u(n,r,s,t.colorSpace)}}:u(a,l,s,t.colorSpace)}function Dn(t,e,n){switch(e.type){case"color":n=Ht.parse(n);break;case"formatted":n=Qt.fromString(n.toString());break;case"resolvedImage":n=re.fromString(n.toString());break;case"padding":n=te.parse(n);break;default:Cn(n)===e.type||"enum"===e.type&&e.values[n]||(n=void 0)}return Ln(n,t.default,e.default)}Oe.register(mn,{error:[{kind:"error"},[ft],(t,[e])=>{throw new ue(e.evaluate(t))}],typeof:[ft,[yt],(t,[e])=>St(se(e.evaluate(t)))],"to-rgba":[Et(pt,4),[gt],(t,[e])=>{const[n,r,i,o]=e.evaluate(t).rgb;return[255*n,255*r,255*i,o]}],rgb:[gt,[pt,pt,pt],yn],rgba:[gt,[pt,pt,pt,pt],yn],has:{type:dt,overloads:[[[ft],(t,[e])=>_n(e.evaluate(t),t.properties())],[[ft,mt],(t,[e,n])=>_n(e.evaluate(t),n.evaluate(t))]]},get:{type:yt,overloads:[[[ft],(t,[e])=>vn(e.evaluate(t),t.properties())],[[ft,mt],(t,[e,n])=>vn(e.evaluate(t),n.evaluate(t))]]},"feature-state":[yt,[ft],(t,[e])=>vn(e.evaluate(t),t.featureState||{})],properties:[mt,[],t=>t.properties()],"geometry-type":[ft,[],t=>t.geometryType()],id:[yt,[],t=>t.id()],zoom:[pt,[],t=>t.globals.zoom],"heatmap-density":[pt,[],t=>t.globals.heatmapDensity||0],"line-progress":[pt,[],t=>t.globals.lineProgress||0],accumulated:[yt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[pt,xn(pt),(t,e)=>{let n=0;for(const r of e)n+=r.evaluate(t);return n}],"*":[pt,xn(pt),(t,e)=>{let n=1;for(const r of e)n*=r.evaluate(t);return n}],"-":{type:pt,overloads:[[[pt,pt],(t,[e,n])=>e.evaluate(t)-n.evaluate(t)],[[pt],(t,[e])=>-e.evaluate(t)]]},"/":[pt,[pt,pt],(t,[e,n])=>e.evaluate(t)/n.evaluate(t)],"%":[pt,[pt,pt],(t,[e,n])=>e.evaluate(t)%n.evaluate(t)],ln2:[pt,[],()=>Math.LN2],pi:[pt,[],()=>Math.PI],e:[pt,[],()=>Math.E],"^":[pt,[pt,pt],(t,[e,n])=>Math.pow(e.evaluate(t),n.evaluate(t))],sqrt:[pt,[pt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))],log2:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[pt,[pt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[pt,[pt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[pt,[pt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[pt,[pt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[pt,[pt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[pt,[pt],(t,[e])=>Math.atan(e.evaluate(t))],min:[pt,xn(pt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[pt,xn(pt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[pt,[pt],(t,[e])=>Math.abs(e.evaluate(t))],round:[pt,[pt],(t,[e])=>{const n=e.evaluate(t);return n<0?-Math.round(-n):Math.round(n)}],floor:[pt,[pt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[pt,[pt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[dt,[ft,yt],(t,[e,n])=>t.properties()[e.value]===n.value],"filter-id-==":[dt,[yt],(t,[e])=>t.id()===e.value],"filter-type-==":[dt,[ft],(t,[e])=>t.geometryType()===e.value],"filter-<":[dt,[ft,yt],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r<i}],"filter-id-<":[dt,[yt],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n<r}],"filter->":[dt,[ft,yt],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[dt,[yt],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n>r}],"filter-<=":[dt,[ft,yt],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[dt,[yt],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n<=r}],"filter->=":[dt,[ft,yt],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[dt,[yt],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n>=r}],"filter-has":[dt,[yt],(t,[e])=>e.value in t.properties()],"filter-has-id":[dt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[dt,[Et(ft)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[dt,[Et(yt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[dt,[ft,Et(yt)],(t,[e,n])=>n.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[dt,[ft,Et(yt)],(t,[e,n])=>function(t,e,n,r){for(;n<=r;){const i=n+r>>1;if(e[i]===t)return!0;e[i]>t?r=i-1:n=i+1}return!1}(t.properties()[e.value],n.value,0,n.value.length-1)],all:{type:dt,overloads:[[[dt,dt],(t,[e,n])=>e.evaluate(t)&&n.evaluate(t)],[xn(dt),(t,e)=>{for(const n of e)if(!n.evaluate(t))return!1;return!0}]]},any:{type:dt,overloads:[[[dt,dt],(t,[e,n])=>e.evaluate(t)||n.evaluate(t)],[xn(dt),(t,e)=>{for(const n of e)if(n.evaluate(t))return!0;return!1}]]},"!":[dt,[dt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[dt,[ft],(t,[e])=>{const n=t.globals&&t.globals.isSupportedScript;return!n||n(e.evaluate(t))}],upcase:[ft,[ft],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ft,[ft],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ft,xn(yt),(t,e)=>e.map((e=>ae(e.evaluate(t)))).join("")],"resolved-locale":[ft,[_t],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Rn{constructor(t,e){var n;this.expression=t,this._warningHistory={},this._evaluator=new ge,this._defaultValue=e?"color"===(n=e).type&&Tn(n.default)?new Ht(0,0,0,0):"color"===n.type?Ht.parse(n.default)||null:"padding"===n.type?te.parse(n.default)||null:"variableAnchorOffsetCollection"===n.type?ne.parse(n.default)||null:void 0===n.default?null:n.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,n,r,i,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,n,r,i,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new ue(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function On(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in mn}function zn(t,e){const n=new me(mn,ze,[],e?function(t){const e={color:gt,string:ft,number:pt,enum:ft,boolean:dt,formatted:vt,padding:xt,resolvedImage:bt,variableAnchorOffsetCollection:wt};return"array"===t.type?Et(e[t.value]||yt,t.length):e[t.type]}(e):void 0),r=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?bn(new Rn(r,e)):wn(n.errors)}class Fn{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Be(e.expression)}evaluateWithoutErrorHandling(t,e,n,r,i,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,r,i,o)}evaluate(t,e,n,r,i,o){return this._styleExpression.evaluate(t,e,n,r,i,o)}}class Bn{constructor(t,e,n,r){this.kind=t,this.zoomStops=n,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Be(e.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,e,n,r,i,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n,r,i,o)}evaluate(t,e,n,r,i,o){return this._styleExpression.evaluate(t,e,n,r,i,o)}interpolationFactor(t,e,n){return this.interpolationType?Xe.interpolationFactor(this.interpolationType,t,e,n):0}}function Un(t,e){const n=zn(t,e);if("error"===n.result)return n;const r=n.value.expression,i=Fe(r);if(!i&&!En(e))return wn([new ut("","data expressions not supported")]);const o=Ue(r,["zoom"]);if(!o&&!Sn(e))return wn([new ut("","zoom expressions not supported")]);const s=jn(r);return s||o?s instanceof ut?wn([s]):s instanceof Xe&&!In(e)?wn([new ut("",'"interpolate" expressions cannot be used with this property')]):bn(s?new Bn(i?"camera":"composite",n.value,s.labels,s instanceof Xe?s.interpolation:void 0):new Fn(i?"constant":"source",n.value)):wn([new ut("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vn{constructor(t,e){this._parameters=t,this._specification=e,lt(this,Mn(this._parameters,this._specification))}static deserialize(t){return new Vn(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function jn(t){let e=null;if(t instanceof We)e=jn(t.result);else if(t instanceof Ye){for(const n of t.args)if(e=jn(n),e)break}else(t instanceof je||t instanceof Xe)&&t.input instanceof Oe&&"zoom"===t.input.name&&(e=t);return e instanceof ut||t.eachChild((t=>{const n=jn(t);n instanceof ut?e=n:!e&&n?e=new ut("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new ut("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Gn(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Gn(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const qn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function $n(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Gn(t)||(t=Yn(t));const e=zn(t,qn);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,n,r)=>e.value.evaluate(t,n,{},r),needGeometry:Zn(t)}}function Xn(t,e){return t<e?-1:t>e?1:0}function Zn(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Zn(t[e]))return!0;return!1}function Yn(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Wn(t[1],t[2],"=="):"!="===e?Jn(Wn(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Wn(t[1],t[2],e):"any"===e?(n=t.slice(1),["any"].concat(n.map(Yn))):"all"===e?["all"].concat(t.slice(1).map(Yn)):"none"===e?["all"].concat(t.slice(1).map(Yn).map(Jn)):"in"===e?Hn(t[1],t.slice(2)):"!in"===e?Jn(Hn(t[1],t.slice(2))):"has"===e?Kn(t[1]):"!has"===e?Jn(Kn(t[1])):"within"!==e||t;var n}function Wn(t,e,n){switch(t){case"$type":return[`filter-type-${n}`,e];case"$id":return[`filter-id-${n}`,e];default:return[`filter-${n}`,t,e]}}function Hn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Xn)]]:["filter-in-small",t,["literal",e]]}}function Kn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Jn(t){return["!",t]}function Qn(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const n of t)e+=`${Qn(n)},`;return`${e}]`}const n=Object.keys(t).sort();let r="{";for(let e=0;e<n.length;e++)r+=`${JSON.stringify(n[e])}:${Qn(t[n[e]])},`;return`${r}}`}function tr(t){let e="";for(const n of H)e+=`/${Qn(t[n])}`;return e}function er(t){const e=t.value;return e?[new at(t.key,e,"constants have been deprecated as of v8")]:[]}function nr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function rr(t){if(Array.isArray(t))return t.map(rr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const n in t)e[n]=rr(t[n]);return e}return nr(t)}function ir(t){const e=t.key,n=t.value,r=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,s=t.styleSpec,a=t.validateSpec;let l=[];const u=Cn(n);if("object"!==u)return[new at(e,n,`object expected, ${u} found`)];for(const t in n){const u=t.split(".")[0],c=r[u]||r["*"];let h;if(i[u])h=i[u];else if(r[u])h=a;else if(i["*"])h=i["*"];else{if(!r["*"]){l.push(new at(e,n[t],`unknown property "${t}"`));continue}h=a}l=l.concat(h({key:(e?`${e}.`:e)+t,value:n[t],valueSpec:c,style:o,styleSpec:s,object:n,objectKey:t,validateSpec:a},n))}for(const t in r)i[t]||r[t].required&&void 0===r[t].default&&void 0===n[t]&&l.push(new at(e,n,`missing required property "${t}"`));return l}function or(t){const e=t.value,n=t.valueSpec,r=t.style,i=t.styleSpec,o=t.key,s=t.arrayElementValidator||t.validateSpec;if("array"!==Cn(e))return[new at(o,e,`array expected, ${Cn(e)} found`)];if(n.length&&e.length!==n.length)return[new at(o,e,`array length ${n.length} expected, length ${e.length} found`)];if(n["min-length"]&&e.length<n["min-length"])return[new at(o,e,`array length at least ${n["min-length"]} expected, length ${e.length} found`)];let a={type:n.value,values:n.values};i.$version<7&&(a.function=n.function),"object"===Cn(n.value)&&(a=n.value);let l=[];for(let n=0;n<e.length;n++)l=l.concat(s({array:e,arrayIndex:n,value:e[n],valueSpec:a,validateSpec:t.validateSpec,style:r,styleSpec:i,key:`${o}[${n}]`}));return l}function sr(t){const e=t.key,n=t.value,r=t.valueSpec;let i=Cn(n);return"number"===i&&n!=n&&(i="NaN"),"number"!==i?[new at(e,n,`number expected, ${i} found`)]:"minimum"in r&&n<r.minimum?[new at(e,n,`${n} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&n>r.maximum?[new at(e,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]}function ar(t){const e=t.valueSpec,n=nr(t.value.type);let r,i,o,s={};const a="categorical"!==n&&void 0===t.value.property,l=!a,u="array"===Cn(t.value.stops)&&"array"===Cn(t.value.stops[0])&&"object"===Cn(t.value.stops[0][0]),c=ir({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===n)return[new at(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const r=t.value;return e=e.concat(or({key:t.key,value:r,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Cn(r)&&0===r.length&&e.push(new at(t.key,r,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===n&&a&&c.push(new at(t.key,t.value,'missing required property "property"')),"identity"===n||t.value.stops||c.push(new at(t.key,t.value,'missing required property "stops"')),"exponential"===n&&t.valueSpec.expression&&!In(t.valueSpec)&&c.push(new at(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!En(t.valueSpec)?c.push(new at(t.key,t.value,"property functions not supported")):a&&!Sn(t.valueSpec)&&c.push(new at(t.key,t.value,"zoom functions not supported"))),"categorical"!==n&&!u||void 0!==t.value.property||c.push(new at(t.key,t.value,'"property" property is required')),c;function h(t){let n=[];const r=t.value,a=t.key;if("array"!==Cn(r))return[new at(a,r,`array expected, ${Cn(r)} found`)];if(2!==r.length)return[new at(a,r,`array length 2 expected, length ${r.length} found`)];if(u){if("object"!==Cn(r[0]))return[new at(a,r,`object expected, ${Cn(r[0])} found`)];if(void 0===r[0].zoom)return[new at(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new at(a,r,"object stop key must have value")];if(o&&o>nr(r[0].zoom))return[new at(a,r[0].zoom,"stop zoom values must appear in ascending order")];nr(r[0].zoom)!==o&&(o=nr(r[0].zoom),i=void 0,s={}),n=n.concat(ir({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:sr,value:p}}))}else n=n.concat(p({key:`${a}[0]`,value:r[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},r));return On(rr(r[1]))?n.concat([new at(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):n.concat(t.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,o){const a=Cn(t.value),l=nr(t.value),u=null!==t.value?t.value:o;if(r){if(a!==r)return[new at(t.key,u,`${a} stop domain type must match previous stop domain type ${r}`)]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new at(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==n){let r=`number expected, ${a} found`;return En(e)&&void 0===n&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new at(t.key,u,r)]}return"categorical"!==n||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===a&&void 0!==i&&l<i?[new at(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===n&&l in s?[new at(t.key,u,"stop domain values must be unique")]:(s[l]=!0,[])):[new at(t.key,u,`integer expected, found ${l}`)]}}function lr(t){const e=("property"===t.expressionContext?Un:zn)(rr(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new at(`${t.key}${e.key}`,t.value,e.message)));const n=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!n.outputDefined())return[new at(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Be(n))return[new at(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Be(n))return[new at(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Ue(n,["zoom","feature-state"]))return[new at(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Fe(n))return[new at(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ur(t){const e=t.key,n=t.value,r=t.valueSpec,i=[];return Array.isArray(r.values)?-1===r.values.indexOf(nr(n))&&i.push(new at(e,n,`expected one of [${r.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(r.values).indexOf(nr(n))&&i.push(new at(e,n,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(n)} found`)),i}function cr(t){return Gn(rr(t.value))?lr(lt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):hr(t)}function hr(t){const e=t.value,n=t.key;if("array"!==Cn(e))return[new at(n,e,`array expected, ${Cn(e)} found`)];const r=t.styleSpec;let i,o=[];if(e.length<1)return[new at(n,e,"filter array must have at least 1 element")];switch(o=o.concat(ur({key:`${n}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),nr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===nr(e[1])&&o.push(new at(n,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new at(n,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Cn(e[1]),"string"!==i&&o.push(new at(`${n}[1]`,e[1],`string expected, ${i} found`)));for(let s=2;s<e.length;s++)i=Cn(e[s]),"$type"===nr(e[1])?o=o.concat(ur({key:`${n}[${s}]`,value:e[s],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&o.push(new at(`${n}[${s}]`,e[s],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let r=1;r<e.length;r++)o=o.concat(hr({key:`${n}[${r}]`,value:e[r],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=Cn(e[1]),2!==e.length?o.push(new at(n,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&o.push(new at(`${n}[1]`,e[1],`string expected, ${i} found`));break;case"within":i=Cn(e[1]),2!==e.length?o.push(new at(n,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==i&&o.push(new at(`${n}[1]`,e[1],`object expected, ${i} found`))}return o}function pr(t,e){const n=t.key,r=t.validateSpec,i=t.style,o=t.styleSpec,s=t.value,a=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];const u=a.match(/^(.*)-transition$/);if("paint"===e&&u&&l[u[1]]&&l[u[1]].transition)return r({key:n,value:s,valueSpec:o.transition,style:i,styleSpec:o});const c=t.valueSpec||l[a];if(!c)return[new at(n,s,`unknown property "${a}"`)];let h;if("string"===Cn(s)&&En(c)&&!c.tokens&&(h=/^{([^}]+)}$/.exec(s)))return[new at(n,s,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const p=[];return"symbol"===t.layerType&&("text-field"===a&&i&&!i.glyphs&&p.push(new at(n,s,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Tn(rr(s))&&"identity"===nr(s.type)&&p.push(new at(n,s,'"text-font" does not support identity functions'))),p.concat(r({key:t.key,value:s,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:a}))}function fr(t){return pr(t,"paint")}function dr(t){return pr(t,"layout")}function gr(t){let e=[];const n=t.value,r=t.key,i=t.style,o=t.styleSpec;n.type||n.ref||e.push(new at(r,n,'either "type" or "ref" is required'));let s=nr(n.type);const a=nr(n.ref);if(n.id){const o=nr(n.id);for(let s=0;s<t.arrayIndex;s++){const t=i.layers[s];nr(t.id)===o&&e.push(new at(r,n.id,`duplicate layer id "${n.id}", previously used at line ${t.id.__line__}`))}}if("ref"in n){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in n&&e.push(new at(r,n[t],`"${t}" is prohibited for ref layers`))})),i.layers.forEach((e=>{nr(e.id)===a&&(t=e)})),t?t.ref?e.push(new at(r,n.ref,"ref cannot reference another ref layer")):s=nr(t.type):e.push(new at(r,n.ref,`ref layer "${a}" not found`))}else if("background"!==s)if(n.source){const t=i.sources&&i.sources[n.source],o=t&&nr(t.type);t?"vector"===o&&"raster"===s?e.push(new at(r,n.source,`layer "${n.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===s?e.push(new at(r,n.source,`layer "${n.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==s?e.push(new at(r,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==o||n["source-layer"]?"raster-dem"===o&&"hillshade"!==s?e.push(new at(r,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!n.paint||!n.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new at(r,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new at(r,n,`layer "${n.id}" must specify a "source-layer"`)):e.push(new at(r,n.source,`source "${n.source}" not found`))}else e.push(new at(r,n,'missing required property "source"'));return e=e.concat(ir({key:r,value:n,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${r}.type`,value:n.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:n,objectKey:"type"}),filter:cr,layout:t=>ir({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>dr(lt({layerType:s},t))}}),paint:t=>ir({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>fr(lt({layerType:s},t))}})}})),e}function mr(t){const e=t.value,n=t.key,r=Cn(e);return"string"!==r?[new at(n,e,`string expected, ${r} found`)]:[]}const yr={promoteId:function({key:t,value:e}){if("string"===Cn(e))return mr({key:t,value:e});{const n=[];for(const r in e)n.push(...mr({key:`${t}.${r}`,value:e[r]}));return n}}};function _r(t){const e=t.value,n=t.key,r=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new at(n,e,'"type" is required')];const s=nr(e.type);let a;switch(s){case"vector":case"raster":return a=ir({key:n,value:e,valueSpec:r[`source_${s.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:yr,validateSpec:o}),a;case"raster-dem":return a=function(t){var e;const n=null!==(e=t.sourceName)&&void 0!==e?e:"",r=t.value,i=t.styleSpec,o=i.source_raster_dem,s=t.style;let a=[];const l=Cn(r);if(void 0===r)return a;if("object"!==l)return a.push(new at("source_raster_dem",r,`object expected, ${l} found`)),a;const u="custom"===nr(r.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in r)!u&&c.includes(e)?a.push(new at(e,r[e],`In "${n}": "${e}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[e]?a=a.concat(t.validateSpec({key:e,value:r[e],valueSpec:o[e],validateSpec:t.validateSpec,style:s,styleSpec:i})):a.push(new at(e,r[e],`unknown property "${e}"`));return a}({sourceName:n,value:e,style:t.style,styleSpec:r,validateSpec:o}),a;case"geojson":if(a=ir({key:n,value:e,valueSpec:r.source_geojson,style:i,styleSpec:r,validateSpec:o,objectElementValidators:yr}),e.cluster)for(const t in e.clusterProperties){const[r,i]=e.clusterProperties[t],s="string"==typeof r?[r,["accumulated"],["get",t]]:r;a.push(...lr({key:`${n}.${t}.map`,value:i,validateSpec:o,expressionContext:"cluster-map"})),a.push(...lr({key:`${n}.${t}.reduce`,value:s,validateSpec:o,expressionContext:"cluster-reduce"}))}return a;case"video":return ir({key:n,value:e,valueSpec:r.source_video,style:i,validateSpec:o,styleSpec:r});case"image":return ir({key:n,value:e,valueSpec:r.source_image,style:i,validateSpec:o,styleSpec:r});case"canvas":return[new at(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ur({key:`${n}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:o,styleSpec:r})}}function vr(t){const e=t.value,n=t.styleSpec,r=n.light,i=t.style;let o=[];const s=Cn(e);if(void 0===e)return o;if("object"!==s)return o=o.concat([new at("light",e,`object expected, ${s} found`)]),o;for(const s in e){const a=s.match(/^(.*)-transition$/);o=o.concat(a&&r[a[1]]&&r[a[1]].transition?t.validateSpec({key:s,value:e[s],valueSpec:n.transition,validateSpec:t.validateSpec,style:i,styleSpec:n}):r[s]?t.validateSpec({key:s,value:e[s],valueSpec:r[s],validateSpec:t.validateSpec,style:i,styleSpec:n}):[new at(s,e[s],`unknown property "${s}"`)])}return o}function xr(t){const e=t.value,n=t.styleSpec,r=n.terrain,i=t.style;let o=[];const s=Cn(e);if(void 0===e)return o;if("object"!==s)return o=o.concat([new at("terrain",e,`object expected, ${s} found`)]),o;for(const s in e)o=o.concat(r[s]?t.validateSpec({key:s,value:e[s],valueSpec:r[s],validateSpec:t.validateSpec,style:i,styleSpec:n}):[new at(s,e[s],`unknown property "${s}"`)]);return o}function br(t){let e=[];const n=t.value,r=t.key;if(Array.isArray(n)){const i=[],o=[];for(const s in n)n[s].id&&i.includes(n[s].id)&&e.push(new at(r,n,`all the sprites' ids must be unique, but ${n[s].id} is duplicated`)),i.push(n[s].id),n[s].url&&o.includes(n[s].url)&&e.push(new at(r,n,`all the sprites' URLs must be unique, but ${n[s].url} is duplicated`)),o.push(n[s].url),e=e.concat(ir({key:`${r}[${s}]`,value:n[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return mr({key:r,value:n})}const wr={"*":()=>[],array:or,boolean:function(t){const e=t.value,n=t.key,r=Cn(e);return"boolean"!==r?[new at(n,e,`boolean expected, ${r} found`)]:[]},number:sr,color:function(t){const e=t.key,n=t.value,r=Cn(n);return"string"!==r?[new at(e,n,`color expected, ${r} found`)]:Ht.parse(String(n))?[]:[new at(e,n,`color expected, "${n}" found`)]},constants:er,enum:ur,filter:cr,function:ar,layer:gr,object:ir,source:_r,light:vr,terrain:xr,string:mr,formatted:function(t){return 0===mr(t).length?[]:lr(t)},resolvedImage:function(t){return 0===mr(t).length?[]:lr(t)},padding:function(t){const e=t.key,n=t.value;if("array"===Cn(n)){if(n.length<1||n.length>4)return[new at(e,n,`padding requires 1 to 4 values; ${n.length} values found`)];const r={type:"number"};let i=[];for(let o=0;o<n.length;o++)i=i.concat(t.validateSpec({key:`${e}[${o}]`,value:n[o],validateSpec:t.validateSpec,valueSpec:r}));return i}return sr({key:e,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(t){const e=t.key,n=t.value,r=Cn(n),i=t.styleSpec;if("array"!==r||n.length<1||n.length%2!=0)return[new at(e,n,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let r=0;r<n.length;r+=2)o=o.concat(ur({key:`${e}[${r}]`,value:n[r],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(or({key:`${e}[${r+1}]`,value:n[r+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o},sprite:br};function Er(t){const e=t.value,n=t.valueSpec,r=t.styleSpec;return t.validateSpec=Er,n.expression&&Tn(nr(e))?ar(t):n.expression&&On(rr(e))?lr(t):n.type&&wr[n.type]?wr[n.type](t):ir(lt({},t,{valueSpec:n.type?r[n.type]:n}))}function Sr(t){const e=t.value,n=t.key,r=mr(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new at(n,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new at(n,e,'"glyphs" url must include a "{range}" token'))),r}function Ir(t,e=W){let n=[];return n=n.concat(Er({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Er,objectElementValidators:{glyphs:Sr,"*":()=>[]}})),t.constants&&(n=n.concat(er({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Er}))),Tr(n)}function Cr(t){return function(e){return t({...e,validateSpec:Er})}}function Tr(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function Pr(t){return function(...e){return Tr(t.apply(this,e))}}Ir.source=Pr(Cr(_r)),Ir.sprite=Pr(Cr(br)),Ir.glyphs=Pr(Cr(Sr)),Ir.light=Pr(Cr(vr)),Ir.terrain=Pr(Cr(xr)),Ir.layer=Pr(Cr(gr)),Ir.filter=Pr(Cr(cr)),Ir.paintProperty=Pr(Cr(fr)),Ir.layoutProperty=Pr(Cr(dr));const Mr=Ir,Lr=Mr.light,Ar=Mr.paintProperty,kr=Mr.layoutProperty;function Nr(t,e){let n=!1;if(e&&e.length)for(const r of e)t.fire(new Z(new Error(r.message))),n=!0;return n}class Dr{constructor(t,e,n){const r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(n=i[2]);for(let t=0;t<this.d*this.d;t++){const e=i[3+t],n=i[3+t+1];r.push(e===n?null:i.subarray(e,n))}const o=i[3+r.length+1];this.keys=i.subarray(i[3+r.length],o),this.bboxes=i.subarray(o),this.insert=this._insertReadonly}else{this.d=e+2*n;for(let t=0;t<this.d*this.d;t++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=n,this.scale=e/t,this.uid=0;const i=n/e*t;this.min=-i,this.max=t+i}insert(t,e,n,r,i){this._forEachCell(e,n,r,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,n,r,i,o){this.cells[i].push(o)}query(t,e,n,r,i){const o=this.min,s=this.max;if(t<=o&&e<=o&&s<=n&&s<=r&&!i)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(t,e,n,r,this._queryCell,o,{},i),o}}_queryCell(t,e,n,r,i,o,s,a){const l=this.cells[i];if(null!==l){const i=this.keys,u=this.bboxes;for(let c=0;c<l.length;c++){const h=l[c];if(void 0===s[h]){const l=4*h;(a?a(u[l+0],u[l+1],u[l+2],u[l+3]):t<=u[l+2]&&e<=u[l+3]&&n>=u[l+0]&&r>=u[l+1])?(s[h]=!0,o.push(i[h])):s[h]=!1}}}}_forEachCell(t,e,n,r,i,o,s,a){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(n),h=this._convertToCellCoord(r);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,n,r,u,o,s,a))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let n=0;for(let t=0;t<this.cells.length;t++)n+=this.cells[t].length;const r=new Int32Array(e+n+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let i=e;for(let e=0;e<t.length;e++){const n=t[e];r[3+e]=i,r.set(n,i),i+=n.length}return r[3+t.length]=i,r.set(this.keys,i),i+=this.keys.length,r[3+t.length+1]=i,r.set(this.bboxes,i),i+=this.bboxes.length,r.buffer}static serialize(t,e){const n=t.toArrayBuffer();return e&&e.push(n),{buffer:n}}static deserialize(t){return new Dr(t.buffer)}}const Rr={};function Or(t,e,n={}){if(Rr[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Rr[t]={klass:e,omit:n.omit||[],shallow:n.shallow||[]}}Or("Object",Object),Or("TransferableGridIndex",Dr),Or("Color",Ht),Or("Error",Error),Or("AJAXError",z),Or("ResolvedImage",re),Or("StylePropertyFunction",Vn),Or("StyleExpression",Rn,{omit:["_evaluator"]}),Or("ZoomDependentExpression",Bn),Or("ZoomConstantExpression",Fn),Or("CompoundExpression",Oe,{omit:["_evaluate"]});for(const t in mn)mn[t]._classRegistryKey||Or(`Expression_${t}`,mn[t]);function zr(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Fr(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(zr(t))return e&&e.push(t),t;if(P(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const n=t;return e&&e.push(n.buffer),n}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const n=[];for(const r of t)n.push(Fr(r,e));return n}if("object"==typeof t){const n=t.constructor,r=n._classRegistryKey;if(!r)throw new Error("can't serialize object of unregistered class");if(!Rr[r])throw new Error(`${r} is not registered.`);const i=n.serialize?n.serialize(t,e):{};if(n.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const n in t){if(!t.hasOwnProperty(n))continue;if(Rr[r].omit.indexOf(n)>=0)continue;const o=t[n];i[n]=Rr[r].shallow.indexOf(n)>=0?o:Fr(o,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(i.$name=r),i}throw new Error("can't serialize object of type "+typeof t)}function Br(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||zr(t)||P(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Br);if("object"==typeof t){const e=t.$name||"Object";if(!Rr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:n}=Rr[e];if(!n)throw new Error(`can't deserialize unregistered class ${e}`);if(n.deserialize)return n.deserialize(t);const r=Object.create(n.prototype);for(const n of Object.keys(t)){if("$name"===n)continue;const i=t[n];r[n]=Rr[e].shallow.indexOf(n)>=0?i:Br(i)}return r}throw new Error("can't deserialize object of type "+typeof t)}class Ur{constructor(){this.first=!0}update(t,e){const n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=n,!0))}}const Vr={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function jr(t){for(const e of t)if($r(e.charCodeAt(0)))return!0;return!1}function Gr(t){for(const e of t)if(!qr(e.charCodeAt(0)))return!1;return!0}function qr(t){return!(Vr.Arabic(t)||Vr["Arabic Supplement"](t)||Vr["Arabic Extended-A"](t)||Vr["Arabic Presentation Forms-A"](t)||Vr["Arabic Presentation Forms-B"](t))}function $r(t){return!(746!==t&&747!==t&&(t<4352||!(Vr["Bopomofo Extended"](t)||Vr.Bopomofo(t)||Vr["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Vr["CJK Compatibility Ideographs"](t)||Vr["CJK Compatibility"](t)||Vr["CJK Radicals Supplement"](t)||Vr["CJK Strokes"](t)||!(!Vr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Vr["CJK Unified Ideographs Extension A"](t)||Vr["CJK Unified Ideographs"](t)||Vr["Enclosed CJK Letters and Months"](t)||Vr["Hangul Compatibility Jamo"](t)||Vr["Hangul Jamo Extended-A"](t)||Vr["Hangul Jamo Extended-B"](t)||Vr["Hangul Jamo"](t)||Vr["Hangul Syllables"](t)||Vr.Hiragana(t)||Vr["Ideographic Description Characters"](t)||Vr.Kanbun(t)||Vr["Kangxi Radicals"](t)||Vr["Katakana Phonetic Extensions"](t)||Vr.Katakana(t)&&12540!==t||!(!Vr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Vr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Vr["Unified Canadian Aboriginal Syllabics"](t)||Vr["Unified Canadian Aboriginal Syllabics Extended"](t)||Vr["Vertical Forms"](t)||Vr["Yijing Hexagram Symbols"](t)||Vr["Yi Syllables"](t)||Vr["Yi Radicals"](t))))}function Xr(t){return!($r(t)||function(t){return!!(Vr["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Vr["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Vr["Letterlike Symbols"](t)||Vr["Number Forms"](t)||Vr["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Vr["Control Pictures"](t)&&9251!==t||Vr["Optical Character Recognition"](t)||Vr["Enclosed Alphanumerics"](t)||Vr["Geometric Shapes"](t)||Vr["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Vr["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Vr["CJK Symbols and Punctuation"](t)||Vr.Katakana(t)||Vr["Private Use Area"](t)||Vr["CJK Compatibility Forms"](t)||Vr["Small Form Variants"](t)||Vr["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Zr(t){return t>=1424&&t<=2303||Vr["Arabic Presentation Forms-A"](t)||Vr["Arabic Presentation Forms-B"](t)}function Yr(t,e){return!(!e&&Zr(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Vr.Khmer(t))}function Wr(t){for(const e of t)if(Zr(e.charCodeAt(0)))return!0;return!1}const Hr="deferred",Kr="loading",Jr="loaded";let Qr=null,ti="unavailable",ei=null;const ni=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(ti="error"),Qr&&Qr(t)};function ri(){ii.fire(new X("pluginStateChange",{pluginStatus:ti,pluginURL:ei}))}const ii=new Y,oi=function(){return ti},si=function(){if(ti!==Hr||!ei)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ti=Kr,ri(),ei&&j({url:ei},(t=>{t?ni(t):(ti=Jr,ri())}))},ai={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ti===Jr||null!=ai.applyArabicShaping,isLoading:()=>ti===Kr,setState(t){if(!C())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");ti=t.pluginStatus,ei=t.pluginURL},isParsed(){if(!C())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=ai.applyArabicShaping&&null!=ai.processBidirectionalText&&null!=ai.processStyledBidirectionalText},getPluginURL(){if(!C())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return ei}};class li{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ur,this.transition={})}isSupportedScript(t){return function(t,e){for(const n of t)if(!Yr(n.charCodeAt(0),e))return!1;return!0}(t,ai.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*e}}}class ui{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Tn(t))return new Vn(t,e);if(On(t)){const n=Un(t,e);if("error"===n.result)throw new Error(n.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return n.value}{let n=t;return"color"===e.type&&"string"==typeof t?n=Ht.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)&&(n=ne.parse(t)):n=te.parse(t),{kind:"constant",evaluate:()=>n}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,n){return this.property.possiblyEvaluate(this,t,e,n)}}class ci{constructor(t){this.property=t,this.value=new ui(t,void 0)}transitioned(t,e){return new pi(this.property,this.value,e,y({},t.transition,this.transition),t.now)}untransitioned(){return new pi(this.property,this.value,null,{},0)}}class hi{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return b(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ci(this._values[t].property)),this._values[t].value=new ui(this._values[t].property,null===e?void 0:b(e))}getTransition(t){return b(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ci(this._values[t].property)),this._values[t].transition=b(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const n=this.getValue(e);void 0!==n&&(t[e]=n);const r=this.getTransition(e);void 0!==r&&(t[`${e}-transition`]=r)}return t}transitioned(t,e){const n=new fi(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(t,e._values[r]);return n}untransitioned(){const t=new fi(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class pi{constructor(t,e,n,r,i){this.property=t,this.value=e,this.begin=i+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=n)}possiblyEvaluate(t,e,n){const r=t.now||0,i=this.value.possiblyEvaluate(t,e,n),o=this.prior;if(o){if(r>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(r<this.begin)return o.possiblyEvaluate(t,e,n);{const s=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,n),i,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}(s))}}return i}}class fi{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,n){const r=new mi(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(t,e,n);return r}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class di{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return b(this._values[t].value)}setValue(t,e){this._values[t]=new ui(this._values[t].property,null===e?void 0:b(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const n=this.getValue(e);void 0!==n&&(t[e]=n)}return t}possiblyEvaluate(t,e,n){const r=new mi(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(t,e,n);return r}}class gi{constructor(t,e,n){this.property=t,this.value=e,this.parameters=n}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,n,r){return this.property.evaluate(this.value,this.parameters,t,e,n,r)}}class mi{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class yi{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,n){const r=$e[this.specification.type];return r?r(t,e,n):t}}class _i{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,n,r){return new gi(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},n,r)}:t.expression,e)}interpolate(t,e,n){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new gi(this,{kind:"constant",value:void 0},t.parameters);const r=$e[this.specification.type];if(r){const i=r(t.value.value,e.value.value,n);return new gi(this,{kind:"constant",value:i},t.parameters)}return t}evaluate(t,e,n,r,i,o){return"constant"===t.kind?t.value:t.evaluate(e,n,r,i,o)}}class vi extends _i{possiblyEvaluate(t,e,n,r){if(void 0===t.value)return new gi(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},n,r),o="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,s=this._calculate(o,o,o,e);return new gi(this,{kind:"constant",value:s},e)}if("camera"===t.expression.kind){const n=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new gi(this,{kind:"constant",value:n},e)}return new gi(this,t.expression,e)}evaluate(t,e,n,r,i,o){if("source"===t.kind){const s=t.evaluate(e,n,r,i,o);return this._calculate(s,s,s,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},n,r),t.evaluate({zoom:Math.floor(e.zoom)},n,r),t.evaluate({zoom:Math.floor(e.zoom)+1},n,r),e):t.value}_calculate(t,e,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}}interpolate(t){return t}}class xi{constructor(t){this.specification=t}possiblyEvaluate(t,e,n,r){if(void 0!==t.value){if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},n,r);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new li(Math.floor(e.zoom-1),e)),t.expression.evaluate(new li(Math.floor(e.zoom),e)),t.expression.evaluate(new li(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}}interpolate(t){return t}}class bi{constructor(t){this.specification=t}possiblyEvaluate(t,e,n,r){return!!t.expression.evaluate(e,null,{},n,r)}interpolate(){return!1}}class wi{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const n=t[e];n.specification.overridable&&this.overridableProperties.push(e);const r=this.defaultPropertyValues[e]=new ui(n,void 0),i=this.defaultTransitionablePropertyValues[e]=new ci(n);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}}}Or("DataDrivenProperty",_i),Or("DataConstantProperty",yi),Or("CrossFadedDataDrivenProperty",vi),Or("CrossFadedProperty",xi),Or("ColorRampProperty",bi);const Ei="-transition";class Si extends Y{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new di(e.layout)),e.paint)){this._transitionablePaint=new hi(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new mi(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,n={}){null!=e&&this._validate(kr,`layers.${this.id}.layout.${t}`,t,e,n)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(Ei)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,n={}){if(null!=e&&this._validate(Ar,`layers.${this.id}.paint.${t}`,t,e,n))return!1;if(t.endsWith(Ei))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const n=this._transitionablePaint._values[t],r="cross-faded-data-driven"===n.property.specification["property-type"],i=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const s=this._transitionablePaint._values[t].value;return s.isDataDriven()||i||r||this._handleOverridablePaintPropertyUpdate(t,o,s)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,n){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),x(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,n,r,i={}){return(!i||!1!==i.validate)&&Nr(this,t.call(Mr,{key:e,layerType:this.type,objectKey:n,value:r,styleSpec:W,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof gi&&En(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const Ii={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ci{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ti{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Pi(t,e=1){let n=0,r=0;return{members:t.map((t=>{const i=Ii[t.type].BYTES_PER_ELEMENT,o=n=Mi(n,Math.max(e,i)),s=t.components||1;return r=Math.max(r,i),n+=i*s,{name:t.name,type:t.type,components:s,offset:o}})),size:Mi(n,Math.max(r,e)),alignment:e}}function Mi(t,e){return Math.ceil(t/e)*e}class Li extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const r=2*t;return this.int16[r+0]=e,this.int16[r+1]=n,t}}Li.prototype.bytesPerElement=4,Or("StructArrayLayout2i4",Li);class Ai extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)}emplace(t,e,n,r){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=n,this.int16[i+2]=r,t}}Ai.prototype.bytesPerElement=6,Or("StructArrayLayout3i6",Ai);class ki extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n,r)}emplace(t,e,n,r,i){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=n,this.int16[o+2]=r,this.int16[o+3]=i,t}}ki.prototype.bytesPerElement=8,Or("StructArrayLayout4i8",ki);class Ni extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,r,i,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,n,r,i,o)}emplace(t,e,n,r,i,o,s){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=n,this.int16[a+2]=r,this.int16[a+3]=i,this.int16[a+4]=o,this.int16[a+5]=s,t}}Ni.prototype.bytesPerElement=12,Or("StructArrayLayout2i4i12",Ni);class Di extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,r,i,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,n,r,i,o)}emplace(t,e,n,r,i,o,s){const a=4*t,l=8*t;return this.int16[a+0]=e,this.int16[a+1]=n,this.uint8[l+4]=r,this.uint8[l+5]=i,this.uint8[l+6]=o,this.uint8[l+7]=s,t}}Di.prototype.bytesPerElement=8,Or("StructArrayLayout2i4ub8",Di);class Ri extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const r=2*t;return this.float32[r+0]=e,this.float32[r+1]=n,t}}Ri.prototype.bytesPerElement=8,Or("StructArrayLayout2f8",Ri);class Oi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,r,i,o,s,a,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,n,r,i,o,s,a,l,u)}emplace(t,e,n,r,i,o,s,a,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=n,this.uint16[h+2]=r,this.uint16[h+3]=i,this.uint16[h+4]=o,this.uint16[h+5]=s,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}Oi.prototype.bytesPerElement=20,Or("StructArrayLayout10ui20",Oi);class zi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,r,i,o,s,a,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,n,r,i,o,s,a,l,u,c,h)}emplace(t,e,n,r,i,o,s,a,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=n,this.int16[f+2]=r,this.int16[f+3]=i,this.uint16[f+4]=o,this.uint16[f+5]=s,this.uint16[f+6]=a,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}zi.prototype.bytesPerElement=24,Or("StructArrayLayout4i4ui4i24",zi);class Fi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)}emplace(t,e,n,r){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=n,this.float32[i+2]=r,t}}Fi.prototype.bytesPerElement=12,Or("StructArrayLayout3f12",Fi);class Bi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Bi.prototype.bytesPerElement=4,Or("StructArrayLayout1ul4",Bi);class Ui extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n,r,i,o,s,a,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,n,r,i,o,s,a,l)}emplace(t,e,n,r,i,o,s,a,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=n,this.int16[c+2]=r,this.int16[c+3]=i,this.int16[c+4]=o,this.int16[c+5]=s,this.uint32[h+3]=a,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}Ui.prototype.bytesPerElement=20,Or("StructArrayLayout6i1ul2ui20",Ui);class Vi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,r,i,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,n,r,i,o)}emplace(t,e,n,r,i,o,s){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=n,this.int16[a+2]=r,this.int16[a+3]=i,this.int16[a+4]=o,this.int16[a+5]=s,t}}Vi.prototype.bytesPerElement=12,Or("StructArrayLayout2i2i2i12",Vi);class ji extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,n,r,i){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,n,r,i)}emplace(t,e,n,r,i,o){const s=4*t,a=8*t;return this.float32[s+0]=e,this.float32[s+1]=n,this.float32[s+2]=r,this.int16[a+6]=i,this.int16[a+7]=o,t}}ji.prototype.bytesPerElement=16,Or("StructArrayLayout2f1f2i16",ji);class Gi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n,r)}emplace(t,e,n,r,i){const o=12*t,s=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=n,this.float32[s+1]=r,this.float32[s+2]=i,t}}Gi.prototype.bytesPerElement=12,Or("StructArrayLayout2ub2f12",Gi);class qi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)}emplace(t,e,n,r){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=n,this.uint16[i+2]=r,t}}qi.prototype.bytesPerElement=6,Or("StructArrayLayout3ui6",qi);class $i extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m){const y=this.length;return this.resize(y+1),this.emplace(y,t,e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m)}emplace(t,e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m,y){const _=24*t,v=12*t,x=48*t;return this.int16[_+0]=e,this.int16[_+1]=n,this.uint16[_+2]=r,this.uint16[_+3]=i,this.uint32[v+2]=o,this.uint32[v+3]=s,this.uint32[v+4]=a,this.uint16[_+10]=l,this.uint16[_+11]=u,this.uint16[_+12]=c,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[x+36]=f,this.uint8[x+37]=d,this.uint8[x+38]=g,this.uint32[v+10]=m,this.int16[_+22]=y,t}}$i.prototype.bytesPerElement=48,Or("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",$i);class Xi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m,y,_,v,x,b,w,E,S,I,C,T){const P=this.length;return this.resize(P+1),this.emplace(P,t,e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m,y,_,v,x,b,w,E,S,I,C,T)}emplace(t,e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m,y,_,v,x,b,w,E,S,I,C,T,P){const M=32*t,L=16*t;return this.int16[M+0]=e,this.int16[M+1]=n,this.int16[M+2]=r,this.int16[M+3]=i,this.int16[M+4]=o,this.int16[M+5]=s,this.int16[M+6]=a,this.int16[M+7]=l,this.uint16[M+8]=u,this.uint16[M+9]=c,this.uint16[M+10]=h,this.uint16[M+11]=p,this.uint16[M+12]=f,this.uint16[M+13]=d,this.uint16[M+14]=g,this.uint16[M+15]=m,this.uint16[M+16]=y,this.uint16[M+17]=_,this.uint16[M+18]=v,this.uint16[M+19]=x,this.uint16[M+20]=b,this.uint16[M+21]=w,this.uint16[M+22]=E,this.uint32[L+12]=S,this.float32[L+13]=I,this.float32[L+14]=C,this.uint16[M+30]=T,this.uint16[M+31]=P,t}}Xi.prototype.bytesPerElement=64,Or("StructArrayLayout8i15ui1ul2f2ui64",Xi);class Zi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Zi.prototype.bytesPerElement=4,Or("StructArrayLayout1f4",Zi);class Yi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)}emplace(t,e,n,r){const i=3*t;return this.uint16[6*t+0]=e,this.float32[i+1]=n,this.float32[i+2]=r,t}}Yi.prototype.bytesPerElement=12,Or("StructArrayLayout1ui2f12",Yi);class Wi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)}emplace(t,e,n,r){const i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=n,this.uint16[i+3]=r,t}}Wi.prototype.bytesPerElement=8,Or("StructArrayLayout1ul2ui8",Wi);class Hi extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=n,t}}Hi.prototype.bytesPerElement=4,Or("StructArrayLayout2ui4",Hi);class Ki extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Ki.prototype.bytesPerElement=2,Or("StructArrayLayout1ui2",Ki);class Ji extends Ti{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,n,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n,r)}emplace(t,e,n,r,i){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=n,this.float32[o+2]=r,this.float32[o+3]=i,t}}Ji.prototype.bytesPerElement=16,Or("StructArrayLayout4f16",Ji);class Qi extends Ci{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 o(this.anchorPointX,this.anchorPointY)}}Qi.prototype.size=20;class to extends Ui{get(t){return new Qi(this,t)}}Or("CollisionBoxArray",to);class eo extends Ci{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}eo.prototype.size=48;class no extends $i{get(t){return new eo(this,t)}}Or("PlacedSymbolArray",no);class ro extends Ci{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get 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]}}ro.prototype.size=64;class io extends Xi{get(t){return new ro(this,t)}}Or("SymbolInstanceArray",io);class oo extends Zi{getoffsetX(t){return this.float32[1*t+0]}}Or("GlyphOffsetArray",oo);class so extends Ai{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Or("SymbolLineVertexArray",so);class ao extends Ci{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]}}ao.prototype.size=12;class lo extends Yi{get(t){return new ao(this,t)}}Or("TextAnchorOffsetArray",lo);class uo extends Ci{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]}}uo.prototype.size=8;class co extends Wi{get(t){return new uo(this,t)}}Or("FeatureIndexArray",co);class ho extends Li{}class po extends Li{}class fo extends Li{}class go extends Ni{}class mo extends Di{}class yo extends Ri{}class _o extends Oi{}class vo extends zi{}class xo extends Fi{}class bo extends Bi{}class wo extends Vi{}class Eo extends Gi{}class So extends qi{}class Io extends Hi{}const Co=Pi([{name:"a_pos",components:2,type:"Int16"}],4),{members:To}=Co;class Po{constructor(t=[]){this.segments=t}prepareSegment(t,e,n,r){let i=this.segments[this.segments.length-1];return t>Po.MAX_VERTEX_ARRAY_LENGTH&&E(`Max vertices per segment is ${Po.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>Po.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==r)&&(i={vertexOffset:e.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==r&&(i.sortKey=r),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,n,r){return new Po([{vertexOffset:t,primitiveOffset:e,vertexLength:n,primitiveLength:r,vaos:{},sortKey:0}])}}function Mo(t,e){return 256*(t=g(Math.floor(t),0,255))+g(Math.floor(e),0,255)}Po.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Or("SegmentVector",Po);const Lo=Pi([{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 Ao={exports:{}},ko=function(t,e){var n,r,i,o,s,a,l,u;for(r=t.length-(n=3&t.length),i=e,s=3432918353,a=461845907,u=0;u<r;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(o=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0},No=function(t,e){for(var n,r=t.length,i=e^r,o=0;r>=4;)n=1540483477*(65535&(n=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:i^=(255&t.charCodeAt(o+2))<<16;case 2:i^=(255&t.charCodeAt(o+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(o)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};Ao.exports=ko,Ao.exports.murmur3=ko,Ao.exports.murmur2=No;var Do=n(Ao.exports);class Ro{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,n,r){this.ids.push(Oo(t)),this.positions.push(e,n,r)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=Oo(t);let n=0,r=this.ids.length-1;for(;n<r;){const t=n+r>>1;this.ids[t]>=e?r=t:n=t+1}const i=[];for(;this.ids[n]===e;)i.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return i}static serialize(t,e){const n=new Float64Array(t.ids),r=new Uint32Array(t.positions);return zo(n,r,0,n.length-1),e&&e.push(n.buffer,r.buffer),{ids:n,positions:r}}static deserialize(t){const e=new Ro;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Oo(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Do(String(t))}function zo(t,e,n,r){for(;n<r;){const i=t[n+r>>1];let o=n-1,s=r+1;for(;;){do{o++}while(t[o]<i);do{s--}while(t[s]>i);if(o>=s)break;Fo(t,o,s),Fo(e,3*o,3*s),Fo(e,3*o+1,3*s+1),Fo(e,3*o+2,3*s+2)}s-n<r-s?(zo(t,e,n,s),n=s+1):(zo(t,e,s+1,r),r=s)}}function Fo(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}Or("FeaturePositionMap",Ro);class Bo{constructor(t,e){this.gl=t.gl,this.location=e}}class Uo extends Bo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Vo extends Bo{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class jo extends Bo{constructor(t,e){super(t,e),this.current=Ht.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Go=new Float32Array(16);function qo(t){return[Mo(255*t.r,255*t.g),Mo(255*t.b,255*t.a)]}class $o{constructor(t,e,n){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=n}setUniform(t,e,n){t.set(n.constantOr(this.value))}getBinding(t,e,n){return"color"===this.type?new jo(t,e):new Uo(t,e)}}class Xo{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,n,r){const i="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;i&&t.set(i)}getBinding(t,e,n){return"u_pattern"===n.substr(0,9)?new Vo(t,e):new Uo(t,e)}}class Zo{constructor(t,e,n,r){this.expression=t,this.type=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===n?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(t,e,n,r,i){const o=this.paintVertexArray.length,s=this.expression.evaluate(new li(0),e,{},r,[],i);this.paintVertexArray.resize(t),this._setPaintValue(o,t,s)}updatePaintArray(t,e,n,r){const i=this.expression.evaluate({zoom:0},n,r);this._setPaintValue(t,e,i)}_setPaintValue(t,e,n){if("color"===this.type){const r=qo(n);for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Yo{constructor(t,e,n,r,i,o){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=n,this.useIntegerZoom=r,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===n?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(t,e,n,r,i){const o=this.expression.evaluate(new li(this.zoom),e,{},r,[],i),s=this.expression.evaluate(new li(this.zoom+1),e,{},r,[],i),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,o,s)}updatePaintArray(t,e,n,r){const i=this.expression.evaluate({zoom:this.zoom},n,r),o=this.expression.evaluate({zoom:this.zoom+1},n,r);this._setPaintValue(t,e,i,o)}_setPaintValue(t,e,n,r){if("color"===this.type){const i=qo(n),o=qo(r);for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i[0],i[1],o[0],o[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n,r);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const n=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=g(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);t.set(r)}getBinding(t,e,n){return new Uo(t,e)}}class Wo{constructor(t,e,n,r,i,o){this.expression=t,this.type=e,this.useIntegerZoom=n,this.zoom=r,this.layerId=o,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(t,e,n){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,e.patterns&&e.patterns[this.layerId],n)}updatePaintArray(t,e,n,r,i){this._setPaintValues(t,e,n.patterns&&n.patterns[this.layerId],i)}_setPaintValues(t,e,n,r){if(!r||!n)return;const{min:i,mid:o,max:s}=n,a=r[i],l=r[o],u=r[s];if(a&&l&&u)for(let n=t;n<e;n++)this.zoomInPaintVertexArray.emplace(n,l.tl[0],l.tl[1],l.br[0],l.br[1],a.tl[0],a.tl[1],a.br[0],a.br[1],l.pixelRatio,a.pixelRatio),this.zoomOutPaintVertexArray.emplace(n,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Lo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Lo.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ho{constructor(t,e,n){this.binders={},this._buffers=[];const r=[];for(const i in t.paint._values){if(!n(i))continue;const o=t.paint.get(i);if(!(o instanceof gi&&En(o.property.specification)))continue;const s=Jo(i,t.type),a=o.value,l=o.property.specification.type,u=o.property.useIntegerZoom,c=o.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===a.kind)this.binders[i]=h?new Xo(a.value,s):new $o(a.value,s,l),r.push(`/u_${i}`);else if("source"===a.kind||h){const n=Qo(i,l,"source");this.binders[i]=h?new Wo(a,l,u,e,n,t.id):new Zo(a,s,l,n),r.push(`/a_${i}`)}else{const t=Qo(i,l,"composite");this.binders[i]=new Yo(a,s,l,u,e,t),r.push(`/z_${i}`)}}this.cacheKey=r.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Zo||e instanceof Yo?e.maxValue:0}populatePaintArrays(t,e,n,r,i){for(const o in this.binders){const s=this.binders[o];(s instanceof Zo||s instanceof Yo||s instanceof Wo)&&s.populatePaintArray(t,e,n,r,i)}}setConstantPatternPositions(t,e){for(const n in this.binders){const r=this.binders[n];r instanceof Xo&&r.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,n,r,i){let o=!1;for(const s in t){const a=e.getPositions(s);for(const e of a){const a=n.feature(e.index);for(const n in this.binders){const l=this.binders[n];if((l instanceof Zo||l instanceof Yo||l instanceof Wo)&&!0===l.expression.isStateDependent){const u=r.paint.get(n);l.expression=u.value,l.updatePaintArray(e.start,e.end,a,t[s],i),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const n=this.binders[e];(n instanceof $o||n instanceof Xo)&&t.push(...n.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const n=this.binders[e];if(n instanceof Zo||n instanceof Yo)for(let e=0;e<n.paintVertexAttributes.length;e++)t.push(n.paintVertexAttributes[e].name);else if(n instanceof Wo)for(let e=0;e<Lo.members.length;e++)t.push(Lo.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const n=this.binders[e];if(n instanceof $o||n instanceof Xo||n instanceof Yo)for(const e of n.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const n=[];for(const r in this.binders){const i=this.binders[r];if(i instanceof $o||i instanceof Xo||i instanceof Yo)for(const o of i.uniformNames)if(e[o]){const s=i.getBinding(t,e[o],o);n.push({name:o,property:r,binding:s})}}return n}setUniforms(t,e,n,r){for(const{name:t,property:i,binding:o}of e)this.binders[i].setUniform(o,r,n.get(i),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const n=this.binders[e];if(t&&n instanceof Wo){const e=2===t.fromScale?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(n instanceof Zo||n instanceof Yo)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(t){for(const e in this.binders){const n=this.binders[e];(n instanceof Zo||n instanceof Yo||n instanceof Wo)&&n.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Zo||e instanceof Yo||e instanceof Wo)&&e.destroy()}}}class Ko{constructor(t,e,n=(()=>!0)){this.programConfigurations={};for(const r of t)this.programConfigurations[r.id]=new Ho(r,e,n);this.needsUpload=!1,this._featureMap=new Ro,this._bufferOffset=0}populatePaintArrays(t,e,n,r,i,o){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,r,i,o);void 0!==e.id&&this._featureMap.add(e.id,n,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,n,r){for(const i of n)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(t,this._featureMap,e,i,r)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Jo(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Qo(t,e,n){const r={color:{source:Ri,composite:Ji},number:{source:Zi,composite:Ri}},i=function(t){return{"line-pattern":{source:_o,composite:_o},"fill-pattern":{source:_o,composite:_o},"fill-extrusion-pattern":{source:_o,composite:_o}}[t]}(t);return i&&i[n]||r[e][n]}Or("ConstantBinder",$o),Or("CrossFadedConstantBinder",Xo),Or("SourceExpressionBinder",Zo),Or("CrossFadedCompositeBinder",Wo),Or("CompositeExpressionBinder",Yo),Or("ProgramConfiguration",Ho,{omit:["_buffers"]}),Or("ProgramConfigurationSet",Ko);const ts=8192,es=Math.pow(2,14)-1,ns=-es-1;function rs(t){const e=ts/t.extent,n=t.loadGeometry();for(let t=0;t<n.length;t++){const r=n[t];for(let t=0;t<r.length;t++){const n=r[t],i=Math.round(n.x*e),o=Math.round(n.y*e);n.x=g(i,ns,es),n.y=g(o,ns,es),(i<n.x||i>n.x+1||o<n.y||o>n.y+1)&&E("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function is(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?rs(t):[]}}function os(t,e,n,r,i){t.emplaceBack(2*e+(r+1)/2,2*n+(i+1)/2)}class ss{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new po,this.indexArray=new So,this.segments=new Po,this.programConfigurations=new Ko(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,n){const r=this.layers[0],i=[];let o=null,s=!1;"circle"===r.type&&(o=r.layout.get("circle-sort-key"),s=!o.isConstant());for(const{feature:e,id:r,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=is(e,t);if(!this.layers[0]._featureFilter.filter(new li(this.zoom),u,n))continue;const c=s?o.evaluate(u,{},n):void 0,h={id:r,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?u.geometry:rs(e),patterns:{},sortKey:c};i.push(h)}s&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of i){const{geometry:i,index:o,sourceLayerIndex:s}=r,a=t[o].feature;this.addFeature(r,i,o,n),e.featureIndex.insert(a,i,o,s,this.index)}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,To),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,n,r){for(const n of e)for(const e of n){const n=e.x,r=e.y;if(n<0||n>=ts||r<0||r>=ts)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=i.vertexLength;os(this.layoutVertexArray,n,r,-1,-1),os(this.layoutVertexArray,n,r,1,-1),os(this.layoutVertexArray,n,r,1,1),os(this.layoutVertexArray,n,r,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+3,o+2),i.vertexLength+=4,i.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{},r)}}function as(t,e){for(let n=0;n<t.length;n++)if(ms(e,t[n]))return!0;for(let n=0;n<e.length;n++)if(ms(t,e[n]))return!0;return!!hs(t,e)}function ls(t,e,n){return!!ms(t,e)||!!fs(e,t,n)}function us(t,e){if(1===t.length)return gs(e,t[0]);for(let n=0;n<e.length;n++){const r=e[n];for(let e=0;e<r.length;e++)if(ms(t,r[e]))return!0}for(let n=0;n<t.length;n++)if(gs(e,t[n]))return!0;for(let n=0;n<e.length;n++)if(hs(t,e[n]))return!0;return!1}function cs(t,e,n){if(t.length>1){if(hs(t,e))return!0;for(let r=0;r<e.length;r++)if(fs(e[r],t,n))return!0}for(let r=0;r<t.length;r++)if(fs(t[r],e,n))return!0;return!1}function hs(t,e){if(0===t.length||0===e.length)return!1;for(let n=0;n<t.length-1;n++){const r=t[n],i=t[n+1];for(let t=0;t<e.length-1;t++)if(ps(r,i,e[t],e[t+1]))return!0}return!1}function ps(t,e,n,r){return S(t,n,r)!==S(e,n,r)&&S(t,e,n)!==S(t,e,r)}function fs(t,e,n){const r=n*n;if(1===e.length)return t.distSqr(e[0])<r;for(let n=1;n<e.length;n++)if(ds(t,e[n-1],e[n])<r)return!0;return!1}function ds(t,e,n){const r=e.distSqr(n);if(0===r)return t.distSqr(e);const i=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;return t.distSqr(i<0?e:i>1?n:n.sub(e)._mult(i)._add(e))}function gs(t,e){let n,r,i,o=!1;for(let s=0;s<t.length;s++){n=t[s];for(let t=0,s=n.length-1;t<n.length;s=t++)r=n[t],i=n[s],r.y>e.y!=i.y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(o=!o)}return o}function ms(t,e){let n=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){const o=t[r],s=t[i];o.y>e.y!=s.y>e.y&&e.x<(s.x-o.x)*(e.y-o.y)/(s.y-o.y)+o.x&&(n=!n)}return n}function ys(t,e,n){const r=n[0],i=n[2];if(t.x<r.x&&e.x<r.x||t.x>i.x&&e.x>i.x||t.y<r.y&&e.y<r.y||t.y>i.y&&e.y>i.y)return!1;const o=S(t,e,n[0]);return o!==S(t,e,n[1])||o!==S(t,e,n[2])||o!==S(t,e,n[3])}function _s(t,e,n){const r=e.paint.get(t).value;return"constant"===r.kind?r.value:n.programConfigurations.get(e.id).getMaxValue(t)}function vs(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function xs(t,e,n,r,i){if(!e[0]&&!e[1])return t;const s=o.convert(e)._mult(i);"viewport"===n&&s._rotate(-r);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(s));return a}let bs,ws;Or("CircleBucket",ss,{omit:["layers"]});var Es={get paint(){return ws=ws||new wi({"circle-radius":new _i(W.paint_circle["circle-radius"]),"circle-color":new _i(W.paint_circle["circle-color"]),"circle-blur":new _i(W.paint_circle["circle-blur"]),"circle-opacity":new _i(W.paint_circle["circle-opacity"]),"circle-translate":new yi(W.paint_circle["circle-translate"]),"circle-translate-anchor":new yi(W.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new yi(W.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new yi(W.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new _i(W.paint_circle["circle-stroke-width"]),"circle-stroke-color":new _i(W.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new _i(W.paint_circle["circle-stroke-opacity"])})},get layout(){return bs=bs||new wi({"circle-sort-key":new _i(W.layout_circle["circle-sort-key"])})}},Ss=1e-6,Is="undefined"!=typeof Float32Array?Float32Array:Array;function Cs(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 Ts(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],g=e[12],m=e[13],y=e[14],_=e[15],v=n[0],x=n[1],b=n[2],w=n[3];return t[0]=v*r+x*a+b*h+w*g,t[1]=v*i+x*l+b*p+w*m,t[2]=v*o+x*u+b*f+w*y,t[3]=v*s+x*c+b*d+w*_,t[4]=(v=n[4])*r+(x=n[5])*a+(b=n[6])*h+(w=n[7])*g,t[5]=v*i+x*l+b*p+w*m,t[6]=v*o+x*u+b*f+w*y,t[7]=v*s+x*c+b*d+w*_,t[8]=(v=n[8])*r+(x=n[9])*a+(b=n[10])*h+(w=n[11])*g,t[9]=v*i+x*l+b*p+w*m,t[10]=v*o+x*u+b*f+w*y,t[11]=v*s+x*c+b*d+w*_,t[12]=(v=n[12])*r+(x=n[13])*a+(b=n[14])*h+(w=n[15])*g,t[13]=v*i+x*l+b*p+w*m,t[14]=v*o+x*u+b*f+w*y,t[15]=v*s+x*c+b*d+w*_,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Ps,Ms=Ts;function Ls(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*s,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*s,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*s,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*s,t}Ps=new Is(4),Is!=Float32Array&&(Ps[0]=0,Ps[1]=0,Ps[2]=0,Ps[3]=0);class As extends Si{constructor(t){super(t,Es)}createBucket(t){return new ss(t)}queryRadius(t){const e=t;return _s("circle-radius",this,e)+_s("circle-stroke-width",this,e)+vs(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,n,r,i,o,s,a){const l=xs(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,s),u=this.paint.get("circle-radius").evaluate(e,n)+this.paint.get("circle-stroke-width").evaluate(e,n),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:function(t,e){return t.map((t=>ks(t,e)))}(l,a),p=c?u*s:u;for(const t of r)for(const e of t){const t=c?e:ks(e,a);let n=p;const r=Ls([],[e.x,e.y,0,1],a);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?n*=r[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(n*=o.cameraToCenterDistance/r[3]),ls(h,t,n))return!0}return!1}}function ks(t,e){const n=Ls([],[t.x,t.y,0,1],e);return new o(n[0]/n[3],n[1]/n[3])}class Ns extends ss{}let Ds;Or("HeatmapBucket",Ns,{omit:["layers"]});var Rs={get paint(){return Ds=Ds||new wi({"heatmap-radius":new _i(W.paint_heatmap["heatmap-radius"]),"heatmap-weight":new _i(W.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new yi(W.paint_heatmap["heatmap-intensity"]),"heatmap-color":new bi(W.paint_heatmap["heatmap-color"]),"heatmap-opacity":new yi(W.paint_heatmap["heatmap-opacity"])})}};function Os(t,{width:e,height:n},r,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*n*r)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*n*r}`)}else i=new Uint8Array(e*n*r);return t.width=e,t.height=n,t.data=i,t}function zs(t,{width:e,height:n},r){if(e===t.width&&n===t.height)return;const i=Os({},{width:e,height:n},r);Fs(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,n)},r),t.width=e,t.height=n,t.data=i.data}function Fs(t,e,n,r,i,o){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const s=t.data,a=e.data;if(s===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){const u=((n.y+l)*t.width+n.x)*o,c=((r.y+l)*e.width+r.x)*o;for(let t=0;t<i.width*o;t++)a[c+t]=s[u+t]}return e}class Bs{constructor(t,e){Os(this,t,1,e)}resize(t){zs(this,t,1)}clone(){return new Bs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,n,r,i){Fs(t,e,n,r,i,1)}}class Us{constructor(t,e){Os(this,t,4,e)}resize(t){zs(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Us({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,n,r,i){Fs(t,e,n,r,i,4)}}function Vs(t){const e={},n=t.resolution||256,r=t.clips?t.clips.length:1,i=t.image||new Us({width:n,height:r});if(Math.log(n)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${n}`);const o=(n,r,o)=>{e[t.evaluationKey]=o;const s=t.expression.evaluate(e);i.data[n+r+0]=Math.floor(255*s.r/s.a),i.data[n+r+1]=Math.floor(255*s.g/s.a),i.data[n+r+2]=Math.floor(255*s.b/s.a),i.data[n+r+3]=Math.floor(255*s.a)};if(t.clips)for(let e=0,i=0;e<r;++e,i+=4*n)for(let r=0,s=0;r<n;r++,s+=4){const a=r/(n-1),{start:l,end:u}=t.clips[e];o(i,s,l*(1-a)+u*a)}else for(let t=0,e=0;t<n;t++,e+=4)o(0,e,t/(n-1));return i}Or("AlphaImage",Bs),Or("RGBAImage",Us);class js extends Si{createBucket(t){return new Ns(t)}constructor(t){super(t,Rs),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Vs({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let Gs;var qs={get paint(){return Gs=Gs||new wi({"hillshade-illumination-direction":new yi(W.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new yi(W.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new yi(W.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new yi(W.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new yi(W.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new yi(W.paint_hillshade["hillshade-accent-color"])})}};class $s extends Si{constructor(t){super(t,qs)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}const Xs=Pi([{name:"a_pos",components:2,type:"Int16"}],4),{members:Zs}=Xs;var Ys={exports:{}};function Ws(t,e,n){n=n||2;var r,i,o,s,a,l,u,c=e&&e.length,h=c?e[0]*n:t.length,p=Hs(t,0,h,n,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(t,e,n,r){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=Hs(t,e[i]*r,i<o-1?e[i+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(aa(s));for(a.sort(ra),i=0;i<a.length;i++)n=ia(a[i],n);return n}(t,e,p,n)),t.length>80*n){r=o=t[0],i=s=t[1];for(var d=n;d<h;d+=n)(a=t[d])<r&&(r=a),(l=t[d+1])<i&&(i=l),a>o&&(o=a),l>s&&(s=l);u=0!==(u=Math.max(o-r,s-i))?32767/u:0}return Js(p,f,n,r,i,u,0),f}function Hs(t,e,n,r,i){var o,s;if(i===xa(t,e,n,r)>0)for(o=e;o<n;o+=r)s=ya(o,t[o],t[o+1],s);else for(o=n-r;o>=e;o-=r)s=ya(o,t[o],t[o+1],s);return s&&ha(s,s.next)&&(_a(s),s=s.next),s}function Ks(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!ha(r,r.next)&&0!==ca(r.prev,r,r.next))r=r.next;else{if(_a(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Js(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=sa(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,s,a,l,u=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e<u&&(a++,r=r.nextZ);e++);for(l=u;a>0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,u*=2}while(s>1)}(i)}(t,r,i,o);for(var a,l,u=t;t.prev!==t.next;)if(a=t.prev,l=t.next,o?ta(t,r,i,o):Qs(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(l.i/n|0),_a(t),t=l.next,u=l.next;else if((t=l)===u){s?1===s?Js(t=ea(Ks(t),e,n),e,n,r,i,o,2):2===s&&na(t,e,n,r,i,o):Js(Ks(t),e,n,r,i,o,1);break}}}function Qs(t){var e=t.prev,n=t,r=t.next;if(ca(e,n,r)>=0)return!1;for(var i=e.x,o=n.x,s=r.x,a=e.y,l=n.y,u=r.y,c=i<o?i<s?i:s:o<s?o:s,h=a<l?a<u?a:u:l<u?l:u,p=i>o?i>s?i:s:o>s?o:s,f=a>l?a>u?a:u:l>u?l:u,d=r.next;d!==e;){if(d.x>=c&&d.x<=p&&d.y>=h&&d.y<=f&&la(i,a,o,l,s,u,d.x,d.y)&&ca(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function ta(t,e,n,r){var i=t.prev,o=t,s=t.next;if(ca(i,o,s)>=0)return!1;for(var a=i.x,l=o.x,u=s.x,c=i.y,h=o.y,p=s.y,f=a<l?a<u?a:u:l<u?l:u,d=c<h?c<p?c:p:h<p?h:p,g=a>l?a>u?a:u:l>u?l:u,m=c>h?c>p?c:p:h>p?h:p,y=sa(f,d,e,n,r),_=sa(g,m,e,n,r),v=t.prevZ,x=t.nextZ;v&&v.z>=y&&x&&x.z<=_;){if(v.x>=f&&v.x<=g&&v.y>=d&&v.y<=m&&v!==i&&v!==s&&la(a,c,l,h,u,p,v.x,v.y)&&ca(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=f&&x.x<=g&&x.y>=d&&x.y<=m&&x!==i&&x!==s&&la(a,c,l,h,u,p,x.x,x.y)&&ca(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=y;){if(v.x>=f&&v.x<=g&&v.y>=d&&v.y<=m&&v!==i&&v!==s&&la(a,c,l,h,u,p,v.x,v.y)&&ca(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=_;){if(x.x>=f&&x.x<=g&&x.y>=d&&x.y<=m&&x!==i&&x!==s&&la(a,c,l,h,u,p,x.x,x.y)&&ca(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function ea(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!ha(i,o)&&pa(i,r,r.next,o)&&ga(i,o)&&ga(o,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),_a(r),_a(r.next),r=t=o),r=r.next}while(r!==t);return Ks(r)}function na(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&ua(s,a)){var l=ma(s,a);return s=Ks(s,s.next),l=Ks(l,l.next),Js(s,e,n,r,i,o,0),void Js(l,e,n,r,i,o,0)}a=a.next}s=s.next}while(s!==t)}function ra(t,e){return t.x-e.x}function ia(t,e){var n=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s&&(s=a,n=r.x<r.next.x?r:r.next,a===i))return n}r=r.next}while(r!==e);if(!n)return null;var l,u=n,c=n.x,h=n.y,p=1/0;r=n;do{i>=r.x&&r.x>=c&&i!==r.x&&la(o<h?i:s,o,c,h,o<h?s:i,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(i-r.x),ga(r,t)&&(l<p||l===p&&(r.x>n.x||r.x===n.x&&oa(n,r)))&&(n=r,p=l)),r=r.next}while(r!==u);return n}(t,e);if(!n)return e;var r=ma(n,t);return Ks(r,r.next),Ks(n,n.next)}function oa(t,e){return ca(t.prev,t,e.prev)<0&&ca(e.next,t,t.next)<0}function sa(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function aa(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function la(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function ua(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&pa(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(ga(t,e)&&ga(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(ca(t.prev,t,e.prev)||ca(t,e.prev,e))||ha(t,e)&&ca(t.prev,t,t.next)>0&&ca(e.prev,e,e.next)>0)}function ca(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ha(t,e){return t.x===e.x&&t.y===e.y}function pa(t,e,n,r){var i=da(ca(t,e,n)),o=da(ca(t,e,r)),s=da(ca(n,r,t)),a=da(ca(n,r,e));return i!==o&&s!==a||!(0!==i||!fa(t,n,e))||!(0!==o||!fa(t,r,e))||!(0!==s||!fa(n,t,r))||!(0!==a||!fa(n,e,r))}function fa(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function da(t){return t>0?1:t<0?-1:0}function ga(t,e){return ca(t.prev,t,t.next)<0?ca(t,e,t.next)>=0&&ca(t,t.prev,e)>=0:ca(t,e,t.prev)<0||ca(t,t.next,e)<0}function ma(t,e){var n=new va(t.i,t.x,t.y),r=new va(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function ya(t,e,n,r){var i=new va(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function _a(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 va(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function xa(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}Ys.exports=Ws,Ys.exports.default=Ws,Ws.deviation=function(t,e,n,r){var i=e&&e.length,o=Math.abs(xa(t,0,i?e[0]*n:t.length,n));if(i)for(var s=0,a=e.length;s<a;s++)o-=Math.abs(xa(t,e[s]*n,s<a-1?e[s+1]*n:t.length,n));var l=0;for(s=0;s<r.length;s+=3){var u=r[s]*n,c=r[s+1]*n,h=r[s+2]*n;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},Ws.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&n.holes.push(r+=t[i-1].length)}return n};var ba=n(Ys.exports);function wa(t,e,n,r,i){Ea(t,e,n||0,r||t.length-1,i||Ia)}function Ea(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=e-n+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);Ea(t,e,Math.max(n,Math.floor(e-s*l/o+u)),Math.min(r,Math.floor(e+(o-s)*l/o+u)),i)}var c=t[e],h=n,p=r;for(Sa(t,n,e),i(t[r],c)>0&&Sa(t,n,r);h<p;){for(Sa(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[n],c)?Sa(t,n,p):Sa(t,++p,r),p<=e&&(n=p+1),e<=p&&(r=p-1)}}function Sa(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Ia(t,e){return t<e?-1:t>e?1:0}function Ca(t,e){const n=t.length;if(n<=1)return[t];const r=[];let i,o;for(let e=0;e<n;e++){const n=I(t[e]);0!==n&&(t[e].area=Math.abs(n),void 0===o&&(o=n<0),o===n<0?(i&&r.push(i),i=[t[e]]):i.push(t[e]))}if(i&&r.push(i),e>1)for(let t=0;t<r.length;t++)r[t].length<=e||(wa(r[t],e,1,r[t].length-1,Ta),r[t]=r[t].slice(0,e));return r}function Ta(t,e){return e.area-t.area}function Pa(t,e,n){const r=n.patternDependencies;let i=!1;for(const n of e){const e=n.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const o=e.constantOr(null);o&&(i=!0,r[o.to]=!0,r[o.from]=!0)}return i}function Ma(t,e,n,r,i){const o=i.patternDependencies;for(const s of e){const e=s.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:r-1},n,{},i.availableImages),a=e.evaluate({zoom:r},n,{},i.availableImages),l=e.evaluate({zoom:r+1},n,{},i.availableImages);t=t&&t.name?t.name:t,a=a&&a.name?a.name:a,l=l&&l.name?l.name:l,o[t]=!0,o[a]=!0,o[l]=!0,n.patterns[s.id]={min:t,mid:a,max:l}}}return n}class La{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new fo,this.indexArray=new So,this.indexArray2=new Io,this.programConfigurations=new Ko(t.layers,t.zoom),this.segments=new Po,this.segments2=new Po,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,n){this.hasPattern=Pa("fill",this.layers,e);const r=this.layers[0].layout.get("fill-sort-key"),i=!r.isConstant(),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=is(s,t);if(!this.layers[0]._featureFilter.filter(new li(this.zoom),c,n))continue;const h=i?r.evaluate(c,{},n,e.availableImages):void 0,p={id:a,properties:s.properties,type:s.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:rs(s),patterns:{},sortKey:h};o.push(p)}i&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of o){const{geometry:i,index:o,sourceLayerIndex:s}=r;if(this.hasPattern){const t=Ma("fill",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,i,o,n,{});e.featureIndex.insert(t[o].feature,i,o,s,this.index)}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)}addFeatures(t,e,n){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Zs),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,n,r,i){for(const t of Ca(e,500)){let e=0;for(const n of t)e+=n.length;const n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),r=n.vertexLength,i=[],o=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&o.push(i.length/2);const n=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),r=n.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(r+e.length-1,r),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(r+t-1,r+t),i.push(e[t].x),i.push(e[t].y);n.vertexLength+=e.length,n.primitiveLength+=e.length}const s=ba(i,o);for(let t=0;t<s.length;t+=3)this.indexArray.emplaceBack(r+s[t],r+s[t+1],r+s[t+2]);n.vertexLength+=e,n.primitiveLength+=s.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,i,r)}}let Aa,ka;Or("FillBucket",La,{omit:["layers","patternFeatures"]});var Na={get paint(){return ka=ka||new wi({"fill-antialias":new yi(W.paint_fill["fill-antialias"]),"fill-opacity":new _i(W.paint_fill["fill-opacity"]),"fill-color":new _i(W.paint_fill["fill-color"]),"fill-outline-color":new _i(W.paint_fill["fill-outline-color"]),"fill-translate":new yi(W.paint_fill["fill-translate"]),"fill-translate-anchor":new yi(W.paint_fill["fill-translate-anchor"]),"fill-pattern":new vi(W.paint_fill["fill-pattern"])})},get layout(){return Aa=Aa||new wi({"fill-sort-key":new _i(W.layout_fill["fill-sort-key"])})}};class Da extends Si{constructor(t){super(t,Na)}recalculate(t,e){super.recalculate(t,e);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new La(t)}queryRadius(){return vs(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,n,r,i,o,s){return us(xs(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,s),r)}isTileClipped(){return!0}}const Ra=Pi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Oa=Pi([{name:"a_centroid",components:2,type:"Int16"}],4),{members:za}=Ra;var Fa={},Ba=r,Ua=Va;function Va(t,e,n,r,i){this.properties={},this.extent=n,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=i,t.readFields(ja,this,e)}function ja(t,e,n){1==t?e.id=n.readVarint():2==t?function(t,e){for(var n=t.readVarint()+t.pos;t.pos<n;){var r=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[r]=i}}(n,e):3==t?e.type=n.readVarint():4==t&&(e._geometry=n.pos)}function Ga(t){for(var e,n,r=0,i=0,o=t.length,s=o-1;i<o;s=i++)r+=((n=t[s]).x-(e=t[i]).x)*(e.y+n.y);return r}Va.types=["Unknown","Point","LineString","Polygon"],Va.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=[];t.pos<n;){if(i<=0){var l=t.readVarint();r=7&l,i=l>>3}if(i--,1===r||2===r)o+=t.readSVarint(),s+=t.readSVarint(),1===r&&(e&&a.push(e),e=[]),e.push(new Ba(o,s));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&a.push(e),a},Va.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,o=0,s=1/0,a=-1/0,l=1/0,u=-1/0;t.pos<e;){if(r<=0){var c=t.readVarint();n=7&c,r=c>>3}if(r--,1===n||2===n)(i+=t.readSVarint())<s&&(s=i),i>a&&(a=i),(o+=t.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==n)throw new Error("unknown command "+n)}return[s,l,a,u]},Va.prototype.toGeoJSON=function(t,e,n){var r,i,o=this.extent*Math.pow(2,n),s=this.extent*t,a=this.extent*e,l=this.loadGeometry(),u=Va.types[this.type];function c(t){for(var e=0;e<t.length;e++){var n=t[e];t[e]=[360*(n.x+s)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(n.y+a)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(r=0;r<l.length;r++)h[r]=l[r][0];c(l=h);break;case 2:for(r=0;r<l.length;r++)c(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var n,r,i=[],o=0;o<e;o++){var s=Ga(t[o]);0!==s&&(void 0===r&&(r=s<0),r===s<0?(n&&i.push(n),n=[t[o]]):n.push(t[o]))}return n&&i.push(n),i}(l),r=0;r<l.length;r++)for(i=0;i<l[r].length;i++)c(l[r][i])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var qa=Ua,$a=Xa;function Xa(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Za,this,e),this.length=this._features.length}function Za(t,e,n){15===t?e.version=n.readVarint():1===t?e.name=n.readString():5===t?e.extent=n.readVarint():2===t?e._features.push(n.pos):3===t?e._keys.push(n.readString()):4===t&&e._values.push(function(t){for(var e=null,n=t.readVarint()+t.pos;t.pos<n;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(n))}Xa.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new qa(this._pbf,e,this.extent,this._keys,this._values)};var Ya=$a;function Wa(t,e,n){if(3===t){var r=new Ya(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}Fa.VectorTile=function(t,e){this.layers=t.readFields(Wa,{},e)},Fa.VectorTileFeature=Ua,Fa.VectorTileLayer=$a;const Ha=Fa.VectorTileFeature.types,Ka=Math.pow(2,13);function Ja(t,e,n,r,i,o,s,a){t.emplaceBack(e,n,2*Math.floor(r*Ka)+s,i*Ka*2,o*Ka*2,Math.round(a))}class Qa{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new go,this.centroidVertexArray=new ho,this.indexArray=new So,this.programConfigurations=new Ko(t.layers,t.zoom),this.segments=new Po,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,n){this.features=[],this.hasPattern=Pa("fill-extrusion",this.layers,e);for(const{feature:r,id:i,index:o,sourceLayerIndex:s}of t){const t=this.layers[0]._featureFilter.needGeometry,a=is(r,t);if(!this.layers[0]._featureFilter.filter(new li(this.zoom),a,n))continue;const l={id:i,sourceLayerIndex:s,index:o,geometry:t?a.geometry:rs(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(Ma("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,o,n,{}),e.featureIndex.insert(r,l.geometry,o,s,this.index,!0)}}addFeatures(t,e,n){for(const t of this.features){const{geometry:r}=t;this.addFeature(t,r,t.index,e,n)}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,za),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Oa.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,n,r,i){const o={x:0,y:0,vertexCount:0};for(const n of Ca(e,500)){let e=0;for(const t of n)e+=t.length;let r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of n){if(0===t.length)continue;if(el(t))continue;let e=0;for(let n=0;n<t.length;n++){const i=t[n];if(n>=1){const s=t[n-1];if(!tl(i,s)){r.vertexLength+4>Po.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=i.sub(s)._perp()._unit(),n=s.dist(i);e+n>32768&&(e=0),Ja(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,0,e),Ja(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,1,e),o.x+=2*i.x,o.y+=2*i.y,o.vertexCount+=2,e+=n,Ja(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,0,e),Ja(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,1,e),o.x+=2*s.x,o.y+=2*s.y,o.vertexCount+=2;const a=r.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),r.vertexLength+=4,r.primitiveLength+=2}}}}if(r.vertexLength+e>Po.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==Ha[t.type])continue;const i=[],s=[],a=r.vertexLength;for(const t of n)if(0!==t.length){t!==n[0]&&s.push(i.length/2);for(let e=0;e<t.length;e++){const n=t[e];Ja(this.layoutVertexArray,n.x,n.y,0,0,1,1,0),o.x+=n.x,o.y+=n.y,o.vertexCount+=1,i.push(n.x),i.push(n.y)}}const l=ba(i,s);for(let t=0;t<l.length;t+=3)this.indexArray.emplaceBack(a+l[t],a+l[t+2],a+l[t+1]);r.primitiveLength+=l.length/3,r.vertexLength+=e}for(let t=0;t<o.vertexCount;t++)this.centroidVertexArray.emplaceBack(Math.floor(o.x/o.vertexCount),Math.floor(o.y/o.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,i,r)}}function tl(t,e){return t.x===e.x&&(t.x<0||t.x>ts)||t.y===e.y&&(t.y<0||t.y>ts)}function el(t){return t.every((t=>t.x<0))||t.every((t=>t.x>ts))||t.every((t=>t.y<0))||t.every((t=>t.y>ts))}let nl;Or("FillExtrusionBucket",Qa,{omit:["layers","features"]});var rl={get paint(){return nl=nl||new wi({"fill-extrusion-opacity":new yi(W["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new _i(W["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new yi(W["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new yi(W["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new vi(W["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new _i(W["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new _i(W["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new yi(W["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class il extends Si{constructor(t){super(t,rl)}createBucket(t){return new Qa(t)}queryRadius(){return vs(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,n,r,i,s,a,l){const u=xs(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,a),c=this.paint.get("fill-extrusion-height").evaluate(e,n),h=this.paint.get("fill-extrusion-base").evaluate(e,n),p=function(t,e,n,r){const i=[];for(const n of t){const t=[n.x,n.y,0,1];Ls(t,t,e),i.push(new o(t[0]/t[3],t[1]/t[3]))}return i}(u,l),f=function(t,e,n,r){const i=[],s=[],a=r[8]*e,l=r[9]*e,u=r[10]*e,c=r[11]*e,h=r[8]*n,p=r[9]*n,f=r[10]*n,d=r[11]*n;for(const e of t){const t=[],n=[];for(const i of e){const e=i.x,s=i.y,g=r[0]*e+r[4]*s+r[12],m=r[1]*e+r[5]*s+r[13],y=r[2]*e+r[6]*s+r[14],_=r[3]*e+r[7]*s+r[15],v=y+u,x=_+c,b=g+h,w=m+p,E=y+f,S=_+d,I=new o((g+a)/x,(m+l)/x);I.z=v/x,t.push(I);const C=new o(b/S,w/S);C.z=E/S,n.push(C)}i.push(t),s.push(n)}return[i,s]}(r,h,c,l);return function(t,e,n){let r=1/0;us(n,e)&&(r=sl(n,e[0]));for(let i=0;i<e.length;i++){const o=e[i],s=t[i];for(let t=0;t<o.length-1;t++){const e=o[t],i=[e,o[t+1],s[t+1],s[t],e];as(n,i)&&(r=Math.min(r,sl(n,i)))}}return r!==1/0&&r}(f[0],f[1],p)}}function ol(t,e){return t.x*e.x+t.y*e.y}function sl(t,e){if(1===t.length){let n=0;const r=e[n++];let i;for(;!i||r.equals(i);)if(i=e[n++],!i)return 1/0;for(;n<e.length;n++){const o=e[n],s=t[0],a=i.sub(r),l=o.sub(r),u=s.sub(r),c=ol(a,a),h=ol(a,l),p=ol(l,l),f=ol(u,a),d=ol(u,l),g=c*p-h*h,m=(p*f-h*d)/g,y=(c*d-h*f)/g,_=r.z*(1-m-y)+i.z*m+o.z*y;if(isFinite(_))return _}return 1/0}{let t=1/0;for(const n of e)t=Math.min(t,n.z);return t}}const al=Pi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ll}=al,ul=Pi([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:cl}=ul,hl=Fa.VectorTileFeature.types,pl=Math.cos(Math.PI/180*37.5),fl=Math.pow(2,14)/.5;class dl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new mo,this.layoutVertexArray2=new yo,this.indexArray=new So,this.programConfigurations=new Ko(t.layers,t.zoom),this.segments=new Po,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,n){this.hasPattern=Pa("line",this.layers,e);const r=this.layers[0].layout.get("line-sort-key"),i=!r.isConstant(),o=[];for(const{feature:e,id:s,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=is(e,t);if(!this.layers[0]._featureFilter.filter(new li(this.zoom),u,n))continue;const c=i?r.evaluate(u,{},n):void 0,h={id:s,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?u.geometry:rs(e),patterns:{},sortKey:c};o.push(h)}i&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of o){const{geometry:i,index:o,sourceLayerIndex:s}=r;if(this.hasPattern){const t=Ma("line",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,i,o,n,{});e.featureIndex.insert(t[o].feature,i,o,s,this.index)}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)}addFeatures(t,e,n){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,cl)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ll),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,n,r,i){const o=this.layers[0].layout,s=o.get("line-join").evaluate(t,{}),a=o.get("line-cap"),l=o.get("line-miter-limit"),u=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const n of e)this.addLine(n,t,s,a,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,i,r)}addLine(t,e,n,r,i,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const s="Polygon"===hl[e.type];let a=t.length;for(;a>=2&&t[a-1].equals(t[a-2]);)a--;let l=0;for(;l<a-1&&t[l].equals(t[l+1]);)l++;if(a<(s?3:2))return;"bevel"===n&&(i=1.05);const u=this.overscaling<=16?15*ts/(512*this.overscaling):0,c=this.segments.prepareSegment(10*a,this.layoutVertexArray,this.indexArray);let h,p,f,d,g;this.e1=this.e2=-1,s&&(h=t[a-2],g=t[l].sub(h)._unit()._perp());for(let e=l;e<a;e++){if(f=e===a-1?s?t[l+1]:void 0:t[e+1],f&&t[e].equals(f))continue;g&&(d=g),h&&(p=h),h=t[e],g=f?f.sub(h)._unit()._perp():d,d=d||g;let m=d.add(g);0===m.x&&0===m.y||m._unit();const y=d.x*g.x+d.y*g.y,_=m.x*g.x+m.y*g.y,v=0!==_?1/_:1/0,x=2*Math.sqrt(2-2*_),b=_<pl&&p&&f,w=d.x*g.y-d.y*g.x>0;if(b&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e}}const E=p&&f;let S=E?n:s?"butt":r;if(E&&"round"===S&&(v<o?S="miter":v<=2&&(S="fakeround")),"miter"===S&&v>i&&(S="bevel"),"bevel"===S&&(v>2&&(S="flipbevel"),v<i&&(S="miter")),p&&this.updateDistance(p,h),"miter"===S)m._mult(v),this.addCurrentVertex(h,m,0,0,c);else if("flipbevel"===S){if(v>100)m=g.mult(-1);else{const t=v*d.add(g).mag()/d.sub(g).mag();m._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c)}else if("bevel"===S||"fakeround"===S){const t=-Math.sqrt(v*v-1),e=w?t:0,n=w?0:t;if(p&&this.addCurrentVertex(h,d,e,n,c),"fakeround"===S){const t=Math.round(180*x/Math.PI/20);for(let e=1;e<t;e++){let n=e/t;if(.5!==n){const t=n-.5;n+=n*t*(n-1)*((1.0904+y*(y*(3.55645-1.43519*y)-3.2452))*t*t+(.848013+y*(.215638*y-1.06021)))}const r=g.sub(d)._mult(n)._add(d)._unit()._mult(w?-1:1);this.addHalfVertex(h,r.x,r.y,!1,w,0,c)}}f&&this.addCurrentVertex(h,g,-e,-n,c)}else if("butt"===S)this.addCurrentVertex(h,m,0,0,c);else if("square"===S){const t=p?1:-1;this.addCurrentVertex(h,m,t,t,c)}else"round"===S&&(p&&(this.addCurrentVertex(h,d,0,0,c),this.addCurrentVertex(h,d,1,1,c,!0)),f&&(this.addCurrentVertex(h,g,-1,-1,c,!0),this.addCurrentVertex(h,g,0,0,c)));if(b&&e<a-1){const t=h.dist(f);if(t>2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,g,0,0,c),h=e}}}}addCurrentVertex(t,e,n,r,i,o=!1){const s=e.y*r-e.x,a=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*n,e.y-e.x*n,o,!1,n,i),this.addHalfVertex(t,s,a,o,!0,-r,i),this.distance>fl/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,n,r,i,o))}addHalfVertex({x:t,y:e},n,r,i,o,s,a){const l=.5*(this.lineClips?this.scaledDistance*(fl-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(o?1:0),Math.round(63*n)+128,Math.round(63*r)+128,1+(0===s?0:s<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),a.primitiveLength++),o?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let gl,ml;Or("LineBucket",dl,{omit:["layers","patternFeatures"]});var yl={get paint(){return ml=ml||new wi({"line-opacity":new _i(W.paint_line["line-opacity"]),"line-color":new _i(W.paint_line["line-color"]),"line-translate":new yi(W.paint_line["line-translate"]),"line-translate-anchor":new yi(W.paint_line["line-translate-anchor"]),"line-width":new _i(W.paint_line["line-width"]),"line-gap-width":new _i(W.paint_line["line-gap-width"]),"line-offset":new _i(W.paint_line["line-offset"]),"line-blur":new _i(W.paint_line["line-blur"]),"line-dasharray":new xi(W.paint_line["line-dasharray"]),"line-pattern":new vi(W.paint_line["line-pattern"]),"line-gradient":new bi(W.paint_line["line-gradient"])})},get layout(){return gl=gl||new wi({"line-cap":new yi(W.layout_line["line-cap"]),"line-join":new _i(W.layout_line["line-join"]),"line-miter-limit":new yi(W.layout_line["line-miter-limit"]),"line-round-limit":new yi(W.layout_line["line-round-limit"]),"line-sort-key":new _i(W.layout_line["line-sort-key"])})}};class _l extends _i{possiblyEvaluate(t,e){return e=new li(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,n,r){return e=y({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,n,r)}}let vl;class xl extends Si{constructor(t){super(t,yl),this.gradientVersion=0,vl||(vl=new _l(yl.paint.properties["line-width"].specification),vl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof je,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=vl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new dl(t)}queryRadius(t){const e=t,n=bl(_s("line-width",this,e),_s("line-gap-width",this,e)),r=_s("line-offset",this,e);return n/2+Math.abs(r)+vs(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,n,r,i,s,a){const l=xs(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,a),u=a/2*bl(this.paint.get("line-width").evaluate(e,n),this.paint.get("line-gap-width").evaluate(e,n)),c=this.paint.get("line-offset").evaluate(e,n);return c&&(r=function(t,e){const n=[];for(let r=0;r<t.length;r++){const i=t[r],s=[];for(let t=0;t<i.length;t++){const n=i[t-1],r=i[t],a=i[t+1],l=0===t?new o(0,0):r.sub(n)._unit()._perp(),u=t===i.length-1?new o(0,0):a.sub(r)._unit()._perp(),c=l._add(u)._unit(),h=c.x*u.x+c.y*u.y;0!==h&&c._mult(1/h),s.push(c._mult(e)._add(r))}n.push(s)}return n}(r,c*a)),function(t,e,n){for(let r=0;r<e.length;r++){const i=e[r];if(t.length>=3)for(let e=0;e<i.length;e++)if(ms(t,i[e]))return!0;if(cs(t,i,n))return!0}return!1}(l,r,u)}isTileClipped(){return!0}}function bl(t,e){return e>0?e+2*t:t}const wl=Pi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),El=Pi([{name:"a_projected_pos",components:3,type:"Float32"}],4);Pi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Sl=Pi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Pi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Il=Pi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Cl=Pi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Tl(t,e,n){return t.sections.forEach((t=>{t.text=function(t,e,n){const r=e.layout.get("text-transform").evaluate(n,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),ai.applyArabicShaping&&(t=ai.applyArabicShaping(t)),t}(t.text,e,n)})),t}Pi([{name:"triangle",components:3,type:"Uint16"}]),Pi([{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"}]),Pi([{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"}]),Pi([{type:"Float32",name:"offsetX"}]),Pi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Pi([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Pl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ml=24,Ll=Nl,Al=function(t,e,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,u=l>>1,c=-7,h=n?i-1:0,p=n?-1:1,f=t[e+h];for(h+=p,o=f&(1<<-c)-1,f>>=-c,c+=a;c>0;o=256*o+t[e+h],h+=p,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+t[e+h],h+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=u}return(f?-1:1)*s*Math.pow(2,o-r)},kl=function(t,e,n,r,i,o){var s,a,l,u=8*o-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,d=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(e*l-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+f]=255&s,f+=d,s/=256,u-=8);t[n+f-d]|=128*g};function Nl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Nl.Varint=0,Nl.Fixed64=1,Nl.Bytes=2,Nl.Fixed32=5;var Dl=4294967296,Rl=1/Dl,Ol="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function zl(t){return t.type===Nl.Bytes?t.readVarint()+t.pos:t.pos+1}function Fl(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Bl(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function Ul(t,e){for(var n=0;n<t.length;n++)e.writeVarint(t[n])}function Vl(t,e){for(var n=0;n<t.length;n++)e.writeSVarint(t[n])}function jl(t,e){for(var n=0;n<t.length;n++)e.writeFloat(t[n])}function Gl(t,e){for(var n=0;n<t.length;n++)e.writeDouble(t[n])}function ql(t,e){for(var n=0;n<t.length;n++)e.writeBoolean(t[n])}function $l(t,e){for(var n=0;n<t.length;n++)e.writeFixed32(t[n])}function Xl(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function Zl(t,e){for(var n=0;n<t.length;n++)e.writeFixed64(t[n])}function Yl(t,e){for(var n=0;n<t.length;n++)e.writeSFixed64(t[n])}function Wl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Hl(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Kl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Nl.prototype={destroy:function(){this.buf=null},readFields:function(t,e,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=7&r,t(i,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Wl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Kl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Wl(this.buf,this.pos)+Wl(this.buf,this.pos+4)*Dl;return this.pos+=8,t},readSFixed64:function(){var t=Wl(this.buf,this.pos)+Kl(this.buf,this.pos+4)*Dl;return this.pos+=8,t},readFloat:function(){var t=Al(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Al(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,r=this.buf;return e=127&(n=r[this.pos++]),n<128?e:(e|=(127&(n=r[this.pos++]))<<7,n<128?e:(e|=(127&(n=r[this.pos++]))<<14,n<128?e:(e|=(127&(n=r[this.pos++]))<<21,n<128?e:function(t,e,n){var r,i,o=n.buf;if(r=(112&(i=o[n.pos++]))>>4,i<128)return Fl(t,r,e);if(r|=(127&(i=o[n.pos++]))<<3,i<128)return Fl(t,r,e);if(r|=(127&(i=o[n.pos++]))<<10,i<128)return Fl(t,r,e);if(r|=(127&(i=o[n.pos++]))<<17,i<128)return Fl(t,r,e);if(r|=(127&(i=o[n.pos++]))<<24,i<128)return Fl(t,r,e);if(r|=(1&(i=o[n.pos++]))<<31,i<128)return Fl(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ol?function(t,e,n){return Ol.decode(t.subarray(e,n))}(this.buf,e,t):function(t,e,n){for(var r="",i=e;i<n;){var o,s,a,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>n)break;1===c?l<128&&(u=l):2===c?128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(s=t[i+2],128==(192&(o=t[i+1]))&&128==(192&s)&&((u=(15&l)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=t[i+2],a=t[i+3],128==(192&(o=t[i+1]))&&128==(192&s)&&128==(192&a)&&((u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),i+=c}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Nl.Bytes)return t.push(this.readVarint(e));var n=zl(this);for(t=t||[];this.pos<n;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Nl.Bytes)return t.push(this.readSVarint());var e=zl(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Nl.Bytes)return t.push(this.readBoolean());var e=zl(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Nl.Bytes)return t.push(this.readFloat());var e=zl(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Nl.Bytes)return t.push(this.readDouble());var e=zl(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Nl.Bytes)return t.push(this.readFixed32());var e=zl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Nl.Bytes)return t.push(this.readSFixed32());var e=zl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Nl.Bytes)return t.push(this.readFixed64());var e=zl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Nl.Bytes)return t.push(this.readSFixed64());var e=zl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Nl.Varint)for(;this.buf[this.pos++]>127;);else if(e===Nl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Nl.Fixed32)this.pos+=4;else{if(e!==Nl.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Hl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Hl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Hl(this.buf,-1&t,this.pos),Hl(this.buf,Math.floor(t*Rl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Hl(this.buf,-1&t,this.pos),Hl(this.buf,Math.floor(t*Rl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var n,r;if(t>=0?(n=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,n.buf[n.pos]=127&(t>>>=7)}(n,0,e),function(t,e){var n=(7&t)<<4;e.buf[e.pos++]|=n|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,n){for(var r,i,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){r>56319||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):i=r;continue}if(r<56320){t[n++]=239,t[n++]=191,t[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[n++]=239,t[n++]=191,t[n++]=189,i=null);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:(r<65536?t[n++]=r>>12|224:(t[n++]=r>>18|240,t[n++]=r>>12&63|128),t[n++]=r>>6&63|128),t[n++]=63&r|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;n>=128&&Bl(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),kl(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),kl(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n<e;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var r=this.pos-n;r>=128&&Bl(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,Nl.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Ul,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Vl,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,ql,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,jl,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Gl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,$l,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Xl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Zl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Yl,e)},writeBytesField:function(t,e){this.writeTag(t,Nl.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Nl.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Nl.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Nl.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Nl.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Nl.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Nl.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Nl.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Nl.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Nl.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Jl=n(Ll);const Ql=3;function tu(t,e,n){1===t&&n.readMessage(eu,e)}function eu(t,e,n){if(3===t){const{id:t,bitmap:r,width:i,height:o,left:s,top:a,advance:l}=n.readMessage(nu,{});e.push({id:t,bitmap:new Bs({width:i+2*Ql,height:o+2*Ql},r),metrics:{width:i,height:o,left:s,top:a,advance:l}})}}function nu(t,e,n){1===t?e.id=n.readVarint():2===t?e.bitmap=n.readBytes():3===t?e.width=n.readVarint():4===t?e.height=n.readVarint():5===t?e.left=n.readSVarint():6===t?e.top=n.readSVarint():7===t&&(e.advance=n.readVarint())}const ru=Ql;function iu(t){let e=0,n=0;for(const r of t)e+=r.w*r.h,n=Math.max(n,r.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}];let i=0,o=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const n=r[t];if(!(e.w>n.w||e.h>n.h)){if(e.x=n.x,e.y=n.y,o=Math.max(o,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===n.w&&e.h===n.h){const e=r.pop();t<r.length&&(r[t]=e)}else e.h===n.h?(n.x+=e.w,n.w-=e.w):e.w===n.w?(n.y+=e.h,n.h-=e.h):(r.push({x:n.x+e.w,y:n.y,w:n.w-e.w,h:e.h}),n.y+=e.h,n.h-=e.h);break}}return{w:i,h:o,fill:e/(i*o)||0}}const ou=1;class su{constructor(t,{pixelRatio:e,version:n,stretchX:r,stretchY:i,content:o}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=r,this.stretchY=i,this.content=o,this.version=n}get tl(){return[this.paddedRect.x+ou,this.paddedRect.y+ou]}get br(){return[this.paddedRect.x+this.paddedRect.w-ou,this.paddedRect.y+this.paddedRect.h-ou]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*ou)/this.pixelRatio,(this.paddedRect.h-2*ou)/this.pixelRatio]}}class au{constructor(t,e){const n={},r={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,n,i),this.addImages(e,r,i);const{w:o,h:s}=iu(i),a=new Us({width:o||1,height:s||1});for(const e in t){const r=t[e],i=n[e].paddedRect;Us.copy(r.data,a,{x:0,y:0},{x:i.x+ou,y:i.y+ou},r.data)}for(const t in e){const n=e[t],i=r[t].paddedRect,o=i.x+ou,s=i.y+ou,l=n.data.width,u=n.data.height;Us.copy(n.data,a,{x:0,y:0},{x:o,y:s},n.data),Us.copy(n.data,a,{x:0,y:u-1},{x:o,y:s-1},{width:l,height:1}),Us.copy(n.data,a,{x:0,y:0},{x:o,y:s+u},{width:l,height:1}),Us.copy(n.data,a,{x:l-1,y:0},{x:o-1,y:s},{width:1,height:u}),Us.copy(n.data,a,{x:0,y:0},{x:o+l,y:s},{width:1,height:u})}this.image=a,this.iconPositions=n,this.patternPositions=r}addImages(t,e,n){for(const r in t){const i=t[r],o={x:0,y:0,w:i.data.width+2*ou,h:i.data.height+2*ou};n.push(o),e[r]=new su(o,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in t.updatedImages)this.patchUpdatedImage(this.iconPositions[n],t.getImage(n),e),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n),e)}patchUpdatedImage(t,e,n){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[r,i]=t.tl;n.update(e.data,void 0,{x:r,y:i})}}var lu;Or("ImagePosition",su),Or("ImageAtlas",au),t.ai=void 0,(lu=t.ai||(t.ai={}))[lu.none=0]="none",lu[lu.horizontal=1]="horizontal",lu[lu.vertical=2]="vertical",lu[lu.horizontalOnly=3]="horizontalOnly";const uu=-17;class cu{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const n=new cu;return n.scale=t||1,n.fontStack=e,n}static forImage(t){const e=new cu;return e.imageName=t,e}}class hu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const n=new hu;for(let r=0;r<t.sections.length;r++){const i=t.sections[r];i.image?n.addImageSection(i):n.addTextSection(i,e)}return n}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let n=0;n<t.length;n++){const r=t.charCodeAt(n+1)||null,i=t.charCodeAt(n-1)||null;e+=r&&Xr(r)&&!Pl[t[n+1]]||i&&Xr(i)&&!Pl[t[n-1]]||!Pl[t[n]]?t[n]:Pl[t[n]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&fu[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let n=this.text.length-1;n>=0&&n>=t&&fu[this.text.charCodeAt(n)];n--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const n=new hu;return n.text=this.text.substring(t,e),n.sectionIndex=this.sectionIndex.slice(t,e),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(cu.forText(t.scale,t.fontStack||e));const n=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(n)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void E("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(cu.forImage(e)),this.sectionIndex.push(this.sections.length-1)):E("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function pu(e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m){const y=hu.fromFeature(e,o);let _;p===t.ai.vertical&&y.verticalizePunctuation();const{processBidirectionalText:v,processStyledBidirectionalText:x}=ai;if(v&&1===y.sections.length){_=[];const t=v(y.toString(),xu(y,c,s,n,i,d,g));for(const e of t){const t=new hu;t.text=e,t.sections=y.sections;for(let n=0;n<e.length;n++)t.sectionIndex.push(0);_.push(t)}}else if(x){_=[];const t=x(y.text,y.sectionIndex,xu(y,c,s,n,i,d,g));for(const e of t){const t=new hu;t.text=e[0],t.sectionIndex=e[1],t.sections=y.sections,_.push(t)}}else _=function(t,e){const n=[],r=t.text;let i=0;for(const r of e)n.push(t.substring(i,r)),i=r;return i<r.length&&n.push(t.substring(i,r.length)),n}(y,xu(y,c,s,n,i,d,g));const b=[],w={positionedLines:b,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(e,n,r,i,o,s,a,l,u,c,h,p){let f=0,d=uu,g=0,m=0;const y="right"===l?1:"left"===l?0:.5;let _=0;for(const a of o){a.trim();const o=a.getMaxScale(),l=(o-1)*Ml,x={positionedGlyphs:[],lineOffset:0};e.positionedLines[_]=x;const b=x.positionedGlyphs;let w=0;if(!a.length()){d+=s,++_;continue}for(let s=0;s<a.length();s++){const g=a.getSection(s),m=a.getSectionIndex(s),y=a.getCharCode(s);let _=0,x=null,E=null,S=null,I=Ml;const C=!(u===t.ai.horizontal||!h&&!$r(y)||h&&(fu[y]||(v=y,Vr.Arabic(v)||Vr["Arabic Supplement"](v)||Vr["Arabic Extended-A"](v)||Vr["Arabic Presentation Forms-A"](v)||Vr["Arabic Presentation Forms-B"](v))));if(g.imageName){const t=i[g.imageName];if(!t)continue;S=g.imageName,e.iconsInText=e.iconsInText||!0,E=t.paddedRect;const n=t.displaySize;g.scale=g.scale*Ml/p,x={width:n[0],height:n[1],left:ou,top:-ru,advance:C?n[1]:n[0]},_=l+(Ml-n[1]*g.scale),I=x.advance;const r=C?n[0]*g.scale-Ml*o:n[1]*g.scale-Ml*o;r>0&&r>w&&(w=r)}else{const t=r[g.fontStack],e=t&&t[y];if(e&&e.rect)E=e.rect,x=e.metrics;else{const t=n[g.fontStack],e=t&&t[y];if(!e)continue;x=e.metrics}_=(o-g.scale)*Ml}C?(e.verticalizable=!0,b.push({glyph:y,imageName:S,x:f,y:d+_,vertical:C,scale:g.scale,fontStack:g.fontStack,sectionIndex:m,metrics:x,rect:E}),f+=I*g.scale+c):(b.push({glyph:y,imageName:S,x:f,y:d+_,vertical:C,scale:g.scale,fontStack:g.fontStack,sectionIndex:m,metrics:x,rect:E}),f+=x.advance*g.scale+c)}0!==b.length&&(g=Math.max(f-c,g),wu(b,0,b.length-1,y,w)),f=0;const E=s*o+w;x.lineOffset=Math.max(w,l),d+=E,m=Math.max(E,m),++_}var v;const x=d-uu,{horizontalAlign:b,verticalAlign:w}=bu(a);(function(t,e,n,r,i,o,s,a,l){const u=(e-n)*i;let c=0;c=o!==s?-a*r-uu:(-r*l+.5)*s;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c})(e.positionedLines,y,b,w,g,m,s,x,o.length),e.top+=-w*x,e.bottom=e.top+x,e.left+=-b*g,e.right=e.left+g}(w,n,r,i,_,a,l,u,p,c,f,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const fu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},du={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 gu(t,e,n,r,i,o){if(e.imageName){const t=r[e.imageName];return t?t.displaySize[0]*e.scale*Ml/o+i:0}{const r=n[e.fontStack],o=r&&r[t];return o?o.metrics.advance*e.scale+i:0}}function mu(t,e,n,r){const i=Math.pow(t-e,2);return r?t<e?i/2:2*i:i+Math.abs(n)*n}function yu(t,e,n){let r=0;return 10===t&&(r-=1e4),n&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function _u(t,e,n,r,i,o){let s=null,a=mu(e,n,i,o);for(const t of r){const r=mu(e-t.x,n,i,o)+t.badness;r<=a&&(s=t,a=r)}return{index:t,x:e,priorBreak:s,badness:a}}function vu(t){return t?vu(t.priorBreak).concat(t.index):[]}function xu(t,e,n,r,i,o,s){if("point"!==o)return[];if(!t)return[];const a=[],l=function(t,e,n,r,i,o){let s=0;for(let n=0;n<t.length();n++){const a=t.getSection(n);s+=gu(t.getCharCode(n),a,r,i,e,o)}return s/Math.max(1,Math.ceil(s/n))}(t,e,n,r,i,s),u=t.text.indexOf("​")>=0;let c=0;for(let n=0;n<t.length();n++){const o=t.getSection(n),p=t.getCharCode(n);if(fu[p]||(c+=gu(p,o,r,i,e,s)),n<t.length()-1){const e=!((h=p)<11904||!(Vr["Bopomofo Extended"](h)||Vr.Bopomofo(h)||Vr["CJK Compatibility Forms"](h)||Vr["CJK Compatibility Ideographs"](h)||Vr["CJK Compatibility"](h)||Vr["CJK Radicals Supplement"](h)||Vr["CJK Strokes"](h)||Vr["CJK Symbols and Punctuation"](h)||Vr["CJK Unified Ideographs Extension A"](h)||Vr["CJK Unified Ideographs"](h)||Vr["Enclosed CJK Letters and Months"](h)||Vr["Halfwidth and Fullwidth Forms"](h)||Vr.Hiragana(h)||Vr["Ideographic Description Characters"](h)||Vr["Kangxi Radicals"](h)||Vr["Katakana Phonetic Extensions"](h)||Vr.Katakana(h)||Vr["Vertical Forms"](h)||Vr["Yi Radicals"](h)||Vr["Yi Syllables"](h)));(du[p]||e||o.imageName)&&a.push(_u(n+1,c,l,a,yu(p,t.getCharCode(n+1),e&&u),!1))}}var h;return vu(_u(t.length(),c,l,a,0,!0))}function bu(t){let e=.5,n=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:e,verticalAlign:n}}function wu(t,e,n,r,i){if(!r&&!i)return;const o=t[n],s=(t[n].x+o.metrics.advance*o.scale)*r;for(let r=e;r<=n;r++)t[r].x-=s,t[r].y+=i}function Eu(t,e,n){const{horizontalAlign:r,verticalAlign:i}=bu(n),o=e[0]-t.displaySize[0]*r,s=e[1]-t.displaySize[1]*i;return{image:t,top:s,bottom:s+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function Su(t,e,n,r,i,o){const s=t.image;let a;if(s.content){const t=s.content,e=s.pixelRatio||1;a=[t[0]/e,t[1]/e,s.displaySize[0]-t[2]/e,s.displaySize[1]-t[3]/e]}const l=e.left*o,u=e.right*o;let c,h,p,f;"width"===n||"both"===n?(f=i[0]+l-r[3],h=i[0]+u+r[1]):(f=i[0]+(l+u-s.displaySize[0])/2,h=f+s.displaySize[0]);const d=e.top*o,g=e.bottom*o;return"height"===n||"both"===n?(c=i[1]+d-r[0],p=i[1]+g+r[2]):(c=i[1]+(d+g-s.displaySize[1])/2,p=c+s.displaySize[1]),{image:s,top:c,right:h,bottom:p,left:f,collisionPadding:a}}const Iu=255,Cu=128,Tu=Iu*Cu;function Pu(t,e){const{expression:n}=e;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new li(t+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:r}=n;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let o=i;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const s=e[i],a=e[o];return"composite"===n.kind?{kind:"composite",minZoom:s,maxZoom:a,interpolationType:r}:{kind:"camera",minZoom:s,maxZoom:a,minSize:n.evaluate(new li(s)),maxSize:n.evaluate(new li(a)),interpolationType:r}}}function Mu(t,e,n){let r="never";const i=t.get(e);return i?r=i:t.get(n)&&(r="always"),r}const Lu=Fa.VectorTileFeature.types,Au=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ku(t,e,n,r,i,o,s,a,l,u,c,h,p){const f=a?Math.min(Tu,Math.round(a[0])):0,d=a?Math.min(Tu,Math.round(a[1])):0;t.emplaceBack(e,n,Math.round(32*r),Math.round(32*i),o,s,(f<<1)+(l?1:0),d,16*u,16*c,256*h,256*p)}function Nu(t,e,n){t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n)}function Du(t){for(const e of t.sections)if(Wr(e.text))return!0;return!1}class Ru{constructor(t){this.layoutVertexArray=new vo,this.indexArray=new So,this.programConfigurations=t,this.segments=new Po,this.dynamicLayoutVertexArray=new xo,this.opacityVertexArray=new bo,this.hasVisibleVertices=!1,this.placedSymbolArray=new no}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wl.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,El.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Au,!0),this.opacityVertexBuffer.itemSize=1),(n||r)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Or("SymbolBuffers",Ru);class Ou{constructor(t,e,n){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new n,this.segments=new Po,this.collisionVertexArray=new Eo}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Sl.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Or("CollisionBuffers",Ou);class zu{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Cs([]),this.placementViewportMatrix=Cs([]);const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Pu(this.zoom,n["text-size"]),this.iconSizeData=Pu(this.zoom,n["icon-size"]);const r=this.layers[0].layout,i=r.get("symbol-sort-key"),o=r.get("symbol-z-order");this.canOverlap="never"!==Mu(r,"text-overlap","text-allow-overlap")||"never"!==Mu(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!i.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((e=>t.ai[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Ru(new Ko(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Ru(new Ko(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new oo,this.lineVertexArray=new so,this.symbolInstances=new io,this.textAnchorOffsets=new lo}calculateGlyphDependencies(t,e,n,r,i){for(let o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(n||r)&&i){const n=Pl[t.charAt(o)];n&&(e[n.charCodeAt(0)]=!0)}}populate(e,n,r){const i=this.layers[0],o=i.layout,s=o.get("text-font"),a=o.get("text-field"),l=o.get("icon-image"),u=("constant"!==a.value.kind||a.value.value instanceof Qt&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;const p=n.iconDependencies,f=n.glyphDependencies,d=n.availableImages,g=new li(this.zoom);for(const{feature:n,id:a,index:l,sourceLayerIndex:m}of e){const e=i._featureFilter.needGeometry,y=is(n,e);if(!i._featureFilter.filter(g,y,r))continue;let _,v;if(e||(y.geometry=rs(n)),u){const t=i.getValueAndResolveTokens("text-field",y,r,d),e=Qt.factory(t);Du(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===oi()||this.hasRTLText&&ai.isParsed())&&(_=Tl(e,i,y))}if(c){const t=i.getValueAndResolveTokens("icon-image",y,r,d);v=t instanceof re?t:re.fromString(t)}if(!_&&!v)continue;const x=this.sortFeaturesByKey?h.evaluate(y,{},r):void 0;if(this.features.push({id:a,text:_,icon:v,index:l,sourceLayerIndex:m,geometry:y.geometry,properties:n.properties,type:Lu[n.type],sortKey:x}),v&&(p[v.name]=!0),_){const e=s.evaluate(y,{},r).join(","),n="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.ai.vertical)>=0;for(const t of _.sections)if(t.image)p[t.image.name]=!0;else{const r=jr(_.toString()),i=t.fontStack||e,o=f[i]=f[i]||{};this.calculateGlyphDependencies(t.text,o,n,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},n={},r=[];let i=0;function o(e){r.push(t[e]),i++}function s(t,e,i){const o=n[t];return delete n[t],n[e]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(i[0]),o}function a(t,n,i){const o=e[n];return delete e[n],e[t]=o,r[o].geometry[0].shift(),r[o].geometry[0]=i[0].concat(r[o].geometry[0]),o}function l(t,e,n){const r=n?e[0][e[0].length-1]:e[0][0];return`${t}:${r.x}:${r.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){o(u);continue}const f=l(p,h),d=l(p,h,!0);if(f in n&&d in e&&n[f]!==e[d]){const t=a(f,d,h),i=s(f,d,r[t].geometry);delete e[f],delete n[d],n[l(p,r[i].geometry,!0)]=i,r[t].geometry=null}else f in n?s(f,d,h):d in e?a(f,d,h):(o(u),e[f]=i-1,n[d]=i-1)}return r.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,n),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,n))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const n=this.lineVertexArray.length;if(void 0!==t.segment){let n=t.dist(e[t.segment+1]),r=t.dist(e[t.segment]);const i={};for(let r=t.segment+1;r<e.length;r++)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r<e.length-1&&(n+=e[r+1].dist(e[r]));for(let n=t.segment||0;n>=0;n--)i[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:r},n>0&&(r+=e[n-1].dist(e[n]));for(let t=0;t<e.length;t++){const e=i[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,n,r,i,o,s,a,l,u,c,h,p){const f=e.indexArray,d=e.layoutVertexArray,g=e.segments.prepareSegment(4*n.length,d,f,this.canOverlap?s.sortKey:void 0),m=this.glyphOffsetArray.length,y=g.vertexLength,_=this.allowVerticalPlacement&&a===t.ai.vertical?Math.PI/2:0,v=s.text&&s.text.sections;for(let t=0;t<n.length;t++){const{tl:i,tr:o,bl:a,br:u,tex:c,pixelOffsetTL:h,pixelOffsetBR:m,minFontScaleX:y,minFontScaleY:x,glyphOffset:b,isSDF:w,sectionIndex:E}=n[t],S=g.vertexLength,I=b[1];ku(d,l.x,l.y,i.x,I+i.y,c.x,c.y,r,w,h.x,h.y,y,x),ku(d,l.x,l.y,o.x,I+o.y,c.x+c.w,c.y,r,w,m.x,h.y,y,x),ku(d,l.x,l.y,a.x,I+a.y,c.x,c.y+c.h,r,w,h.x,m.y,y,x),ku(d,l.x,l.y,u.x,I+u.y,c.x+c.w,c.y+c.h,r,w,m.x,m.y,y,x),Nu(e.dynamicLayoutVertexArray,l,_),f.emplaceBack(S,S+1,S+2),f.emplaceBack(S+1,S+2,S+3),g.vertexLength+=4,g.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),t!==n.length-1&&E===n[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(d.length,s,s.index,{},p,v&&v[E])}e.placedSymbolArray.emplaceBack(l.x,l.y,m,this.glyphOffsetArray.length-m,y,u,c,l.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],a,0,!1,0,h)}_addCollisionDebugVertex(t,e,n,r,i,o){return e.emplaceBack(0,0),t.emplaceBack(n.x,n.y,r,i,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,n,r,i,s,a){const l=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),u=l.vertexLength,c=i.layoutVertexArray,h=i.collisionVertexArray,p=a.anchorX,f=a.anchorY;this._addCollisionDebugVertex(c,h,s,p,f,new o(t,e)),this._addCollisionDebugVertex(c,h,s,p,f,new o(n,e)),this._addCollisionDebugVertex(c,h,s,p,f,new o(n,r)),this._addCollisionDebugVertex(c,h,s,p,f,new o(t,r)),l.vertexLength+=4;const d=i.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,n,r){for(let i=t;i<e;i++){const t=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,r?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ou(wo,Il.members,Io),this.iconCollisionBox=new Ou(wo,Il.members,Io);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,n,r,i,o,s,a,l){const u={};for(let r=e;r<n;r++){const e=t.get(r);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},u.textFeatureIndex=e.featureIndex;break}for(let e=r;e<i;e++){const n=t.get(e);u.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},u.verticalTextFeatureIndex=n.featureIndex;break}for(let e=o;e<s;e++){const n=t.get(e);u.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},u.iconFeatureIndex=n.featureIndex;break}for(let e=a;e<l;e++){const n=t.get(e);u.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},u.verticalIconFeatureIndex=n.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const n=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const n=t.placedSymbolArray.get(e),r=n.vertexStartIndex+4*n.numGlyphs;for(let e=n.vertexStartIndex;e<r;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),n=Math.cos(t),r=[],i=[],o=[];for(let t=0;t<this.symbolInstances.length;++t){o.push(t);const s=this.symbolInstances.get(t);r.push(0|Math.round(e*s.anchorX+n*s.anchorY)),i.push(s.featureIndex)}return o.sort(((t,e)=>r[t]-r[e]||i[e]-i[t])),o}addToSortKeyRanges(t,e){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===e?n.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,n)=>{t>=0&&n.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Fu,Bu;Or("SymbolBucket",zu,{omit:["layers","collisionBoxArray","features","compareText"]}),zu.MAX_GLYPHS=65535,zu.addDynamicAttributes=Nu;var Uu={get paint(){return Bu=Bu||new wi({"icon-opacity":new _i(W.paint_symbol["icon-opacity"]),"icon-color":new _i(W.paint_symbol["icon-color"]),"icon-halo-color":new _i(W.paint_symbol["icon-halo-color"]),"icon-halo-width":new _i(W.paint_symbol["icon-halo-width"]),"icon-halo-blur":new _i(W.paint_symbol["icon-halo-blur"]),"icon-translate":new yi(W.paint_symbol["icon-translate"]),"icon-translate-anchor":new yi(W.paint_symbol["icon-translate-anchor"]),"text-opacity":new _i(W.paint_symbol["text-opacity"]),"text-color":new _i(W.paint_symbol["text-color"],{runtimeType:gt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new _i(W.paint_symbol["text-halo-color"]),"text-halo-width":new _i(W.paint_symbol["text-halo-width"]),"text-halo-blur":new _i(W.paint_symbol["text-halo-blur"]),"text-translate":new yi(W.paint_symbol["text-translate"]),"text-translate-anchor":new yi(W.paint_symbol["text-translate-anchor"])})},get layout(){return Fu=Fu||new wi({"symbol-placement":new yi(W.layout_symbol["symbol-placement"]),"symbol-spacing":new yi(W.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new yi(W.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new _i(W.layout_symbol["symbol-sort-key"]),"symbol-z-order":new yi(W.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new yi(W.layout_symbol["icon-allow-overlap"]),"icon-overlap":new yi(W.layout_symbol["icon-overlap"]),"icon-ignore-placement":new yi(W.layout_symbol["icon-ignore-placement"]),"icon-optional":new yi(W.layout_symbol["icon-optional"]),"icon-rotation-alignment":new yi(W.layout_symbol["icon-rotation-alignment"]),"icon-size":new _i(W.layout_symbol["icon-size"]),"icon-text-fit":new yi(W.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new yi(W.layout_symbol["icon-text-fit-padding"]),"icon-image":new _i(W.layout_symbol["icon-image"]),"icon-rotate":new _i(W.layout_symbol["icon-rotate"]),"icon-padding":new _i(W.layout_symbol["icon-padding"]),"icon-keep-upright":new yi(W.layout_symbol["icon-keep-upright"]),"icon-offset":new _i(W.layout_symbol["icon-offset"]),"icon-anchor":new _i(W.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new yi(W.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new yi(W.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new yi(W.layout_symbol["text-rotation-alignment"]),"text-field":new _i(W.layout_symbol["text-field"]),"text-font":new _i(W.layout_symbol["text-font"]),"text-size":new _i(W.layout_symbol["text-size"]),"text-max-width":new _i(W.layout_symbol["text-max-width"]),"text-line-height":new yi(W.layout_symbol["text-line-height"]),"text-letter-spacing":new _i(W.layout_symbol["text-letter-spacing"]),"text-justify":new _i(W.layout_symbol["text-justify"]),"text-radial-offset":new _i(W.layout_symbol["text-radial-offset"]),"text-variable-anchor":new yi(W.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new _i(W.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new _i(W.layout_symbol["text-anchor"]),"text-max-angle":new yi(W.layout_symbol["text-max-angle"]),"text-writing-mode":new yi(W.layout_symbol["text-writing-mode"]),"text-rotate":new _i(W.layout_symbol["text-rotate"]),"text-padding":new yi(W.layout_symbol["text-padding"]),"text-keep-upright":new yi(W.layout_symbol["text-keep-upright"]),"text-transform":new _i(W.layout_symbol["text-transform"]),"text-offset":new _i(W.layout_symbol["text-offset"]),"text-allow-overlap":new yi(W.layout_symbol["text-allow-overlap"]),"text-overlap":new yi(W.layout_symbol["text-overlap"]),"text-ignore-placement":new yi(W.layout_symbol["text-ignore-placement"]),"text-optional":new yi(W.layout_symbol["text-optional"])})}};class Vu{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:ht,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Or("FormatSectionOverride",Vu,{omit:["defaultValue"]});class ju extends Si{constructor(t){super(t,Uu)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const n of t)e.indexOf(n)<0&&e.push(n);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,n,r){const i=this.layout.get(t).evaluate(e,{},n,r),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||On(o.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,n)=>t&&n in t?String(t[n]):""))}(e.properties,i)}createBucket(t){return new zu(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Uu.paint.overridableProperties){if(!ju.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),n=new Vu(e),r=new Rn(n,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new Fn("source",r):new Bn("composite",r,e.value.zoomStops),this.paint._values[t]=new gi(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,n){return!(!this.layout||e.isDataDriven()||n.isDataDriven())&&ju.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const n=t.get("text-field"),r=Uu.paint.properties[e];let i=!1;const o=t=>{for(const e of t)if(r.overrides&&r.overrides.hasOverride(e))return void(i=!0)};if("constant"===n.value.kind&&n.value.value instanceof Qt)o(n.value.value.sections);else if("source"===n.value.kind){const t=e=>{i||(e instanceof le&&se(e.value)===vt?o(e.value.sections):e instanceof fn?o(e.sections):e.eachChild(t))},e=n.value;e._styleExpression&&t(e._styleExpression.expression)}return i}}let Gu;var qu={get paint(){return Gu=Gu||new wi({"background-color":new yi(W.paint_background["background-color"]),"background-pattern":new xi(W.paint_background["background-pattern"]),"background-opacity":new yi(W.paint_background["background-opacity"])})}};class $u extends Si{constructor(t){super(t,qu)}}let Xu;var Zu={get paint(){return Xu=Xu||new wi({"raster-opacity":new yi(W.paint_raster["raster-opacity"]),"raster-hue-rotate":new yi(W.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new yi(W.paint_raster["raster-brightness-min"]),"raster-brightness-max":new yi(W.paint_raster["raster-brightness-max"]),"raster-saturation":new yi(W.paint_raster["raster-saturation"]),"raster-contrast":new yi(W.paint_raster["raster-contrast"]),"raster-resampling":new yi(W.paint_raster["raster-resampling"]),"raster-fade-duration":new yi(W.paint_raster["raster-fade-duration"])})}};class Yu extends Si{constructor(t){super(t,Zu)}}class Wu extends Si{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Hu{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(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=()=>{}}}const Ku=6371008.8;class Ju{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ju(m(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,n=this.lat*e,r=t.lat*e,i=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return Ku*Math.acos(Math.min(i,1))}static convert(t){if(t instanceof Ju)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Ju(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Ju(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Qu=2*Math.PI*Ku;function tc(t){return Qu*Math.cos(t*Math.PI/180)}function ec(t){return(180+t)/360}function nc(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function rc(t,e){return t/tc(e)}function ic(t){return 360*t-180}function oc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class sc{constructor(t,e,n=0){this.x=+t,this.y=+e,this.z=+n}static fromLngLat(t,e=0){const n=Ju.convert(t);return new sc(ec(n.lng),nc(n.lat),rc(e,n.lat))}toLngLat(){return new Ju(ic(this.x),oc(this.y))}toAltitude(){return this.z*tc(oc(this.y))}meterInMercatorCoordinateUnits(){return 1/Qu*(t=oc(this.y),1/Math.cos(t*Math.PI/180));var t}}function ac(t,e,n){var r=2*Math.PI*6378137/256/Math.pow(2,n);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}class lc{constructor(t,e,n){if(t<0||t>25||n<0||n>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${n}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=n,this.key=hc(0,t,t,e,n)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,n){const r=(o=this.y,s=this.z,a=ac(256*(i=this.x),256*(o=Math.pow(2,s)-o-1),s),l=ac(256*(i+1),256*(o+1),s),a[0]+","+a[1]+","+l[0]+","+l[1]);var i,o,s,a,l;const u=function(t,e,n){let r,i="";for(let o=t;o>0;o--)r=1<<o-1,i+=(e&r?1:0)+(n&r?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===n?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new o((t.x*e-this.x)*ts,(t.y*e-this.y)*ts)}toString(){return`${this.z}/${this.x}/${this.y}`}}class uc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=hc(t,e.z,e.z,e.x,e.y)}}class cc{constructor(t,e,n,r,i){if(t<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${n}`);this.overscaledZ=t,this.wrap=e,this.canonical=new lc(n,+r,+i),this.key=hc(e,t,n,r,i)}clone(){return new cc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new cc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new cc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-t;return t>this.canonical.z?hc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):hc(this.wrap*+e,t,t,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new cc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,n=2*this.canonical.x,r=2*this.canonical.y;return[new cc(e,this.wrap,e,n,r),new cc(e,this.wrap,e,n+1,r),new cc(e,this.wrap,e,n,r+1),new cc(e,this.wrap,e,n+1,r+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new cc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new cc(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new uc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new sc(t.x-this.wrap,t.y))}}function hc(t,e,n,r,i){(t*=2)<0&&(t=-1*t-1);const o=1<<n;return(o*o*t+o*i+r).toString(36)+n.toString(36)+e.toString(36)}Or("CanonicalTileID",lc),Or("OverscaledTileID",cc,{omit:["posMatrix"]});class pc{constructor(t,e,n,r=1,i=1,o=1,s=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n))return void E(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const a=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=i,this.blueFactor=o,this.baseShift=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<a;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(a,t)]=this.data[this._idx(a-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,a)]=this.data[this._idx(t,a-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(a,-1)]=this.data[this._idx(a-1,0)],this.data[this._idx(-1,a)]=this.data[this._idx(0,a-1)],this.data[this._idx(a,a)]=this.data[this._idx(a-1,a-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<a;t++)for(let e=0;e<a;e++){const n=this.get(t,e);n>this.max&&(this.max=n),n<this.min&&(this.min=n)}}get(t,e){const n=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return this.unpack(n[r],n[r+1],n[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}unpack(t,e,n){return t*this.redFactor+e*this.greenFactor+n*this.blueFactor-this.baseShift}getPixels(){return new Us({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let r=e*this.dim,i=e*this.dim+this.dim,o=n*this.dim,s=n*this.dim+this.dim;switch(e){case-1:r=i-1;break;case 1:i=r+1}switch(n){case-1:o=s-1;break;case 1:s=o+1}const a=-e*this.dim,l=-n*this.dim;for(let e=o;e<s;e++)for(let n=r;n<i;n++)this.data[this._idx(n,e)]=t.data[this._idx(n+a,e+l)]}}Or("DEMData",pc);class fc{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const n=t[e];this._stringToNumber[n]=e,this._numberToString[e]=n}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class dc{constructor(t,e,n,r,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=n,t._y=r,this.properties=t.properties,this.id=i}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class gc{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Dr(ts,16,0),this.grid3D=new Dr(ts,16,0),this.featureIndexArray=new co,this.promoteId=e}insert(t,e,n,r,i,o){const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,i);const a=o?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const n=e[t],r=[1/0,1/0,-1/0,-1/0];for(let t=0;t<n.length;t++){const e=n[t];r[0]=Math.min(r[0],e.x),r[1]=Math.min(r[1],e.y),r[2]=Math.max(r[2],e.x),r[3]=Math.max(r[3],e.y)}r[0]<ts&&r[1]<ts&&r[2]>=0&&r[3]>=0&&a.insert(s,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Fa.VectorTile(new Jl(this.rawTileData)).layers,this.sourceLayerCoder=new fc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,n,r){this.loadVTLayers();const i=t.params||{},s=ts/t.tileSize/t.scale,a=$n(i.filter),l=t.queryGeometry,u=t.queryPadding*s,c=yc(l),h=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),p=yc(t.cameraQueryGeometry),f=this.grid3D.query(p.minX-u,p.minY-u,p.maxX+u,p.maxY+u,((e,n,r,i)=>function(t,e,n,r,i){for(const o of t)if(e<=o.x&&n<=o.y&&r>=o.x&&i>=o.y)return!0;const s=[new o(e,n),new o(e,i),new o(r,i),new o(r,n)];if(t.length>2)for(const e of s)if(ms(t,e))return!0;for(let e=0;e<t.length-1;e++)if(ys(t[e],t[e+1],s))return!0;return!1}(t.cameraQueryGeometry,e-u,n-u,r+u,i+u)));for(const t of f)h.push(t);h.sort(_c);const d={};let g;for(let o=0;o<h.length;o++){const u=h[o];if(u===g)continue;g=u;const c=this.featureIndexArray.get(u);let p=null;this.loadMatchingFeature(d,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,a,i.layers,i.availableImages,e,n,r,((e,n,r)=>(p||(p=rs(e)),n.queryIntersectsFeature(l,e,r,p,this.z,t.transform,s,t.pixelPosMatrix))))}return d}loadMatchingFeature(t,e,n,r,i,o,s,a,l,u,c){const h=this.bucketLayerIDs[e];if(o&&!function(t,e){for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>=0)return!0;return!1}(o,h))return;const p=this.sourceLayerCoder.decode(n),f=this.vtLayers[p].feature(r);if(i.needGeometry){const t=is(f,!0);if(!i.filter(new li(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!i.filter(new li(this.tileID.overscaledZ),f))return;const d=this.getId(f,p);for(let e=0;e<h.length;e++){const n=h[e];if(o&&o.indexOf(n)<0)continue;const i=a[n];if(!i)continue;let p={};d&&u&&(p=u.getState(i.sourceLayer||"_geojsonTileLayer",d));const g=y({},l[n]);g.paint=mc(g.paint,i.paint,f,p,s),g.layout=mc(g.layout,i.layout,f,p,s);const m=!c||c(f,i,p);if(!m)continue;const _=new dc(f,this.z,this.x,this.y,d);_.layer=g;let v=t[n];void 0===v&&(v=t[n]=[]),v.push({featureIndex:r,feature:_,intersectionZ:m})}}lookupSymbolFeatures(t,e,n,r,i,o,s,a){const l={};this.loadVTLayers();const u=$n(i);for(const i of t)this.loadMatchingFeature(l,n,r,i,u,o,s,a,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const n of e)if(t===n)return!0;return!1}getId(t,e){let n=t.id;return this.promoteId&&(n=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof n&&(n=Number(n))),n}}function mc(t,e,n,r,i){return v(t,((t,o)=>{const s=e instanceof mi?e.get(o):null;return s&&s.evaluate?s.evaluate(n,r,i):s}))}function yc(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(const o of t)e=Math.min(e,o.x),n=Math.min(n,o.y),r=Math.max(r,o.x),i=Math.max(i,o.y);return{minX:e,minY:n,maxX:r,maxY:i}}function _c(t,e){return e-t}function vc(t,e,n,r,i){const s=[];for(let a=0;a<t.length;a++){const l=t[a];let u;for(let t=0;t<l.length-1;t++){let a=l[t],c=l[t+1];a.x<e&&c.x<e||(a.x<e?a=new o(e,a.y+(e-a.x)/(c.x-a.x)*(c.y-a.y))._round():c.x<e&&(c=new o(e,a.y+(e-a.x)/(c.x-a.x)*(c.y-a.y))._round()),a.y<n&&c.y<n||(a.y<n?a=new o(a.x+(n-a.y)/(c.y-a.y)*(c.x-a.x),n)._round():c.y<n&&(c=new o(a.x+(n-a.y)/(c.y-a.y)*(c.x-a.x),n)._round()),a.x>=r&&c.x>=r||(a.x>=r?a=new o(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y))._round():c.x>=r&&(c=new o(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y))._round()),a.y>=i&&c.y>=i||(a.y>=i?a=new o(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i)._round():c.y>=i&&(c=new o(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i)._round()),u&&a.equals(u[u.length-1])||(u=[a],s.push(u)),u.push(c)))))}}return s}Or("FeatureIndex",gc,{omit:["rawTileData","sourceLayerCoder"]});class xc extends o{constructor(t,e,n,r){super(t,e),this.angle=n,void 0!==r&&(this.segment=r)}clone(){return new xc(this.x,this.y,this.angle,this.segment)}}function bc(t,e,n,r,i){if(void 0===e.segment||0===n)return!0;let o=e,s=e.segment+1,a=0;for(;a>-n/2;){if(s--,s<0)return!1;a-=t[s].dist(o),o=t[s]}a+=t[s].dist(t[s+1]),s++;const l=[];let u=0;for(;a<n/2;){const e=t[s],n=t[s+1];if(!n)return!1;let o=t[s-1].angleTo(e)-e.angleTo(n);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:o}),u+=o;a-l[0].distance>r;)u-=l.shift().angleDelta;if(u>i)return!1;s++,a+=e.dist(n)}return!0}function wc(t){let e=0;for(let n=0;n<t.length-1;n++)e+=t[n].dist(t[n+1]);return e}function Ec(t,e,n){return t?.6*e*n:0}function Sc(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Ic(t,e,n,r,i,o){const s=Ec(n,i,o),a=Sc(n,r)*o;let l=0;const u=wc(t)/2;for(let n=0;n<t.length-1;n++){const r=t[n],i=t[n+1],o=r.dist(i);if(l+o>u){const c=(u-l)/o,h=$e.number(r.x,i.x,c),p=$e.number(r.y,i.y,c),f=new xc(h,p,i.angleTo(r),n);return f._round(),!s||bc(t,f,a,s,e)?f:void 0}l+=o}}function Cc(t,e,n,r,i,o,s,a,l){const u=Ec(r,o,s),c=Sc(r,i),h=c*s,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),Tc(t,p?e/2*a%e:(c/2+2*o)*s*a%e,e,u,n,h,p,!1,l)}function Tc(t,e,n,r,i,o,s,a,l){const u=o/2,c=wc(t);let h=0,p=e-n,f=[];for(let e=0;e<t.length-1;e++){const s=t[e],a=t[e+1],d=s.dist(a),g=a.angleTo(s);for(;p+n<h+d;){p+=n;const m=(p-h)/d,y=$e.number(s.x,a.x,m),_=$e.number(s.y,a.y,m);if(y>=0&&y<l&&_>=0&&_<l&&p-u>=0&&p+u<=c){const n=new xc(y,_,g,e);n._round(),r&&!bc(t,n,o,r,i)||f.push(n)}}h+=d}return a||f.length||s||(f=Tc(t,h/2,n,r,i,o,s,!0,l)),f}Or("Anchor",xc);const Pc=ou;function Mc(t,e,n,r){const i=[],s=t.image,a=s.pixelRatio,l=s.paddedRect.w-2*Pc,u=s.paddedRect.h-2*Pc,c=t.right-t.left,h=t.bottom-t.top,p=s.stretchX||[[0,l]],f=s.stretchY||[[0,u]],d=(t,e)=>t+e[1]-e[0],g=p.reduce(d,0),m=f.reduce(d,0),y=l-g,_=u-m;let v=0,x=g,b=0,w=m,E=0,S=y,I=0,C=_;if(s.content&&r){const t=s.content;v=Lc(p,0,t[0]),b=Lc(f,0,t[1]),x=Lc(p,t[0],t[2]),w=Lc(f,t[1],t[3]),E=t[0]-v,I=t[1]-b,S=t[2]-t[0]-x,C=t[3]-t[1]-w}const T=(r,i,l,u)=>{const p=kc(r.stretch-v,x,c,t.left),f=Nc(r.fixed-E,S,r.stretch,g),d=kc(i.stretch-b,w,h,t.top),y=Nc(i.fixed-I,C,i.stretch,m),_=kc(l.stretch-v,x,c,t.left),T=Nc(l.fixed-E,S,l.stretch,g),P=kc(u.stretch-b,w,h,t.top),M=Nc(u.fixed-I,C,u.stretch,m),L=new o(p,d),A=new o(_,d),k=new o(_,P),N=new o(p,P),D=new o(f/a,y/a),R=new o(T/a,M/a),O=e*Math.PI/180;if(O){const t=Math.sin(O),e=Math.cos(O),n=[e,-t,t,e];L._matMult(n),A._matMult(n),N._matMult(n),k._matMult(n)}const z=r.stretch+r.fixed,F=i.stretch+i.fixed;return{tl:L,tr:A,bl:N,br:k,tex:{x:s.paddedRect.x+Pc+z,y:s.paddedRect.y+Pc+F,w:l.stretch+l.fixed-z,h:u.stretch+u.fixed-F},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:R,minFontScaleX:S/a/c,minFontScaleY:C/a/h,isSDF:n}};if(r&&(s.stretchX||s.stretchY)){const t=Ac(p,y,g),e=Ac(f,_,m);for(let n=0;n<t.length-1;n++){const r=t[n],o=t[n+1];for(let t=0;t<e.length-1;t++)i.push(T(r,e[t],o,e[t+1]))}}else i.push(T({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return i}function Lc(t,e,n){let r=0;for(const i of t)r+=Math.max(e,Math.min(n,i[1]))-Math.max(e,Math.min(n,i[0]));return r}function Ac(t,e,n){const r=[{fixed:-Pc,stretch:0}];for(const[e,n]of t){const t=r[r.length-1];r.push({fixed:e-t.stretch,stretch:t.stretch}),r.push({fixed:e-t.stretch,stretch:t.stretch+(n-e)})}return r.push({fixed:e+Pc,stretch:n}),r}function kc(t,e,n,r){return t/e*n+r}function Nc(t,e,n,r){return t-e*n/r}class Dc{constructor(t,e,n,r,i,s,a,l,u,c){if(this.boxStartIndex=t.length,u){let t=s.top,e=s.bottom;const n=s.collisionPadding;n&&(t-=n[1],e+=n[3]);let r=e-t;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let u=s.top*a-l[0],h=s.bottom*a+l[2],p=s.left*a-l[3],f=s.right*a+l[1];const d=s.collisionPadding;if(d&&(p-=d[0]*a,u-=d[1]*a,f+=d[2]*a,h+=d[3]*a),c){const t=new o(p,u),e=new o(f,u),n=new o(p,h),r=new o(f,h),i=c*Math.PI/180;t._rotate(i),e._rotate(i),n._rotate(i),r._rotate(i),p=Math.min(t.x,e.x,n.x,r.x),f=Math.max(t.x,e.x,n.x,r.x),u=Math.min(t.y,e.y,n.y,r.y),h=Math.max(t.y,e.y,n.y,r.y)}t.emplaceBack(e.x,e.y,p,u,f,h,n,r,i)}this.boxEndIndex=t.length}}class Rc{constructor(t=[],e=Oc){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,r=e[t];for(;t>0;){const i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}_down(t){const{data:e,compare:n}=this,r=this.length>>1,i=e[t];for(;t<r;){let r=1+(t<<1),o=e[r];const s=r+1;if(s<this.length&&n(e[s],o)<0&&(r=s,o=e[s]),n(o,i)>=0)break;e[t]=o,t=r}e[t]=i}}function Oc(t,e){return t<e?-1:t>e?1:0}function zc(t,e=1,n=!1){let r=1/0,i=1/0,s=-1/0,a=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<r)&&(r=e.x),(!t||e.y<i)&&(i=e.y),(!t||e.x>s)&&(s=e.x),(!t||e.y>a)&&(a=e.y)}const u=Math.min(s-r,a-i);let c=u/2;const h=new Rc([],Fc);if(0===u)return new o(r,i);for(let e=r;e<s;e+=u)for(let n=i;n<a;n+=u)h.push(new Bc(e+c,n+c,c,t));let p=function(t){let e=0,n=0,r=0;const i=t[0];for(let t=0,o=i.length,s=o-1;t<o;s=t++){const o=i[t],a=i[s],l=o.x*a.y-a.x*o.y;n+=(o.x+a.x)*l,r+=(o.y+a.y)*l,e+=3*l}return new Bc(n/e,r/e,0,t)}(t),f=h.length;for(;h.length;){const r=h.pop();(r.d>p.d||!p.d)&&(p=r,n&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,f)),r.max-p.d<=e||(c=r.h/2,h.push(new Bc(r.p.x-c,r.p.y-c,c,t)),h.push(new Bc(r.p.x+c,r.p.y-c,c,t)),h.push(new Bc(r.p.x-c,r.p.y+c,c,t)),h.push(new Bc(r.p.x+c,r.p.y+c,c,t)),f+=4)}return n&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Fc(t,e){return e.max-t.max}function Bc(t,e,n,r){this.p=new o(t,e),this.h=n,this.d=function(t,e){let n=!1,r=1/0;for(let i=0;i<e.length;i++){const o=e[i];for(let e=0,i=o.length,s=i-1;e<i;s=e++){const i=o[e],a=o[s];i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(n=!n),r=Math.min(r,ds(t,i,a))}}return(n?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var Uc;t.aq=void 0,(Uc=t.aq||(t.aq={}))[Uc.center=1]="center",Uc[Uc.left=2]="left",Uc[Uc.right=3]="right",Uc[Uc.top=4]="top",Uc[Uc.bottom=5]="bottom",Uc[Uc["top-left"]=6]="top-left",Uc[Uc["top-right"]=7]="top-right",Uc[Uc["bottom-left"]=8]="bottom-left",Uc[Uc["bottom-right"]=9]="bottom-right";const Vc=7,jc=Number.POSITIVE_INFINITY;function Gc(t,e){return e[1]!==jc?function(t,e,n){let r=0,i=0;switch(e=Math.abs(e),n=Math.abs(n),t){case"top-right":case"top-left":case"top":i=n-Vc;break;case"bottom-right":case"bottom-left":case"bottom":i=-n+Vc}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,i]}(t,e[0],e[1]):function(t,e){let n=0,r=0;e<0&&(e=0);const i=e/Math.SQRT2;switch(t){case"top-right":case"top-left":r=i-Vc;break;case"bottom-right":case"bottom-left":r=-i+Vc;break;case"bottom":r=-e+Vc;break;case"top":r=e-Vc}switch(t){case"top-right":case"bottom-right":n=-i;break;case"top-left":case"bottom-left":n=i;break;case"left":n=e;break;case"right":n=-e}return[n,r]}(t,e[0])}function qc(t,e,n){var r;const i=t.layout,o=null===(r=i.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(e,{},n);if(o){const t=o.values,e=[];for(let n=0;n<t.length;n+=2){const r=e[n]=t[n],i=t[n+1].map((t=>t*Ml));r.startsWith("top")?i[1]-=Vc:r.startsWith("bottom")&&(i[1]+=Vc),e[n+1]=i}return new ne(e)}const s=i.get("text-variable-anchor");if(s){let r;r=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[i.get("text-radial-offset").evaluate(e,{},n)*Ml,jc]:i.get("text-offset").evaluate(e,{},n).map((t=>t*Ml));const o=[];for(const t of s)o.push(t,Gc(t,r));return new ne(o)}return null}function $c(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Xc(e,n,r,i,o,s,a,l,u,c,h){let p=s.textMaxSize.evaluate(n,{});void 0===p&&(p=a);const f=e.layers[0].layout,d=f.get("icon-offset").evaluate(n,{},h),g=Yc(r.horizontal),m=a/24,y=e.tilePixelRatio*m,_=e.tilePixelRatio*p/24,v=e.tilePixelRatio*l,x=e.tilePixelRatio*f.get("symbol-spacing"),b=f.get("text-padding")*e.tilePixelRatio,w=function(t,e,n,r=1){const i=t.get("icon-padding").evaluate(e,{},n),o=i&&i.values;return[o[0]*r,o[1]*r,o[2]*r,o[3]*r]}(f,n,h,e.tilePixelRatio),S=f.get("text-max-angle")/180*Math.PI,I="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),C="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),T=f.get("symbol-placement"),P=x/2,M=f.get("icon-text-fit");let L;i&&"none"!==M&&(e.allowVerticalPlacement&&r.vertical&&(L=Su(i,r.vertical,M,f.get("icon-text-fit-padding"),d,m)),g&&(i=Su(i,g,M,f.get("icon-text-fit-padding"),d,m)));const A=(l,p)=>{p.x<0||p.x>=ts||p.y<0||p.y>=ts||function(e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m,y,_,v,x,b,w,S,I,C){const T=e.addToLineVertexArray(n,r);let P,M,L,A,k=0,N=0,D=0,R=0,O=-1,z=-1;const F={};let B=Do("");if(e.allowVerticalPlacement&&i.vertical){const t=l.layout.get("text-rotate").evaluate(b,{},I)+90;L=new Dc(u,n,c,h,p,i.vertical,f,d,g,t),a&&(A=new Dc(u,n,c,h,p,a,y,_,g,t))}if(o){const r=l.layout.get("icon-rotate").evaluate(b,{}),i="none"!==l.layout.get("icon-text-fit"),s=Mc(o,r,S,i),f=a?Mc(a,r,S,i):void 0;M=new Dc(u,n,c,h,p,o,y,_,!1,r),k=4*s.length;const d=e.iconSizeData;let g=null;"source"===d.kind?(g=[Cu*l.layout.get("icon-size").evaluate(b,{})],g[0]>Tu&&E(`${e.layerIds[0]}: Value for "icon-size" is >= ${Iu}. Reduce your "icon-size".`)):"composite"===d.kind&&(g=[Cu*w.compositeIconSizes[0].evaluate(b,{},I),Cu*w.compositeIconSizes[1].evaluate(b,{},I)],(g[0]>Tu||g[1]>Tu)&&E(`${e.layerIds[0]}: Value for "icon-size" is >= ${Iu}. Reduce your "icon-size".`)),e.addSymbols(e.icon,s,g,x,v,b,t.ai.none,n,T.lineStartIndex,T.lineLength,-1,I),O=e.icon.placedSymbolArray.length-1,f&&(N=4*f.length,e.addSymbols(e.icon,f,g,x,v,b,t.ai.vertical,n,T.lineStartIndex,T.lineLength,-1,I),z=e.icon.placedSymbolArray.length-1)}const U=Object.keys(i.horizontal);for(const r of U){const o=i.horizontal[r];if(!P){B=Do(o.text);const t=l.layout.get("text-rotate").evaluate(b,{},I);P=new Dc(u,n,c,h,p,o,f,d,g,t)}const a=1===o.positionedLines.length;if(D+=Zc(e,n,o,s,l,g,b,m,T,i.vertical?t.ai.horizontal:t.ai.horizontalOnly,a?U:[r],F,O,w,I),a)break}i.vertical&&(R+=Zc(e,n,i.vertical,s,l,g,b,m,T,t.ai.vertical,["vertical"],F,z,w,I));const V=P?P.boxStartIndex:e.collisionBoxArray.length,j=P?P.boxEndIndex:e.collisionBoxArray.length,G=L?L.boxStartIndex:e.collisionBoxArray.length,q=L?L.boxEndIndex:e.collisionBoxArray.length,$=M?M.boxStartIndex:e.collisionBoxArray.length,X=M?M.boxEndIndex:e.collisionBoxArray.length,Z=A?A.boxStartIndex:e.collisionBoxArray.length,Y=A?A.boxEndIndex:e.collisionBoxArray.length;let W=-1;const H=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;W=H(P,W),W=H(L,W),W=H(M,W),W=H(A,W);const K=W>-1?1:0;K&&(W*=C/Ml),e.glyphOffsetArray.length>=zu.MAX_GLYPHS&&E("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey);const J=qc(l,b,I),[Q,tt]=function(e,n){const r=e.length,i=null==n?void 0:n.values;if((null==i?void 0:i.length)>0)for(let n=0;n<i.length;n+=2){const r=i[n+1];e.emplaceBack(t.aq[i[n]],r[0],r[1])}return[r,e.length]}(e.textAnchorOffsets,J);e.symbolInstances.emplaceBack(n.x,n.y,F.right>=0?F.right:-1,F.center>=0?F.center:-1,F.left>=0?F.left:-1,F.vertical||-1,O,z,B,V,j,G,q,$,X,Z,Y,c,D,R,k,N,K,0,f,W,Q,tt)}(e,p,l,r,i,o,L,e.layers[0],e.collisionBoxArray,n.index,n.sourceLayerIndex,e.index,y,[b,b,b,b],I,u,v,w,C,d,n,s,c,h,a)};if("line"===T)for(const t of vc(n.geometry,0,0,ts,ts)){const n=Cc(t,x,S,r.vertical||g,i,24,_,e.overscaling,ts);for(const r of n)g&&Wc(e,g.text,P,r)||A(t,r)}else if("line-center"===T){for(const t of n.geometry)if(t.length>1){const e=Ic(t,S,r.vertical||g,i,24,_);e&&A(t,e)}}else if("Polygon"===n.type)for(const t of Ca(n.geometry,0)){const e=zc(t,16);A(t[0],new xc(e.x,e.y,0))}else if("LineString"===n.type)for(const t of n.geometry)A(t,new xc(t[0].x,t[0].y,0));else if("Point"===n.type)for(const t of n.geometry)for(const e of t)A([e],new xc(e.x,e.y,0))}function Zc(t,e,n,r,i,s,a,l,u,c,h,p,f,d,g){const m=function(t,e,n,r,i,s,a,l){const u=r.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,c=[];for(const t of e.positionedLines)for(const r of t.positionedGlyphs){if(!r.rect)continue;const s=r.rect||{};let h=ru+1,p=!0,f=1,d=0;const g=(i||l)&&r.vertical,m=r.metrics.advance*r.scale/2;if(l&&e.verticalizable&&(d=t.lineOffset/2-(r.imageName?-(Ml-r.metrics.width*r.scale)/2:(r.scale-1)*Ml)),r.imageName){const t=a[r.imageName];p=t.sdf,f=t.pixelRatio,h=ou/f}const y=i?[r.x+m,r.y]:[0,0];let _=i?[0,0]:[r.x+m+n[0],r.y+n[1]-d],v=[0,0];g&&(v=_,_=[0,0]);const x=r.metrics.isDoubleResolution?2:1,b=(r.metrics.left-h)*r.scale-m+_[0],w=(-r.metrics.top-h)*r.scale+_[1],E=b+s.w/x*r.scale/f,S=w+s.h/x*r.scale/f,I=new o(b,w),C=new o(E,w),T=new o(b,S),P=new o(E,S);if(g){const t=new o(-m,m-uu),e=-Math.PI/2,n=Ml/2-m,i=new o(5-uu-n,-(r.imageName?n:0)),s=new o(...v);I._rotateAround(e,t)._add(i)._add(s),C._rotateAround(e,t)._add(i)._add(s),T._rotateAround(e,t)._add(i)._add(s),P._rotateAround(e,t)._add(i)._add(s)}if(u){const t=Math.sin(u),e=Math.cos(u),n=[e,-t,t,e];I._matMult(n),C._matMult(n),T._matMult(n),P._matMult(n)}const M=new o(0,0),L=new o(0,0);c.push({tl:I,tr:C,bl:T,br:P,tex:s,writingMode:e.writingMode,glyphOffset:y,sectionIndex:r.sectionIndex,isSDF:p,pixelOffsetTL:M,pixelOffsetBR:L,minFontScaleX:0,minFontScaleY:0})}return c}(0,n,l,i,s,a,r,t.allowVerticalPlacement),y=t.textSizeData;let _=null;"source"===y.kind?(_=[Cu*i.layout.get("text-size").evaluate(a,{})],_[0]>Tu&&E(`${t.layerIds[0]}: Value for "text-size" is >= ${Iu}. Reduce your "text-size".`)):"composite"===y.kind&&(_=[Cu*d.compositeTextSizes[0].evaluate(a,{},g),Cu*d.compositeTextSizes[1].evaluate(a,{},g)],(_[0]>Tu||_[1]>Tu)&&E(`${t.layerIds[0]}: Value for "text-size" is >= ${Iu}. Reduce your "text-size".`)),t.addSymbols(t.text,m,_,l,s,a,c,e,u.lineStartIndex,u.lineLength,f,g);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*m.length}function Yc(t){for(const e in t)return t[e];return null}function Wc(t,e,n,r){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(r.dist(t[e])<n)return!0}else i[e]=[];return i[e].push(r),!1}const Hc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Kc{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,n]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const r=n>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const i=Hc[15&n];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new Kc(s,o,i,t)}constructor(t,e=64,n=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Hc.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=e,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Jc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:s}=this,a=[0,i.length-1,0],l=[];for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=s){for(let s=h;s<=c;s++){const a=o[2*s],u=o[2*s+1];a>=t&&a<=n&&u>=e&&u<=r&&l.push(i[s])}continue}const p=h+c>>1,f=o[2*p],d=o[2*p+1];f>=t&&f<=n&&d>=e&&d<=r&&l.push(i[p]),(0===u?t<=f:e<=d)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?n>=f:r>=d)&&(a.push(p+1),a.push(c),a.push(1-u))}return l}within(t,e,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:i,nodeSize:o}=this,s=[0,r.length-1,0],a=[],l=n*n;for(;s.length;){const u=s.pop()||0,c=s.pop()||0,h=s.pop()||0;if(c-h<=o){for(let n=h;n<=c;n++)nh(i[2*n],i[2*n+1],t,e)<=l&&a.push(r[n]);continue}const p=h+c>>1,f=i[2*p],d=i[2*p+1];nh(f,d,t,e)<=l&&a.push(r[p]),(0===u?t-n<=f:e-n<=d)&&(s.push(h),s.push(p-1),s.push(1-u)),(0===u?t+n>=f:e+n>=d)&&(s.push(p+1),s.push(c),s.push(1-u))}return a}}function Jc(t,e,n,r,i,o){if(i-r<=n)return;const s=r+i>>1;Qc(t,e,s,r,i,o),Jc(t,e,n,r,s-1,1-o),Jc(t,e,n,s+1,i,1-o)}function Qc(t,e,n,r,i,o){for(;i>r;){if(i-r>600){const s=i-r+1,a=n-r+1,l=Math.log(s),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(s-u)/s)*(a-s/2<0?-1:1);Qc(t,e,n,Math.max(r,Math.floor(n-a*u/s+c)),Math.min(i,Math.floor(n+(s-a)*u/s+c)),o)}const s=e[2*n+o];let a=r,l=i;for(th(t,e,r,n),e[2*i+o]>s&&th(t,e,r,i);a<l;){for(th(t,e,a,l),a++,l--;e[2*a+o]<s;)a++;for(;e[2*l+o]>s;)l--}e[2*r+o]===s?th(t,e,r,l):(l++,th(t,e,l,i)),l<=n&&(r=l+1),n<=l&&(i=l-1)}}function th(t,e,n,r){eh(t,n,r),eh(e,2*n,2*r),eh(e,2*n+1,2*r+1)}function eh(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function nh(t,e,n,r){const i=t-n,o=e-r;return i*i+o*o}var rh;t.bh=void 0,(rh=t.bh||(t.bh={})).create="create",rh.load="load",rh.fullLoad="fullLoad";let ih=null,oh=[];const sh=1e3/60,ah="loadTime",lh="fullLoadTime",uh={mark(t){performance.mark(t)},frame(t){const e=t;null!=ih&&oh.push(e-ih),ih=e},clearMetrics(){ih=null,oh=[],performance.clearMeasures(ah),performance.clearMeasures(lh);for(const e in t.bh)performance.clearMarks(t.bh[e])},getPerformanceMetrics(){performance.measure(ah,t.bh.create,t.bh.load),performance.measure(lh,t.bh.create,t.bh.fullLoad);const e=performance.getEntriesByName(ah)[0].duration,n=performance.getEntriesByName(lh)[0].duration,r=oh.length,i=1/(oh.reduce(((t,e)=>t+e),0)/r/1e3),o=oh.filter((t=>t>sh)).reduce(((t,e)=>t+(e-sh)/sh),0);return{loadTime:e,fullLoadTime:n,fps:i,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};t.$=function(t,e,n){var r,i,o,s,a,l,u,c,h,p,f,d,g=n[0],m=n[1],y=n[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*y+e[12],t[13]=e[1]*g+e[5]*m+e[9]*y+e[13],t[14]=e[2]*g+e[6]*m+e[10]*y+e[14],t[15]=e[3]*g+e[7]*m+e[11]*y+e[15]):(i=e[1],o=e[2],s=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=r=e[0],t[1]=i,t[2]=o,t[3]=s,t[4]=a,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=r*g+a*m+h*y+e[12],t[13]=i*g+l*m+p*y+e[13],t[14]=o*g+u*m+f*y+e[14],t[15]=s*g+c*m+d*y+e[15]),t},t.A=Is,t.B=$e,t.C=class{constructor(t,e,n){this.receive=t=>{const e=t.data,n=e.id;if(n&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[n];const t=this.cancelCallbacks[n];delete this.cancelCallbacks[n],t&&t()}else C()||e.mustQueue?(this.tasks[n]=e,this.taskQueue.push(n),this.invoker.trigger()):this.processTask(n,e)},this.process=()=>{if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)},this.target=t,this.parent=e,this.mapId=n,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new Hu(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=C()?t:window}send(t,e,n,r,i=!1){const o=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(this.callbacks[o]=n);const s=[],a={id:o,type:t,hasCallback:!!n,targetMapId:r,mustQueue:i,sourceMapId:this.mapId,data:Fr(e,s)};return this.target.postMessage(a,{transfer:s}),{cancel:()=>{n&&delete this.callbacks[o],this.target.postMessage({id:o,type:"<cancel>",targetMapId:r,sourceMapId:this.mapId})}}}processTask(t,e){if("<response>"===e.type){const n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(Br(e.error)):n(null,Br(e.data)))}else{let n=!1;const r=[],i=e.hasCallback?(e,i)=>{n=!0,delete this.cancelCallbacks[t];const o={id:t,type:"<response>",sourceMapId:this.mapId,error:e?Fr(e):null,data:Fr(i,r)};this.target.postMessage(o,{transfer:r})}:t=>{n=!0};let o=null;const s=Br(e.data);if(this.parent[e.type])o=this.parent[e.type](e.sourceMapId,s,i);else if("getWorkerSource"in this.parent){const t=e.type.split(".");o=this.parent.getWorkerSource(e.sourceMapId,t[0],s.source)[t[1]](s,i)}else i(new Error(`Could not find function ${e.type}`));!n&&o&&o.cancel&&(this.cancelCallbacks[t]=o.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.D=yi,t.E=Y,t.F=function(t,e){const n={};for(let r=0;r<e.length;r++){const i=e[r];i in t&&(n[i]=t[i])}return n},t.G=ec,t.H=nc,t.I=su,t.J=h,t.K=p,t.L=Ju,t.M=L,t.N=ts,t.O=cc,t.P=o,t.Q=Pi,t.R=Us,t.S=Po,t.T=hi,t.U=sc,t.V=class extends ki{},t.W=lc,t.X=function(t,e){const n=window.document.createElement("video");n.muted=!0,n.onloadstart=function(){e(null,n)};for(let e=0;e<t.length;e++){const r=window.document.createElement("source");G(t[e])||(n.crossOrigin="Anonymous"),r.src=t[e],n.appendChild(r)}return{cancel:()=>{}}},t.Y=at,t.Z=function(){var t=new Is(16);return Is!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t._=e,t.a=P,t.a$=class extends Ki{},t.a0=function(t,e,n){var r=n[0],i=n[1],o=n[2];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]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.a1=Ts,t.a2=function(){return _++},t.a3=to,t.a4=zu,t.a5=function(){ai.isLoading()||ai.isLoaded()||"deferred"!==oi()||si()},t.a6=$n,t.a7=is,t.a8=li,t.a9=dc,t.aA=ni,t.aB=function(t){t=t.slice();const e=Object.create(null);for(let n=0;n<t.length;n++)e[t[n].id]=t[n];for(let n=0;n<t.length;n++)"ref"in t[n]&&(t[n]=K(t[n],e[t[n].ref]));return t},t.aC=function(t){if("custom"===t.type)return new Wu(t);switch(t.type){case"background":return new $u(t);case"circle":return new As(t);case"fill":return new Da(t);case"fill-extrusion":return new il(t);case"heatmap":return new js(t);case"hillshade":return new $s(t);case"line":return new xl(t);case"raster":return new Yu(t);case"symbol":return new ju(t)}},t.aD=b,t.aE=function(t,e){if(!t)return[{command:Q.setStyle,args:[e]}];let n=[];try{if(!J(t.version,e.version))return[{command:Q.setStyle,args:[e]}];J(t.center,e.center)||n.push({command:Q.setCenter,args:[e.center]}),J(t.zoom,e.zoom)||n.push({command:Q.setZoom,args:[e.zoom]}),J(t.bearing,e.bearing)||n.push({command:Q.setBearing,args:[e.bearing]}),J(t.pitch,e.pitch)||n.push({command:Q.setPitch,args:[e.pitch]}),J(t.sprite,e.sprite)||n.push({command:Q.setSprite,args:[e.sprite]}),J(t.glyphs,e.glyphs)||n.push({command:Q.setGlyphs,args:[e.glyphs]}),J(t.transition,e.transition)||n.push({command:Q.setTransition,args:[e.transition]}),J(t.light,e.light)||n.push({command:Q.setLight,args:[e.light]});const r={},i=[];!function(t,e,n,r){let i;for(i in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)||et(i,n,r));for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)?J(t[i],e[i])||("geojson"===t[i].type&&"geojson"===e[i].type&&rt(t,e,i)?n.push({command:Q.setGeoJSONSourceData,args:[i,e[i].data]}):nt(i,e,n,r)):tt(i,e,n))}(t.sources,e.sources,i,r);const o=[];t.layers&&t.layers.forEach((t=>{r[t.source]?n.push({command:Q.removeLayer,args:[t.id]}):o.push(t)})),n=n.concat(i),function(t,e,n){e=e||[];const r=(t=t||[]).map(ot),i=e.map(ot),o=t.reduce(st,{}),s=e.reduce(st,{}),a=r.slice(),l=Object.create(null);let u,c,h,p,f,d,g;for(u=0,c=0;u<r.length;u++)h=r[u],Object.prototype.hasOwnProperty.call(s,h)?c++:(n.push({command:Q.removeLayer,args:[h]}),a.splice(a.indexOf(h,c),1));for(u=0,c=0;u<i.length;u++)h=i[i.length-1-u],a[a.length-1-u]!==h&&(Object.prototype.hasOwnProperty.call(o,h)?(n.push({command:Q.removeLayer,args:[h]}),a.splice(a.lastIndexOf(h,a.length-c),1)):c++,d=a[a.length-u],n.push({command:Q.addLayer,args:[s[h],d]}),a.splice(a.length-u,0,h),l[h]=!0);for(u=0;u<i.length;u++)if(h=i[u],p=o[h],f=s[h],!l[h]&&!J(p,f))if(J(p.source,f.source)&&J(p["source-layer"],f["source-layer"])&&J(p.type,f.type)){for(g in it(p.layout,f.layout,n,h,null,Q.setLayoutProperty),it(p.paint,f.paint,n,h,null,Q.setPaintProperty),J(p.filter,f.filter)||n.push({command:Q.setFilter,args:[h,f.filter]}),J(p.minzoom,f.minzoom)&&J(p.maxzoom,f.maxzoom)||n.push({command:Q.setLayerZoomRange,args:[h,f.minzoom,f.maxzoom]}),p)Object.prototype.hasOwnProperty.call(p,g)&&"layout"!==g&&"paint"!==g&&"filter"!==g&&"metadata"!==g&&"minzoom"!==g&&"maxzoom"!==g&&(0===g.indexOf("paint.")?it(p[g],f[g],n,h,g.slice(6),Q.setPaintProperty):J(p[g],f[g])||n.push({command:Q.setLayerProperty,args:[h,g,f[g]]}));for(g in f)Object.prototype.hasOwnProperty.call(f,g)&&!Object.prototype.hasOwnProperty.call(p,g)&&"layout"!==g&&"paint"!==g&&"filter"!==g&&"metadata"!==g&&"minzoom"!==g&&"maxzoom"!==g&&(0===g.indexOf("paint.")?it(p[g],f[g],n,h,g.slice(6),Q.setPaintProperty):J(p[g],f[g])||n.push({command:Q.setLayerProperty,args:[h,g,f[g]]}))}else n.push({command:Q.removeLayer,args:[h]}),d=a[a.lastIndexOf(h)+1],n.push({command:Q.addLayer,args:[f,d]})}(o,e.layers,n)}catch(t){console.warn("Unable to compute style diff:",t),n=[{command:Q.setStyle,args:[e]}]}return n},t.aF=function(t){const e=[],n=t.id;return void 0===n&&e.push({message:`layers.${n}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${n}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),e},t.aG=function t(e,n){if(Array.isArray(e)){if(!Array.isArray(n)||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],n[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==n){if("object"!=typeof n)return!1;if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(!t(e[r],n[r]))return!1;return!0}return e===n},t.aH=v,t.aI=x,t.aJ=ii,t.aK=function(t){return t({pluginStatus:ti,pluginURL:ei}),ii.on("pluginStateChange",t),t},t.aL=class extends Bo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.aM=Uo,t.aN=class extends Bo{constructor(t,e){super(t,e),this.current=Go}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.aO=Vo,t.aP=class extends Bo{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.aQ=class extends Bo{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.aR=jo,t.aS=function(t,e,n,r,i,o,s){var a=1/(e-n),l=1/(r-i),u=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+n)*a,t[13]=(i+r)*l,t[14]=(s+o)*u,t[15]=1,t},t.aT=Ht,t.aU=Ms,t.aV=class extends ji{},t.aW=Cl,t.aX=class extends qi{},t.aY=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.aZ=Vs,t.a_=ho,t.aa=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,n,r,i)=>{const o=r||i;return e[n]=!o||o.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.ab=function(t,e){const n=[];for(const r in t)r in e||n.push(r);return n},t.ac=function(t){if(null==T){const e=t.navigator?t.navigator.userAgent:null;T=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return T},t.ad=g,t.ae=function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],s=e[1],a=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=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]=o*i+u*r,t[1]=s*i+c*r,t[2]=a*i+h*r,t[3]=l*i+p*r,t[4]=u*i-o*r,t[5]=c*i-s*r,t[6]=h*i-a*r,t[7]=p*i-l*r,t},t.af=function(t){var e=new Is(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.ag=Ls,t.ah=function(t,e){let n=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){const{interpolationType:i,minZoom:o,maxZoom:s}=t,a=i?g(Xe.interpolationFactor(i,e,o,s),0,1):0;"camera"===t.kind?r=$e.number(t.minSize,t.maxSize,a):n=a}return{uSizeT:n,uSize:r}},t.aj=function(t,{uSize:e,uSizeT:n},{lowerSize:r,upperSize:i}){return"source"===t.kind?r/Cu:"composite"===t.kind?$e.number(r/Cu,i/Cu,n):e},t.ak=Nu,t.al=function(t,e,n,r){const i=e.y-t.y,s=e.x-t.x,a=r.y-n.y,l=r.x-n.x,u=a*s-l*i;if(0===u)return null;const c=(l*(t.y-n.y)-a*(t.x-n.x))/u;return new o(t.x+c*s,t.y+c*i)},t.am=vc,t.an=as,t.ao=Cs,t.ap=Ml,t.ar=Mu,t.as=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],f=e[11],d=e[12],g=e[13],m=e[14],y=e[15],_=n*a-r*s,v=n*l-i*s,x=n*u-o*s,b=r*l-i*a,w=r*u-o*a,E=i*u-o*l,S=c*g-h*d,I=c*m-p*d,C=c*y-f*d,T=h*m-p*g,P=h*y-f*g,M=p*y-f*m,L=_*M-v*P+x*T+b*C-w*I+E*S;return L?(t[0]=(a*M-l*P+u*T)*(L=1/L),t[1]=(i*P-r*M-o*T)*L,t[2]=(g*E-m*w+y*b)*L,t[3]=(p*w-h*E-f*b)*L,t[4]=(l*C-s*M-u*I)*L,t[5]=(n*M-i*C+o*I)*L,t[6]=(m*x-d*E-y*v)*L,t[7]=(c*E-p*x+f*v)*L,t[8]=(s*P-a*C+u*S)*L,t[9]=(r*C-n*P-o*S)*L,t[10]=(d*w-g*x+y*_)*L,t[11]=(h*x-c*w-f*_)*L,t[12]=(a*I-s*T-l*S)*L,t[13]=(n*T-r*I+i*S)*L,t[14]=(g*v-d*b-m*_)*L,t[15]=(c*b-h*v+p*_)*L,t):null},t.at=$c,t.au=bu,t.av=Kc,t.aw=function(){const t={},e=W.$version;for(const n in W.$root){const r=W.$root[n];if(r.required){let i=null;i="version"===n?e:"array"===r.type?[]:{},null!=i&&(t[n]=i)}}return t},t.ax=Q,t.ay=Ur,t.az=F,t.b=function(t,e){const n=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(n).then((t=>{e(null,t)})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))},t.b0=So,t.b1=function(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],s=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=t[9],p=t[10],f=t[11],d=t[12],g=t[13],m=t[14],y=t[15],_=e[0],v=e[1],x=e[2],b=e[3],w=e[4],E=e[5],S=e[6],I=e[7],C=e[8],T=e[9],P=e[10],M=e[11],L=e[12],A=e[13],k=e[14],N=e[15];return Math.abs(n-_)<=Ss*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(r-v)<=Ss*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(i-x)<=Ss*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-b)<=Ss*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(s-w)<=Ss*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(a-E)<=Ss*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(l-S)<=Ss*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(u-I)<=Ss*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-C)<=Ss*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(h-T)<=Ss*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(p-P)<=Ss*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(f-M)<=Ss*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(d-L)<=Ss*Math.max(1,Math.abs(d),Math.abs(L))&&Math.abs(g-A)<=Ss*Math.max(1,Math.abs(g),Math.abs(A))&&Math.abs(m-k)<=Ss*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(y-N)<=Ss*Math.max(1,Math.abs(y),Math.abs(N))},t.b2=function(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},t.b3=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},t.b4=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.b5=m,t.b6=uc,t.b7=rc,t.b8=function(t,e,n,r,i){var o,s=1/Math.tan(e/2);return t[0]=s/n,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,null!=i&&i!==1/0?(t[10]=(i+r)*(o=1/(r-i)),t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r),t},t.b9=function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],s=e[5],a=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=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]=o*i+u*r,t[5]=s*i+c*r,t[6]=a*i+h*r,t[7]=l*i+p*r,t[8]=u*i-o*r,t[9]=c*i-s*r,t[10]=h*i-a*r,t[11]=p*i-l*r,t},t.bA=r,t.bB=Ll,t.bC=zn,t.bD=ai,t.ba=f,t.bb=d,t.bc=function(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},t.bd=class extends Ai{},t.be=Ku,t.bf=ic,t.bg=uh,t.bi=z,t.bj=function(t,e,n=!1){if(ti===Hr||ti===Kr||ti===Jr)throw new Error("setRTLTextPlugin cannot be called multiple times.");ei=R.resolveURL(t),ti=Hr,Qr=e,ri(),n||si()},t.bk=oi,t.bl=function(t,e){const n={};for(let r=0;r<t.length;r++){const i=e&&e[t[r].id]||tr(t[r]);e&&(e[t[r].id]=i);let o=n[i];o||(o=n[i]=[]),o.push(t[r])}const r=[];for(const t in n)r.push(n[t]);return r},t.bm=Or,t.bn=fc,t.bo=gc,t.bp=au,t.bq=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=ts/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const n=e.bucket.layers[0],r=n.layout,i=n._unevaluatedLayout._values,o={layoutIconSize:i["icon-size"].possiblyEvaluate(new li(e.bucket.zoom+1),e.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new li(e.bucket.zoom+1),e.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new li(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:n}=e.bucket.textSizeData;o.compositeTextSizes=[i["text-size"].possiblyEvaluate(new li(t),e.canonical),i["text-size"].possiblyEvaluate(new li(n),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:n}=e.bucket.iconSizeData;o.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new li(t),e.canonical),i["icon-size"].possiblyEvaluate(new li(n),e.canonical)]}const s=r.get("text-line-height")*Ml,a="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),l=r.get("text-keep-upright"),u=r.get("text-size");for(const i of e.bucket.features){const c=r.get("text-font").evaluate(i,{},e.canonical).join(","),h=u.evaluate(i,{},e.canonical),p=o.layoutTextSize.evaluate(i,{},e.canonical),f=o.layoutIconSize.evaluate(i,{},e.canonical),d={horizontal:{},vertical:void 0},g=i.text;let m,y=[0,0];if(g){const o=g.toString(),u=r.get("text-letter-spacing").evaluate(i,{},e.canonical)*Ml,f=Gr(o)?u:0,m=r.get("text-anchor").evaluate(i,{},e.canonical),_=qc(n,i,e.canonical);if(!_){const t=r.get("text-radial-offset").evaluate(i,{},e.canonical);y=t?Gc(m,[t*Ml,jc]):r.get("text-offset").evaluate(i,{},e.canonical).map((t=>t*Ml))}let v=a?"center":r.get("text-justify").evaluate(i,{},e.canonical);const x=r.get("symbol-placement"),b="point"===x?r.get("text-max-width").evaluate(i,{},e.canonical)*Ml:0,w=()=>{e.bucket.allowVerticalPlacement&&jr(o)&&(d.vertical=pu(g,e.glyphMap,e.glyphPositions,e.imagePositions,c,b,s,m,"left",f,y,t.ai.vertical,!0,x,p,h))};if(!a&&_){const n=new Set;if("auto"===v)for(let t=0;t<_.values.length;t+=2)n.add($c(_.values[t]));else n.add(v);let r=!1;for(const i of n)if(!d.horizontal[i])if(r)d.horizontal[i]=d.horizontal[0];else{const n=pu(g,e.glyphMap,e.glyphPositions,e.imagePositions,c,b,s,"center",i,f,y,t.ai.horizontal,!1,x,p,h);n&&(d.horizontal[i]=n,r=1===n.positionedLines.length)}w()}else{"auto"===v&&(v=$c(m));const n=pu(g,e.glyphMap,e.glyphPositions,e.imagePositions,c,b,s,m,v,f,y,t.ai.horizontal,!1,x,p,h);n&&(d.horizontal[v]=n),w(),jr(o)&&a&&l&&(d.vertical=pu(g,e.glyphMap,e.glyphPositions,e.imagePositions,c,b,s,m,v,f,y,t.ai.vertical,!1,x,p,h))}}let _=!1;if(i.icon&&i.icon.name){const t=e.imageMap[i.icon.name];t&&(m=Eu(e.imagePositions[i.icon.name],r.get("icon-offset").evaluate(i,{},e.canonical),r.get("icon-anchor").evaluate(i,{},e.canonical)),_=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=_:e.bucket.sdfIcons!==_&&E("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const v=Yc(d.horizontal)||d.vertical;e.bucket.iconsInText=!!v&&v.iconsInText,(v||m)&&Xc(e.bucket,i,d,m,e.imageMap,o,p,f,y,_,e.canonical)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.br=dl,t.bs=La,t.bt=Qa,t.bu=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.bv=Jl,t.bw=Fa,t.bx=function(t,n,r,i,o){return e(this,void 0,void 0,(function*(){if(p())try{return yield L(t,n,r,i,o)}catch(t){}return function(t,e,n,r,i){const o=t.width,s=t.height;A&&k||(A=new OffscreenCanvas(o,s),k=A.getContext("2d",{willReadFrequently:!0})),A.width=o,A.height=s,k.drawImage(t,0,0,o,s);const a=k.getImageData(e,n,r,i);return k.clearRect(0,0,o,s),a.data}(t,n,r,i,o)}))},t.by=pc,t.bz=n,t.c=O,t.d=function(t,e){const n=new Image;n.onload=()=>{e(null,n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame((()=>{n.src=M}))},n.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const r=new Blob([new Uint8Array(t)],{type:"image/png"});n.src=t.byteLength?URL.createObjectURL(r):M},t.e=y,t.f=function(t,e){return V(y(t,{type:"json"}),e)},t.g=B,t.h=R,t.i=C,t.j=Z,t.k=X,t.l=j,t.m=V,t.n=function(t){return new Jl(t).readFields(tu,[])},t.o=function(t,e,n){if(!t.length)return n(null,[]);let r=t.length;const i=new Array(t.length);let o=null;t.forEach(((t,s)=>{e(t,((t,e)=>{t&&(o=t),i[s]=e,0==--r&&n(o,i)}))}))},t.p=iu,t.q=Bs,t.r=wi,t.s=G,t.t=Lr,t.u=Vr,t.v=W,t.w=E,t.x=Nr,t.y=Mr,t.z=function([t,e,n]){return e+=90,e*=Math.PI/180,n*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(n),y:t*Math.sin(e)*Math.sin(n),z:t*Math.cos(n)}}})),r(0,(function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,n){for(const n of e){this._layerConfigs[n.id]=n;const e=this._layers[n.id]=t.aC(n);e._featureFilter=t.a6(e.filter),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(const t of n)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=t.bl(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map((t=>this._layers[t.id])),n=e[0];if("none"===n.visibility)continue;const r=n.source||"";let i=this.familiesBySource[r];i||(i=this.familiesBySource[r]={});const o=n.sourceLayer||"_geojsonTileLayer";let s=i[o];s||(s=i[o]=[]),s.push(e)}}}class n{constructor(e){const n={},r=[];for(const t in e){const i=e[t],o=n[t]={};for(const t in i){const e=i[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const n={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};r.push(n),o[t]={rect:n,metrics:e.metrics}}}const{w:i,h:o}=t.p(r),s=new t.q({width:i||1,height:o||1});for(const r in e){const i=e[r];for(const e in i){const o=i[+e];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const a=n[r][e].rect;t.q.copy(o.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},o.bitmap)}}this.image=s,this.positions=n}}t.bm("GlyphAtlas",n);class r{constructor(e){this.tileID=new t.O(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(e,r,o,s,a){this.status="parsing",this.data=e,this.collisionBoxArray=new t.a3;const l=new t.bn(Object.keys(e.layers).sort()),u=new t.bo(this.tileID,this.promoteId);u.bucketLayerIDs=[];const c={},h={featureIndex:u,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:o},p=r.familiesBySource[this.source];for(const n in p){const r=e.layers[n];if(!r)continue;1===r.version&&t.w(`Vector tile source "${this.source}" layer "${n}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const s=l.encode(n),a=[];for(let t=0;t<r.length;t++){const e=r.feature(t),i=u.getId(e,n);a.push({feature:e,id:i,index:t,sourceLayerIndex:s})}for(const e of p[n]){const n=e[0];n.source!==this.source&&t.w(`layer.source = ${n.source} does not equal this.source = ${this.source}`),n.minzoom&&this.zoom<Math.floor(n.minzoom)||n.maxzoom&&this.zoom>=n.maxzoom||"none"!==n.visibility&&(i(e,this.zoom,o),(c[n.id]=n.createBucket({index:u.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:s,sourceID:this.source})).populate(a,h,this.tileID.canonical),u.bucketLayerIDs.push(e.map((t=>t.id))))}}let f,d,g,m;const y=t.aH(h.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.cancel())),this.inFlightDependencies=[];const _=++this.dependencySentinel;Object.keys(y).length?this.inFlightDependencies.push(s.send("getGlyphs",{uid:this.uid,stacks:y,source:this.source,tileID:this.tileID,type:"glyphs"},((t,e)=>{_===this.dependencySentinel&&(f||(f=t,d=e,b.call(this)))}))):d={};const v=Object.keys(h.iconDependencies);v.length?this.inFlightDependencies.push(s.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{_===this.dependencySentinel&&(f||(f=t,g=e,b.call(this)))}))):g={};const x=Object.keys(h.patternDependencies);function b(){if(f)return a(f);if(d&&g&&m){const e=new n(d),r=new t.bp(g,m);for(const n in c){const s=c[n];s instanceof t.a4?(i(s.layers,this.zoom,o),t.bq({bucket:s,glyphMap:d,glyphPositions:e.positions,imageMap:g,imagePositions:r.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):s.hasPattern&&(s instanceof t.br||s instanceof t.bs||s instanceof t.bt)&&(i(s.layers,this.zoom,o),s.addFeatures(h,this.tileID.canonical,r.patternPositions))}this.status="done",a(null,{buckets:Object.values(c).filter((t=>!t.isEmpty())),featureIndex:u,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?g:null,glyphPositions:this.returnDependencies?e.positions:null})}}x.length?this.inFlightDependencies.push(s.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{_===this.dependencySentinel&&(f||(f=t,m=e,b.call(this)))}))):m={},b.call(this)}}function i(e,n,r){const i=new t.a8(n);for(const t of e)t.recalculate(i,r)}function o(e,n){const r=t.l(e.request,((r,i,o,s)=>{if(r)n(r);else if(i)try{const e=new t.bw.VectorTile(new t.bv(i));n(null,{vectorTile:e,rawData:i,cacheControl:o,expires:s})}catch(t){const r=new Uint8Array(i);let o=`Unable to parse the tile at ${e.request.url}, `;o+=31===r[0]&&139===r[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.messge}`,n(new Error(o))}}));return()=>{r.cancel(),n()}}class s{constructor(t,e,n,r){this.actor=t,this.layerIndex=e,this.availableImages=n,this.loadVectorData=r||o,this.fetching={},this.loading={},this.loaded={}}loadTile(e,n){const i=e.uid;this.loading||(this.loading={});const o=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.bu(e.request),s=this.loading[i]=new r(e);s.abort=this.loadVectorData(e,((e,r)=>{if(delete this.loading[i],e||!r)return s.status="done",this.loaded[i]=s,n(e);const a=r.rawData,l={};r.expires&&(l.expires=r.expires),r.cacheControl&&(l.cacheControl=r.cacheControl);const u={};if(o){const t=o.finish();t&&(u.resourceTiming=JSON.parse(JSON.stringify(t)))}s.vectorTile=r.vectorTile,s.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,r)=>{if(delete this.fetching[i],e||!r)return n(e);n(null,t.e({rawTileData:a.slice(0)},r,l,u))})),this.loaded=this.loaded||{},this.loaded[i]=s,this.fetching[i]={rawTileData:a,cacheControl:l,resourceTiming:u}}))}reloadTile(e,n){const r=this.loaded,i=e.uid;if(r&&r[i]){const o=r[i];o.showCollisionBoxes=e.showCollisionBoxes,"parsing"===o.status?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,r)=>{if(e||!r)return n(e,r);let o;if(this.fetching[i]){const{rawTileData:e,cacheControl:n,resourceTiming:s}=this.fetching[i];delete this.fetching[i],o=t.e({rawTileData:e.slice(0)},r,n,s)}else o=r;n(null,o)})):"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,n):n())}}abortTile(t,e){const n=this.loading,r=t.uid;n&&n[r]&&n[r].abort&&(n[r].abort(),delete n[r]),e()}removeTile(t,e){const n=this.loaded,r=t.uid;n&&n[r]&&delete n[r],e()}}class a{constructor(){this.loaded={}}loadTile(e,n){return t._(this,void 0,void 0,(function*(){const{uid:r,encoding:i,rawImageData:o,redFactor:s,greenFactor:a,blueFactor:l,baseShift:u}=e,c=o.width+2,h=o.height+2,p=t.a(o)?new t.R({width:c,height:h},yield t.bx(o,-1,-1,c,h)):o,f=new t.by(r,p,i,s,a,l,u);this.loaded=this.loaded||{},this.loaded[r]=f,n(null,f)}))}removeTile(t){const e=this.loaded,n=t.uid;e&&e[n]&&delete e[n]}}function l(t,e){if(0!==t.length){u(t[0],e);for(var n=1;n<t.length;n++)u(t[n],!e)}}function u(t,e){for(var n=0,r=0,i=0,o=t.length,s=o-1;i<o;s=i++){var a=(t[i][0]-t[s][0])*(t[s][1]+t[i][1]),l=n+a;r+=Math.abs(n)>=Math.abs(a)?n-l+a:a-l+n,n=l}n+r>=0!=!!e&&t.reverse()}var c=t.bz((function t(e,n){var r,i=e&&e.type;if("FeatureCollection"===i)for(r=0;r<e.features.length;r++)t(e.features[r],n);else if("GeometryCollection"===i)for(r=0;r<e.geometries.length;r++)t(e.geometries[r],n);else if("Feature"===i)t(e.geometry,n);else if("Polygon"===i)l(e.coordinates,n);else if("MultiPolygon"===i)for(r=0;r<e.coordinates.length;r++)l(e.coordinates[r],n);return e}));const h=t.bw.VectorTileFeature.prototype.toGeoJSON;var p={exports:{}},f=t.bA,d=t.bw.VectorTileFeature,g=m;function m(t,e){this.options=e||{},this.features=t,this.length=t.length}function y(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}m.prototype.feature=function(t){return new y(this.features[t],this.options.extent)},y.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var n=t[e],r=[],i=0;i<n.length;i++)r.push(new f(n[i][0],n[i][1]));this.geometry.push(r)}return this.geometry},y.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,n=-1/0,r=1/0,i=-1/0,o=0;o<t.length;o++)for(var s=t[o],a=0;a<s.length;a++){var l=s[a];e=Math.min(e,l.x),n=Math.max(n,l.x),r=Math.min(r,l.y),i=Math.max(i,l.y)}return[e,r,n,i]},y.prototype.toGeoJSON=d.prototype.toGeoJSON;var _=t.bB,v=g;function x(t){var e=new _;return function(t,e){for(var n in t.layers)e.writeMessage(3,b,t.layers[n])}(t,e),e.finish()}function b(t,e){var n;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<t.length;n++)r.feature=t.feature(n),e.writeMessage(2,w,r);var i=r.keys;for(n=0;n<i.length;n++)e.writeStringField(3,i[n]);var o=r.values;for(n=0;n<o.length;n++)e.writeMessage(4,T,o[n])}function w(t,e){var n=t.feature;void 0!==n.id&&e.writeVarintField(1,n.id),e.writeMessage(2,E,t),e.writeVarintField(3,n.type),e.writeMessage(4,C,n)}function E(t,e){var n=t.feature,r=t.keys,i=t.values,o=t.keycache,s=t.valuecache;for(var a in n.properties){var l=n.properties[a],u=o[a];if(null!==l){void 0===u&&(r.push(a),o[a]=u=r.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=s[h];void 0===p&&(i.push(l),s[h]=p=i.length-1),e.writeVarint(p)}}}function S(t,e){return(e<<3)+(7&t)}function I(t){return t<<1^t>>31}function C(t,e){for(var n=t.loadGeometry(),r=t.type,i=0,o=0,s=n.length,a=0;a<s;a++){var l=n[a],u=1;1===r&&(u=l.length),e.writeVarint(S(1,u));for(var c=3===r?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==r&&e.writeVarint(S(2,c-1));var p=l[h].x-i,f=l[h].y-o;e.writeVarint(I(p)),e.writeVarint(I(f)),i+=p,o+=f}3===r&&e.writeVarint(S(7,1))}}function T(t,e){var n=typeof t;"string"===n?e.writeStringField(1,t):"boolean"===n?e.writeBooleanField(7,t):"number"===n&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}p.exports=x,p.exports.fromVectorTileJs=x,p.exports.fromGeojsonVt=function(t,e){e=e||{};var n={};for(var r in t)n[r]=new v(t[r].features,e),n[r].name=r,n[r].version=e.version,n[r].extent=e.extent;return x({layers:n})},p.exports.GeoJSONWrapper=v;var P=t.bz(p.exports);const M={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},L=Math.fround||(A=new Float32Array(1),t=>(A[0]=+t,A[0]));var A;const k=3,N=5,D=6;class R{constructor(t){this.options=Object.assign(Object.create(M),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:n,maxZoom:r}=this.options;e&&console.time("total time");const i=`prepare ${t.length} points`;e&&console.time(i),this.points=t;const o=[];for(let e=0;e<t.length;e++){const n=t[e];if(!n.geometry)continue;const[r,i]=n.geometry.coordinates,s=L(F(r)),a=L(B(i));o.push(s,a,1/0,e,-1,1),this.options.reduce&&o.push(0)}let s=this.trees[r+1]=this._createTree(o);e&&console.timeEnd(i);for(let t=r;t>=n;t--){const n=+Date.now();s=this.trees[t]=this._createTree(this._cluster(s,t)),e&&console.log("z%d: %d clusters in %dms",t,s.numItems,+Date.now()-n)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let n=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let i=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,i=180;else if(n>i){const t=this.getClusters([n,r,180,o],e),s=this.getClusters([-180,r,i,o],e);return t.concat(s)}const s=this.trees[this._limitZoom(e)],a=s.range(F(n),B(o),F(i),B(r)),l=s.data,u=[];for(const t of a){const e=this.stride*t;u.push(l[e+N]>1?O(l,e,this.clusterProps):this.points[l[e+k]])}return u}getChildren(t){const e=this._getOriginId(t),n=this._getOriginZoom(t),r="No cluster with the specified id.",i=this.trees[n];if(!i)throw new Error(r);const o=i.data;if(e*this.stride>=o.length)throw new Error(r);const s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),a=i.within(o[e*this.stride],o[e*this.stride+1],s),l=[];for(const e of a){const n=e*this.stride;o[n+4]===t&&l.push(o[n+N]>1?O(o,n,this.clusterProps):this.points[o[n+k]])}if(0===l.length)throw new Error(r);return l}getLeaves(t,e,n){const r=[];return this._appendLeaves(r,t,e=e||10,n=n||0,0),r}getTile(t,e,n){const r=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:o,radius:s}=this.options,a=s/o,l=(n-a)/i,u=(n+1+a)/i,c={features:[]};return this._addTileFeatures(r.range((e-a)/i,l,(e+1+a)/i,u),r.data,e,n,i,c),0===e&&this._addTileFeatures(r.range(1-a/i,l,1,u),r.data,i,n,i,c),e===i-1&&this._addTileFeatures(r.range(0,l,a/i,u),r.data,-1,n,i,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const n=this.getChildren(t);if(e++,1!==n.length)break;t=n[0].properties.cluster_id}return e}_appendLeaves(t,e,n,r,i){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?i+o.point_count<=r?i+=o.point_count:i=this._appendLeaves(t,o.cluster_id,n,r,i):i<r?i++:t.push(e),t.length===n)break}return i}_createTree(e){const n=new t.av(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)n.add(e[t],e[t+1]);return n.finish(),n.data=e,n}_addTileFeatures(t,e,n,r,i,o){for(const s of t){const t=s*this.stride,a=e[t+N]>1;let l,u,c;if(a)l=z(e,t,this.clusterProps),u=e[t],c=e[t+1];else{const n=this.points[e[t+k]];l=n.properties;const[r,i]=n.geometry.coordinates;u=F(r),c=B(i)}const h={type:1,geometry:[[Math.round(this.options.extent*(u*i-n)),Math.round(this.options.extent*(c*i-r))]],tags:l};let p;p=a||this.options.generateId?e[t+k]:this.points[e[t+k]].id,void 0!==p&&(h.id=p),o.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:n,extent:r,reduce:i,minPoints:o}=this.options,s=n/(r*Math.pow(2,e)),a=t.data,l=[],u=this.stride;for(let n=0;n<a.length;n+=u){if(a[n+2]<=e)continue;a[n+2]=e;const r=a[n],c=a[n+1],h=t.within(a[n],a[n+1],s),p=a[n+N];let f=p;for(const t of h){const n=t*u;a[n+2]>e&&(f+=a[n+N])}if(f>p&&f>=o){let t,o=r*p,s=c*p,d=-1;const g=((n/u|0)<<5)+(e+1)+this.points.length;for(const r of h){const l=r*u;if(a[l+2]<=e)continue;a[l+2]=e;const c=a[l+N];o+=a[l]*c,s+=a[l+1]*c,a[l+4]=g,i&&(t||(t=this._map(a,n,!0),d=this.clusterProps.length,this.clusterProps.push(t)),i(t,this._map(a,l)))}a[n+4]=g,l.push(o/f,s/f,1/0,g,-1,f),i&&l.push(d)}else{for(let t=0;t<u;t++)l.push(a[n+t]);if(f>1)for(const t of h){const n=t*u;if(!(a[n+2]<=e)){a[n+2]=e;for(let t=0;t<u;t++)l.push(a[n+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,n){if(t[e+N]>1){const r=this.clusterProps[t[e+D]];return n?Object.assign({},r):r}const r=this.points[t[e+k]].properties,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}}function O(t,e,n){return{type:"Feature",id:t[e+k],properties:z(t,e,n),geometry:{type:"Point",coordinates:[(r=t[e],360*(r-.5)),U(t[e+1])]}};var r}function z(t,e,n){const r=t[e+N],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=t[e+D],s=-1===o?{}:Object.assign({},n[o]);return Object.assign(s,{cluster:!0,cluster_id:t[e+k],point_count:r,point_count_abbreviated:i})}function F(t){return t/360+.5}function B(t){const e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function U(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function V(t,e,n,r){for(var i,o=r,s=n-e>>1,a=n-e,l=t[e],u=t[e+1],c=t[n],h=t[n+1],p=e+3;p<n;p+=3){var f=j(t[p],t[p+1],l,u,c,h);if(f>o)i=p,o=f;else if(f===o){var d=Math.abs(p-s);d<a&&(i=p,a=d)}}o>r&&(i-e>3&&V(t,e,i,r),t[i+2]=o,n-i>3&&V(t,i,n,r))}function j(t,e,n,r,i,o){var s=i-n,a=o-r;if(0!==s||0!==a){var l=((t-n)*s+(e-r)*a)/(s*s+a*a);l>1?(n=i,r=o):l>0&&(n+=s*l,r+=a*l)}return(s=t-n)*s+(a=e-r)*a}function G(t,e,n,r){var i={id:void 0===t?null:t,type:e,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,n=t.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)q(t,e);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r<e.length;r++)q(t,e[r]);else if("MultiPolygon"===n)for(r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)q(t,e[r][i])}(i),i}function q(t,e){for(var n=0;n<e.length;n+=3)t.minX=Math.min(t.minX,e[n]),t.minY=Math.min(t.minY,e[n+1]),t.maxX=Math.max(t.maxX,e[n]),t.maxY=Math.max(t.maxY,e[n+1])}function $(t,e,n,r){if(e.geometry){var i=e.geometry.coordinates,o=e.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),a=[],l=e.id;if(n.promoteId?l=e.properties[n.promoteId]:n.generateId&&(l=r||0),"Point"===o)X(i,a);else if("MultiPoint"===o)for(var u=0;u<i.length;u++)X(i[u],a);else if("LineString"===o)Z(i,a,s,!1);else if("MultiLineString"===o){if(n.lineMetrics){for(u=0;u<i.length;u++)Z(i[u],a=[],s,!1),t.push(G(l,"LineString",a,e.properties));return}Y(i,a,s,!1)}else if("Polygon"===o)Y(i,a,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(u=0;u<e.geometry.geometries.length;u++)$(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},n,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<i.length;u++){var c=[];Y(i[u],c,s,!0),a.push(c)}}t.push(G(l,o,a,e.properties))}}function X(t,e){e.push(W(t[0])),e.push(H(t[1])),e.push(0)}function Z(t,e,n,r){for(var i,o,s=0,a=0;a<t.length;a++){var l=W(t[a][0]),u=H(t[a][1]);e.push(l),e.push(u),e.push(0),a>0&&(s+=r?(i*u-l*o)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=e.length-3;e[2]=1,V(e,0,c,n),e[c+2]=1,e.size=Math.abs(s),e.start=0,e.end=e.size}function Y(t,e,n,r){for(var i=0;i<t.length;i++){var o=[];Z(t[i],o,n,r),e.push(o)}}function W(t){return t/360+.5}function H(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function K(t,e,n,r,i,o,s,a){if(r/=e,o>=(n/=e)&&s<r)return t;if(s<n||o>=r)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,f=0===i?c.minX:c.minY,d=0===i?c.maxX:c.maxY;if(f>=n&&d<r)l.push(c);else if(!(d<n||f>=r)){var g=[];if("Point"===p||"MultiPoint"===p)J(h,g,n,r,i);else if("LineString"===p)Q(h,g,n,r,i,!1,a.lineMetrics);else if("MultiLineString"===p)et(h,g,n,r,i,!1);else if("Polygon"===p)et(h,g,n,r,i,!0);else if("MultiPolygon"===p)for(var m=0;m<h.length;m++){var y=[];et(h[m],y,n,r,i,!0),y.length&&g.push(y)}if(g.length){if(a.lineMetrics&&"LineString"===p){for(m=0;m<g.length;m++)l.push(G(c.id,p,g[m],c.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===g.length?(p="LineString",g=g[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===g.length?"Point":"MultiPoint"),l.push(G(c.id,p,g,c.tags))}}}return l.length?l:null}function J(t,e,n,r,i){for(var o=0;o<t.length;o+=3){var s=t[o+i];s>=n&&s<=r&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function Q(t,e,n,r,i,o,s){for(var a,l,u=tt(t),c=0===i?rt:it,h=t.start,p=0;p<t.length-3;p+=3){var f=t[p],d=t[p+1],g=t[p+2],m=t[p+3],y=t[p+4],_=0===i?f:d,v=0===i?m:y,x=!1;s&&(a=Math.sqrt(Math.pow(f-m,2)+Math.pow(d-y,2))),_<n?v>n&&(l=c(u,f,d,m,y,n),s&&(u.start=h+a*l)):_>r?v<r&&(l=c(u,f,d,m,y,r),s&&(u.start=h+a*l)):nt(u,f,d,g),v<n&&_>=n&&(l=c(u,f,d,m,y,n),x=!0),v>r&&_<=r&&(l=c(u,f,d,m,y,r),x=!0),!o&&x&&(s&&(u.end=h+a*l),e.push(u),u=tt(t)),s&&(h+=a)}var b=t.length-3;f=t[b],d=t[b+1],g=t[b+2],(_=0===i?f:d)>=n&&_<=r&&nt(u,f,d,g),b=u.length-3,o&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&nt(u,u[0],u[1],u[2]),u.length&&e.push(u)}function tt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function et(t,e,n,r,i,o){for(var s=0;s<t.length;s++)Q(t[s],e,n,r,i,o,!1)}function nt(t,e,n,r){t.push(e),t.push(n),t.push(r)}function rt(t,e,n,r,i,o){var s=(o-e)/(r-e);return t.push(o),t.push(n+(i-n)*s),t.push(1),s}function it(t,e,n,r,i,o){var s=(o-n)/(i-n);return t.push(e+(r-e)*s),t.push(o),t.push(1),s}function ot(t,e){for(var n=[],r=0;r<t.length;r++){var i,o=t[r],s=o.type;if("Point"===s||"MultiPoint"===s||"LineString"===s)i=st(o.geometry,e);else if("MultiLineString"===s||"Polygon"===s){i=[];for(var a=0;a<o.geometry.length;a++)i.push(st(o.geometry[a],e))}else if("MultiPolygon"===s)for(i=[],a=0;a<o.geometry.length;a++){for(var l=[],u=0;u<o.geometry[a].length;u++)l.push(st(o.geometry[a][u],e));i.push(l)}n.push(G(o.id,s,i,o.tags))}return n}function st(t,e){var n=[];n.size=t.size,void 0!==t.start&&(n.start=t.start,n.end=t.end);for(var r=0;r<t.length;r+=3)n.push(t[r]+e,t[r+1],t[r+2]);return n}function at(t,e){if(t.transformed)return t;var n,r,i,o=1<<t.z,s=t.x,a=t.y;for(n=0;n<t.features.length;n++){var l=t.features[n],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(r=0;r<u.length;r+=2)l.geometry.push(lt(u[r],u[r+1],e,o,s,a));else for(r=0;r<u.length;r++){var h=[];for(i=0;i<u[r].length;i+=2)h.push(lt(u[r][i],u[r][i+1],e,o,s,a));l.geometry.push(h)}}return t.transformed=!0,t}function lt(t,e,n,r,i,o){return[Math.round(n*(t*r-i)),Math.round(n*(e*r-o))]}function ut(t,e,n,r,i){for(var o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){s.numFeatures++,ct(s,t[a],o,i);var l=t[a].minX,u=t[a].minY,c=t[a].maxX,h=t[a].maxY;l<s.minX&&(s.minX=l),u<s.minY&&(s.minY=u),c>s.maxX&&(s.maxX=c),h>s.maxY&&(s.maxY=h)}return s}function ct(t,e,n,r){var i=e.geometry,o=e.type,s=[];if("Point"===o||"MultiPoint"===o)for(var a=0;a<i.length;a+=3)s.push(i[a]),s.push(i[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)ht(s,i,t,n,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(a=0;a<i.length;a++)ht(s,i[a],t,n,"Polygon"===o,0===a);else if("MultiPolygon"===o)for(var l=0;l<i.length;l++){var u=i[l];for(a=0;a<u.length;a++)ht(s,u[a],t,n,!0,0===a)}if(s.length){var c=e.tags||null;if("LineString"===o&&r.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var p={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function ht(t,e,n,r,i,o){var s=r*r;if(r>0&&e.size<(i?s:r))n.numPoints+=e.length/3;else{for(var a=[],l=0;l<e.length;l+=3)(0===r||e[l+2]>s)&&(n.numSimplified++,a.push(e[l]),a.push(e[l+1])),n.numPoints++;i&&function(t,e){for(var n=0,r=0,i=t.length,o=i-2;r<i;o=r,r+=2)n+=(t[r]-t[o])*(t[r+1]+t[o+1]);if(n>0===e)for(r=0,i=t.length;r<i/2;r+=2){var s=t[r],a=t[r+1];t[r]=t[i-2-r],t[r+1]=t[i-1-r],t[i-2-r]=s,t[i-1-r]=a}}(a,o),t.push(a)}}function pt(t,e){var n=(e=this.options=function(t,e){for(var n in e)t[n]=e[n];return t}(Object.create(this.options),e)).debug;if(n&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(t,e){var n=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)$(n,t.features[r],e,r);else $(n,"Feature"===t.type?t:{geometry:t},e);return n}(t,e);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,e){var n=e.buffer/e.extent,r=t,i=K(t,1,-1-n,n,0,-1,2,e),o=K(t,1,1-n,2+n,0,-1,2,e);return(i||o)&&(r=K(t,1,-n,1+n,0,-1,2,e)||[],i&&(r=ot(i,1).concat(r)),o&&(r=r.concat(ot(o,-1)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),n&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function ft(t,e,n){return 32*((1<<t)*n+e)+t}function dt(t,e){return e?t.properties[e]:t.id}function gt(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=dt(t,e);if("FeatureCollection"===t.type){const n=new Set;for(const r of t.features){const t=dt(r,e);if(null==t)return!1;if(n.has(t))return!1;n.add(t)}return!0}return!1}function mt(t,e){const n=new Map;if(null==t);else if("Feature"===t.type)n.set(dt(t,e),t);else for(const r of t.features)n.set(dt(r,e),r);return n}pt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},pt.prototype.splitTile=function(t,e,n,r,i,o,s){for(var a=[t,e,n,r],l=this.options,u=l.debug;a.length;){r=a.pop(),n=a.pop(),e=a.pop(),t=a.pop();var c=1<<e,h=ft(e,n,r),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=ut(t,e,n,r,l),this.tileCoords.push({z:e,x:n,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,r,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<<i-e;if(n!==Math.floor(o/d)||r!==Math.floor(s/d))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){u>1&&console.time("clipping");var g,m,y,_,v,x,b=.5*l.buffer/l.extent,w=.5-b,E=.5+b,S=1+b;g=m=y=_=null,v=K(t,c,n-b,n+E,0,p.minX,p.maxX,l),x=K(t,c,n+w,n+S,0,p.minX,p.maxX,l),t=null,v&&(g=K(v,c,r-b,r+E,1,p.minY,p.maxY,l),m=K(v,c,r+w,r+S,1,p.minY,p.maxY,l),v=null),x&&(y=K(x,c,r-b,r+E,1,p.minY,p.maxY,l),_=K(x,c,r+w,r+S,1,p.minY,p.maxY,l),x=null),u>1&&console.timeEnd("clipping"),a.push(g||[],e+1,2*n,2*r),a.push(m||[],e+1,2*n,2*r+1),a.push(y||[],e+1,2*n+1,2*r),a.push(_||[],e+1,2*n+1,2*r+1)}}},pt.prototype.getTile=function(t,e,n){var r=this.options,i=r.extent,o=r.debug;if(t<0||t>24)return null;var s=1<<t,a=ft(t,e=(e%s+s)%s,n);if(this.tiles[a])return at(this.tiles[a],i);o>1&&console.log("drilling down to z%d-%d-%d",t,e,n);for(var l,u=t,c=e,h=n;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[ft(u,c,h)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,h),o>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,n),o>1&&console.timeEnd("drilling down"),this.tiles[a]?at(this.tiles[a],i):null):null};class yt extends s{constructor(e,n,r,i){super(e,n,r),this._dataUpdateable=new Map,this.loadGeoJSON=(e,n)=>{const{promoteId:r}=e;if(e.request)return t.f(e.request,((t,e,i,o)=>{this._dataUpdateable=gt(e,r)?mt(e,r):void 0,n(t,e,i,o)}));if("string"==typeof e.data)try{const t=JSON.parse(e.data);this._dataUpdateable=gt(t,r)?mt(t,r):void 0,n(null,t)}catch(t){n(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}else e.dataDiff?this._dataUpdateable?(function(t,e,n){var r,i,o,s;if(e.removeAll&&t.clear(),e.remove)for(const n of e.remove)t.delete(n);if(e.add)for(const r of e.add){const e=dt(r,n);null!=e&&t.set(e,r)}if(e.update)for(const n of e.update){let e=t.get(n.id);if(null==e)continue;const a=!n.removeAllProperties&&((null===(r=n.removeProperties)||void 0===r?void 0:r.length)>0||(null===(i=n.addOrUpdateProperties)||void 0===i?void 0:i.length)>0);if((n.newGeometry||n.removeAllProperties||a)&&(e=Object.assign({},e),t.set(n.id,e),a&&(e.properties=Object.assign({},e.properties))),n.newGeometry&&(e.geometry=n.newGeometry),n.removeAllProperties)e.properties={};else if((null===(o=n.removeProperties)||void 0===o?void 0:o.length)>0)for(const t of n.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(s=n.addOrUpdateProperties)||void 0===s?void 0:s.length)>0)for(const{key:t,value:r}of n.addOrUpdateProperties)e.properties[t]=r}}(this._dataUpdateable,e.dataDiff,r),n(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):n(new Error(`Cannot update existing geojson data in ${e.source}`)):n(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,i&&(this.loadGeoJSON=i)}loadGeoJSONTile(e,n){const r=e.tileID.canonical;if(!this._geoJSONIndex)return n(null,null);const i=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!i)return n(null,null);const o=new class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.N,this.length=e.length,this._features=e}feature(e){return new class{constructor(e){this._feature=e,this.extent=t.N,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const n of this._feature.geometry)e.push([new t.P(n[0],n[1])]);return e}{const e=[];for(const n of this._feature.geometry){const r=[];for(const e of n)r.push(new t.P(e[0],e[1]));e.push(r)}return e}}toGeoJSON(t,e,n){return h.call(this,t,e,n)}}(this._features[e])}}(i.features);let s=P(o);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),n(null,{vectorTile:o,rawData:s.buffer})}loadData(e,n){var r;null===(r=this._pendingRequest)||void 0===r||r.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const i=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.bu(e.request);this._pendingCallback=n,this._pendingRequest=this.loadGeoJSON(e,((r,o)=>{if(delete this._pendingCallback,delete this._pendingRequest,r||!o)return n(r);if("object"!=typeof o)return n(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{c(o,!0);try{if(e.filter){const n=t.bC(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===n.result)throw new Error(n.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const r=o.features.filter((t=>n.value.evaluate({zoom:0},t)));o={type:"FeatureCollection",features:r}}this._geoJSONIndex=e.cluster?new R(function({superclusterOptions:e,clusterProperties:n}){if(!n||!e)return e;const r={},i={},o={accumulated:null,zoom:0},s={properties:null},a=Object.keys(n);for(const e of a){const[o,s]=n[e],a=t.bC(s),l=t.bC("string"==typeof o?[o,["accumulated"],["get",e]]:o);r[e]=a.value,i[e]=l.value}return e.map=t=>{s.properties=t;const e={};for(const t of a)e[t]=r[t].evaluate(o,s);return e},e.reduce=(t,e)=>{s.properties=e;for(const e of a)o.accumulated=t[e],t[e]=i[e].evaluate(o,s)},e}(e)).load(o.features):function(t,e){return new pt(t,e)}(o,e.geojsonVtOptions)}catch(r){return n(r)}this.loaded={};const s={};if(i){const t=i.finish();t&&(s.resourceTiming={},s.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}n(null,s)}}))}reloadTile(t,e){const n=this.loaded;return n&&n[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class _t{constructor(e){this.self=e,this.actor=new t.C(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:s,geojson:yt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.bD.isParsed())throw new Error("RTL text plugin already registered.");t.bD.applyArabicShaping=e.applyArabicShaping,t.bD.processBidirectionalText=e.processBidirectionalText,t.bD.processStyledBidirectionalText=e.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,n){this.availableImages[t]=e;for(const n in this.workerSources[t]){const r=this.workerSources[t][n];for(const t in r)r[t].availableImages=e}n()}setLayers(t,e,n){this.getLayerIndex(t).replace(e),n()}updateLayers(t,e,n){this.getLayerIndex(t).update(e.layers,e.removedIds),n()}loadTile(t,e,n){this.getWorkerSource(t,e.type,e.source).loadTile(e,n)}loadDEMTile(t,e,n){this.getDEMWorkerSource(t,e.source).loadTile(e,n)}reloadTile(t,e,n){this.getWorkerSource(t,e.type,e.source).reloadTile(e,n)}abortTile(t,e,n){this.getWorkerSource(t,e.type,e.source).abortTile(e,n)}removeTile(t,e,n){this.getWorkerSource(t,e.type,e.source).removeTile(e,n)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,n){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const r=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==r.removeSource?r.removeSource(e,n):n()}loadWorkerSource(t,e,n){try{this.self.importScripts(e.url),n()}catch(t){n(t.toString())}}syncRTLPluginState(e,n,r){try{t.bD.setState(n);const e=t.bD.getPluginURL();if(t.bD.isLoaded()&&!t.bD.isParsed()&&null!=e){this.self.importScripts(e);const n=t.bD.isParsed();r(n?void 0:new Error(`RTL Text Plugin failed to import scripts from ${e}`),n)}}catch(t){r(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let n=this.layerIndexes[t];return n||(n=this.layerIndexes[t]=new e),n}getWorkerSource(t,e,n){return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][n]||(this.workerSources[t][e][n]=new this.workerSourceTypes[e]({send:(e,n,r)=>{this.actor.send(e,n,r,t)}},this.getLayerIndex(t),this.getAvailableImages(t))),this.workerSources[t][e][n]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new a),this.demWorkerSources[t][e]}}return t.i()&&(self.worker=new _t(self)),_t})),r(0,(function(t){var e="3.6.2";class n{static testProp(t){if(!n.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in n.docStyle)return t[e];return t[0]}static create(t,e,n){const r=window.document.createElement(t);return void 0!==e&&(r.className=e),n&&n.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){n.docStyle&&n.selectProp&&(n.userSelect=n.docStyle[n.selectProp],n.docStyle[n.selectProp]="none")}static enableDrag(){n.docStyle&&n.selectProp&&(n.docStyle[n.selectProp]=n.userSelect)}static setTransform(t,e){t.style[n.transformProp]=e}static addEventListener(t,e,n,r={}){t.addEventListener(e,n,"passive"in r?r:r.capture)}static removeEventListener(t,e,n,r={}){t.removeEventListener(e,n,"passive"in r?r:r.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",n.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",n.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",n.suppressClickInternal,!0)}),0)}static mousePos(e,n){const r=e.getBoundingClientRect();return new t.P(n.clientX-r.left-e.clientLeft,n.clientY-r.top-e.clientTop)}static touchPos(e,n){const r=e.getBoundingClientRect(),i=[];for(let o=0;o<n.length;o++)i.push(new t.P(n[o].clientX-r.left-e.clientLeft,n[o].clientY-r.top-e.clientTop));return i}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}n.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,n.selectProp=n.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),n.transformProp=n.testProp(["transform","WebkitTransform"]);const r={supported:!1,testSupport:function(t){!s&&o&&(a?l(t):i=t)}};let i,o,s=!1,a=!1;function l(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.isContextLost())return;r.supported=!0}catch(t){}t.deleteTexture(e),s=!0}var u,c;"undefined"!=typeof document&&(o=document.createElement("img"),o.onload=function(){i&&l(i),i=null,a=!0},o.onerror=function(){s=!0,i=null},o.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let n,i,o,s;e.resetRequestQueue=()=>{n=[],i=0,o=0,s={}},e.addThrottleControl=t=>{const e=o++;return s[e]=t,e},e.removeThrottleControl=t=>{delete s[t],u()},e.getImage=(t,e,o=!0)=>{r.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*");const s={requestParameters:t,supportImageRefresh:o,callback:e,cancelled:!1,completed:!1,cancel:()=>{s.completed||s.cancelled||(s.cancelled=!0,s.innerRequest&&(s.innerRequest.cancel(),i--),u())}};return n.push(s),u(),s};const a=e=>{const{requestParameters:n,supportImageRefresh:r,callback:i}=e;return t.e(n,{type:"image"}),(!1!==r||t.i()||t.g(n.url)||n.headers&&!Object.keys(n.headers).reduce(((t,e)=>t&&"accept"===e),!0)?t.m:c)(n,((t,n,r,o)=>{l(e,i,t,n,r,o)}))},l=(e,n,r,o,s,a)=>{r?n(r):o instanceof HTMLImageElement||t.a(o)?n(null,o):o&&((e,n)=>{"function"==typeof createImageBitmap?t.b(e,n):t.d(e,n)})(o,((t,e)=>{null!=t?n(t):null!=e&&n(null,e,{cacheControl:s,expires:a})})),e.cancelled||(e.completed=!0,i--,u())},u=()=>{const e=(()=>{const t=Object.keys(s);let e=!1;if(t.length>0)for(const n of t)if(e=s[n](),e)break;return e})()?t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=i;t<e&&n.length>0;t++){const e=n.shift();if(e.cancelled){t--;continue}const r=a(e);i++,e.innerRequest=r}},c=(e,n)=>{const r=new Image,i=e.url;let o=!1;const s=e.credentials;return s&&"include"===s?r.crossOrigin="use-credentials":(s&&"same-origin"===s||!t.s(i))&&(r.crossOrigin="anonymous"),r.fetchPriority="high",r.onload=()=>{n(null,r),r.onerror=r.onload=null},r.onerror=()=>{o||n(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.")),r.onerror=r.onload=null},r.src=i,{cancel:()=>{o=!0,r.src=""}}}}(u||(u={})),u.resetRequestQueue(),function(t){t.Glyphs="Glyphs",t.Image="Image",t.Source="Source",t.SpriteImage="SpriteImage",t.SpriteJSON="SpriteJSON",t.Style="Style",t.Tile="Tile",t.Unknown="Unknown"}(c||(c={}));class h{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,n){const r=function(t){const e=t.match(p);if(!e)throw new Error(`Unable to parse URL "${t}"`);return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}(t);return r.path+=`${e}${n}`,function(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}(r)}setTransformRequest(t){this._transformRequestFn=t}}const p=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function f(e){var n=new t.A(3);return n[0]=e[0],n[1]=e[1],n[2]=e[2],n}var d,g=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t};d=new t.A(3),t.A!=Float32Array&&(d[0]=0,d[1]=0,d[2]=0);var m=function(t){var e=t[0],n=t[1];return e*e+n*n};function y(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const n=[];for(const{id:r,url:i}of t){const t=`${r}${i}`;-1===n.indexOf(t)&&(n.push(t),e.push({id:r,url:i}))}}return e}function _(e,n,r,i,o){if(i)return void e(i);if(o!==Object.values(n).length||o!==Object.values(r).length)return;const s={};for(const e in n){s[e]={};const i=t.h.getImageCanvasContext(r[e]),o=n[e];for(const t in o){const{width:n,height:r,x:a,y:l,sdf:u,pixelRatio:c,stretchX:h,stretchY:p,content:f}=o[t];s[e][t]={data:null,pixelRatio:c,sdf:u,stretchX:h,stretchY:p,content:f,spriteData:{width:n,height:r,x:a,y:l,context:i}}}}e(null,s)}!function(){var e=new t.A(2);t.A!=Float32Array&&(e[0]=0,e[1]=0)}();class v{constructor(t,e,n,r){this.context=t,this.format=n,this.texture=t.gl.createTexture(),this.update(e,r)}update(e,n,r){const{width:i,height:o}=e,s=!(this.size&&this.size[0]===i&&this.size[1]===o||r),{context:a}=this,{gl:l}=a;if(this.useMipmap=Boolean(n&&n.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!n||!1!==n.premultiply)),s)this.size=[i,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.a(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,i,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:n,y:s}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.a(e)?l.texSubImage2D(l.TEXTURE_2D,0,n,s,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,n,s,i,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,n){const{context:r}=this,{gl:i}=r;i.bindTexture(i.TEXTURE_2D,this.texture),n!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=i.LINEAR),t!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n||t),this.filter=t),e!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function x(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class b extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(e){const n=this.images[e];if(n&&!n.data&&n.spriteData){const e=n.spriteData;n.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),n.spriteData=null}return n}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(e,n){let r=!0;const i=n.data||n.spriteData;return this._validateStretch(n.stretchX,i&&i.width)||(this.fire(new t.j(new Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(n.stretchY,i&&i.height)||(this.fire(new t.j(new Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(n.content,n)||(this.fire(new t.j(new Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(t,e){if(!t)return!0;let n=0;for(const r of t){if(r[0]<n||r[1]<r[0]||e<r[1])return!1;n=r[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const n=e.spriteData,r=n&&n.width||e.data.width,i=n&&n.height||e.data.height;return!(t[0]<0||r<t[0]||t[1]<0||i<t[1]||t[2]<0||r<t[2]||t[3]<0||i<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,n=!0){const r=this.getImage(t);if(n&&(r.data.width!==e.data.width||r.data.height!==e.data.height))throw new Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=r.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,e){let n=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(n=!1);this.isLoaded()||n?this._notify(t,e):this.requestors.push({ids:t,callback:e})}_notify(e,n){const r={};for(const n of e){let e=this.getImage(n);e||(this.fire(new t.k("styleimagemissing",{id:n})),e=this.getImage(n)),e?r[n]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.w(`Image "${n}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,r)}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(e){const n=this.patterns[e],r=this.getImage(e);if(!r)return null;if(n&&n.position.version===r.version)return n.position;if(n)n.position.version=r.version;else{const n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},i=new t.I(n,r);this.patterns[e]={bin:n,position:i}}return this._updatePatternAtlas(),this.patterns[e].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new v(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:n,h:r}=t.p(e),i=this.atlasImage;i.resize({width:n||1,height:r||1});for(const e in this.patterns){const{bin:n}=this.patterns[e],r=n.x+1,o=n.y+1,s=this.getImage(e).data,a=s.width,l=s.height;t.R.copy(s,i,{x:0,y:0},{x:r,y:o},{width:a,height:l}),t.R.copy(s,i,{x:0,y:l-1},{x:r,y:o-1},{width:a,height:1}),t.R.copy(s,i,{x:0,y:0},{x:r,y:o+l},{width:a,height:1}),t.R.copy(s,i,{x:a-1,y:0},{x:r-1,y:o},{width:1,height:l}),t.R.copy(s,i,{x:0,y:0},{x:r+a,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const e=this.getImage(n);e||t.w(`Image with ID: "${n}" was not found`),x(e)&&this.updateImage(n,e)}}}const w=1e20;function E(t,e,n,r,i,o,s,a,l){for(let u=e;u<e+r;u++)S(t,n*o+u,o,i,s,a,l);for(let u=n;u<n+i;u++)S(t,u*o+e,1,r,s,a,l)}function S(t,e,n,r,i,o,s){o[0]=0,s[0]=-w,s[1]=w,i[0]=t[e];for(let a=1,l=0,u=0;a<r;a++){i[a]=t[e+a*n];const r=a*a;do{const t=o[l];u=(i[a]-i[t]+r-t*t)/(a-t)/2}while(u<=s[l]&&--l>-1);l++,o[l]=a,s[l]=u,s[l+1]=w}for(let a=0,l=0;a<r;a++){for(;s[l+1]<a;)l++;const r=o[l],u=a-r;t[e+a*n]=i[r]+u*u}}class I{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(e,n){const r=[];for(const t in e)for(const n of e[t])r.push({stack:t,id:n});t.o(r,(({stack:t,id:e},n)=>{let r=this.entries[t];r||(r=this.entries[t]={glyphs:{},requests:{},ranges:{}});let i=r.glyphs[e];if(void 0!==i)return void n(null,{stack:t,id:e,glyph:i});if(i=this._tinySDF(r,t,e),i)return r.glyphs[e]=i,void n(null,{stack:t,id:e,glyph:i});const o=Math.floor(e/256);if(256*o>65535)return void n(new Error("glyphs > 65535 not supported"));if(r.ranges[o])return void n(null,{stack:t,id:e,glyph:i});if(!this.url)return void n(new Error("glyphsUrl is not set"));let s=r.requests[o];s||(s=r.requests[o]=[],I.loadGlyphRange(t,o,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(r.glyphs[+t]=e[+t]);r.ranges[o]=!0}for(const n of s)n(t,e);delete r.requests[o]}))),s.push(((r,i)=>{r?n(r):i&&n(null,{stack:t,id:e,glyph:i[e]||null})}))}),((t,e)=>{if(t)n(t);else if(e){const t={};for(const{stack:n,id:r,glyph:i}of e)(t[n]||(t[n]={}))[r]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics};n(null,t)}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(t.u["CJK Unified Ideographs"](e)||t.u["Hangul Syllables"](e)||t.u.Hiragana(e)||t.u.Katakana(e))}_tinySDF(e,n,r){const i=this.localIdeographFontFamily;if(!i)return;if(!this._doesCharSupportLocalGlyph(r))return;let o=e.tinySDF;if(!o){let t="400";/bold/i.test(n)?t="900":/medium/i.test(n)?t="500":/light/i.test(n)&&(t="200"),o=e.tinySDF=new I.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:i,fontWeight:t})}const s=o.draw(String.fromCharCode(r));return{id:r,bitmap:new t.q({width:s.width||60,height:s.height||60},s.data),metrics:{width:s.glyphWidth/2||24,height:s.glyphHeight/2||24,left:s.glyphLeft/2+.5||0,top:s.glyphTop/2-27.5||-8,advance:s.glyphAdvance/2||24,isDoubleResolution:!0}}}}I.loadGlyphRange=function(e,n,r,i,o){const s=256*n,a=s+255,l=i.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${s}-${a}`),c.Glyphs);t.l(l,((e,n)=>{if(e)o(e);else if(n){const e={};for(const r of t.n(n))e[r.id]=r;o(null,e)}}))},I.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:n=8,cutoff:r=.25,fontFamily:i="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=e,this.cutoff=r,this.radius=n;const a=this.size=t+4*e,l=this._createCanvas(a),u=this.ctx=l.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${o} ${t}px ${i}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:o}=this.ctx.measureText(t),s=Math.ceil(n),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-i))),l=Math.min(this.size-this.buffer,s+Math.ceil(r)),u=a+2*this.buffer,c=l+2*this.buffer,h=Math.max(u*c,0),p=new Uint8ClampedArray(h),f={data:p,width:u,height:c,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return f;const{ctx:d,buffer:g,gridInner:m,gridOuter:y}=this;d.clearRect(g,g,a,l),d.fillText(t,g,g+s);const _=d.getImageData(g,g,a,l);y.fill(w,0,h),m.fill(0,0,h);for(let t=0;t<l;t++)for(let e=0;e<a;e++){const n=_.data[4*(t*a+e)+3]/255;if(0===n)continue;const r=(t+g)*u+e+g;if(1===n)y[r]=0,m[r]=w;else{const t=.5-n;y[r]=t>0?t*t:0,m[r]=t<0?t*t:0}}E(y,0,0,u,c,u,this.f,this.v,this.z),E(m,g,g,a,l,u,this.f,this.v,this.z);for(let t=0;t<h;t++){const e=Math.sqrt(y[t])-Math.sqrt(m[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return f}};class C{constructor(){this.specification=t.v.light.position}possiblyEvaluate(e,n){return t.z(e.expression.evaluate(n))}interpolate(e,n,r){return{x:t.B.number(e.x,n.x,r),y:t.B.number(e.y,n.y,r),z:t.B.number(e.z,n.z,r)}}}let T;class P extends t.E{constructor(e){super(),T=T||new t.r({anchor:new t.D(t.v.light.anchor),position:new C,color:new t.D(t.v.light.color),intensity:new t.D(t.v.light.intensity)}),this._transitionable=new t.T(T),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(t.t,e,n))for(const t in e){const n=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),n):this._transitionable.setValue(t,n)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(e,n,r){return(!r||!1!==r.validate)&&t.x(this,e.call(t.y,t.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.v})))}}class M{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const n=t.join(",")+String(e);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(t,e)),this.dashEntry[n]}getDashRanges(t,e,n){const r=[];let i=t.length%2==1?-t[t.length-1]*n:0,o=t[0]*n,s=!0;r.push({left:i,right:o,isDash:s,zeroLength:0===t[0]});let a=t[0];for(let e=1;e<t.length;e++){s=!s;const l=t[e];i=a*n,a+=l,o=a*n,r.push({left:i,right:o,isDash:s,zeroLength:0===l})}return r}addRoundDash(t,e,n){const r=e/2;for(let e=-n;e<=n;e++){const i=this.width*(this.nextRow+n+e);let o=0,s=t[o];for(let a=0;a<this.width;a++){a/s.right>1&&(s=t[++o]);const l=Math.abs(a-s.left),u=Math.abs(a-s.right),c=Math.min(l,u);let h;const p=e/n*(r+1);if(s.isDash){const t=r-Math.abs(p);h=Math.sqrt(c*c+t*t)}else h=r-Math.sqrt(c*c+p*p);this.data[i+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const n=t[e],r=t[e+1];n.zeroLength?t.splice(e,1):r&&r.isDash===n.isDash&&(r.left=n.left,t.splice(e,1))}const e=t[0],n=t[t.length-1];e.isDash===n.isDash&&(e.left=n.left-this.width,n.right=e.right+this.width);const r=this.width*this.nextRow;let i=0,o=t[i];for(let e=0;e<this.width;e++){e/o.right>1&&(o=t[++i]);const n=Math.abs(e-o.left),s=Math.abs(e-o.right),a=Math.min(n,s);this.data[r+e]=Math.max(0,Math.min(255,(o.isDash?a:-a)+128))}}addDash(e,n){const r=n?7:0,i=2*r+1;if(this.nextRow+i>this.height)return t.w("LineAtlas out of space"),null;let o=0;for(let t=0;t<e.length;t++)o+=e[t];if(0!==o){const t=this.width/o,i=this.getDashRanges(e,this.width,t);n?this.addRoundDash(i,t,r):this.addRegularDash(i)}const s={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=i,this.dirty=!0,s}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}class L{constructor(e,n,r){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=r;const i=this.workerPool.acquire(r);for(let e=0;e<i.length;e++){const o=new t.C(i[e],n,r);o.name=`Worker ${e}`,this.actors.push(o)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,n,r){t.o(this.actors,((t,r)=>{t.send(e,n,r)}),r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((t=>{t.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}}function A(e,n,r){const i=function(n,i){if(n)return r(n);if(i){const n=t.F(t.e(i,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);i.vector_layers&&(n.vectorLayers=i.vector_layers,n.vectorLayerIds=n.vectorLayers.map((t=>t.id))),r(null,n)}};return e.url?t.f(n.transformRequest(e.url,c.Source),i):t.h.frame((()=>i(null,e)))}class k{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(e){return this._ne=e instanceof t.L?new t.L(e.lng,e.lat):t.L.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.L?new t.L(e.lng,e.lat):t.L.convert(e),this}extend(e){const n=this._sw,r=this._ne;let i,o;if(e instanceof t.L)i=e,o=e;else{if(!(e instanceof k))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(k.convert(e)):this.extend(t.L.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.L.convert(e)):this;if(i=e._sw,o=e._ne,!i||!o)return this}return n||r?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),r.lng=Math.max(o.lng,r.lng),r.lat=Math.max(o.lat,r.lat)):(this._sw=new t.L(i.lng,i.lat),this._ne=new t.L(o.lng,o.lat)),this}getCenter(){return new t.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 t.L(this.getWest(),this.getNorth())}getSouthEast(){return new t.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(e){const{lng:n,lat:r}=t.L.convert(e);let i=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&i}static convert(t){return t instanceof k?t:t?new k(t):t}static fromLngLat(e,n=0){const r=360*n/40075017,i=r/Math.cos(Math.PI/180*e.lat);return new k(new t.L(e.lng-i,e.lat-r),new t.L(e.lng+i,e.lat+r))}}class N{constructor(t,e,n){this.bounds=k.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=n||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const n=Math.pow(2,e.z),r=Math.floor(t.G(this.bounds.getWest())*n),i=Math.floor(t.H(this.bounds.getNorth())*n),o=Math.ceil(t.G(this.bounds.getEast())*n),s=Math.ceil(t.H(this.bounds.getSouth())*n);return e.x>=r&&e.x<o&&e.y>=i&&e.y<s}}class D extends t.E{constructor(e,n,r,i){if(super(),this.load=()=>{this._loaded=!1,this.fire(new t.k("dataloading",{dataType:"source"})),this._tileJSONRequest=A(this._options,this.map._requestManager,((e,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.j(e)):n&&(t.e(this,n),n.bounds&&(this.tileBounds=new N(n.bounds,this.minzoom,this.maxzoom)),this.fire(new t.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.k("data",{dataType:"source",sourceDataType:"content"})))}))},this.serialize=()=>t.e({},this._options),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.F(n,["url","scheme","tileSize","promoteId"])),this._options=t.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(i)}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(t,e){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(n,c.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function i(n,r){return delete t.request,t.aborted?e(null):n&&404!==n.status?e(n):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadVectorData(r,this.map.painter),e(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}r.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=e:t.request=t.actor.send("reloadTile",r,i.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",r,i.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class R extends t.E{constructor(e,n,r,i){super(),this.id=e,this.dispatcher=r,this.setEventedParent(i),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.e({type:"raster"},n),t.e(this,t.F(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new t.k("dataloading",{dataType:"source"})),this._tileJSONRequest=A(this._options,this.map._requestManager,((e,n)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.j(e)):n&&(t.e(this,n),n.bounds&&(this.tileBounds=new N(n.bounds,this.minzoom,this.maxzoom)),this.fire(new t.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.k("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}serialize(){return t.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,e){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=u.getImage(this.map._requestManager.transformRequest(n,c.Tile),((n,r,i)=>{if(delete t.request,t.aborted)t.state="unloaded",e(null);else if(n)t.state="errored",e(n);else if(r){this.map._refreshExpiredTiles&&i&&t.setExpiryData(i);const n=this.map.painter.context,o=n.gl;t.texture=this.map.painter.getTileTexture(r.width),t.texture?t.texture.update(r,{useMipmap:!0}):(t.texture=new v(n,r,o.RGBA,{useMipmap:!0}),t.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),n.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax)),t.state="loaded",e(null)}}),this.map._refreshExpiredTiles)}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}class O extends R{constructor(e,n,r,i){super(e,n,r,i),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e,n){const r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(r,c.Tile);function o(t,r){t&&(e.state="errored",n(t)),r&&(e.dem=r,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",n(null))}e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.request=u.getImage(i,((r,i,s)=>t._(this,void 0,void 0,(function*(){if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(r)e.state="errored",n(r);else if(i){this.map._refreshExpiredTiles&&e.setExpiryData(s);const n=t.a(i)&&t.J()?i:yield function(e){return t._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&t.K()){const n=e.width+2,r=e.height+2;try{return new t.R({width:n,height:r},yield t.M(e,-1,-1,n,r))}catch(t){}}return t.h.getImageData(e,1)}))}(i),r={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",r,o))}}))),this.map._refreshExpiredTiles)}_getNeighboringTiles(e){const n=e.canonical,r=Math.pow(2,n.z),i=(n.x-1+r)%r,o=0===n.x?e.wrap-1:e.wrap,s=(n.x+1+r)%r,a=n.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.O(e.overscaledZ,o,n.z,i,n.y).key]={backfilled:!1},l[new t.O(e.overscaledZ,a,n.z,s,n.y).key]={backfilled:!1},n.y>0&&(l[new t.O(e.overscaledZ,o,n.z,i,n.y-1).key]={backfilled:!1},l[new t.O(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},l[new t.O(e.overscaledZ,a,n.z,s,n.y-1).key]={backfilled:!1}),n.y+1<r&&(l[new t.O(e.overscaledZ,o,n.z,i,n.y+1).key]={backfilled:!1},l[new t.O(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},l[new t.O(e.overscaledZ,a,n.z,s,n.y+1).key]={backfilled:!1}),l}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class z extends t.E{constructor(e,n,r,i){super(),this.load=()=>{this._updateWorkerData()},this.serialize=()=>t.e({},this._options,{type:this.type,data:this._data}),this.id=e,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=r.getActor(),this.setEventedParent(i),this._data=n.data,this._options=t.e({},n),this._collectResourceTiming=n.collectResourceTiming,void 0!==n.maxzoom&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const o=t.N/this.tileSize;this.workerOptions=t.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(void 0!==n.buffer?n.buffer:128)*o,tolerance:(void 0!==n.tolerance?n.tolerance:.375)*o,extent:t.N,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:void 0!==n.clusterMaxZoom?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:t.N,radius:(n.clusterRadius||50)*o,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,n,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:n},r),this}_updateWorkerData(e){const n=t.e({},this.workerOptions);e?n.dataDiff=e:"string"==typeof this._data?(n.request=this.map._requestManager.transformRequest(t.h.resolveURL(this._data),c.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,((e,n)=>{if(this._pendingLoads--,this._removed||n&&n.abandoned)return void this.fire(new t.k("dataabort",{dataType:"source"}));let r=null;if(n&&n.resourceTiming&&n.resourceTiming[this.id]&&(r=n.resourceTiming[this.id].slice(0)),e)return void this.fire(new t.j(e));const i={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&t.e(i,{resourceTiming:r}),this.fire(new t.k("data",Object.assign(Object.assign({},i),{sourceDataType:"metadata"}))),this.fire(new t.k("data",Object.assign(Object.assign({},i),{sourceDataType:"content"})))}))}loaded(){return 0===this._pendingLoads}loadTile(t,e){const n=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const r={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(n,r,((r,i)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):r?e(r):(t.loadVectorData(i,this.map.painter,"reloadTile"===n),e(null)))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var F=t.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class B extends t.E{constructor(e,n,r,i){super(),this.load=(e,n)=>{this._loaded=!1,this.fire(new t.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=u.getImage(this.map._requestManager.transformRequest(this.url,c.Image),((r,i)=>{this._request=null,this._loaded=!0,r?this.fire(new t.j(r)):i&&(this.image=i,e&&(this.coordinates=e),n&&n(),this._finishLoading())}))},this.prepare=()=>{if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,F.members)),this.boundsSegments||(this.boundsSegments=t.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new v(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new t.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=e,this.dispatcher=r,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=n}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(e){this.coordinates=e;const n=e.map(t.U.fromLngLat);this.tileID=function(e){let n=1/0,r=1/0,i=-1/0,o=-1/0;for(const t of e)n=Math.min(n,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y);const s=Math.max(i-n,o-r),a=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),l=Math.pow(2,a);return new t.W(a,Math.floor((n+i)/2*l),Math.floor((r+o)/2*l))}(n),this.minzoom=this.maxzoom=this.tileID.z;const r=n.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.V,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,t.N,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,t.N),this._boundsArray.emplaceBack(r[2].x,r[2].y,t.N,t.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}hasTransition(){return!1}}class U extends B{constructor(e,n,r,i){super(e,n,r,i),this.load=()=>{this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,c.Source).url);t.X(this.urls,((e,n)=>{this._loaded=!0,e?this.fire(new t.j(e)):n&&(this.video=n,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))},this.prepare=()=>{if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,F.members)),this.boundsSegments||(this.boundsSegments=t.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new v(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new t.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=n}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new t.j(new t.Y(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class V extends B{constructor(e,n,r,i){super(e,n,r,i),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 t.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 e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const n=this.map.painter.context,r=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,F.members)),this.boundsSegments||(this.boundsSegments=t.S.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new v(n,this.canvas,r.RGBA,{premultiply:!0});let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new t.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new t.j(new t.Y(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.j(new t.Y(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.j(new t.Y(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof HTMLCanvasElement||this.fire(new t.j(new t.Y(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.j(new t.Y(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const j={},G=t=>{switch(t){case"geojson":return z;case"image":return B;case"raster":return R;case"raster-dem":return O;case"vector":return D;case"video":return U;case"canvas":return V}return j[t]};function q(e,n){const r=t.Z();return t.$(r,r,[1,1,0]),t.a0(r,r,[.5*e.width,.5*e.height,1]),t.a1(r,r,e.calculatePosMatrix(n.toUnwrapped()))}function $(t,e,n,r,i,o){const s=function(t,e,n){if(t)for(const r of t){const t=e[r];if(t&&t.source===n&&"fill-extrusion"===t.type)return!0}else for(const t in e){const r=e[t];if(r.source===n&&"fill-extrusion"===r.type)return!0}return!1}(i&&i.layers,e,t.id),a=o.maxPitchScaleFactor(),l=t.tilesIn(r,a,s);l.sort(X);const u=[];for(const r of l)u.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(e,n,t._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,i,o,a,q(t.transform,r.tileID))});const c=function(t){const e={},n={};for(const r of t){const t=r.queryResults,i=r.wrappedTileID,o=n[i]=n[i]||{};for(const n in t){const r=t[n],i=o[n]=o[n]||{},s=e[n]=e[n]||[];for(const t of r)i[t.featureIndex]||(i[t.featureIndex]=!0,s.push(t))}}return e}(u);for(const e in c)c[e].forEach((e=>{const n=e.feature,r=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=r}));return c}function X(t,e){const n=t.tileID,r=e.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.canonical.x}class Z{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.a2(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(t,e){const n={};if(!e)return n;for(const r of t){const t=r.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){r.layers=t,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)n[e.id]=r}}return n}(e.buckets,n.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const n=this.buckets[e];if(n instanceof t.a4){if(this.hasSymbolBuckets=!0,!r)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const n=this.buckets[e];if(n instanceof t.a4&&n.hasRTLText){this.hasRTLText=!0,t.a5();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(t).queryRadius(e))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.a3}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const n=this.buckets[e];n.uploadPending()&&n.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new v(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new v(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,n,r,i,o,s,a,l,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:i,scale:o,tileSize:this.tileSize,pixelPosMatrix:u,transform:a,params:s,queryPadding:this.queryPadding*l},t,e,n):{}}querySourceFeatures(e,n){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const i=r.loadVTLayers(),o=n&&n.sourceLayer?n.sourceLayer:"",s=i._geojsonTileLayer||i[o];if(!s)return;const a=t.a6(n&&n.filter),{z:l,x:u,y:c}=this.tileID.canonical,h={z:l,x:u,y:c};for(let n=0;n<s.length;n++){const i=s.feature(n);if(a.needGeometry){const e=t.a7(i,!0);if(!a.filter(new t.a8(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!a.filter(new t.a8(this.tileID.overscaledZ),i))continue;const p=r.getId(i,o),f=new t.a9(i,l,u,c,p);f.tile=h,e.push(f)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const n=this.expirationTime;if(e.cacheControl){const n=t.aa(e.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(n)if(this.expirationTime<n)e=!0;else{const r=this.expirationTime-n;r?this.expirationTime=t+Math.max(r,3e4):e=!0}else e=!0;e?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const n=this.latestFeatureIndex.loadVTLayers();for(const r in this.buckets){if(!e.style.hasLayer(r))continue;const i=this.buckets[r],o=i.layers[0].sourceLayer||"_geojsonTileLayer",s=n[o],a=t[o];if(!s||!a||0===Object.keys(a).length)continue;i.update(a,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(i)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<t.h.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=t.h.now()+e}setDependencies(t,e){const n={};for(const t of e)n[t]=!0;this.dependencies[t]=n}hasDependency(t,e){for(const n of t){const t=this.dependencies[n];if(t)for(const n of e)if(t[n])return!0}return!1}}class Y{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,n){const r=t.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const i={value:e,timeout:void 0};if(void 0!==n&&(i.timeout=setTimeout((()=>{this.remove(t,i)}),n)),this.data[r].push(i),this.order.push(r),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const n=t.wrapped().key,r=void 0===e?0:this.data[n].indexOf(e),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const n in this.data)for(const r of this.data[n])t(r.value)||e.push(r);for(const t of e)this.remove(t.value.tileID,t)}}class W{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,r){const i=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][i]=this.stateChanges[e][i]||{},t.e(this.stateChanges[e][i],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==i&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][i]){this.deletedStates[e][i]={};for(const t in this.state[e][i])r[t]||(this.deletedStates[e][i][t]=null)}else for(const t in r)this.deletedStates[e]&&this.deletedStates[e][i]&&null===this.deletedStates[e][i][t]&&delete this.deletedStates[e][i][t]}removeFeatureState(t,e,n){if(null===this.deletedStates[t])return;const r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},n&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][n]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(n in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][n]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}getState(e,n){const r=String(n),i=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][n];if(null===t)return{};for(const e in t)delete i[e]}return i}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(e,n){const r={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const n={};for(const r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),n[r]=this.state[e][r];r[e]=n}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const n={};if(null===this.deletedStates[e])for(const t in this.state[e])n[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const n of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][n];n[t]=this.state[e][t]}r[e]=r[e]||{},t.e(r[e],n)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const t in e)e[t].setFeatureState(r,n)}}class H extends t.E{constructor(t,e,n){super(),this.id=t,this.dispatcher=n,this.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((t,e,n,r)=>{const i=new(G(e.type))(t,e,n,r);if(i.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${i.id}`);return i})(t,e,n,this),this._tiles={},this._cache=new Y(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new W,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,(()=>{})),this._source.fire(new t.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const n=this._tiles[e];n.upload(t),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(K).map((t=>t.key))}getRenderableIds(e){const n=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&n.push(this._tiles[t]);return e?n.sort(((e,n)=>{const r=e.tileID,i=n.tileID,o=new t.P(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),s=new t.P(i.canonical.x,i.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-i.overscaledZ||s.y-o.y||s.x-o.x})).map((t=>t.tileID.key)):n.map((t=>t.tileID)).sort(K).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}}_reloadTile(t,e){const n=this._tiles[t];n&&("loading"!==n.state&&(n.state=e),this._loadTile(n,this._tileLoaded.bind(this,n,t,e)))}_tileLoaded(e,n,r,i){if(i)return e.state="errored",void(404!==i.status?this._source.fire(new t.j(i,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=t.h.now(),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let r=0;r<e.length;r++){const i=e[r];if(t.neighboringTiles&&t.neighboringTiles[i]){const e=this.getTileByID(i);n(t,e),n(e,t)}}function n(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let n=e.tileID.canonical.x-t.tileID.canonical.x;const r=e.tileID.canonical.y-t.tileID.canonical.y,i=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===n&&0===r||Math.abs(r)>1||(Math.abs(n)>1&&(1===Math.abs(n+i)?n+=i:1===Math.abs(n-i)&&(n-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,n,r),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,n,r){for(const i in this._tiles){let o=this._tiles[i];if(r[i]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>n)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(s=t)}let a=s;for(;a.overscaledZ>e;)if(a=a.scaledTo(a.overscaledZ-1),t[a.key]){r[s.key]=s;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const n=this._loadedParentTiles[t.key];return n&&n.tileID.overscaledZ>=e?n:null}for(let n=t.overscaledZ-1;n>=e;n--){const e=t.scaledTo(n),r=this._getLoadedTile(e);if(r)return r}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(e){const n=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,i=Math.floor(n*r*(null===this._maxTileCacheZoomLevels?t.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._cache.setMaxSize(o)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const n in this._tiles){const r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}update(e,n){if(this.transform=e,this.terrain=n,!this._sourceLoaded||this._paused)return;let r;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.O(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=e.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:n}),this._source.hasTile&&(r=r.filter((t=>this._source.hasTile(t))))):r=[];const i=e.coveringZoomLevel(this._source),o=Math.max(i-H.maxOverzooming,this._source.minzoom),s=Math.max(i+H.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of r)if(e.canonical.z>this._source.minzoom){const n=e.scaledTo(e.canonical.z-1);t[n.key]=n;const r=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[r.key]=r}r=r.concat(Object.values(t))}const a=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new t.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(r,i);if(J(this._source.type)){const e={},a={},u=Object.keys(l),c=t.h.now();for(const t of u){const n=l[t],r=this._tiles[t];if(!r||0!==r.fadeEndTime&&r.fadeEndTime<=c)continue;const i=this.findLoadedParent(n,o);i&&(this._addTile(i.tileID),e[i.tileID.key]=i.tileID),a[t]=n}this._retainLoadedChildren(a,i,s,l);for(const t in e)l[t]||(this._coveredTiles[t]=!0,l[t]=e[t]);if(n){const t={},e={};for(const n of r)this._tiles[n.key].hasData()?t[n.key]=n:e[n.key]=n;for(const n in e){const r=e[n].children(this._source.maxzoom);this._tiles[r[0].key]&&this._tiles[r[1].key]&&this._tiles[r[2].key]&&this._tiles[r[3].key]&&(t[r[0].key]=l[r[0].key]=r[0],t[r[1].key]=l[r[1].key]=r[1],t[r[2].key]=l[r[2].key]=r[2],t[r[3].key]=l[r[3].key]=r[3],delete e[n])}for(const n in e){const r=this.findLoadedParent(e[n],this._source.minzoom);if(r){t[r.tileID.key]=l[r.tileID.key]=r.tileID;for(const e in t)t[e].isChildOf(r.tileID)&&delete t[e]}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}for(const t in l)this._tiles[t].clearFadeHold();const u=t.ab(this._tiles,l);for(const t of u){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){const n={},r={},i=Math.max(e-H.maxOverzooming,this._source.minzoom),o=Math.max(e+H.maxUnderzooming,this._source.minzoom),s={};for(const r of t){const t=this._addTile(r);n[r.key]=r,t.hasData()||e<this._source.maxzoom&&(s[r.key]=r)}this._retainLoadedChildren(s,e,o,n);for(const o of t){let t=this._tiles[o.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=o.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){n[t.key]=t;continue}}else{const t=o.children(this._source.maxzoom);if(n[t[0].key]&&n[t[1].key]&&n[t[2].key]&&n[t[3].key])continue}let s=t.wasRequested();for(let e=o.overscaledZ-1;e>=i;--e){const i=o.scaledTo(e);if(r[i.key])break;if(r[i.key]=!0,t=this.getTile(i),!t&&s&&(t=this._addTile(i)),t){const e=t.hasData();if((s||e)&&(n[i.key]=i),s=t.wasRequested(),e)break}}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let n,r=this._tiles[t].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){n=this._loadedParentTiles[r.key];break}e.push(r.key);const t=r.scaledTo(r.overscaledZ-1);if(n=this._getLoadedTile(t),n)break;r=t}for(const t of e)this._loadedParentTiles[t]=n}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));const r=n;return n||(n=new Z(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,e.key,n.state))),n.uses++,this._tiles[e.key]=n,r||this._source.fire(new t.k("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),n))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(e,n,r){const i=[],o=this.transform;if(!o)return i;const s=r?o.getCameraQueryGeometry(e):e,a=e.map((t=>o.pointCoordinate(t,this.terrain))),l=s.map((t=>o.pointCoordinate(t,this.terrain))),u=this.getIds();let c=1/0,h=1/0,p=-1/0,f=-1/0;for(const t of l)c=Math.min(c,t.x),h=Math.min(h,t.y),p=Math.max(p,t.x),f=Math.max(f,t.y);for(let e=0;e<u.length;e++){const r=this._tiles[u[e]];if(r.holdingForFade())continue;const s=r.tileID,d=Math.pow(2,o.zoom-r.tileID.overscaledZ),g=n*r.queryPadding*t.N/r.tileSize/d,m=[s.getTilePoint(new t.U(c,h)),s.getTilePoint(new t.U(p,f))];if(m[0].x-g<t.N&&m[0].y-g<t.N&&m[1].x+g>=0&&m[1].y+g>=0){const t=a.map((t=>s.getTilePoint(t))),e=l.map((t=>s.getTilePoint(t)));i.push({tile:r,tileID:s,queryGeometry:t,cameraQueryGeometry:e,scale:d})}}return i}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(J(this._source.type)){const e=t.h.now();for(const t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(t,e,n){this._state.updateState(t=t||"_geojsonTileLayer",e,n)}removeFeatureState(t,e,n){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,n)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,n){const r=this._tiles[t];r&&r.setDependencies(e,n)}reloadTilesForDependencies(t,e){for(const n in this._tiles)this._tiles[n].hasDependency(t,e)&&this._reloadTile(n,"reloading");this._cache.filter((n=>!n.hasDependency(t,e)))}}function K(t,e){const n=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-n||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function J(t){return"raster"===t||"image"===t||"video"===t}H.maxOverzooming=10,H.maxUnderzooming=3;const Q="mapboxgl_preloaded_worker_pool";class tt{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<tt.workerCount;)this.workers.push(new Worker(t.c.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((t=>{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Q]}numActive(){return Object.keys(this.active).length}}const et=Math.floor(t.h.hardwareConcurrency/2);let nt;function rt(){return nt||(nt=new tt),nt}tt.workerCount=t.ac(globalThis)?Math.max(Math.min(et,3),1):1;class it{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.ad(e,0,1);let n=1,r=this._distances[n];const i=e*this.paddedLength+this.padding;for(;r<i&&n<this._distances.length;)r=this._distances[++n];const o=n-1,s=this._distances[o],a=r-s,l=a>0?(i-s)/a:0;return this.points[o].mult(1-l).add(this.points[n].mult(l))}}function ot(t,e){let n=!0;return"always"===t||"never"!==t&&"never"!==e||(n=!1),n}class st{constructor(t,e,n){const r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/n),this.yCellCount=Math.ceil(e/n);for(let t=0;t<this.xCellCount*this.yCellCount;t++)r.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,n,r,i){this._forEachCell(e,n,r,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}insertCircle(t,e,n,r){this._forEachCell(e-r,n-r,e+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(n),this.circles.push(r)}_insertBoxCell(t,e,n,r,i,o){this.boxCells[i].push(o)}_insertCircleCell(t,e,n,r,i,o){this.circleCells[i].push(o)}_query(t,e,n,r,i,o,s){if(n<0||t>this.width||r<0||e>this.height)return[];const a=[];if(t<=0&&e<=0&&this.width<=n&&this.height<=r){if(i)return[{key:null,x1:t,y1:e,x2:n,y2:r}];for(let t=0;t<this.boxKeys.length;t++)a.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],n=this.circles[3*t+1],r=this.circles[3*t+2];a.push({key:this.circleKeys[t],x1:e-r,y1:n-r,x2:e+r,y2:n+r})}}else this._forEachCell(t,e,n,r,this._queryCell,a,{hitTest:i,overlapMode:o,seenUids:{box:{},circle:{}}},s);return a}query(t,e,n,r){return this._query(t,e,n,r,!1,null)}hitTest(t,e,n,r,i,o){return this._query(t,e,n,r,!0,i,o).length>0}hitTestCircle(t,e,n,r,i){const o=t-n,s=t+n,a=e-n,l=e+n;if(s<0||o>this.width||l<0||a>this.height)return!1;const u=[];return this._forEachCell(o,a,s,l,this._queryCellCircle,u,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radius:n},seenUids:{box:{},circle:{}}},i),u.length>0}_queryCell(t,e,n,r,i,o,s,a){const{seenUids:l,hitTest:u,overlapMode:c}=s,h=this.boxCells[i];if(null!==h){const i=this.bboxes;for(const s of h)if(!l.box[s]){l.box[s]=!0;const h=4*s,p=this.boxKeys[s];if(t<=i[h+2]&&e<=i[h+3]&&n>=i[h+0]&&r>=i[h+1]&&(!a||a(p))&&(!u||!ot(c,p.overlapMode))&&(o.push({key:p,x1:i[h],y1:i[h+1],x2:i[h+2],y2:i[h+3]}),u))return!0}}const p=this.circleCells[i];if(null!==p){const i=this.circles;for(const s of p)if(!l.circle[s]){l.circle[s]=!0;const h=3*s,p=this.circleKeys[s];if(this._circleAndRectCollide(i[h],i[h+1],i[h+2],t,e,n,r)&&(!a||a(p))&&(!u||!ot(c,p.overlapMode))){const t=i[h],e=i[h+1],n=i[h+2];if(o.push({key:p,x1:t-n,y1:e-n,x2:t+n,y2:e+n}),u)return!0}}}return!1}_queryCellCircle(t,e,n,r,i,o,s,a){const{circle:l,seenUids:u,overlapMode:c}=s,h=this.boxCells[i];if(null!==h){const t=this.bboxes;for(const e of h)if(!u.box[e]){u.box[e]=!0;const n=4*e,r=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[n+0],t[n+1],t[n+2],t[n+3])&&(!a||a(r))&&!ot(c,r.overlapMode))return o.push(!0),!0}}const p=this.circleCells[i];if(null!==p){const t=this.circles;for(const e of p)if(!u.circle[e]){u.circle[e]=!0;const n=3*e,r=this.circleKeys[e];if(this._circlesCollide(t[n],t[n+1],t[n+2],l.x,l.y,l.radius)&&(!a||a(r))&&!ot(c,r.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,n,r,i,o,s,a){const l=this._convertToXCellCoord(t),u=this._convertToYCellCoord(e),c=this._convertToXCellCoord(n),h=this._convertToYCellCoord(r);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++)if(i.call(this,t,e,n,r,this.xCellCount*l+p,o,s,a))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,n,r,i,o){const s=r-t,a=i-e,l=n+o;return l*l>s*s+a*a}_circleAndRectCollide(t,e,n,r,i,o,s){const a=(o-r)/2,l=Math.abs(t-(r+a));if(l>a+n)return!1;const u=(s-i)/2,c=Math.abs(e-(i+u));if(c>u+n)return!1;if(l<=a||c<=u)return!0;const h=l-a,p=c-u;return h*h+p*p<=n*n}}function at(e,n,r,i,o){const s=t.Z();return n?(t.a0(s,s,[1/o,1/o,1]),r||t.ae(s,s,i.angle)):t.a1(s,i.labelPlaneMatrix,e),s}function lt(e,n,r,i,o){if(n){const n=t.af(e);return t.a0(n,n,[o,o,1]),r||t.ae(n,n,-i.angle),n}return i.glCoordMatrix}function ut(e,n,r){let i;r?(i=[e.x,e.y,r(e.x,e.y),1],t.ag(i,i,n)):(i=[e.x,e.y,0,1],Et(i,i,n));const o=i[3];return{point:new t.P(i[0]/o,i[1]/o),signedDistanceFromCamera:o}}function ct(t,e){return.5+t/e*.5}function ht(t,e){const n=t[0]/t[3],r=t[1]/t[3];return n>=-e[0]&&n<=e[0]&&r>=-e[1]&&r<=e[1]}function pt(e,n,r,i,o,s,a,l,u,c){const h=i?e.textSizeData:e.iconSizeData,p=t.ah(h,r.transform.zoom),f=[256/r.width*2+1,256/r.height*2+1],d=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;d.clear();const g=e.lineVertexArray,m=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,y=r.transform.width/r.transform.height;let _=!1;for(let i=0;i<m.length;i++){const v=m.get(i);if(v.hidden||v.writingMode===t.ai.vertical&&!_){wt(v.numGlyphs,d);continue}let x;if(_=!1,c?(x=[v.anchorX,v.anchorY,c(v.anchorX,v.anchorY),1],t.ag(x,x,n)):(x=[v.anchorX,v.anchorY,0,1],Et(x,x,n)),!ht(x,f)){wt(v.numGlyphs,d);continue}const b=ct(r.transform.cameraToCenterDistance,x[3]),w=t.aj(h,p,v),E=a?w/b:w*b,S=new t.P(v.anchorX,v.anchorY),I=ut(S,o,c).point,C={projections:{},offsets:{}},T=gt(v,E,!1,l,n,o,s,e.glyphOffsetArray,g,d,I,S,C,y,u,c);_=T.useVertical,(T.notEnoughRoom||_||T.needsFlipping&&gt(v,E,!0,l,n,o,s,e.glyphOffsetArray,g,d,I,S,C,y,u,c).notEnoughRoom)&&wt(v.numGlyphs,d)}i?e.text.dynamicLayoutVertexBuffer.updateData(d):e.icon.dynamicLayoutVertexBuffer.updateData(d)}function ft(t,e,n,r,i,o,s,a,l,u,c,h,p){const f=a.glyphStartIndex+a.numGlyphs,d=a.lineStartIndex,g=a.lineStartIndex+a.lineLength,m=e.getoffsetX(a.glyphStartIndex),y=e.getoffsetX(f-1),_=xt(t*m,n,r,i,o,s,a.segment,d,g,l,u,c,h,p);if(!_)return null;const v=xt(t*y,n,r,i,o,s,a.segment,d,g,l,u,c,h,p);return v?{first:_,last:v}:null}function dt(e,n,r,i){return e===t.ai.horizontal&&Math.abs(r.y-n.y)>Math.abs(r.x-n.x)*i?{useVertical:!0}:(e===t.ai.vertical?n.y<r.y:n.x>r.x)?{needsFlipping:!0}:null}function gt(e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m){const y=n/24,_=e.lineOffsetX*y,v=e.lineOffsetY*y;let x;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,n=e.lineStartIndex,o=e.lineStartIndex+e.lineLength,c=ft(y,l,_,v,r,h,p,e,u,s,f,g,m);if(!c)return{notEnoughRoom:!0};const b=ut(c.first.point,a,m).point,w=ut(c.last.point,a,m).point;if(i&&!r){const t=dt(e.writingMode,b,w,d);if(t)return t}x=[c.first];for(let i=e.glyphStartIndex+1;i<t-1;i++)x.push(xt(y*l.getoffsetX(i),_,v,r,h,p,e.segment,n,o,u,s,f,g,m));x.push(c.last)}else{if(i&&!r){const n=ut(p,o,m).point,r=e.lineStartIndex+e.segment+1,i=new t.P(u.getx(r),u.gety(r)),s=ut(i,o,m),a=s.signedDistanceFromCamera>0?s.point:mt(p,i,n,1,o,m),l=dt(e.writingMode,n,a,d);if(l)return l}const n=xt(y*l.getoffsetX(e.glyphStartIndex),_,v,r,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,s,f,g,m);if(!n)return{notEnoughRoom:!0};x=[n]}for(const e of x)t.ak(c,e.point,e.angle);return{}}function mt(t,e,n,r,i,o){const s=ut(t.add(t.sub(e)._unit()),i,o).point,a=n.sub(s);return n.add(a._mult(r/a.mag()))}function yt(e,n){const{projectionCache:r,lineVertexArray:i,labelPlaneMatrix:o,tileAnchorPoint:s,distanceFromAnchor:a,getElevation:l,previousVertex:u,direction:c,absOffsetX:h}=n;if(r.projections[e])return r.projections[e];const p=new t.P(i.getx(e),i.gety(e)),f=ut(p,o,l);if(f.signedDistanceFromCamera>0)return r.projections[e]=f.point,f.point;const d=e-c;return mt(0===a?s:new t.P(i.getx(d),i.gety(d)),p,u,h-a+1,o,l)}function _t(t,e,n){return t._unit()._perp()._mult(e*n)}function vt(e,n,r,i,o,s,a,l){const{projectionCache:u,direction:c}=l;if(u.offsets[e])return u.offsets[e];const h=r.add(n);if(e+c<i||e+c>=o)return u.offsets[e]=h,h;const p=yt(e+c,l),f=_t(p.sub(r),a,c),d=r.add(f),g=p.add(f);return u.offsets[e]=t.al(s,h,d,g)||h,u.offsets[e]}function xt(t,e,n,r,i,o,s,a,l,u,c,h,p,f){const d=r?t-e:t+e;let g=d>0?1:-1,m=0;r&&(g*=-1,m=Math.PI),g<0&&(m+=Math.PI);let y,_,v=g>0?a+s:a+s+1,x=i,b=i,w=0,E=0;const S=Math.abs(d),I=[];let C;for(;w+E<=S;){if(v+=g,v<a||v>=l)return null;w+=E,b=x,_=y;const t={projectionCache:h,lineVertexArray:u,labelPlaneMatrix:c,tileAnchorPoint:o,distanceFromAnchor:w,getElevation:f,previousVertex:b,direction:g,absOffsetX:S};if(x=yt(v,t),0===n)I.push(b),C=x.sub(b);else{let e;const r=x.sub(b);e=0===r.mag()?_t(yt(v+g,t).sub(x),n,g):_t(r,n,g),_||(_=b.add(e)),y=vt(v,e,x,a,l,_,n,t),I.push(_),C=y.sub(_)}E=C.mag()}const T=C._mult((S-w)/E)._add(_||b),P=m+Math.atan2(x.y-b.y,x.x-b.x);return I.push(T),{point:T,angle:p?P:0,path:I}}const bt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function wt(t,e){for(let n=0;n<t;n++){const t=e.length;e.resize(t+4),e.float32.set(bt,3*t)}}function Et(t,e,n){const r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t[3]=n[3]*r+n[7]*i+n[15],t}const St=100;class It{constructor(t,e=new st(t.width+200,t.height+200,25),n=new st(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=n,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+St,this.screenBottomBoundary=t.height+St,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,n,r,i,o){const s=this.projectAndGetPerspectiveRatio(r,t.anchorPointX,t.anchorPointY,o),a=n*s.perspectiveRatio,l=t.x1*a+s.point.x,u=t.y1*a+s.point.y,c=t.x2*a+s.point.x,h=t.y2*a+s.point.y;return!this.isInsideGrid(l,u,c,h)||"always"!==e&&this.grid.hitTest(l,u,c,h,e,i)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,u,c,h],offscreen:this.isOffscreen(l,u,c,h)}}placeCollisionCircles(e,n,r,i,o,s,a,l,u,c,h,p,f,d){const g=[],m=new t.P(n.anchorX,n.anchorY),y=ut(m,s,d),_=ct(this.transform.cameraToCenterDistance,y.signedDistanceFromCamera),v=(c?o/_:o*_)/t.ap,x=ut(m,a,d).point,b=ft(v,i,n.lineOffsetX*v,n.lineOffsetY*v,!1,x,m,n,r,a,{projections:{},offsets:{}},!1,d);let w=!1,E=!1,S=!0;if(b){const n=.5*p*_+f,r=new t.P(-100,-100),i=new t.P(this.screenRightBoundary,this.screenBottomBoundary),o=new it,s=b.first,a=b.last;let c=[];for(let t=s.path.length-1;t>=1;t--)c.push(s.path[t]);for(let t=1;t<a.path.length;t++)c.push(a.path[t]);const m=2.5*n;if(l){const t=c.map((t=>ut(t,l,d)));c=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let y=[];if(c.length>0){const e=c[0].clone(),n=c[0].clone();for(let t=1;t<c.length;t++)e.x=Math.min(e.x,c[t].x),e.y=Math.min(e.y,c[t].y),n.x=Math.max(n.x,c[t].x),n.y=Math.max(n.y,c[t].y);y=e.x>=r.x&&n.x<=i.x&&e.y>=r.y&&n.y<=i.y?[c]:n.x<r.x||e.x>i.x||n.y<r.y||e.y>i.y?[]:t.am([c],r.x,r.y,i.x,i.y)}for(const t of y){o.reset(t,.25*n);let r=0;r=o.length<=.5*n?1:Math.ceil(o.paddedLength/m)+1;for(let t=0;t<r;t++){const i=t/Math.max(r-1,1),s=o.lerp(i),a=s.x+St,l=s.y+St;g.push(a,l,n,0);const c=a-n,p=l-n,f=a+n,d=l+n;if(S=S&&this.isOffscreen(c,p,f,d),E=E||this.isInsideGrid(c,p,f,d),"always"!==e&&this.grid.hitTestCircle(a,l,n,e,h)&&(w=!0,!u))return{circles:[],offscreen:!1,collisionDetected:w}}}}return{circles:!u&&w||!E||_<this.perspectiveRatioCutoff?[]:g,offscreen:S,collisionDetected:w}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const n=[];let r=1/0,i=1/0,o=-1/0,s=-1/0;for(const a of e){const e=new t.P(a.x+St,a.y+St);r=Math.min(r,e.x),i=Math.min(i,e.y),o=Math.max(o,e.x),s=Math.max(s,e.y),n.push(e)}const a=this.grid.query(r,i,o,s).concat(this.ignoredGrid.query(r,i,o,s)),l={},u={};for(const e of a){const r=e.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const i=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.an(n,i)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===u[r.bucketInstanceId]&&(u[r.bucketInstanceId]=[]),u[r.bucketInstanceId].push(r.featureIndex))}return u}insertCollisionBox(t,e,n,r,i,o){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:i,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,n,r,i,o){const s=n?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:i,collisionGroupID:o,overlapMode:e};for(let e=0;e<t.length;e+=4)s.insertCircle(a,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(e,n,r,i){let o;return i?(o=[n,r,i(n,r),1],t.ag(o,o,e)):(o=[n,r,0,1],Et(o,o,e)),{point:new t.P((o[0]/o[3]+1)/2*this.transform.width+St,(-o[1]/o[3]+1)/2*this.transform.height+St),perspectiveRatio:.5+this.transform.cameraToCenterDistance/o[3]*.5}}isOffscreen(t,e,n,r){return n<St||t>=this.screenRightBoundary||r<St||e>this.screenBottomBoundary}isInsideGrid(t,e,n,r){return n>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const e=t.ao([]);return t.$(e,e,[-100,-100,0]),e}}function Ct(e,n,r){return n*(t.N/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}class Tt{constructor(t,e,n,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&n?1:0,this.placed=n}isHidden(){return 0===this.opacity&&!this.placed}}class Pt{constructor(t,e,n,r,i){this.text=new Tt(t?t.text:null,e,n,i),this.icon=new Tt(t?t.icon:null,e,r,i)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Mt{constructor(t,e,n){this.text=t,this.icon=e,this.skipFade=n}}class Lt{constructor(){this.invProjMatrix=t.Z(),this.viewportMatrix=t.Z(),this.circles=[]}}class At{constructor(t,e,n,r,i){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=i}}class kt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function Nt(e,n,r,i,o){const{horizontalAlign:s,verticalAlign:a}=t.au(e);return new t.P(-(s-.5)*n+i[0]*o,-(a-.5)*r+i[1]*o)}function Dt(e,n,r,i,o,s){const{x1:a,x2:l,y1:u,y2:c,anchorPointX:h,anchorPointY:p}=e,f=new t.P(n,r);return i&&f._rotate(o?s:-s),{x1:a+f.x,y1:u+f.y,x2:l+f.x,y2:c+f.y,anchorPointX:h,anchorPointY:p}}class Rt{constructor(t,e,n,r,i){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new It(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new kt(r),this.collisionCircleArrays={},this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,n,r,i){const o=r.getBucket(n),s=r.latestFeatureIndex;if(!o||!s||n.id!==o.layerIds[0])return;const a=r.collisionBoxArray,l=o.layers[0].layout,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),c=r.tileSize/t.N,h=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),f="map"===l.get("text-rotation-alignment"),d=Ct(r,1,this.transform.zoom),g=at(h,p,f,this.transform,d);let m=null;if(p){const e=lt(h,p,f,this.transform,d);m=t.a1([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[o.bucketInstanceId]=new At(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,r.tileID);const y={bucket:o,layout:l,posMatrix:h,textLabelPlaneMatrix:g,labelToScreenMatrix:m,scale:u,textPixelRatio:c,holdingForFade:r.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:t.ah(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(i)for(const t of o.sortKeyRanges){const{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i}=t;e.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i,parameters:y})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:y})}attemptAnchorPlacement(e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m){const y=t.aq[e.textAnchor],_=[e.textOffset0,e.textOffset1],v=Nt(y,r,i,_,o),x=this.collisionIndex.placeCollisionBox(Dt(n,v.x,v.y,s,a,this.transform.angle),h,l,u,c.predicate,m);if((!g||0!==this.collisionIndex.placeCollisionBox(Dt(g,v.x,v.y,s,a,this.transform.angle),h,l,u,c.predicate,m).box.length)&&x.box.length>0){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(t=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:_,width:r,height:i,anchor:y,textBoxScale:o,prevAnchor:t},this.markUsedJustification(f,y,p,d),f.allowVerticalPlacement&&(this.markUsedOrientation(f,d,p),this.placedOrientations[p.crossTileID]=d),{shift:v,placedGlyphBoxes:x}}}placeLayerBucketPart(e,n,r){const{bucket:i,layout:o,posMatrix:s,textLabelPlaneMatrix:a,labelToScreenMatrix:l,textPixelRatio:u,holdingForFade:c,collisionBoxArray:h,partiallyEvaluatedTextSize:p,collisionGroup:f}=e.parameters,d=o.get("text-optional"),g=o.get("icon-optional"),m=t.ar(o,"text-overlap","text-allow-overlap"),y="always"===m,_=t.ar(o,"icon-overlap","icon-allow-overlap"),v="always"===_,x="map"===o.get("text-rotation-alignment"),b="map"===o.get("text-pitch-alignment"),w="none"!==o.get("icon-text-fit"),E="viewport-y"===o.get("symbol-z-order"),S=y&&(v||!i.hasIconData()||g),I=v&&(y||!i.hasTextData()||d);!i.collisionArrays&&h&&i.deserializeCollisionBoxes(h);const C=this.retainedQueryData[i.bucketInstanceId].tileID,T=this.terrain?(t,e)=>this.terrain.getElevation(C,t,e):null,P=(e,h)=>{var v,E;if(n[e.crossTileID])return;if(c)return void(this.placements[e.crossTileID]=new Mt(!1,!1,!1));let C=!1,P=!1,M=!0,L=null,A={box:null,offscreen:null},k={box:null,offscreen:null},N=null,D=null,R=null,O=0,z=0,F=0;h.textFeatureIndex?O=h.textFeatureIndex:e.useRuntimeCollisionCircles&&(O=e.featureIndex),h.verticalTextFeatureIndex&&(z=h.verticalTextFeatureIndex);const B=h.textBox;if(B){const n=n=>{let r=t.ai.horizontal;if(i.allowVerticalPlacement&&!n&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(i,r,e))}return r},r=(n,r)=>{if(i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&h.verticalTextBox){for(const e of i.writingModes)if(e===t.ai.vertical?(A=r(),k=A):A=n(),A&&A.box&&A.box.length)break}else A=n()},o=e.textAnchorOffsetStartIndex,a=e.textAnchorOffsetEndIndex;if(a===o){const o=(t,n)=>{const r=this.collisionIndex.placeCollisionBox(t,m,u,s,f.predicate,T);return r&&r.box&&r.box.length&&(this.markUsedOrientation(i,n,e),this.placedOrientations[e.crossTileID]=n),r};r((()=>o(B,t.ai.horizontal)),(()=>{const n=h.verticalTextBox;return i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&n?o(n,t.ai.vertical):{box:null,offscreen:null}})),n(A&&A.box&&A.box.length)}else{let l=t.aq[null===(E=null===(v=this.prevPlacement)||void 0===v?void 0:v.variableOffsets[e.crossTileID])||void 0===E?void 0:E.anchor];const c=(t,n,r)=>{const c=t.x2-t.x1,h=t.y2-t.y1,p=e.textBoxScale,d=w&&"never"===_?n:null;let g={box:[],offscreen:!1},y="never"===m?1:2,v="never";l&&y++;for(let n=0;n<y;n++){for(let n=o;n<a;n++){const o=i.textAnchorOffsets.get(n);if(l&&o.textAnchor!==l)continue;const a=this.attemptAnchorPlacement(o,t,c,h,p,x,b,u,s,f,v,e,i,r,d,T);if(a&&(g=a.placedGlyphBoxes,g&&g.box&&g.box.length))return C=!0,L=a.shift,g}l?l=null:v=m}return g};r((()=>c(B,h.iconBox,t.ai.horizontal)),(()=>{const n=h.verticalTextBox;return i.allowVerticalPlacement&&!(A&&A.box&&A.box.length)&&e.numVerticalGlyphVertices>0&&n?c(n,h.verticalIconBox,t.ai.vertical):{box:null,offscreen:null}})),A&&(C=A.box,M=A.offscreen);const p=n(A&&A.box);if(!C&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(i,t.anchor,e,p))}}}if(N=A,C=N&&N.box&&N.box.length>0,M=N&&N.offscreen,e.useRuntimeCollisionCircles){const n=i.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),u=t.aj(i.textSizeData,p,n),c=o.get("text-padding");D=this.collisionIndex.placeCollisionCircles(m,n,i.lineVertexArray,i.glyphOffsetArray,u,s,a,l,r,b,f.predicate,e.collisionCircleDiameter,c,T),D.circles.length&&D.collisionDetected&&!r&&t.w("Collisions detected, but collision boxes are not shown"),C=y||D.circles.length>0&&!D.collisionDetected,M=M&&D.offscreen}if(h.iconFeatureIndex&&(F=h.iconFeatureIndex),h.iconBox){const t=t=>{const e=w&&L?Dt(t,L.x,L.y,x,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,_,u,s,f.predicate,T)};k&&k.box&&k.box.length&&h.verticalIconBox?(R=t(h.verticalIconBox),P=R.box.length>0):(R=t(h.iconBox),P=R.box.length>0),M=M&&R.offscreen}const U=d||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,V=g||0===e.numIconVertices;if(U||V?V?U||(P=P&&C):C=P&&C:P=C=P&&C,C&&N&&N.box&&this.collisionIndex.insertCollisionBox(N.box,m,o.get("text-ignore-placement"),i.bucketInstanceId,k&&k.box&&z?z:O,f.ID),P&&R&&this.collisionIndex.insertCollisionBox(R.box,_,o.get("icon-ignore-placement"),i.bucketInstanceId,F,f.ID),D&&(C&&this.collisionIndex.insertCollisionCircles(D.circles,m,o.get("text-ignore-placement"),i.bucketInstanceId,O,f.ID),r)){const t=i.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new Lt);for(let t=0;t<D.circles.length;t+=4)e.circles.push(D.circles[t+0]),e.circles.push(D.circles[t+1]),e.circles.push(D.circles[t+2]),e.circles.push(D.collisionDetected?1:0)}if(0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===i.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new Mt(C||S,P||I,M||i.justReloaded),n[e.crossTileID]=!0};if(E){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=i.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const n=t[e];P(i.symbolInstances.get(n),i.collisionArrays[n])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)P(i.symbolInstances.get(t),i.collisionArrays[t]);if(r&&i.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[i.bucketInstanceId];t.as(e.invProjMatrix,s),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}i.justReloaded=!1}markUsedJustification(e,n,r,i){let o;o=i===t.ai.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.at(n)];const s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const t of s)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:r.crossTileID)}markUsedOrientation(e,n,r){const i=n===t.ai.horizontal||n===t.ai.horizontalOnly?n:0,o=n===t.ai.vertical?n:0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const t of s)e.text.placedSymbolArray.get(t).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let n=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const r=e?e.symbolFadeChange(t):1,i=e?e.opacities:{},o=e?e.variableOffsets:{},s=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=i[t];o?(this.opacities[t]=new Pt(o,r,e.text,e.icon),n=n||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new Pt(null,r,e.text,e.icon,e.skipFade),n=n||e.text||e.icon)}for(const t in i){const e=i[t];if(!this.opacities[t]){const i=new Pt(e,r,!1,!1);i.isHidden()||(this.opacities[t]=i,n=n||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in s)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=s[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");n?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const n={};for(const r of e){const e=r.getBucket(t);e&&r.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,n,r.collisionBoxArray)}}updateBucketOpacities(e,n,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const i=e.layers[0],o=i.layout,s=new Pt(null,0,!1,!1,!0),a=o.get("text-allow-overlap"),l=o.get("icon-allow-overlap"),u=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),c="map"===o.get("text-rotation-alignment"),h="map"===o.get("text-pitch-alignment"),p="none"!==o.get("icon-text-fit"),f=new Pt(null,0,a&&(l||!e.hasIconData()||o.get("icon-optional")),l&&(a||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);const d=(t,e,n)=>{for(let r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(n);t.hasVisibleVertices=t.hasVisibleVertices||n!==$t};for(let r=0;r<e.symbolInstances.length;r++){const i=e.symbolInstances.get(r),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:a,crossTileID:l}=i;let g=this.opacities[l];n[l]?g=s:g||(g=f,this.opacities[l]=g),n[l]=!0;const m=i.numIconVertices>0,y=this.placedOrientations[i.crossTileID],_=y===t.ai.vertical,v=y===t.ai.horizontal||y===t.ai.horizontalOnly;if(o>0||a>0){const t=qt(g.text);d(e.text,o,_?$t:t),d(e.text,a,v?$t:t);const n=g.text.isHidden();[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=n||_?1:0)})),i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=n||v?1:0);const r=this.variableOffsets[i.crossTileID];r&&this.markUsedJustification(e,r.anchor,i,y);const s=this.placedOrientations[i.crossTileID];s&&(this.markUsedJustification(e,"left",i,s),this.markUsedOrientation(e,s,i))}if(m){const t=qt(g.icon),n=!(p&&i.verticalPlacedIconSymbolIndex&&_);i.placedIconSymbolIndex>=0&&(d(e.icon,i.numIconVertices,n?t:$t),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=g.icon.isHidden()),i.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,i.numVerticalIconVertices,n?$t:t),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=g.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const n=e.collisionArrays[r];if(n){let r=new t.P(0,0);if(n.textBox||n.verticalTextBox){let t=!0;if(u){const e=this.variableOffsets[l];e?(r=Nt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&r._rotate(h?this.transform.angle:-this.transform.angle)):t=!1}n.textBox&&Ot(e.textCollisionBox.collisionVertexArray,g.text.placed,!t||_,r.x,r.y),n.verticalTextBox&&Ot(e.textCollisionBox.collisionVertexArray,g.text.placed,!t||v,r.x,r.y)}const i=Boolean(!v&&n.verticalIconBox);n.iconBox&&Ot(e.iconCollisionBox.collisionVertexArray,g.icon.placed,i,p?r.x:0,p?r.y:0),n.verticalIconBox&&Ot(e.iconCollisionBox.collisionVertexArray,g.icon.placed,!i,p?r.x:0,p?r.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const n=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*n>t}setStale(){this.stale=!0}}function Ot(t,e,n,r,i){t.emplaceBack(e?1:0,n?1:0,r||0,i||0),t.emplaceBack(e?1:0,n?1:0,r||0,i||0),t.emplaceBack(e?1:0,n?1:0,r||0,i||0),t.emplaceBack(e?1:0,n?1:0,r||0,i||0)}const zt=Math.pow(2,25),Ft=Math.pow(2,24),Bt=Math.pow(2,17),Ut=Math.pow(2,16),Vt=Math.pow(2,9),jt=Math.pow(2,8),Gt=Math.pow(2,1);function qt(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,n=Math.floor(127*t.opacity);return n*zt+e*Ft+n*Bt+e*Ut+n*Vt+e*jt+n*Gt+e}const $t=0;class Xt{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,n,r,i){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,i())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,i())return!0;return!1}}class Zt{constructor(t,e,n,r,i,o,s,a){this.placement=new Rt(t,e,o,s,a),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=i,this._done=!1}isDone(){return this._done}continuePlacement(e,n,r){const i=t.h.now(),o=()=>!this._forceFullPlacement&&t.h.now()-i>2;for(;this._currentPlacementIndex>=0;){const t=n[e[this._currentPlacementIndex]],i=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=i)&&(!t.maxzoom||t.maxzoom>i)){if(this._inProgressLayer||(this._inProgressLayer=new Xt(t)),this._inProgressLayer.continuePlacement(r[t.source],this.placement,this._showCollisionBoxes,t,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Yt=512/t.N/2;class Wt{constructor(e,n,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};const i=new Map;for(let t=0;t<n.length;t++){const e=n.get(t),r=e.key,o=i.get(r);o?o.push(e):i.set(r,[e])}for(const[e,n]of i){const r={positions:n.map((t=>({x:Math.floor(t.anchorX*Yt),y:Math.floor(t.anchorY*Yt)}))),crossTileIDs:n.map((t=>t.crossTileID))};if(r.positions.length>128){const e=new t.av(r.positions.length,16,Uint16Array);for(const{x:t,y:n}of r.positions)e.add(t,n);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,n){const{x:r,y:i,z:o}=this.tileID.canonical,{x:s,y:a,z:l}=n.canonical,u=Yt/Math.pow(2,l-o),c=(a*t.N+e.anchorY)*u,h=i*t.N*Yt;return{x:Math.floor((s*t.N+e.anchorX)*u-r*t.N*Yt),y:Math.floor(c-h)}}findMatches(t,e,n){const r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let i=0;i<t.length;i++){const o=t.get(i);if(o.crossTileID)continue;const s=this._symbolsByKey[o.key];if(!s)continue;const a=this.getScaledCoordinates(o,e);if(s.index){const t=s.index.range(a.x-r,a.y-r,a.x+r,a.y+r).sort();for(const e of t){const t=s.crossTileIDs[e];if(!n[t]){n[t]=!0,o.crossTileID=t;break}}}else if(s.positions)for(let t=0;t<s.positions.length;t++){const e=s.positions[t],i=s.crossTileIDs[t];if(Math.abs(e.x-a.x)<=r&&Math.abs(e.y-a.y)<=r&&!n[i]){n[i]=!0,o.crossTileID=i;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Ht{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Kt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const n=this.indexes[t],r={};for(const t in n){const i=n[t];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),r[i.tileID.key]=i}this.indexes[t]=r}this.lng=t}addBucket(t,e,n){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const r=this.usedCrossTileIDs[t.overscaledZ];for(const n in this.indexes){const i=this.indexes[n];if(Number(n)>t.overscaledZ)for(const n in i){const o=i[n];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,r)}else{const o=i[t.scaledTo(Number(n)).key];o&&o.findMatches(e.symbolInstances,t,r)}}for(let t=0;t<e.symbolInstances.length;t++){const i=e.symbolInstances.get(t);i.crossTileID||(i.crossTileID=n.generate(),r[i.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Wt(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const n of e.getCrossTileIDsLists())for(const e of n)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const n in this.indexes){const r=this.indexes[n];for(const i in r)t[r[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[i]),delete r[i],e=!0)}return e}}class Jt{constructor(){this.layerIndexes={},this.crossTileIDs=new Ht,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,n){let r=this.layerIndexes[t.id];void 0===r&&(r=this.layerIndexes[t.id]=new Kt);let i=!1;const o={};r.handleWrapJump(n);for(const n of e){const e=n.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(n.tileID,e,this.crossTileIDs)&&(i=!0),o[e.bucketInstanceId]=!0)}return r.removeStaleBuckets(o)&&(i=!0),i}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const Qt=(e,n)=>t.x(e,n&&n.filter((t=>"source.canvas"!==t.identifier))),te=t.F(t.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),ee=t.F(t.ax,["setCenter","setZoom","setBearing","setPitch"]),ne=t.aw();class re extends t.E{constructor(e,n={}){super(),this.map=e,this.dispatcher=new L(rt(),this,e._getMapId()),this.imageManager=new b,this.imageManager.setEventedParent(this),this.glyphManager=new I(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new M(256,512),this.crossTileSymbolIndex=new Jt,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.az());const r=this;this._rtlTextPluginCallback=re.registerForPluginStateChange((e=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,n)=>{if(t.aA(e),n&&n.every((t=>t)))for(const t in r.sourceCaches){const e=r.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||r.sourceCaches[t].reload()}}))})),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const n=e.getSource();if(n&&n.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===n.id&&this._validateLayer(e)}}))}loadURL(e,n={},r){this.fire(new t.k("dataloading",{dataType:"style"})),n.validate="boolean"!=typeof n.validate||n.validate;const i=this.map._requestManager.transformRequest(e,c.Style);this._request=t.f(i,((e,i)=>{this._request=null,e?this.fire(new t.j(e)):i&&this._load(i,n,r)}))}loadJSON(e,n={},r){this.fire(new t.k("dataloading",{dataType:"style"})),this._request=t.h.frame((()=>{this._request=null,n.validate=!1!==n.validate,this._load(e,n,r)}))}loadEmpty(){this.fire(new t.k("dataloading",{dataType:"style"})),this._load(ne,{validate:!1})}_load(e,n,r){var i;const o=n.transformStyle?n.transformStyle(r,e):e;if(!n.validate||!Qt(this,t.y(o))){this._loaded=!0,this.stylesheet=o;for(const t in o.sources)this.addSource(t,o.sources[t],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new P(this.stylesheet.light),this.map.setTerrain(null!==(i=this.stylesheet.terrain)&&void 0!==i?i:null),this.fire(new t.k("data",{dataType:"style"})),this.fire(new t.k("style.load"))}}_createLayers(){const e=t.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",e),this._order=e.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const n of e){const e=t.aC(n);e.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=e}}_loadSprite(e,n=!1,r=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(e,n,r,i){const o=y(e),s=o.length,a=r>1?"@2x":"",l={},h={},p={};for(const{id:e,url:r}of o){const o=n.transformRequest(n.normalizeSpriteURL(r,a,".json"),c.SpriteJSON),f=`${e}_${o.url}`;l[f]=t.f(o,((t,n)=>{delete l[f],h[e]=n,_(i,h,p,t,s)}));const d=n.transformRequest(n.normalizeSpriteURL(r,a,".png"),c.SpriteImage),g=`${e}_${d.url}`;l[g]=u.getImage(d,((t,n)=>{delete l[g],p[e]=n,_(i,h,p,t,s)}))}return{cancel(){for(const t of Object.values(l))t.cancel()}}}(e,this.map._requestManager,this.map.getPixelRatio(),((e,i)=>{if(this._spriteRequest=null,e)this.fire(new t.j(e));else if(i)for(const t in i){this._spritesImagesIds[t]=[];const e=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in i))):[];for(const t of e)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const e in i[t]){const r="default"===t?e:`${t}:${e}`;this._spritesImagesIds[t].push(r),r in this.imageManager.images?this.imageManager.updateImage(r,i[t][e],!1):this.imageManager.addImage(r,i[t][e]),n&&(this._changedImages[r]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.k("data",{dataType:"style"})),r&&r(e)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.k("data",{dataType:"style"}))}_validateLayer(e){const n=this.sourceCaches[e.source];if(!n)return;const r=e.sourceLayer;if(!r)return;const i=n.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new t.j(new Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const e=this._serializedAllLayers();if(!t||0===t.length)return Object.values(e);const n=[];for(const r of t)e[r]&&n.push(e[r]);return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const n of e){const e=this._layers[n];"custom"!==e.type&&(t[n]=e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const n=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(t.length||n.length)&&this._updateWorkerLayers(t,n);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}const r={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];r[t]=e.used,e.used=!1}for(const t of this._order){const n=this._layers[t];n.recalculate(e,this._availableImages),!n.isHidden(e.zoom)&&n.source&&(this.sourceCaches[n.source].used=!0)}for(const e in r){const n=this.sourceCaches[e];r[e]!==n.used&&n.fire(new t.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,n&&this.fire(new t.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){this._checkLoaded();const r=this.serialize();if(e=n.transformStyle?n.transformStyle(r,e):e,Qt(this,t.y(e)))return!1;(e=t.aD(e)).layers=t.aB(e.layers);const i=t.aE(r,e).filter((t=>!(t.command in ee)));if(0===i.length)return!1;const o=i.filter((t=>!(t.command in te)));if(o.length>0)throw new Error(`Unimplemented: ${o.map((t=>t.command)).join(", ")}.`);for(const t of i)"setTransition"!==t.command&&this[t.command].apply(this,t.args);return this.stylesheet=e,this._serializedLayers=null,!0}addImage(e,n){if(this.getImage(e))return this.fire(new t.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(t.y.source,`sources.${e}`,n,null,r))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const i=this.sourceCaches[e]=new H(e,n,this.dispatcher);i.style=this,i.setEventedParent(this,(()=>({isSourceLoaded:i.loaded(),source:i.serialize(),sourceId:e}))),i.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===e)return this.fire(new t.j(new Error(`Source "${e}" cannot be removed while layer "${n}" is using it.`)));const n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const n=this.sourceCaches[t].getSource();if("geojson"!==n.type)throw new Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(e,n,r={}){this._checkLoaded();const i=e.id;if(this.getLayer(i))return void this.fire(new t.j(new Error(`Layer "${i}" already exists on this map.`)));let o;if("custom"===e.type){if(Qt(this,t.aF(e)))return;o=t.aC(e)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(i,e.source),e=t.aD(e),e=t.e(e,{source:i})),this._validate(t.y.layer,`layers.${i}`,e,{arrayIndex:-1},r))return;o=t.aC(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:i}})}const s=n?this._order.indexOf(n):this._order.length;if(n&&-1===s)this.fire(new t.j(new Error(`Cannot add layer "${i}" before non-existing layer "${n}".`)));else{if(this._order.splice(s,0,i),this._layerOrderChanged=!0,this._layers[i]=o,this._removedLayers[i]&&o.source&&"custom"!==o.type){const t=this._removedLayers[i];delete this._removedLayers[i],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;const r=this._order.indexOf(e);this._order.splice(r,1);const i=n?this._order.indexOf(n):this._order.length;n&&-1===i?this.fire(new t.j(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const n=this._layers[e];if(!n)return void this.fire(new t.j(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);const r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,n,r){this._checkLoaded();const i=this.getLayer(e);i?i.minzoom===n&&i.maxzoom===r||(null!=n&&(i.minzoom=n),null!=r&&(i.maxzoom=r),this._updateLayer(i)):this.fire(new t.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,r={}){this._checkLoaded();const i=this.getLayer(e);if(i){if(!t.aG(i.filter,n))return null==n?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.y.filter,`layers.${i.id}.filter`,n,null,r)||(i.filter=t.aD(n),this._updateLayer(i)))}else this.fire(new t.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.aD(this.getLayer(e).filter)}setLayoutProperty(e,n,r,i={}){this._checkLoaded();const o=this.getLayer(e);o?t.aG(o.getLayoutProperty(n),r)||(o.setLayoutProperty(n,r,i),this._updateLayer(o)):this.fire(new t.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){const r=this.getLayer(e);if(r)return r.getLayoutProperty(n);this.fire(new t.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,r,i={}){this._checkLoaded();const o=this.getLayer(e);o?t.aG(o.getPaintProperty(n),r)||(o.setPaintProperty(n,r,i)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,n){this._checkLoaded();const r=e.source,i=e.sourceLayer,o=this.sourceCaches[r];if(void 0===o)return void this.fire(new t.j(new Error(`The source '${r}' does not exist in the map's style.`)));const s=o.getSource().type;"geojson"===s&&i?this.fire(new t.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||i?(void 0===e.id&&this.fire(new t.j(new Error("The feature id parameter must be provided."))),o.setFeatureState(i,e.id,n)):this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();const r=e.source,i=this.sourceCaches[r];if(void 0===i)return void this.fire(new t.j(new Error(`The source '${r}' does not exist in the map's style.`)));const o=i.getSource().type,s="vector"===o?e.sourceLayer:void 0;"vector"!==o||s?n&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.j(new Error("A feature id is required to remove its specific state property."))):i.removeFeatureState(s,e.id,n):this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const n=e.source,r=e.sourceLayer,i=this.sourceCaches[n];if(void 0!==i)return"vector"!==i.getSource().type||r?(void 0===e.id&&this.fire(new t.j(new Error("The feature id parameter must be provided."))),i.getFeatureState(r,e.id)):void this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.j(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=t.aH(this.sourceCaches,(t=>t.serialize())),n=this._serializeByIds(this._order),r=this.map.getTerrain()||void 0,i=this.stylesheet;return t.aI({version:i.version,name:i.name,metadata:i.metadata,light:i.light,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,transition:i.transition,sources:e,layers:n,terrain:r},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,n={},r=[];for(let i=this._order.length-1;i>=0;i--){const o=this._order[i];if(e(o)){n[o]=i;for(const e of t){const t=e[o];if(t)for(const e of t)r.push(e)}}}r.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const i=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if(e(s))for(let t=r.length-1;t>=0;t--){const e=r[t].feature;if(n[e.layer.id]<o)break;i.push(e),r.pop()}else for(const e of t){const t=e[s];if(t)for(const e of t)i.push(e.feature)}}return i}queryRenderedFeatures(e,n,r){n&&n.filter&&this._validate(t.y.filter,"queryRenderedFeatures.filter",n.filter,null,n);const i={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new t.j(new Error("parameters.layers must be an Array."))),[];for(const e of n.layers){const n=this._layers[e];if(!n)return this.fire(new t.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];i[n.source]=!0}}const o=[];n.availableImages=this._availableImages;const s=this._serializedAllLayers();for(const t in this.sourceCaches)n.layers&&!i[t]||o.push($(this.sourceCaches[t],this._layers,s,e,n,r));return this.placement&&o.push(function(t,e,n,r,i,o,s){const a={},l=o.queryRenderedSymbols(r),u=[];for(const t of Object.keys(l).map(Number))u.push(s[t]);u.sort(X);for(const n of u){const r=n.featureIndex.lookupSymbolFeatures(l[n.bucketInstanceId],e,n.bucketIndex,n.sourceLayerIndex,i.filter,i.layers,i.availableImages,t);for(const t in r){const e=a[t]=a[t]||[],i=r[t];i.sort(((t,e)=>{const r=n.featureSortOrder;if(r){const n=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-n}return e.featureIndex-t.featureIndex}));for(const t of i)e.push(t)}}for(const e in a)a[e].forEach((r=>{const i=r.feature,o=n[t[e].source].getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=o}));return a}(this._layers,s,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,n){n&&n.filter&&this._validate(t.y.filter,"querySourceFeatures.filter",n.filter,null,n);const r=this.sourceCaches[e];return r?function(t,e){const n=t.getRenderableIds().map((e=>t.getTileByID(e))),r=[],i={};for(let t=0;t<n.length;t++){const o=n[t],s=o.tileID.canonical.key;i[s]||(i[s]=!0,o.querySourceFeatures(r,e))}return r}(r,n):[]}addSourceType(t,e,n){return G(t)?n(new Error(`A source type called "${t}" already exists.`)):(((t,e)=>{j[t]=e})(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();const r=this.light.getLight();let i=!1;for(const n in e)if(!t.aG(e[n],r[n])){i=!0;break}if(!i)return;const o={now:t.h.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(o)}_validate(e,n,r,i,o={}){return(!o||!1!==o.validate)&&Qt(this,e.call(t.y,t.e({key:n,style:this.serialize(),value:r,styleSpec:t.v},i)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(e)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(e,n,r,i,o=!1){let s=!1,a=!1;const l={};for(const t of this._order){const n=this._layers[t];if("symbol"!==n.type)continue;if(!l[n.source]){const t=this.sourceCaches[n.source];l[n.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(n,l[n.source],e.center.lng);s=s||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.h.now(),e.zoom))&&(this.pauseablePlacement=new Zt(e,this.map.terrain,this._order,o,n,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.h.now()),a=!0),s&&this.pauseablePlacement.placement.setStale()),a||s)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.h.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,n){this.imageManager.getImages(e.icons,n),this._updateTilesForChangedImages();const r=this.sourceCaches[e.source];r&&r.setDependencies(e.tileID.key,e.type,e.icons)}getGlyphs(t,e,n){this.glyphManager.getGlyphs(e.stacks,n);const r=this.sourceCaches[e.source];r&&r.setDependencies(e.tileID.key,e.type,[""])}getResource(e,n,r){return t.m(n,r)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(t.y.glyphs,"glyphs",e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,n,r={},i){this._checkLoaded();const o=[{id:e,url:n}],s=[...y(this.stylesheet.sprite),...o];this._validate(t.y.sprite,"sprite",s,null,r)||(this.stylesheet.sprite=s,this._loadSprite(o,!0,i))}removeSprite(e){this._checkLoaded();const n=y(this.stylesheet.sprite);if(n.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;n.splice(n.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.k("data",{dataType:"style"}))}else this.fire(new t.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return y(this.stylesheet.sprite)}setSprite(e,n={},r){this._checkLoaded(),e&&this._validate(t.y.sprite,"sprite",e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}}re.registerForPluginStateChange=t.aK;var ie=t.Q([{name:"a_pos",type:"Int16",components:2}]),oe="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;}";const se={prelude:ae("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:ae("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:ae("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:ae("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:ae("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:ae("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:ae("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:ae("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:ae("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:ae("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:ae("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:ae("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:ae("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:ae("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:ae("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:ae("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:ae("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:ae("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:ae("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:ae("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:ae("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:ae("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:ae("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:ae("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:ae("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",oe),terrainDepth:ae("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);}",oe),terrainCoords:ae("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);}",oe)};function ae(t,e){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/attribute ([\w]+) ([\w]+)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=o?o.concat(i):i,a={};return{fragmentSource:t=t.replace(n,((t,e,n,r,i)=>(a[i]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${i}\nvarying ${n} ${r} ${i};\n#else\nuniform ${n} ${r} u_${i};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${i}\n ${n} ${r} ${i} = u_${i};\n#endif\n`))),vertexSource:e=e.replace(n,((t,e,n,r,i)=>{const o="float"===r?"vec2":"vec4",s=i.match(/color/)?"color":o;return a[i]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${i}\nuniform lowp float u_${i}_t;\nattribute ${n} ${o} a_${i};\nvarying ${n} ${r} ${i};\n#else\nuniform ${n} ${r} u_${i};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${i}\n ${i} = a_${i};\n#else\n ${n} ${r} ${i} = u_${i};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${i}\n ${i} = unpack_mix_${s}(a_${i}, u_${i}_t);\n#else\n ${n} ${r} ${i} = u_${i};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${i}\nuniform lowp float u_${i}_t;\nattribute ${n} ${o} a_${i};\n#else\nuniform ${n} ${r} u_${i};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${i}\n ${n} ${r} ${i} = a_${i};\n#else\n ${n} ${r} ${i} = u_${i};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${i}\n ${n} ${r} ${i} = unpack_mix_${s}(a_${i}, u_${i}_t);\n#else\n ${n} ${r} ${i} = u_${i};\n#endif\n`})),staticAttributes:r,staticUniforms:s}}class le{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,n,r,i,o,s,a,l){this.context=t;let u=this.boundPaintVertexBuffers.length!==r.length;for(let t=0;!u&&t<r.length;t++)this.boundPaintVertexBuffers[t]!==r[t]&&(u=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==n||u||this.boundIndexBuffer!==i||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==a||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,n,r,i,o,s,a,l):(t.bindVertexArray.set(this.vao),s&&s.bind(),i&&i.dynamicDraw&&i.bind(),a&&a.bind(),l&&l.bind())}freshBind(t,e,n,r,i,o,s,a){const l=t.numAttributes,u=this.context,c=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=r,this.boundVertexOffset=i,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=a,e.enableAttributes(c,t);for(const e of n)e.enableAttributes(c,t);o&&o.enableAttributes(c,t),s&&s.enableAttributes(c,t),a&&a.enableAttributes(c,t),e.bind(),e.setVertexAttribPointers(c,t,i);for(const e of n)e.bind(),e.setVertexAttribPointers(c,t,i);o&&(o.bind(),o.setVertexAttribPointers(c,t,i)),r&&r.bind(),s&&(s.bind(),s.setVertexAttribPointers(c,t,i)),a&&(a.bind(),a.setVertexAttribPointers(c,t,i)),u.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}function ue(t){const e=[];for(let n=0;n<t.length;n++){if(null===t[n])continue;const r=t[n].split(" ");e.push(r.pop())}return e}class ce{constructor(e,n,r,i,o,s){const a=e.gl;this.program=a.createProgram();const l=ue(n.staticAttributes),u=r?r.getBinderAttributes():[],c=l.concat(u),h=se.prelude.staticUniforms?ue(se.prelude.staticUniforms):[],p=n.staticUniforms?ue(n.staticUniforms):[],f=r?r.getBinderUniforms():[],d=h.concat(p).concat(f),g=[];for(const t of d)g.indexOf(t)<0&&g.push(t);const m=r?r.defines():[];o&&m.push("#define OVERDRAW_INSPECTOR;"),s&&m.push("#define TERRAIN3D;");const y=m.concat(se.prelude.fragmentSource,n.fragmentSource).join("\n"),_=m.concat(se.prelude.vertexSource,n.vertexSource).join("\n"),v=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);if(a.shaderSource(v,y),a.compileShader(v),!a.getShaderParameter(v,a.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${a.getShaderInfoLog(v)}`);a.attachShader(this.program,v);const x=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);if(a.shaderSource(x,_),a.compileShader(x),!a.getShaderParameter(x,a.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${a.getShaderInfoLog(x)}`);a.attachShader(this.program,x),this.attributes={};const b={};this.numAttributes=c.length;for(let t=0;t<this.numAttributes;t++)c[t]&&(a.bindAttribLocation(this.program,t,c[t]),this.attributes[c[t]]=t);if(a.linkProgram(this.program),!a.getProgramParameter(this.program,a.LINK_STATUS))throw new Error(`Program failed to link: ${a.getProgramInfoLog(this.program)}`);a.deleteShader(x),a.deleteShader(v);for(let t=0;t<g.length;t++){const e=g[t];if(e&&!b[e]){const t=a.getUniformLocation(this.program,e);t&&(b[e]=t)}}this.fixedUniforms=i(e,b),this.terrainUniforms=((e,n)=>({u_depth:new t.aL(e,n.u_depth),u_terrain:new t.aL(e,n.u_terrain),u_terrain_dim:new t.aM(e,n.u_terrain_dim),u_terrain_matrix:new t.aN(e,n.u_terrain_matrix),u_terrain_unpack:new t.aO(e,n.u_terrain_unpack),u_terrain_exaggeration:new t.aM(e,n.u_terrain_exaggeration)}))(e,b),this.binderUniforms=r?r.getUniforms(e,b):[]}draw(t,e,n,r,i,o,s,a,l,u,c,h,p,f,d,g,m,y){const _=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(n),t.setStencilMode(r),t.setColorMode(i),t.setCullFace(o),a){t.activeTexture.set(_.TEXTURE2),_.bindTexture(_.TEXTURE_2D,a.depthTexture),t.activeTexture.set(_.TEXTURE3),_.bindTexture(_.TEXTURE_2D,a.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(a[t])}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(s[t]);d&&d.setUniforms(t,this.binderUniforms,p,{zoom:f});let v=0;switch(e){case _.LINES:v=2;break;case _.TRIANGLES:v=3;break;case _.LINE_STRIP:v=1}for(const n of h.get()){const r=n.vaos||(n.vaos={});(r[l]||(r[l]=new le)).bind(t,this,u,d?d.getPaintVertexBuffers():[],c,n.vertexOffset,g,m,y),_.drawElements(e,n.primitiveLength*v,_.UNSIGNED_SHORT,n.primitiveOffset*v*2)}}}function he(t,e,n){const r=1/Ct(n,1,e.transform.tileZoom),i=Math.pow(2,n.tileID.overscaledZ),o=n.tileSize*Math.pow(2,e.transform.tileZoom)/i,s=o*(n.tileID.canonical.x+n.tileID.wrap*i),a=o*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[s>>16,a>>16],u_pixel_coord_lower:[65535&s,65535&a]}}const pe=(e,n,r,i)=>{const o=n.style.light,s=o.properties.get("position"),a=[s.x,s.y,s.z],l=function(){var e=new t.A(9);return t.A!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}();"viewport"===o.properties.get("anchor")&&function(t,e){var n=Math.sin(e),r=Math.cos(e);t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(l,-n.transform.angle),function(t,e,n){var r=e[0],i=e[1],o=e[2];t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8]}(a,a,l);const u=o.properties.get("color");return{u_matrix:e,u_lightpos:a,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+r,u_opacity:i}},fe=(e,n,r,i,o,s,a)=>t.e(pe(e,n,r,i),he(s,n,a),{u_height_factor:-Math.pow(2,o.overscaledZ)/a.tileSize/8}),de=t=>({u_matrix:t}),ge=(e,n,r,i)=>t.e(de(e),he(r,n,i)),me=(t,e)=>({u_matrix:t,u_world:e}),ye=(e,n,r,i,o)=>t.e(ge(e,n,r,i),{u_world:o}),_e=(t,e,n,r)=>{const i=t.transform;let o,s;if("map"===r.paint.get("circle-pitch-alignment")){const t=Ct(n,1,i.zoom);o=!0,s=[t,t]}else o=!1,s=i.pixelsToGLUnits;return{u_camera_to_center_distance:i.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,n,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:s}},ve=(t,e,n)=>{const r=Ct(n,1,e.zoom),i=Math.pow(2,e.zoom-n.tileID.overscaledZ),o=n.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:r,u_extrude_scale:[e.pixelsToGLUnits[0]/(r*i),e.pixelsToGLUnits[1]/(r*i)],u_overscale_factor:o}},xe=(t,e,n=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:n}),be=t=>({u_matrix:t}),we=(t,e,n,r)=>({u_matrix:t,u_extrude_scale:Ct(e,1,n),u_intensity:r});function Ee(e,n){const r=Math.pow(2,n.canonical.z),i=n.canonical.y;return[new t.U(0,i/r).toLngLat().lat,new t.U(0,(i+1)/r).toLngLat().lat]}const Se=(t,e,n,r)=>{const i=t.transform;return{u_matrix:Me(t,e,n,r),u_ratio:1/Ct(e,1,i.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},Ie=(e,n,r,i,o)=>t.e(Se(e,n,r,o),{u_image:0,u_image_height:i}),Ce=(t,e,n,r,i)=>{const o=t.transform,s=Pe(e,o);return{u_matrix:Me(t,e,n,i),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Ct(e,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[s,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Te=(e,n,r,i,o,s)=>{const a=e.lineAtlas,l=Pe(n,e.transform),u="round"===r.layout.get("line-cap"),c=a.getDash(i.from,u),h=a.getDash(i.to,u),p=c.width*o.fromScale,f=h.width*o.toScale;return t.e(Se(e,n,r,s),{u_patternscale_a:[l/p,-c.height/2],u_patternscale_b:[l/f,-h.height/2],u_sdfgamma:a.width/(256*Math.min(p,f)*e.pixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:h.y,u_mix:o.t})};function Pe(t,e){return 1/Ct(t,1,e.tileZoom)}function Me(t,e,n,r){return t.translatePosMatrix(r?r.posMatrix:e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Le=(t,e,n,r,i)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:(s=i.paint.get("raster-saturation"),s>0?1-1/(1.001-s):-s),u_contrast_factor:(o=i.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Ae(i.paint.get("raster-hue-rotate"))};var o,s};function Ae(t){t*=Math.PI/180;const e=Math.sin(t),n=Math.cos(t);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}const ke=(t,e,n,r,i,o,s,a,l,u)=>{const c=i.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:c.width/c.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:s,u_coord_matrix:a,u_is_text:+l,u_pitch_with_map:+r,u_texsize:u,u_texture:0}},Ne=(e,n,r,i,o,s,a,l,u,c,h)=>{const p=o.transform;return t.e(ke(e,n,r,i,o,s,a,l,u,c),{u_gamma_scale:i?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+h})},De=(e,n,r,i,o,s,a,l,u,c)=>t.e(Ne(e,n,r,i,o,s,a,l,!0,u,!0),{u_texsize_icon:c,u_texture_icon:1}),Re=(t,e,n)=>({u_matrix:t,u_opacity:e,u_color:n}),Oe=(e,n,r,i,o,s)=>t.e(function(t,e,n,r){const i=n.imageManager.getPattern(t.from.toString()),o=n.imageManager.getPattern(t.to.toString()),{width:s,height:a}=n.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),u=r.tileSize*Math.pow(2,n.transform.tileZoom)/l,c=u*(r.tileID.canonical.x+r.tileID.wrap*l),h=u*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,a],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/Ct(r,1,n.transform.tileZoom),u_pixel_coord_upper:[c>>16,h>>16],u_pixel_coord_lower:[65535&c,65535&h]}}(i,s,r,o),{u_matrix:e,u_opacity:n}),ze={fillExtrusion:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_lightpos:new t.aP(e,n.u_lightpos),u_lightintensity:new t.aM(e,n.u_lightintensity),u_lightcolor:new t.aP(e,n.u_lightcolor),u_vertical_gradient:new t.aM(e,n.u_vertical_gradient),u_opacity:new t.aM(e,n.u_opacity)}),fillExtrusionPattern:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_lightpos:new t.aP(e,n.u_lightpos),u_lightintensity:new t.aM(e,n.u_lightintensity),u_lightcolor:new t.aP(e,n.u_lightcolor),u_vertical_gradient:new t.aM(e,n.u_vertical_gradient),u_height_factor:new t.aM(e,n.u_height_factor),u_image:new t.aL(e,n.u_image),u_texsize:new t.aQ(e,n.u_texsize),u_pixel_coord_upper:new t.aQ(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.aQ(e,n.u_pixel_coord_lower),u_scale:new t.aP(e,n.u_scale),u_fade:new t.aM(e,n.u_fade),u_opacity:new t.aM(e,n.u_opacity)}),fill:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix)}),fillPattern:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_image:new t.aL(e,n.u_image),u_texsize:new t.aQ(e,n.u_texsize),u_pixel_coord_upper:new t.aQ(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.aQ(e,n.u_pixel_coord_lower),u_scale:new t.aP(e,n.u_scale),u_fade:new t.aM(e,n.u_fade)}),fillOutline:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_world:new t.aQ(e,n.u_world)}),fillOutlinePattern:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_world:new t.aQ(e,n.u_world),u_image:new t.aL(e,n.u_image),u_texsize:new t.aQ(e,n.u_texsize),u_pixel_coord_upper:new t.aQ(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.aQ(e,n.u_pixel_coord_lower),u_scale:new t.aP(e,n.u_scale),u_fade:new t.aM(e,n.u_fade)}),circle:(e,n)=>({u_camera_to_center_distance:new t.aM(e,n.u_camera_to_center_distance),u_scale_with_map:new t.aL(e,n.u_scale_with_map),u_pitch_with_map:new t.aL(e,n.u_pitch_with_map),u_extrude_scale:new t.aQ(e,n.u_extrude_scale),u_device_pixel_ratio:new t.aM(e,n.u_device_pixel_ratio),u_matrix:new t.aN(e,n.u_matrix)}),collisionBox:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_camera_to_center_distance:new t.aM(e,n.u_camera_to_center_distance),u_pixels_to_tile_units:new t.aM(e,n.u_pixels_to_tile_units),u_extrude_scale:new t.aQ(e,n.u_extrude_scale),u_overscale_factor:new t.aM(e,n.u_overscale_factor)}),collisionCircle:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_inv_matrix:new t.aN(e,n.u_inv_matrix),u_camera_to_center_distance:new t.aM(e,n.u_camera_to_center_distance),u_viewport_size:new t.aQ(e,n.u_viewport_size)}),debug:(e,n)=>({u_color:new t.aR(e,n.u_color),u_matrix:new t.aN(e,n.u_matrix),u_overlay:new t.aL(e,n.u_overlay),u_overlay_scale:new t.aM(e,n.u_overlay_scale)}),clippingMask:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix)}),heatmap:(e,n)=>({u_extrude_scale:new t.aM(e,n.u_extrude_scale),u_intensity:new t.aM(e,n.u_intensity),u_matrix:new t.aN(e,n.u_matrix)}),heatmapTexture:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_world:new t.aQ(e,n.u_world),u_image:new t.aL(e,n.u_image),u_color_ramp:new t.aL(e,n.u_color_ramp),u_opacity:new t.aM(e,n.u_opacity)}),hillshade:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_image:new t.aL(e,n.u_image),u_latrange:new t.aQ(e,n.u_latrange),u_light:new t.aQ(e,n.u_light),u_shadow:new t.aR(e,n.u_shadow),u_highlight:new t.aR(e,n.u_highlight),u_accent:new t.aR(e,n.u_accent)}),hillshadePrepare:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_image:new t.aL(e,n.u_image),u_dimension:new t.aQ(e,n.u_dimension),u_zoom:new t.aM(e,n.u_zoom),u_unpack:new t.aO(e,n.u_unpack)}),line:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_ratio:new t.aM(e,n.u_ratio),u_device_pixel_ratio:new t.aM(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.aQ(e,n.u_units_to_pixels)}),lineGradient:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_ratio:new t.aM(e,n.u_ratio),u_device_pixel_ratio:new t.aM(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.aQ(e,n.u_units_to_pixels),u_image:new t.aL(e,n.u_image),u_image_height:new t.aM(e,n.u_image_height)}),linePattern:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_texsize:new t.aQ(e,n.u_texsize),u_ratio:new t.aM(e,n.u_ratio),u_device_pixel_ratio:new t.aM(e,n.u_device_pixel_ratio),u_image:new t.aL(e,n.u_image),u_units_to_pixels:new t.aQ(e,n.u_units_to_pixels),u_scale:new t.aP(e,n.u_scale),u_fade:new t.aM(e,n.u_fade)}),lineSDF:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_ratio:new t.aM(e,n.u_ratio),u_device_pixel_ratio:new t.aM(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.aQ(e,n.u_units_to_pixels),u_patternscale_a:new t.aQ(e,n.u_patternscale_a),u_patternscale_b:new t.aQ(e,n.u_patternscale_b),u_sdfgamma:new t.aM(e,n.u_sdfgamma),u_image:new t.aL(e,n.u_image),u_tex_y_a:new t.aM(e,n.u_tex_y_a),u_tex_y_b:new t.aM(e,n.u_tex_y_b),u_mix:new t.aM(e,n.u_mix)}),raster:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_tl_parent:new t.aQ(e,n.u_tl_parent),u_scale_parent:new t.aM(e,n.u_scale_parent),u_buffer_scale:new t.aM(e,n.u_buffer_scale),u_fade_t:new t.aM(e,n.u_fade_t),u_opacity:new t.aM(e,n.u_opacity),u_image0:new t.aL(e,n.u_image0),u_image1:new t.aL(e,n.u_image1),u_brightness_low:new t.aM(e,n.u_brightness_low),u_brightness_high:new t.aM(e,n.u_brightness_high),u_saturation_factor:new t.aM(e,n.u_saturation_factor),u_contrast_factor:new t.aM(e,n.u_contrast_factor),u_spin_weights:new t.aP(e,n.u_spin_weights)}),symbolIcon:(e,n)=>({u_is_size_zoom_constant:new t.aL(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.aL(e,n.u_is_size_feature_constant),u_size_t:new t.aM(e,n.u_size_t),u_size:new t.aM(e,n.u_size),u_camera_to_center_distance:new t.aM(e,n.u_camera_to_center_distance),u_pitch:new t.aM(e,n.u_pitch),u_rotate_symbol:new t.aL(e,n.u_rotate_symbol),u_aspect_ratio:new t.aM(e,n.u_aspect_ratio),u_fade_change:new t.aM(e,n.u_fade_change),u_matrix:new t.aN(e,n.u_matrix),u_label_plane_matrix:new t.aN(e,n.u_label_plane_matrix),u_coord_matrix:new t.aN(e,n.u_coord_matrix),u_is_text:new t.aL(e,n.u_is_text),u_pitch_with_map:new t.aL(e,n.u_pitch_with_map),u_texsize:new t.aQ(e,n.u_texsize),u_texture:new t.aL(e,n.u_texture)}),symbolSDF:(e,n)=>({u_is_size_zoom_constant:new t.aL(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.aL(e,n.u_is_size_feature_constant),u_size_t:new t.aM(e,n.u_size_t),u_size:new t.aM(e,n.u_size),u_camera_to_center_distance:new t.aM(e,n.u_camera_to_center_distance),u_pitch:new t.aM(e,n.u_pitch),u_rotate_symbol:new t.aL(e,n.u_rotate_symbol),u_aspect_ratio:new t.aM(e,n.u_aspect_ratio),u_fade_change:new t.aM(e,n.u_fade_change),u_matrix:new t.aN(e,n.u_matrix),u_label_plane_matrix:new t.aN(e,n.u_label_plane_matrix),u_coord_matrix:new t.aN(e,n.u_coord_matrix),u_is_text:new t.aL(e,n.u_is_text),u_pitch_with_map:new t.aL(e,n.u_pitch_with_map),u_texsize:new t.aQ(e,n.u_texsize),u_texture:new t.aL(e,n.u_texture),u_gamma_scale:new t.aM(e,n.u_gamma_scale),u_device_pixel_ratio:new t.aM(e,n.u_device_pixel_ratio),u_is_halo:new t.aL(e,n.u_is_halo)}),symbolTextAndIcon:(e,n)=>({u_is_size_zoom_constant:new t.aL(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.aL(e,n.u_is_size_feature_constant),u_size_t:new t.aM(e,n.u_size_t),u_size:new t.aM(e,n.u_size),u_camera_to_center_distance:new t.aM(e,n.u_camera_to_center_distance),u_pitch:new t.aM(e,n.u_pitch),u_rotate_symbol:new t.aL(e,n.u_rotate_symbol),u_aspect_ratio:new t.aM(e,n.u_aspect_ratio),u_fade_change:new t.aM(e,n.u_fade_change),u_matrix:new t.aN(e,n.u_matrix),u_label_plane_matrix:new t.aN(e,n.u_label_plane_matrix),u_coord_matrix:new t.aN(e,n.u_coord_matrix),u_is_text:new t.aL(e,n.u_is_text),u_pitch_with_map:new t.aL(e,n.u_pitch_with_map),u_texsize:new t.aQ(e,n.u_texsize),u_texsize_icon:new t.aQ(e,n.u_texsize_icon),u_texture:new t.aL(e,n.u_texture),u_texture_icon:new t.aL(e,n.u_texture_icon),u_gamma_scale:new t.aM(e,n.u_gamma_scale),u_device_pixel_ratio:new t.aM(e,n.u_device_pixel_ratio),u_is_halo:new t.aL(e,n.u_is_halo)}),background:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_opacity:new t.aM(e,n.u_opacity),u_color:new t.aR(e,n.u_color)}),backgroundPattern:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_opacity:new t.aM(e,n.u_opacity),u_image:new t.aL(e,n.u_image),u_pattern_tl_a:new t.aQ(e,n.u_pattern_tl_a),u_pattern_br_a:new t.aQ(e,n.u_pattern_br_a),u_pattern_tl_b:new t.aQ(e,n.u_pattern_tl_b),u_pattern_br_b:new t.aQ(e,n.u_pattern_br_b),u_texsize:new t.aQ(e,n.u_texsize),u_mix:new t.aM(e,n.u_mix),u_pattern_size_a:new t.aQ(e,n.u_pattern_size_a),u_pattern_size_b:new t.aQ(e,n.u_pattern_size_b),u_scale_a:new t.aM(e,n.u_scale_a),u_scale_b:new t.aM(e,n.u_scale_b),u_pixel_coord_upper:new t.aQ(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.aQ(e,n.u_pixel_coord_lower),u_tile_units_to_pixels:new t.aM(e,n.u_tile_units_to_pixels)}),terrain:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_texture:new t.aL(e,n.u_texture),u_ele_delta:new t.aM(e,n.u_ele_delta)}),terrainDepth:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_ele_delta:new t.aM(e,n.u_ele_delta)}),terrainCoords:(e,n)=>({u_matrix:new t.aN(e,n.u_matrix),u_texture:new t.aL(e,n.u_texture),u_terrain_coords_id:new t.aM(e,n.u_terrain_coords_id),u_ele_delta:new t.aM(e,n.u_ele_delta)})};class Fe{constructor(t,e,n){this.context=t;const r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Be={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ue{constructor(t,e,n,r){this.length=e.length,this.attributes=n,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;const i=t.gl;this.buffer=i.createBuffer(),t.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let n=0;n<this.attributes.length;n++){const r=e.attributes[this.attributes[n].name];void 0!==r&&t.enableVertexAttribArray(r)}}setVertexAttribPointers(t,e,n){for(let r=0;r<this.attributes.length;r++){const i=this.attributes[r],o=e.attributes[i.name];void 0!==o&&t.vertexAttribPointer(o,i.components,t[Be[i.type]],!1,this.itemSize,i.offset+this.itemSize*(n||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ve=new WeakMap;function je(t){var e;if(Ve.has(t))return Ve.get(t);{const n=null===(e=t.getParameter(t.VERSION))||void 0===e?void 0:e.startsWith("WebGL 2.0");return Ve.set(t,n),n}}class Ge{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class qe extends Ge{getDefault(){return t.aT.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class $e extends Ge{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Xe extends Ge{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Ze extends Ge{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Ye extends Ge{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class We extends Ge{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class He extends Ge{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Ke extends Ge{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Je extends Ge{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class Qe extends Ge{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class tn extends Ge{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class en extends Ge{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class nn extends Ge{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class rn extends Ge{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class on extends Ge{getDefault(){return t.aT.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class sn extends Ge{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class an extends Ge{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class ln extends Ge{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class un extends Ge{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class cn extends Ge{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class hn extends Ge{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class pn extends Ge{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class fn extends Ge{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class dn extends Ge{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class gn extends Ge{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class mn extends Ge{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class yn extends Ge{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class _n extends Ge{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const n=this.gl;je(n)?n.bindVertexArray(t):null===(e=n.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class vn extends Ge{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class xn extends Ge{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class bn extends Ge{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class wn extends Ge{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class En extends wn{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Sn extends wn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class In extends wn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Cn{constructor(t,e,n,r,i){this.context=t,this.width=e,this.height=n;const o=t.gl,s=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new En(t,s),r)this.depthAttachment=i?new In(t,s):new Sn(t,s);else if(i)throw new Error("Stencil cannot be setted without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class Tn{constructor(t,e,n){this.blendFunction=t,this.blendColor=e,this.mask=n}}Tn.Replace=[1,0],Tn.disabled=new Tn(Tn.Replace,t.aT.transparent,[!1,!1,!1,!1]),Tn.unblended=new Tn(Tn.Replace,t.aT.transparent,[!0,!0,!0,!0]),Tn.alphaBlended=new Tn([1,771],t.aT.transparent,[!0,!0,!0,!0]);class Pn{constructor(t){var e,n;if(this.gl=t,this.clearColor=new qe(this),this.clearDepth=new $e(this),this.clearStencil=new Xe(this),this.colorMask=new Ze(this),this.depthMask=new Ye(this),this.stencilMask=new We(this),this.stencilFunc=new He(this),this.stencilOp=new Ke(this),this.stencilTest=new Je(this),this.depthRange=new Qe(this),this.depthTest=new tn(this),this.depthFunc=new en(this),this.blend=new nn(this),this.blendFunc=new rn(this),this.blendColor=new on(this),this.blendEquation=new sn(this),this.cullFace=new an(this),this.cullFaceSide=new ln(this),this.frontFace=new un(this),this.program=new cn(this),this.activeTexture=new hn(this),this.viewport=new pn(this),this.bindFramebuffer=new fn(this),this.bindRenderbuffer=new dn(this),this.bindTexture=new gn(this),this.bindVertexBuffer=new mn(this),this.bindElementBuffer=new yn(this),this.bindVertexArray=new _n(this),this.pixelStoreUnpack=new vn(this),this.pixelStoreUnpackPremultiplyAlpha=new xn(this),this.pixelStoreUnpackFlipY=new bn(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),je(t)){this.HALF_FLOAT=t.HALF_FLOAT;const r=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==r?void 0:r.RGBA16F_EXT,this.RGB16F=null!==(n=t.RGB16F)&&void 0!==n?n:null==r?void 0:r.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Fe(this,t,e)}createVertexBuffer(t,e,n){return new Ue(this,t,e,n)}createRenderbuffer(t,e,n){const r=this.gl,i=r.createRenderbuffer();return this.bindRenderbuffer.set(i),r.renderbufferStorage(r.RENDERBUFFER,t,e,n),this.bindRenderbuffer.set(null),i}createFramebuffer(t,e,n,r){return new Cn(this,t,e,n,r)}clear({color:t,depth:e,stencil:n}){const r=this.gl;let i=0;t&&(i|=r.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(i|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==n&&(i|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),r.clear(i)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.aG(e.blendFunction,Tn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var t;return je(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return je(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class Mn{constructor(t,e,n){this.func=t,this.mask=e,this.range=n}}Mn.ReadOnly=!1,Mn.ReadWrite=!0,Mn.disabled=new Mn(519,Mn.ReadOnly,[0,1]);const Ln=7680;class An{constructor(t,e,n,r,i,o){this.test=t,this.ref=e,this.mask=n,this.fail=r,this.depthFail=i,this.pass=o}}An.disabled=new An({func:519,mask:0},0,0,Ln,Ln,Ln);class kn{constructor(t,e,n){this.enable=t,this.mode=e,this.frontFace=n}}let Nn;function Dn(e,n,r,i,o,s,a){const l=e.context,u=l.gl,c=e.useProgram("collisionBox"),h=[];let p=0,f=0;for(let d=0;d<i.length;d++){const g=i[d],m=n.getTile(g),y=m.getBucket(r);if(!y)continue;let _=g.posMatrix;0===o[0]&&0===o[1]||(_=e.translatePosMatrix(g.posMatrix,m,o,s));const v=a?y.textCollisionBox:y.iconCollisionBox,x=y.collisionCircleArray;if(x.length>0){const n=t.Z(),r=_;t.aU(n,y.placementInvProjMatrix,e.transform.glCoordMatrix),t.aU(n,n,y.placementViewportMatrix),h.push({circleArray:x,circleOffset:f,transform:r,invTransform:n,coord:g}),p+=x.length/4,f=p}v&&c.draw(l,u.LINES,Mn.disabled,An.disabled,e.colorModeForRenderPass(),kn.disabled,ve(_,e.transform,m),e.style.map.terrain&&e.style.map.terrain.getTerrainData(g),r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,e.transform.zoom,null,null,v.collisionVertexBuffer)}if(!a||!h.length)return;const d=e.useProgram("collisionCircle"),g=new t.aV;g.resize(4*p),g._trim();let m=0;for(const t of h)for(let e=0;e<t.circleArray.length/4;e++){const n=4*e,r=t.circleArray[n+0],i=t.circleArray[n+1],o=t.circleArray[n+2],s=t.circleArray[n+3];g.emplace(m++,r,i,o,s,0),g.emplace(m++,r,i,o,s,1),g.emplace(m++,r,i,o,s,2),g.emplace(m++,r,i,o,s,3)}(!Nn||Nn.length<2*p)&&(Nn=function(e){const n=2*e,r=new t.aX;r.resize(n),r._trim();for(let t=0;t<n;t++){const e=6*t;r.uint16[e+0]=4*t+0,r.uint16[e+1]=4*t+1,r.uint16[e+2]=4*t+2,r.uint16[e+3]=4*t+2,r.uint16[e+4]=4*t+3,r.uint16[e+5]=4*t+0}return r}(p));const y=l.createIndexBuffer(Nn,!0),_=l.createVertexBuffer(g,t.aW.members,!0);for(const n of h){const i={u_matrix:n.transform,u_inv_matrix:n.invTransform,u_camera_to_center_distance:(v=e.transform).cameraToCenterDistance,u_viewport_size:[v.width,v.height]};d.draw(l,u.TRIANGLES,Mn.disabled,An.disabled,e.colorModeForRenderPass(),kn.disabled,i,e.style.map.terrain&&e.style.map.terrain.getTerrainData(n.coord),r.id,_,y,t.S.simpleSegment(0,2*n.circleOffset,n.circleArray.length,n.circleArray.length/2),null,e.transform.zoom,null,null,null)}var v;_.destroy(),y.destroy()}kn.disabled=new kn(!1,1029,2305),kn.backCCW=new kn(!0,1029,2305);const Rn=t.ao(new Float32Array(16));function On(e,n,r,i,o,s){const{horizontalAlign:a,verticalAlign:l}=t.au(e);return new t.P((-(a-.5)*n/o+i[0])*s,(-(l-.5)*r/o+i[1])*s)}function zn(e,n,r,i,o,s,a,l,u,c,h){const p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,d=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let d=0;d<p.length;d++){const m=p.get(d),y=m.hidden||!m.crossTileID||e.allowVerticalPlacement&&!m.placedOrientation?null:i[m.crossTileID];if(y){const i=new t.P(m.anchorX,m.anchorY),p=ut(i,r?a:s,h),d=ct(o.cameraToCenterDistance,p.signedDistanceFromCamera);let _=t.aj(e.textSizeData,u,m)*d/t.ap;r&&(_*=e.tilePixelRatio/l);const{width:v,height:x,anchor:b,textOffset:w,textBoxScale:E}=y,S=On(b,v,x,w,E,_),I=r?ut(i.add(S),s,h).point:p.point.add(n?S.rotate(-o.angle):S),C=e.allowVerticalPlacement&&m.placedOrientation===t.ai.vertical?Math.PI/2:0;for(let e=0;e<m.numGlyphs;e++)t.ak(f,I,C);c&&m.associatedIconIndex>=0&&(g[m.associatedIconIndex]={shiftedAnchor:I,angle:C})}else wt(m.numGlyphs,f)}if(c){d.clear();const n=e.icon.placedSymbolArray;for(let e=0;e<n.length;e++){const r=n.get(e);if(r.hidden)wt(r.numGlyphs,d);else{const n=g[e];if(n)for(let e=0;e<r.numGlyphs;e++)t.ak(d,n.shiftedAnchor,n.angle);else wt(r.numGlyphs,d)}}e.icon.dynamicLayoutVertexBuffer.updateData(d)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function Fn(t,e,n){return n.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function Bn(e,n,r,i,o,s,a,l,u,c,h,p){const f=e.context,d=f.gl,g=e.transform,m="map"===l,y="map"===u,_="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),v=m&&!y&&!_,x=!r.layout.get("symbol-sort-key").isConstant();let b=!1;const w=e.depthModeForSublayer(0,Mn.ReadOnly),E=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),S=[];for(const l of i){const i=n.getTile(l),u=i.getBucket(r);if(!u)continue;const h=o?u.text:u.icon;if(!h||!h.segments.get().length||!h.hasVisibleVertices)continue;const p=h.programConfigurations.get(r.id),f=o||u.sdfIcons,w=o?u.textSizeData:u.iconSizeData,I=y||0!==g.pitch,C=e.useProgram(Fn(f,o,u),p),T=t.ah(w,g.zoom),P=e.style.map.terrain&&e.style.map.terrain.getTerrainData(l);let M,L,A,k,N=[0,0],D=null;if(o)L=i.glyphAtlasTexture,A=d.LINEAR,M=i.glyphAtlasTexture.size,u.iconsInText&&(N=i.imageAtlasTexture.size,D=i.imageAtlasTexture,k=I||e.options.rotating||e.options.zooming||"composite"===w.kind||"camera"===w.kind?d.LINEAR:d.NEAREST);else{const t=1!==r.layout.get("icon-size").constantOr(0)||u.iconsNeedLinear;L=i.imageAtlasTexture,A=f||e.options.rotating||e.options.zooming||t||I?d.LINEAR:d.NEAREST,M=i.imageAtlasTexture.size}const R=Ct(i,1,e.transform.zoom),O=at(l.posMatrix,y,m,e.transform,R),z=lt(l.posMatrix,y,m,e.transform,R),F=E&&u.hasTextData(),B="none"!==r.layout.get("icon-text-fit")&&F&&u.hasIconData();if(_){const t=e.style.map.terrain?(t,n)=>e.style.map.terrain.getElevation(l,t,n):null,n="map"===r.layout.get("text-rotation-alignment");pt(u,l.posMatrix,e,o,O,z,y,c,n,t)}const U=e.translatePosMatrix(l.posMatrix,i,s,a),V=_||o&&E||B?Rn:O,j=e.translatePosMatrix(z,i,s,a,!0),G=f&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let q;q=f?u.iconsInText?De(w.kind,T,v,y,e,U,V,j,M,N):Ne(w.kind,T,v,y,e,U,V,j,o,M,!0):ke(w.kind,T,v,y,e,U,V,j,o,M);const $={program:C,buffers:h,uniformValues:q,atlasTexture:L,atlasTextureIcon:D,atlasInterpolation:A,atlasInterpolationIcon:k,isSDF:f,hasHalo:G};if(x&&u.canOverlap){b=!0;const e=h.segments.get();for(const n of e)S.push({segments:new t.S([n]),sortKey:n.sortKey,state:$,terrainData:P})}else S.push({segments:h.segments,sortKey:0,state:$,terrainData:P})}b&&S.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of S){const n=t.state;if(f.activeTexture.set(d.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,d.CLAMP_TO_EDGE),n.atlasTextureIcon&&(f.activeTexture.set(d.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),n.isSDF){const i=n.uniformValues;n.hasHalo&&(i.u_is_halo=1,Un(n.buffers,t.segments,r,e,n.program,w,h,p,i,t.terrainData)),i.u_is_halo=0}Un(n.buffers,t.segments,r,e,n.program,w,h,p,n.uniformValues,t.terrainData)}}function Un(t,e,n,r,i,o,s,a,l,u){const c=r.context;i.draw(c,c.gl.TRIANGLES,o,s,a,kn.disabled,l,u,n.id,t.layoutVertexBuffer,t.indexBuffer,e,n.paint,r.transform.zoom,t.programConfigurations.get(n.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Vn(t,e,n,r,i){if(!n||!r||!r.imageAtlas)return;const o=r.imageAtlas.patternPositions;let s=o[n.to.toString()],a=o[n.from.toString()];if(!s&&a&&(s=a),!a&&s&&(a=s),!s||!a){const t=i.getPaintProperty(e);s=o[t],a=o[t]}s&&a&&t.setConstantPatternPositions(s,a)}function jn(t,e,n,r,i,o,s){const a=t.context.gl,l="fill-pattern",u=n.paint.get(l),c=u&&u.constantOr(1),h=n.getCrossfadeParameters();let p,f,d,g,m;s?(f=c&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=a.LINES):(f=c?"fillPattern":"fill",p=a.TRIANGLES);const y=u.constantOr(null);for(const u of r){const r=e.getTile(u);if(c&&!r.patternsLoaded())continue;const _=r.getBucket(n);if(!_)continue;const v=_.programConfigurations.get(n.id),x=t.useProgram(f,v),b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(u);c&&(t.context.activeTexture.set(a.TEXTURE0),r.imageAtlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),v.updatePaintBuffers(h)),Vn(v,l,y,r,n);const w=b?u:null,E=t.translatePosMatrix(w?w.posMatrix:u.posMatrix,r,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(s){g=_.indexBuffer2,m=_.segments2;const e=[a.drawingBufferWidth,a.drawingBufferHeight];d="fillOutlinePattern"===f&&c?ye(E,t,h,r,e):me(E,e)}else g=_.indexBuffer,m=_.segments,d=c?ge(E,t,h,r):de(E);x.draw(t.context,p,i,t.stencilModeForClipping(u),o,kn.disabled,d,b,n.id,_.layoutVertexBuffer,g,m,n.paint,t.transform.zoom,v)}}function Gn(t,e,n,r,i,o,s){const a=t.context,l=a.gl,u="fill-extrusion-pattern",c=n.paint.get(u),h=c.constantOr(1),p=n.getCrossfadeParameters(),f=n.paint.get("fill-extrusion-opacity"),d=c.constantOr(null);for(const c of r){const r=e.getTile(c),g=r.getBucket(n);if(!g)continue;const m=t.style.map.terrain&&t.style.map.terrain.getTerrainData(c),y=g.programConfigurations.get(n.id),_=t.useProgram(h?"fillExtrusionPattern":"fillExtrusion",y);h&&(t.context.activeTexture.set(l.TEXTURE0),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),y.updatePaintBuffers(p)),Vn(y,u,d,r,n);const v=t.translatePosMatrix(c.posMatrix,r,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),x=n.paint.get("fill-extrusion-vertical-gradient"),b=h?fe(v,t,x,f,c,p,r):pe(v,t,x,f);_.draw(a,a.gl.TRIANGLES,i,o,s,kn.backCCW,b,m,n.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,n.paint,t.transform.zoom,y,t.style.map.terrain&&g.centroidVertexBuffer)}}function qn(t,e,n,r,i,o,s){const a=t.context,l=a.gl,u=n.fbo;if(!u)return;const c=t.useProgram("hillshade"),h=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);a.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,u.colorAttachment.get()),c.draw(a,l.TRIANGLES,i,o,s,kn.disabled,((t,e,n,r)=>{const i=n.paint.get("hillshade-shadow-color"),o=n.paint.get("hillshade-highlight-color"),s=n.paint.get("hillshade-accent-color");let a=n.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===n.paint.get("hillshade-illumination-anchor")&&(a-=t.transform.angle);const l=!t.options.moving;return{u_matrix:r?r.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:Ee(0,e.tileID),u_light:[n.paint.get("hillshade-exaggeration"),a],u_shadow:i,u_highlight:o,u_accent:s}})(t,n,r,h?e:null),h,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function $n(e,n,r,i,o,s){const a=e.context,l=a.gl,u=n.dem;if(u&&u.data){const c=u.dim,h=u.stride,p=u.getPixels();if(a.activeTexture.set(l.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||e.getTileTexture(h),n.demTexture){const t=n.demTexture;t.update(p,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else n.demTexture=new v(a,p,l.RGBA,{premultiply:!1}),n.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);a.activeTexture.set(l.TEXTURE0);let f=n.fbo;if(!f){const t=new v(a,{width:c,height:c,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),f=n.fbo=a.createFramebuffer(c,c,!0,!1),f.colorAttachment.set(t.texture)}a.bindFramebuffer.set(f.framebuffer),a.viewport.set([0,0,c,c]),e.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,i,o,s,kn.disabled,((e,n)=>{const r=n.stride,i=t.Z();return t.aS(i,0,t.N,-t.N,0,0,1),t.$(i,i,[0,-t.N,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:n.getUnpackVector()}})(n.tileID,u),null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),n.needsHillshadePrepare=!1}}function Xn(e,n,r,i,o,s){const a=i.paint.get("raster-fade-duration");if(!s&&a>0){const i=t.h.now(),s=(i-e.timeAdded)/a,l=n?(i-n.timeAdded)/a:-1,u=r.getSource(),c=o.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),h=!n||Math.abs(n.tileID.overscaledZ-c)>Math.abs(e.tileID.overscaledZ-c),p=h&&e.refreshedUponExpiration?1:t.ad(h?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),n?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const Zn=new t.aT(1,0,0,1),Yn=new t.aT(0,1,0,1),Wn=new t.aT(0,0,1,1),Hn=new t.aT(1,0,1,1),Kn=new t.aT(0,1,1,1);function Jn(t,e,n,r){tr(t,0,e+n/2,t.transform.width,n,r)}function Qn(t,e,n,r){tr(t,e-n/2,0,n,t.transform.height,r)}function tr(t,e,n,r,i,o){const s=t.context,a=s.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,n*t.pixelRatio,r*t.pixelRatio,i*t.pixelRatio),s.clear({color:o}),a.disable(a.SCISSOR_TEST)}function er(e,n,r){const i=e.context,o=i.gl,s=r.posMatrix,a=e.useProgram("debug"),l=Mn.disabled,u=An.disabled,c=e.colorModeForRenderPass(),h="$debug",p=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r);i.activeTexture.set(o.TEXTURE0);const f=n.getTileByID(r.key).latestRawTileData,d=Math.floor((f&&f.byteLength||0)/1024),g=n.getTile(r).tileSize,m=512/Math.min(g,512)*(r.overscaledZ/e.transform.zoom)*.5;let y=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(y+=` => ${r.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const n=t.debugOverlayCanvas,r=t.context.gl,i=t.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,n.width,n.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(e,5,5),i.strokeText(e,5,5),t.debugOverlayTexture.update(n),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,`${y} ${d}kB`),a.draw(i,o.TRIANGLES,l,u,Tn.alphaBlended,kn.disabled,xe(s,t.aT.transparent,m),null,h,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(i,o.LINE_STRIP,l,u,c,kn.disabled,xe(s,t.aT.red),p,h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function nr(t,e,n){const r=t.context,i=r.gl,o=t.colorModeForRenderPass(),s=new Mn(i.LEQUAL,Mn.ReadWrite,t.depthRangeFor3D),a=t.useProgram("terrain"),l=e.getTerrainMesh();r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height]);for(const u of n){const n=t.renderToTexture.getTexture(u),c=e.getTerrainData(u.tileID);r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,n.texture);const h={u_matrix:t.transform.calculatePosMatrix(u.tileID.toUnwrapped()),u_texture:0,u_ele_delta:e.getMeshFrameDelta(t.transform.zoom)};a.draw(r,i.TRIANGLES,s,An.disabled,o,kn.backCCW,h,c,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}class rr{constructor(e,n){this.context=new Pn(e),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.Z(),renderTime:0},this.setup(),this.numSublayers=H.maxUnderzooming+H.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jt}resize(t,e,n){if(this.width=Math.floor(t*n),this.height=Math.floor(e*n),this.pixelRatio=n,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const e=this.context,n=new t.a_;n.emplaceBack(0,0),n.emplaceBack(t.N,0),n.emplaceBack(0,t.N),n.emplaceBack(t.N,t.N),this.tileExtentBuffer=e.createVertexBuffer(n,ie.members),this.tileExtentSegments=t.S.simpleSegment(0,0,4,2);const r=new t.a_;r.emplaceBack(0,0),r.emplaceBack(t.N,0),r.emplaceBack(0,t.N),r.emplaceBack(t.N,t.N),this.debugBuffer=e.createVertexBuffer(r,ie.members),this.debugSegments=t.S.simpleSegment(0,0,4,5);const i=new t.V;i.emplaceBack(0,0,0,0),i.emplaceBack(t.N,0,t.N,0),i.emplaceBack(0,t.N,0,t.N),i.emplaceBack(t.N,t.N,t.N,t.N),this.rasterBoundsBuffer=e.createVertexBuffer(i,F.members),this.rasterBoundsSegments=t.S.simpleSegment(0,0,4,2);const o=new t.a_;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,ie.members),this.viewportSegments=t.S.simpleSegment(0,0,4,2);const s=new t.a$;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);const a=new t.b0;a.emplaceBack(0,1,2),a.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(a);const l=this.context.gl;this.stencilClearMode=new An({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){const e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const r=t.Z();t.aS(r,0,this.width,this.height,0,0,1),t.a0(r,r,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,Mn.disabled,this.stencilClearMode,Tn.disabled,kn.disabled,be(r),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const n=this.context,r=n.gl;this.nextStencilID+e.length>256&&this.clearStencil(),n.setColorMode(Tn.disabled),n.setDepthMode(Mn.disabled);const i=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,o=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);i.draw(n,r.TRIANGLES,Mn.disabled,new An({func:r.ALWAYS,mask:0},e,255,r.KEEP,r.KEEP,r.REPLACE),Tn.disabled,kn.disabled,be(t.posMatrix),o,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new An({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new An({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,n=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),r=n[n.length-1].overscaledZ,i=n[0].overscaledZ-r+1;if(i>1){this.currentStencilSource=void 0,this.nextStencilID+i>256&&this.clearStencil();const t={};for(let n=0;n<i;n++)t[n+r]=new An({func:e.GEQUAL,mask:255},n+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=i,[t,n]}return[{[r]:An.disabled},n]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const n=1/8;return new Tn([e.CONSTANT_COLOR,e.ONE],new t.aT(n,n,n,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Tn.unblended:Tn.alphaBlended}depthModeForSublayer(t,e,n){if(!this.opaquePassEnabledForLayer())return Mn.disabled;const r=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Mn(n||this.context.gl.LEQUAL,e,[r,r])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,n){this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.h.now()),this.imageManager.beginFrame();const r=this.style._order,i=this.style.sourceCaches,o={},s={},a={};for(const t in i){const e=i[t];e.used&&e.prepare(this.context),o[t]=e.getVisibleCoordinates(),s[t]=o[t].slice().reverse(),a[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<r.length;t++)if(this.style._layers[r[t]].is3D()){this.opaquePassCutoff=t;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const e=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!t.b1(this.terrainFacilitator.matrix,this.transform.projMatrix)||e.length)&&(t.b2(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,n){const r=e.context,i=r.gl,o=Tn.unblended,s=new Mn(i.LEQUAL,Mn.ReadWrite,[0,1]),a=n.getTerrainMesh(),l=n.sourceCache.getRenderableTiles(),u=e.useProgram("terrainDepth");r.bindFramebuffer.set(n.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.aT.transparent,depth:1});for(const t of l){const l=n.getTerrainData(t.tileID),c={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_ele_delta:n.getMeshFrameDelta(e.transform.zoom)};u.draw(r,i.TRIANGLES,s,An.disabled,o,kn.backCCW,c,l,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain),function(e,n){const r=e.context,i=r.gl,o=Tn.unblended,s=new Mn(i.LEQUAL,Mn.ReadWrite,[0,1]),a=n.getTerrainMesh(),l=n.getCoordsTexture(),u=n.sourceCache.getRenderableTiles(),c=e.useProgram("terrainCoords");r.bindFramebuffer.set(n.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.aT.transparent,depth:1}),n.coordsIndex=[];for(const t of u){const u=n.getTerrainData(t.tileID);r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,l.texture);const h={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_terrain_coords_id:(255-n.coordsIndex.length)/255,u_texture:0,u_ele_delta:n.getMeshFrameDelta(e.transform.zoom)};c.draw(r,i.TRIANGLES,s,An.disabled,o,kn.backCCW,h,u,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),n.coordsIndex.push(t.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const t of r){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const n=s[e.source];("custom"===e.type||n.length)&&this.renderLayer(this,i[e.source],e,n)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?t.aT.black:t.aT.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[r[this.currentLayer]],e=i[t.source],n=o[t.source];this._renderTileClippingMasks(t,n),this.renderLayer(this,e,t,n)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){const t=this.style._layers[r[this.currentLayer]],e=i[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t))continue;const n=("symbol"===t.type?a:s)[t.source];this._renderTileClippingMasks(t,o[t.source]),this.renderLayer(this,e,t,n)}if(this.options.showTileBoundaries){const t=function(t,e){let n=null;const r=Object.values(t._layers).flatMap((n=>n.source&&!n.isHidden(e)?[t.sourceCaches[n.source]]:[])),i=r.filter((t=>"vector"===t.getSource().type)),o=r.filter((t=>"vector"!==t.getSource().type)),s=t=>{(!n||n.getSource().maxzoom<t.getSource().maxzoom)&&(n=t)};return i.forEach((t=>s(t))),n||o.forEach((t=>s(t))),n}(this.style,this.transform.zoom);t&&function(t,e,n){for(let r=0;r<n.length;r++)er(t,e,n[r])}(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;Jn(t,t.transform.height-(e.top||0),3,Zn),Jn(t,e.bottom||0,3,Yn),Qn(t,e.left||0,3,Wn),Qn(t,t.transform.width-(e.right||0),3,Hn);const n=t.transform.centerPoint;!function(t,e,n,r){tr(t,e-1,n-10,2,20,r),tr(t,e-10,n-1,20,2,r)}(t,n.x,t.transform.height-n.y,Kn)}(this),this.context.setDefault()}renderLayer(e,n,r,i){if(!r.isHidden(this.transform.zoom)&&("background"===r.type||"custom"===r.type||(i||[]).length))switch(this.id=r.id,r.type){case"symbol":!function(e,n,r,i,o){if("translucent"!==e.renderPass)return;const s=An.disabled,a=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,n,r,i,o,s,a){const l=n.transform,u="map"===o,c="map"===s;for(const o of e){const e=i.getTile(o),s=e.getBucket(r);if(!s||!s.text||!s.text.segments.get().length)continue;const h=t.ah(s.textSizeData,l.zoom),p=Ct(e,1,n.transform.zoom),f=at(o.posMatrix,c,u,n.transform,p),d="none"!==r.layout.get("icon-text-fit")&&s.hasIconData();if(h){const t=Math.pow(2,l.zoom-e.tileID.overscaledZ);zn(s,u,c,a,l,f,o.posMatrix,t,h,d,n.style.map.terrain?(t,e)=>n.style.map.terrain.getElevation(o,t,e):null)}}}(i,e,r,n,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&Bn(e,n,r,i,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),s,a),0!==r.paint.get("text-opacity").constantOr(1)&&Bn(e,n,r,i,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),s,a),n.map.showCollisionBoxes&&(Dn(e,n,r,i,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),Dn(e,n,r,i,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))}(e,n,r,i,this.style.placement.variableOffsets);break;case"circle":!function(e,n,r,i){if("translucent"!==e.renderPass)return;const o=r.paint.get("circle-opacity"),s=r.paint.get("circle-stroke-width"),a=r.paint.get("circle-stroke-opacity"),l=!r.layout.get("circle-sort-key").isConstant();if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const u=e.context,c=u.gl,h=e.depthModeForSublayer(0,Mn.ReadOnly),p=An.disabled,f=e.colorModeForRenderPass(),d=[];for(let o=0;o<i.length;o++){const s=i[o],a=n.getTile(s),u=a.getBucket(r);if(!u)continue;const c=u.programConfigurations.get(r.id),h=e.useProgram("circle",c),p=u.layoutVertexBuffer,f=u.indexBuffer,g=e.style.map.terrain&&e.style.map.terrain.getTerrainData(s),m={programConfiguration:c,program:h,layoutVertexBuffer:p,indexBuffer:f,uniformValues:_e(e,s,a,r),terrainData:g};if(l){const e=u.segments.get();for(const n of e)d.push({segments:new t.S([n]),sortKey:n.sortKey,state:m})}else d.push({segments:u.segments,sortKey:0,state:m})}l&&d.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of d){const{programConfiguration:n,program:i,layoutVertexBuffer:o,indexBuffer:s,uniformValues:a,terrainData:l}=t.state;i.draw(u,c.TRIANGLES,h,p,f,kn.disabled,a,l,r.id,o,s,t.segments,r.paint,e.transform.zoom,n)}}(e,n,r,i);break;case"heatmap":!function(e,n,r,i){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const o=e.context,s=o.gl,a=An.disabled,l=new Tn([s.ONE,s.ONE],t.aT.transparent,[!0,!0,!0,!0]);!function(t,e,n){const r=t.gl;t.activeTexture.set(r.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let i=n.heatmapFbo;if(i)r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),t.bindFramebuffer.set(i.framebuffer);else{const o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),i=n.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1,!1),function(t,e,n,r){var i,o;const s=t.gl,a=null!==(i=t.HALF_FLOAT)&&void 0!==i?i:s.UNSIGNED_BYTE,l=null!==(o=t.RGBA16F)&&void 0!==o?o:s.RGBA;s.texImage2D(s.TEXTURE_2D,0,l,e.width/4,e.height/4,0,s.RGBA,a,null),r.colorAttachment.set(n)}(t,e,o,i)}}(o,e,r),o.clear({color:t.aT.transparent});for(let t=0;t<i.length;t++){const u=i[t];if(n.hasRenderableParent(u))continue;const c=n.getTile(u),h=c.getBucket(r);if(!h)continue;const p=h.programConfigurations.get(r.id),f=e.useProgram("heatmap",p),{zoom:d}=e.transform;f.draw(o,s.TRIANGLES,Mn.disabled,a,l,kn.disabled,we(u.posMatrix,c,d,r.paint.get("heatmap-intensity")),null,r.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,r.paint,e.transform.zoom,p)}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,n){const r=e.context,i=r.gl,o=n.heatmapFbo;if(!o)return;r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,o.colorAttachment.get()),r.activeTexture.set(i.TEXTURE1);let s=n.colorRampTexture;s||(s=n.colorRampTexture=new v(r,n.colorRamp,i.RGBA)),s.bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,i.TRIANGLES,Mn.disabled,An.disabled,e.colorModeForRenderPass(),kn.disabled,((e,n,r,i)=>{const o=t.Z();t.aS(o,0,e.width,e.height,0,0,1);const s=e.context.gl;return{u_matrix:o,u_world:[s.drawingBufferWidth,s.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:n.paint.get("heatmap-opacity")}})(e,n),null,n.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,n.paint,e.transform.zoom)}(e,r))}(e,n,r,i);break;case"line":!function(e,n,r,i){if("translucent"!==e.renderPass)return;const o=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;const a=e.depthModeForSublayer(0,Mn.ReadOnly),l=e.colorModeForRenderPass(),u=r.paint.get("line-dasharray"),c=r.paint.get("line-pattern"),h=c.constantOr(1),p=r.paint.get("line-gradient"),f=r.getCrossfadeParameters(),d=h?"linePattern":u?"lineSDF":p?"lineGradient":"line",g=e.context,m=g.gl;let y=!0;for(const o of i){const i=n.getTile(o);if(h&&!i.patternsLoaded())continue;const s=i.getBucket(r);if(!s)continue;const _=s.programConfigurations.get(r.id),x=e.context.program.get(),b=e.useProgram(d,_),w=y||b.program!==x,E=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),S=c.constantOr(null);if(S&&i.imageAtlas){const t=i.imageAtlas,e=t.patternPositions[S.to.toString()],n=t.patternPositions[S.from.toString()];e&&n&&_.setConstantPatternPositions(e,n)}const I=E?o:null,C=h?Ce(e,i,r,f,I):u?Te(e,i,r,u,f,I):p?Ie(e,i,r,s.lineClipsArray.length,I):Se(e,i,r,I);if(h)g.activeTexture.set(m.TEXTURE0),i.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),_.updatePaintBuffers(f);else if(u&&(w||e.lineAtlas.dirty))g.activeTexture.set(m.TEXTURE0),e.lineAtlas.bind(g);else if(p){const i=s.gradients[r.id];let a=i.texture;if(r.gradientVersion!==i.version){let l=256;if(r.stepInterpolant){const r=n.getSource().maxzoom,i=o.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;l=t.ad(t.aY(s.maxLineLength/t.N*1024*i),256,g.maxTextureSize)}i.gradient=t.aZ({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:i.gradient||void 0,clips:s.lineClipsArray}),i.texture?i.texture.update(i.gradient):i.texture=new v(g,i.gradient,m.RGBA),i.version=r.gradientVersion,a=i.texture}g.activeTexture.set(m.TEXTURE0),a.bind(r.stepInterpolant?m.NEAREST:m.LINEAR,m.CLAMP_TO_EDGE)}b.draw(g,m.TRIANGLES,a,e.stencilModeForClipping(o),l,kn.disabled,C,E,r.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,r.paint,e.transform.zoom,_,s.layoutVertexBuffer2),y=!1}}(e,n,r,i);break;case"fill":!function(e,n,r,i){const o=r.paint.get("fill-color"),s=r.paint.get("fill-opacity");if(0===s.constantOr(1))return;const a=e.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(t.aT.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(e.renderPass===u){const t=e.depthModeForSublayer(1,"opaque"===e.renderPass?Mn.ReadWrite:Mn.ReadOnly);jn(e,n,r,i,t,a,!1)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){const t=e.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,Mn.ReadOnly);jn(e,n,r,i,t,a,!0)}}(e,n,r,i);break;case"fill-extrusion":!function(t,e,n,r){const i=n.paint.get("fill-extrusion-opacity");if(0!==i&&"translucent"===t.renderPass){const o=new Mn(t.context.gl.LEQUAL,Mn.ReadWrite,t.depthRangeFor3D);if(1!==i||n.paint.get("fill-extrusion-pattern").constantOr(1))Gn(t,e,n,r,o,An.disabled,Tn.disabled),Gn(t,e,n,r,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{const i=t.colorModeForRenderPass();Gn(t,e,n,r,o,An.disabled,i)}}}(e,n,r,i);break;case"hillshade":!function(t,e,n,r){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const i=t.context,o=t.depthModeForSublayer(0,Mn.ReadOnly),s=t.colorModeForRenderPass(),[a,l]="translucent"===t.renderPass?t.stencilConfigForOverlap(r):[{},r];for(const r of l){const i=e.getTile(r);void 0!==i.needsHillshadePrepare&&i.needsHillshadePrepare&&"offscreen"===t.renderPass?$n(t,i,n,o,An.disabled,s):"translucent"===t.renderPass&&qn(t,r,i,n,o,a[r.overscaledZ],s)}i.viewport.set([0,0,t.width,t.height])}(e,n,r,i);break;case"raster":!function(t,e,n,r){if("translucent"!==t.renderPass)return;if(0===n.paint.get("raster-opacity"))return;if(!r.length)return;const i=t.context,o=i.gl,s=e.getSource(),a=t.useProgram("raster"),l=t.colorModeForRenderPass(),[u,c]=s instanceof B?[{},r]:t.stencilConfigForOverlap(r),h=c[c.length-1].overscaledZ,p=!t.options.moving;for(const r of c){const c=t.depthModeForSublayer(r.overscaledZ-h,1===n.paint.get("raster-opacity")?Mn.ReadWrite:Mn.ReadOnly,o.LESS),f=e.getTile(r);f.registerFadeDuration(n.paint.get("raster-fade-duration"));const d=e.findLoadedParent(r,0),g=Xn(f,d,e,n,t.transform,t.style.map.terrain);let m,y;const _="nearest"===n.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;i.activeTexture.set(o.TEXTURE0),f.texture.bind(_,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.activeTexture.set(o.TEXTURE1),d?(d.texture.bind(_,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),m=Math.pow(2,d.tileID.overscaledZ-f.tileID.overscaledZ),y=[f.tileID.canonical.x*m%1,f.tileID.canonical.y*m%1]):f.texture.bind(_,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);const v=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r),x=v?r:null,b=x?x.posMatrix:t.transform.calculatePosMatrix(r.toUnwrapped(),p),w=Le(b,y||[0,0],m||1,g,n);s instanceof B?a.draw(i,o.TRIANGLES,c,An.disabled,l,kn.disabled,w,v,n.id,s.boundsBuffer,t.quadTriangleIndexBuffer,s.boundsSegments):a.draw(i,o.TRIANGLES,c,u[r.overscaledZ],l,kn.disabled,w,v,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}}(e,n,r,i);break;case"background":!function(t,e,n,r){const i=n.paint.get("background-color"),o=n.paint.get("background-opacity");if(0===o)return;const s=t.context,a=s.gl,l=t.transform,u=l.tileSize,c=n.paint.get("background-pattern");if(t.isPatternMissing(c))return;const h=!c&&1===i.a&&1===o&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==h)return;const p=An.disabled,f=t.depthModeForSublayer(0,"opaque"===h?Mn.ReadWrite:Mn.ReadOnly),d=t.colorModeForRenderPass(),g=t.useProgram(c?"backgroundPattern":"background"),m=r||l.coveringTiles({tileSize:u,terrain:t.style.map.terrain});c&&(s.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));const y=n.getCrossfadeParameters();for(const e of m){const l=r?e.posMatrix:t.transform.calculatePosMatrix(e.toUnwrapped()),h=c?Oe(l,o,t,c,{tileID:e,tileSize:u},y):Re(l,o,i),m=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);g.draw(s,a.TRIANGLES,f,p,d,kn.disabled,h,m,n.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}(e,0,r,i);break;case"custom":!function(t,e,n){const r=t.context,i=n.implementation;if("offscreen"===t.renderPass){const e=i.prerender;e&&(t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),e.call(i,r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),r.setStencilMode(An.disabled);const e="3d"===i.renderingMode?new Mn(t.context.gl.LEQUAL,Mn.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Mn.ReadOnly);r.setDepthMode(e),i.render(r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState(),r.bindFramebuffer.set(null)}}(e,0,r)}}translatePosMatrix(e,n,r,i,o){if(!r[0]&&!r[1])return e;const s=o?"map"===i?this.transform.angle:0:"viewport"===i?-this.transform.angle:0;if(s){const t=Math.sin(s),e=Math.cos(s);r=[r[0]*e-r[1]*t,r[0]*t+r[1]*e]}const a=[o?r[0]:Ct(n,r[0],this.transform.zoom),o?r[1]:Ct(n,r[1],this.transform.zoom),0],l=new Float32Array(16);return t.$(l,e,a),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),n=this.imageManager.getPattern(t.to.toString());return!e||!n}useProgram(t,e){this.cache=this.cache||{};const n=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[n]||(this.cache[n]=new ce(this.context,se[t],e,ze[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[n]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new v(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}class ir{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(e,n,r){const i=Math.pow(2,r),o=[[-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((r=>{const o=1/(r=t.ag([],r,e))[3]/n*i;return t.b3(r,r,[o,o,1/r[3],o])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=function(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}([],function(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],l=n[2];return t[0]=i*l-o*a,t[1]=o*s-r*l,t[2]=r*a-i*s,t}([],g([],o[t[0]],o[t[1]]),g([],o[t[2]],o[t[1]]))),n=-((r=e)[0]*(i=o[t[1]])[0]+r[1]*i[1]+r[2]*i[2]);var r,i;return e.concat(n)}));return new ir(o,s)}}class or{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,n){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],n=f(this.min),r=f(this.max);for(let t=0;t<e.length;t++)n[t]=e[t]?this.min[t]:this.center[t],r[t]=e[t]?this.center[t]:this.max[t];return r[2]=this.max[2],new or(n,r)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(e){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let r=!0;for(let i=0;i<e.planes.length;i++){const o=e.planes[i];let s=0;for(let e=0;e<n.length;e++)t.b4(o,n[e])>=0&&s++;if(0===s)return 0;s!==n.length&&(r=!1)}if(r)return 2;for(let t=0;t<3;t++){let n=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let i=0;i<e.points.length;i++){const o=e.points[i][t]-this.min[t];n=Math.min(n,o),r=Math.max(r,o)}if(r<0||n>this.max[t]-this.min[t])return 0}return 1}}class sr{constructor(t=0,e=0,n=0,r=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(n)||n<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=n,this.right=r}interpolate(e,n,r){return null!=n.top&&null!=e.top&&(this.top=t.B.number(e.top,n.top,r)),null!=n.bottom&&null!=e.bottom&&(this.bottom=t.B.number(e.bottom,n.bottom,r)),null!=n.left&&null!=e.left&&(this.left=t.B.number(e.left,n.left,r)),null!=n.right&&null!=e.right&&(this.right=t.B.number(e.right,n.right,r)),this}getCenter(e,n){const r=t.ad((this.left+e-this.right)/2,0,e),i=t.ad((this.top+n-this.bottom)/2,0,n);return new t.P(r,i)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new sr(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ar{constructor(e,n,r,i,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||!!o,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=null==r?0:r,this._maxPitch=null==i?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new sr,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new ar(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const n=-t.b5(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}(),function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(n),l=Math.cos(n);t[0]=r*l+o*a,t[1]=i*l+s*a,t[2]=r*-a+o*l,t[3]=i*-a+s*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const n=t.ad(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,n){this._unmodified=!1,this._edgeInsets.interpolate(t,e,n),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const n=[new t.b6(0,e)];if(this._renderWorldCopies){const r=this.pointCoordinate(new t.P(0,0)),i=this.pointCoordinate(new t.P(this.width,0)),o=this.pointCoordinate(new t.P(this.width,this.height)),s=this.pointCoordinate(new t.P(0,this.height)),a=Math.floor(Math.min(r.x,i.x,o.x,s.x)),l=Math.floor(Math.max(r.x,i.x,o.x,s.x)),u=1;for(let r=a-u;r<=l+u;r++)0!==r&&n.push(new t.b6(r,e))}return n}coveringTiles(e){var n,r;let i=this.coveringZoomLevel(e);const o=i;if(void 0!==e.minzoom&&i<e.minzoom)return[];void 0!==e.maxzoom&&i>e.maxzoom&&(i=e.maxzoom);const s=this.pointCoordinate(this.getCameraPoint()),a=t.U.fromLngLat(this.center),l=Math.pow(2,i),u=[l*s.x,l*s.y,0],c=[l*a.x,l*a.y,0],h=ir.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i);let p=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=i);const f=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,d=t=>({aabb:new or([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),g=[],y=[],_=i,v=e.reparseOverscaled?o:i;if(this._renderWorldCopies)for(let t=1;t<=3;t++)g.push(d(-t)),g.push(d(t));for(g.push(d(0));g.length>0;){const i=g.pop(),o=i.x,s=i.y;let a=i.fullyVisible;if(!a){const t=i.aabb.intersects(h);if(0===t)continue;a=2===t}const l=e.terrain?u:c,d=i.aabb.distanceX(l),x=i.aabb.distanceY(l),b=Math.max(Math.abs(d),Math.abs(x));if(i.zoom===_||b>f+(1<<_-i.zoom)-2&&i.zoom>=p){const e=_-i.zoom,n=u[0]-.5-(o<<e),r=u[1]-.5-(s<<e);y.push({tileID:new t.O(i.zoom===_?v:i.zoom,i.wrap,i.zoom,o,s),distanceSq:m([c[0]-.5-o,c[1]-.5-s]),tileDistanceToCamera:Math.sqrt(n*n+r*r)})}else for(let l=0;l<4;l++){const u=(o<<1)+l%2,c=(s<<1)+(l>>1),h=i.zoom+1;let p=i.aabb.quadrant(l);if(e.terrain){const o=new t.O(h,i.wrap,h,u,c),s=e.terrain.getMinMaxElevation(o),a=null!==(n=s.minElevation)&&void 0!==n?n:this.elevation,l=null!==(r=s.maxElevation)&&void 0!==r?r:this.elevation;p=new or([p.min[0],p.min[1],a],[p.max[0],p.max[1],l])}g.push({aabb:p,zoom:h,x:u,y:c,wrap:i.wrap,fullyVisible:a})}}return y.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const n=t.ad(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.P(t.G(e.lng)*this.worldSize,t.H(n)*this.worldSize)}unproject(e){return new t.U(e.x/this.worldSize,e.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(e){const n=this.pointLocation(this.centerPoint,e),r=e.getElevationForLngLatZoom(n,this.tileZoom);if(!(this.elevation-r))return;const i=this.getCameraPosition(),o=t.U.fromLngLat(i.lngLat,i.altitude),s=t.U.fromLngLat(n,r),a=o.x-s.x,l=o.y-s.y,u=o.z-s.z,c=Math.sqrt(a*a+l*l+u*u),h=this.scaleZoom(this.cameraToCenterDistance/c/this.tileSize);this._elevation=r,this._center=n,this.zoom=h}setLocationAtPoint(e,n){const r=this.pointCoordinate(n),i=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),s=new t.U(o.x-(r.x-i.x),o.y-(r.y-i.y));this.center=this.coordinateLocation(s),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),e.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(e){return t.U.fromLngLat(e)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(e,n){if(n){const t=n.pointCoordinate(e);if(null!=t)return t}const r=[e.x,e.y,0,1],i=[e.x,e.y,1,1];t.ag(r,r,this.pixelMatrixInverse),t.ag(i,i,this.pixelMatrixInverse);const o=r[3],s=i[3],a=r[1]/o,l=i[1]/s,u=r[2]/o,c=i[2]/s,h=u===c?0:(0-u)/(c-u);return new t.U(t.B.number(r[0]/o,i[0]/s,h)/this.worldSize,t.B.number(a,l,h)/this.worldSize)}coordinatePoint(e,n=0,r=this.pixelMatrix){const i=[e.x*this.worldSize,e.y*this.worldSize,n,1];return t.ag(i,i,r),new t.P(i[0]/i[3],i[1]/i[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return(new k).extend(this.pointLocation(new t.P(0,e))).extend(this.pointLocation(new t.P(this.width,e))).extend(this.pointLocation(new t.P(this.width,this.height))).extend(this.pointLocation(new t.P(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new k([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,n=!1){const r=e.key,i=n?this._alignedPosMatrixCache:this._posMatrixCache;if(i[r])return i[r];const o=e.canonical,s=this.worldSize/this.zoomScale(o.z),a=o.x+Math.pow(2,o.z)*e.wrap,l=t.ao(new Float64Array(16));return t.$(l,l,[a*s,o.y*s,0]),t.a0(l,l,[s/t.N,s/t.N,1]),t.a1(l,n?this.alignedProjMatrix:this.projMatrix,l),i[r]=new Float32Array(l),i[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,n,r,i,o=-90,s=90,a=-180,l=180;const u=this.size,c=this._unmodified;if(this.latRange){const n=this.latRange;o=t.H(n[1])*this.worldSize,s=t.H(n[0])*this.worldSize,e=s-o<u.y?u.y/(s-o):0}if(this.lngRange){const e=this.lngRange;a=t.b5(t.G(e[0])*this.worldSize,0,this.worldSize),l=t.b5(t.G(e[1])*this.worldSize,0,this.worldSize),l<a&&(l+=this.worldSize),n=l-a<u.x?u.x/(l-a):0}const h=this.point,p=Math.max(n||0,e||0);if(p)return this.center=this.unproject(new t.P(n?(l+a)/2:h.x,e?(s+o)/2:h.y)),this.zoom+=this.scaleZoom(p),this._unmodified=c,void(this._constraining=!1);if(this.latRange){const t=h.y,e=u.y/2;t-e<o&&(i=o+e),t+e>s&&(i=s-e)}if(this.lngRange){const e=(a+l)/2,n=t.b5(h.x,e-this.worldSize/2,e+this.worldSize/2),i=u.x/2;n-i<a&&(r=a+i),n+i>l&&(r=l-i)}void 0===r&&void 0===i||(this.center=this.unproject(new t.P(void 0!==r?r:h.x,void 0!==i?i:h.y)).wrap()),this._unmodified=c,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,n=this.point.x,r=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=t.b7(1,this.center.lat)*this.worldSize;let i=t.ao(new Float64Array(16));t.a0(i,i,[this.width/2,-this.height/2,1]),t.$(i,i,[1,-1,0]),this.labelPlaneMatrix=i,i=t.ao(new Float64Array(16)),t.a0(i,i,[1,-1,1]),t.$(i,i,[-1,-1,0]),t.a0(i,i,[2/this.width,2/this.height,1]),this.glCoordMatrix=i;const o=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),s=Math.min(this.elevation,this._minEleveationForCurrentTile),a=o-s*this._pixelPerMeter/Math.cos(this._pitch),l=s<0?a:o,u=Math.PI/2+this._pitch,c=this._fov*(.5+e.y/this.height),h=Math.sin(c)*l/Math.sin(t.ad(Math.PI-u-c,.01,Math.PI-.01)),p=this.getHorizon(),f=2*Math.atan(p/this.cameraToCenterDistance)*(.5+e.y/(2*p)),d=Math.sin(f)*l/Math.sin(t.ad(Math.PI-u-f,.01,Math.PI-.01)),g=Math.min(h,d),m=1.01*(Math.cos(Math.PI/2-this._pitch)*g+l),y=this.height/50;i=new Float64Array(16),t.b8(i,this._fov,this.width/this.height,y,m),i[8]=2*-e.x/this.width,i[9]=2*e.y/this.height,t.a0(i,i,[1,-1,1]),t.$(i,i,[0,0,-this.cameraToCenterDistance]),t.b9(i,i,this._pitch),t.ae(i,i,this.angle),t.$(i,i,[-n,-r,0]),this.mercatorMatrix=t.a0([],i,[this.worldSize,this.worldSize,this.worldSize]),t.a0(i,i,[1,1,this._pixelPerMeter]),this.pixelMatrix=t.a1(new Float64Array(16),this.labelPlaneMatrix,i),t.$(i,i,[0,0,-this.elevation]),this.projMatrix=i,this.invProjMatrix=t.as([],i),this.pixelMatrix3D=t.a1(new Float64Array(16),this.labelPlaneMatrix,i);const _=this.width%2/2,v=this.height%2/2,x=Math.cos(this.angle),b=Math.sin(this.angle),w=n-Math.round(n)+x*_+b*v,E=r-Math.round(r)+x*v+b*_,S=new Float64Array(i);if(t.$(S,S,[w>.5?w-1:w,E>.5?E-1:E,0]),this.alignedProjMatrix=S,i=t.as(new Float64Array(16),this.pixelMatrix),!i)throw new Error("failed to invert matrix");this.pixelMatrixInverse=i,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.P(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(0,e))}getCameraQueryGeometry(e){const n=this.getCameraPoint();if(1===e.length)return[e[0],n];{let r=n.x,i=n.y,o=n.x,s=n.y;for(const t of e)r=Math.min(r,t.x),i=Math.min(i,t.y),o=Math.max(o,t.x),s=Math.max(s,t.y);return[new t.P(r,i),new t.P(o,i),new t.P(o,s),new t.P(r,s),new t.P(r,i)]}}}function lr(t,e){let n,r=!1,i=null,o=null;const s=()=>{i=null,r&&(t.apply(o,n),i=setTimeout(s,e),r=!1)};return(...t)=>(r=!0,o=this,n=t,i||s(),i)}class ur{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(t){}},this._updateHash=lr(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,r),o=Math.round(e.lng*i)/i,s=Math.round(e.lat*i)/i,a=this._map.getBearing(),l=this._map.getPitch();let u="";if(u+=t?`/${o}/${s}/${n}`:`${n}/${s}/${o}`,(a||l)&&(u+="/"+Math.round(10*a)/10),l&&(u+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const n=window.location.hash.slice(1).split("&").map((n=>{const r=n.split("=")[0];return r===t?(e=!0,`${r}=${u}`):n})).filter((t=>t));return e||n.push(`${t}=${u}`),`#${n.join("&")}`}return`#${u}`}}const cr={linearity:.3,easing:t.ba(0,0,.3,1)},hr=t.e({deceleration:2500,maxSpeed:1400},cr),pr=t.e({deceleration:20,maxSpeed:1400},cr),fr=t.e({deceleration:1e3,maxSpeed:360},cr),dr=t.e({deceleration:1e3,maxSpeed:90},cr);class gr{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.h.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,n=t.h.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)n.zoom+=t.zoomDelta||0,n.bearing+=t.bearingDelta||0,n.pitch+=t.pitchDelta||0,t.panDelta&&n.pan._add(t.panDelta),t.around&&(n.around=t.around),t.pinchAround&&(n.pinchAround=t.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,i={};if(n.pan.mag()){const o=yr(n.pan.mag(),r,t.e({},hr,e||{}));i.offset=n.pan.mult(o.amount/n.pan.mag()),i.center=this._map.transform.center,mr(i,o)}if(n.zoom){const t=yr(n.zoom,r,pr);i.zoom=this._map.transform.zoom+t.amount,mr(i,t)}if(n.bearing){const e=yr(n.bearing,r,fr);i.bearing=this._map.transform.bearing+t.ad(e.amount,-179,179),mr(i,e)}if(n.pitch){const t=yr(n.pitch,r,dr);i.pitch=this._map.transform.pitch+t.amount,mr(i,t)}if(i.zoom||i.bearing){const t=void 0===n.pinchAround?n.around:n.pinchAround;i.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.e(i,{noMoveStart:!0})}}function mr(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function yr(e,n,r){const{maxSpeed:i,linearity:o,deceleration:s}=r,a=t.ad(e*o/(n/1e3),-i,i),l=Math.abs(a)/(s*o);return{easing:r.easing,duration:1e3*l,amount:a*(l/2)}}class _r extends t.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,i,o={}){const s=n.mousePos(r.getCanvasContainer(),i),a=r.unproject(s);super(e,t.e({point:s,lngLat:a,originalEvent:i},o)),this._defaultPrevented=!1,this.target=r}}class vr extends t.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,i){const o="touchend"===e?i.changedTouches:i.touches,s=n.touchPos(r.getCanvasContainer(),o),a=s.map((t=>r.unproject(t))),l=s.reduce(((t,e,n,r)=>t.add(e.div(r.length))),new t.P(0,0));super(e,{points:s,point:l,lngLats:a,lngLat:r.unproject(l),originalEvent:i}),this._defaultPrevented=!1}}class xr extends t.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,n){super(t,{originalEvent:n}),this._defaultPrevented=!1}}class br{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new xr(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new _r(t.type,this._map,t))}mouseup(t){this._map.fire(new _r(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new _r(t.type,this._map,t))}dblclick(t){return this._firePreventable(new _r(t.type,this._map,t))}mouseover(t){this._map.fire(new _r(t.type,this._map,t))}mouseout(t){this._map.fire(new _r(t.type,this._map,t))}touchstart(t){return this._firePreventable(new vr(t.type,this._map,t))}touchmove(t){this._map.fire(new vr(t.type,this._map,t))}touchend(t){this._map.fire(new vr(t.type,this._map,t))}touchcancel(t){this._map.fire(new vr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class wr{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new _r(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new _r("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new _r(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Er{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(t.P.convert(e),this._map.terrain)}}class Sr{constructor(t,e){this._map=t,this._tr=new Er(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(n.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const r=e;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;const i=this._startPos;this._lastPos=r,this._box||(this._box=n.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const o=Math.min(i.x,r.x),s=Math.max(i.x,r.x),a=Math.min(i.y,r.y),l=Math.max(i.y,r.y);n.setTransform(this._box,`translate(${o}px,${a}px)`),this._box.style.width=s-o+"px",this._box.style.height=l-a+"px"}mouseupWindow(e,r){if(!this._active)return;if(0!==e.button)return;const i=this._startPos,o=r;if(this.reset(),n.suppressClick(),i.x!==o.x||i.y!==o.y)return this._map.fire(new t.k("boxzoomend",{originalEvent:e})),{cameraAnimation:t=>t.fitScreenCoordinates(i,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(n.remove(this._box),this._box=null),n.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new t.k(e,{originalEvent:n}))}}function Ir(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const n={};for(let r=0;r<t.length;r++)n[t[r].identifier]=e[r];return n}class Cr{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,n,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){const n=new t.P(0,0);for(const t of e)n._add(t);return n.div(e.length)}(n),this.touches=Ir(r,n)))}touchmove(t,e,n){if(this.aborted||!this.centroid)return;const r=Ir(n,e);for(const t in this.touches){const e=r[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,n){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Tr{constructor(t){this.singleTap=new Cr(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,n){this.singleTap.touchstart(t,e,n)}touchmove(t,e,n){this.singleTap.touchmove(t,e,n)}touchend(t,e,n){const r=this.singleTap.touchend(t,e,n);if(r){const e=t.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(r)<30;if(e&&n||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Pr{constructor(t){this._tr=new Er(t),this._zoomIn=new Tr({numTouches:1,numTaps:2}),this._zoomOut=new Tr({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,n){this._zoomIn.touchstart(t,e,n),this._zoomOut.touchstart(t,e,n)}touchmove(t,e,n){this._zoomIn.touchmove(t,e,n),this._zoomOut.touchmove(t,e,n)}touchend(t,e,n){const r=this._zoomIn.touchend(t,e,n),i=this._zoomOut.touchend(t,e,n),o=this._tr;return r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(r)},{originalEvent:t})}):i?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(i)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Mr{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const n=this._lastPoint;if(!n)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const r=e.length?e[0]:e;return!this._moved&&r.dist(n)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(n,r))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&n.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Lr={0:1,2:2};class Ar{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const e=n.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const n=Lr[e];return void 0===t.buttons||(t.buttons&n)!==n}(t,this._eventButton)}isValidEndEvent(t){return n.mouseButton(t)===this._eventButton}}class kr{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const Nr=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=function(t){t.preventDefault()}},Dr=({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:r=.8})=>{const i=new Ar({checkCorrectEvent:t=>0===n.mouseButton(t)&&t.ctrlKey||2===n.mouseButton(t)});return new Mr({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*r}),moveStateManager:i,enable:t,assignEvents:Nr})},Rr=({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:r=-.5})=>{const i=new Ar({checkCorrectEvent:t=>0===n.mouseButton(t)&&t.ctrlKey||2===n.mouseButton(t)});return new Mr({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*r}),moveStateManager:i,enable:t,assignEvents:Nr})};class Or{constructor(t,e){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0),setTimeout((()=>{this._cancelCooperativeMessage=!1}),200)}touchstart(t,e,n){return this._calculateTransform(t,e,n)}touchmove(t,e,n){if(this._map._cooperativeGestures&&(2===this._minTouches&&n.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,n.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(n.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,n)}touchend(t,e,n){this._calculateTransform(t,e,n),this._active&&n.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,r){r.length>0&&(this._active=!0);const i=Ir(r,n),o=new t.P(0,0),s=new t.P(0,0);let a=0;for(const t in i){const e=i[t],n=this._touches[t];n&&(o._add(e),s._add(e.sub(n)),a++,i[t]=e)}if(this._touches=i,a<this._minTouches||!s.mag())return;const l=s.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(a),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class zr{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,n){if(!this._firstTwoTouches)return;t.preventDefault();const[r,i]=this._firstTwoTouches,o=Fr(n,e,r),s=Fr(n,e,i);if(!o||!s)return;const a=this._aroundCenter?null:o.add(s).div(2);return this._move([o,s],a,t)}touchend(t,e,r){if(!this._firstTwoTouches)return;const[i,o]=this._firstTwoTouches,s=Fr(r,e,i),a=Fr(r,e,o);s&&a||(this._active&&n.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Fr(t,e,n){for(let r=0;r<t.length;r++)if(t[r].identifier===n)return e[r]}function Br(t,e){return Math.log(t/e)/Math.LN2}class Ur extends zr{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const n=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Br(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Br(this._distance,n),pinchAround:e}}}function Vr(t,e){return 180*t.angleWith(e)/Math.PI}class jr extends zr{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e){const n=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Vr(this._vector,n),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,n=Vr(t,this._startVector);return Math.abs(n)<e}}function Gr(t){return Math.abs(t.y)>Math.abs(t.x)}class qr extends zr{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,n){super.touchstart(t,e,n),this._currentTouchCount=n.length}_start(t){this._lastPoints=t,Gr(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,n){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const r=t[0].sub(this._lastPoints[0]),i=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,i,n.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+i.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,n){if(void 0!==this._valid)return this._valid;const r=t.mag()>=2,i=e.mag()>=2;if(!r&&!i)return;if(!r||!i)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return Gr(t)&&Gr(e)&&o}}const $r={panStep:100,bearingStep:15,pitchStep:10};class Xr{constructor(t){this._tr=new Er(t);const e=$r;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,n=0,r=0,i=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),i=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),i=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(n=0,r=0),{cameraAnimation:s=>{const a=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:Zr,zoom:e?Math.round(a.zoom)+e*(t.shiftKey?2:1):a.zoom,bearing:a.bearing+n*this._bearingStep,pitch:a.pitch+r*this._pitchStep,offset:[-i*this._panStep,-o*this._panStep],center:a.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Zr(t){return t*(2-t)}const Yr=4.000244140625;class Wr{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new Er(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!e[this._map._metaKey])return;e.preventDefault()}let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const r=t.h.now(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==n&&n%Yr==0?this._type="wheel":0!==n&&Math.abs(n)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const r=n.mousePos(this._el,e),i=this._tr;this._around=t.L.convert(this._aroundCenter?i.center:i.unproject(r)),this._aroundPoint=i.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._tr.transform;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>Yr?this._wheelZoomRate:this._defaultZoomRate;let n=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==n&&(n=1/n);const r="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(r*n))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n="number"==typeof this._targetZoom?this._targetZoom:e.zoom,r=this._startZoom,i=this._easing;let o,s=!1;if("wheel"===this._type&&r&&i){const e=Math.min((t.h.now()-this._lastWheelEventTime)/200,1),a=i(e);o=t.B.number(r,n,a),e<1?this._frameId||(this._frameId=!0):s=!0}else o=n,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!s,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=t.bb;if(this._prevEase){const e=this._prevEase,r=(t.h.now()-e.start)/e.duration,i=e.easing(r+.01)-e.easing(r),o=.27/Math.sqrt(i*i+1e-4)*.01,s=Math.sqrt(.0729-o*o);n=t.ba(o,s,.25,1)}return this._prevEase={start:t.h.now(),duration:e,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Hr{constructor(t,e){this._clickZoom=t,this._tapZoom=e}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Kr{constructor(t){this._tr=new Er(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Jr{constructor(){this._tap=new Tr({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,e,n){if(!this._swipePoint)if(this._tapTime){const r=e[0],i=t.timeStamp-this._tapTime<500,o=this._tapPoint.dist(r)<30;i&&o?n.length>0&&(this._swipePoint=r,this._swipeTouch=n[0].identifier):this.reset()}else this._tap.touchstart(t,e,n)}touchmove(t,e,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const r=e[0],i=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:i/128}}}else this._tap.touchmove(t,e,n)}touchend(t,e,n){if(this._tapTime)this._swipePoint&&0===n.length&&this.reset();else{const r=this._tap.touchend(t,e,n);r&&(this._tapTime=t.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Qr{constructor(t,e,n){this._el=t,this._mousePan=e,this._touchPan=n}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ti{constructor(t,e,n){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=n}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 ei{constructor(t,e,n,r){this._el=t,this._touchZoom=e,this._touchRotate=n,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const ni=t=>t.zoom||t.drag||t.pitch||t.rotate;class ri extends t.k{}function ii(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class oi{constructor(t,e){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,e)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const r="renderFrame"===t.type?void 0:t,i={needsRenderFrame:!1},o={},s={},a=t.touches,l=a?this._getMapTouches(a):void 0,u=l?n.touchPos(this._el,l):n.mousePos(this._el,t);for(const{handlerName:n,handler:a,allowed:c}of this._handlers){if(!a.isEnabled())continue;let h;this._blockedByActive(s,c,n)?a.reset():a[e||t.type]&&(h=a[e||t.type](t,u,l),this.mergeHandlerResult(i,o,h,n,r),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||a.isActive())&&(s[n]=a)}const c={};for(const t in this._previousActiveHandlers)s[t]||(c[t]=r);this._previousActiveHandlers=s,(Object.keys(c).length||ii(i))&&(this._changes.push([i,o,c]),this._triggerRenderFrame()),(Object.keys(s).length||ii(i))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=i;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new gr(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,r]of this._listeners)n.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(const[t,e,r]of this._listeners)n.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){const e=this._map,r=e.getCanvasContainer();this._add("mapEvent",new br(e,t));const i=e.boxZoom=new Sr(e,t);this._add("boxZoom",i),t.interactive&&t.boxZoom&&i.enable();const o=new Pr(e),s=new Kr(e);e.doubleClickZoom=new Hr(s,o),this._add("tapZoom",o),this._add("clickZoom",s),t.interactive&&t.doubleClickZoom&&e.doubleClickZoom.enable();const a=new Jr;this._add("tapDragZoom",a);const l=e.touchPitch=new qr(e);this._add("touchPitch",l),t.interactive&&t.touchPitch&&e.touchPitch.enable(t.touchPitch);const u=Dr(t),c=Rr(t);e.dragRotate=new ti(t,u,c),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]),t.interactive&&t.dragRotate&&e.dragRotate.enable();const h=(({enable:t,clickTolerance:e})=>{const r=new Ar({checkCorrectEvent:t=>0===n.mouseButton(t)&&!t.ctrlKey});return new Mr({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:r,enable:t,assignEvents:Nr})})(t),p=new Or(t,e);e.dragPan=new Qr(r,h,p),this._add("mousePan",h),this._add("touchPan",p,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&e.dragPan.enable(t.dragPan);const f=new jr,d=new Ur;e.touchZoomRotate=new ei(r,d,f,a),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",d,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&e.touchZoomRotate.enable(t.touchZoomRotate);const g=e.scrollZoom=new Wr(e,(()=>this._triggerRenderFrame()));this._add("scrollZoom",g,["mousePan"]),t.interactive&&t.scrollZoom&&e.scrollZoom.enable(t.scrollZoom);const m=e.keyboard=new Xr(e);this._add("keyboard",m),t.interactive&&t.keyboard&&e.keyboard.enable(),this._add("blockableMapEvent",new wr(e))}_add(t,e,n){this._handlers.push({handlerName:t,handler:e,allowed:n}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(ni(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,n){for(const r in t)if(r!==n&&(!e||e.indexOf(r)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const n of t)this._el.contains(n.target)&&e.push(n);return e}mergeHandlerResult(e,n,r,i,o){if(!r)return;t.e(e,r);const s={handlerName:i,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(n.zoom=s),void 0!==r.panDelta&&(n.drag=s),void 0!==r.pitchDelta&&(n.pitch=s),void 0!==r.bearingDelta&&(n.rotate=s)}_applyChanges(){const e={},n={},r={};for(const[i,o,s]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),void 0!==i.around&&(e.around=i.around),void 0!==i.pinchAround&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),t.e(n,o),t.e(r,s);this._updateMapTransform(e,n,r),this._changes=[]}_updateMapTransform(t,e,n){const r=this._map,i=r._getTransformForUpdate(),o=r.terrain;if(!(ii(t)||o&&this._terrainMovement))return this._fireEvents(e,n,!0);let{panDelta:s,zoomDelta:a,bearingDelta:l,pitchDelta:u,around:c,pinchAround:h}=t;void 0!==h&&(c=h),r._stop(!0),c=c||r.transform.centerPoint;const p=i.pointLocation(s?c.sub(s):c);l&&(i.bearing+=l),u&&(i.pitch+=u),a&&(i.zoom+=a),o?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?i.center=i.pointLocation(i.centerPoint.sub(s)):i.setLocationAtPoint(p,c):(this._terrainMovement=!0,this._map._elevationFreeze=!0,i.setLocationAtPoint(p,c),this._map.once("moveend",(()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,i.recalculateZoom(r.terrain)}))):i.setLocationAtPoint(p,c),r._applyUpdatedTransform(i),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,n,!0)}_fireEvents(e,n,r){const i=ni(this._eventsInProgress),o=ni(e),s={};for(const t in e){const{originalEvent:n}=e[t];this._eventsInProgress[t]||(s[`${t}start`]=n),this._eventsInProgress[t]=e[t]}!i&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in s)this._fireEvent(t,s[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:n}=e[t];this._fireEvent(t,n)}const a={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:r}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=n[e]||r,a[`${t}end`]=l)}for(const t in a)this._fireEvent(t,a[t]);const u=ni(this._eventsInProgress);if(r&&(i||o)&&!u){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),n=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;!e||!e.essential&&t.h.prefersReducedMotion?(this._map.fire(new t.k("moveend",{originalEvent:l})),n(this._map.getBearing())&&this._map.resetNorth()):(n(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:l})),this._updatingCamera=!1}}_fireEvent(e,n){this._map.fire(new t.k(e,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new ri("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class si extends t.E{constructor(e,n){super(),this._renderFrameCallback=()=>{const e=Math.min((t.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new t.L(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,n,r){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},n),r)}panTo(e,n,r){return this.easeTo(t.e({center:e},n),r)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,n,r){return this.easeTo(t.e({zoom:e},n),r)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,n,r){return this.easeTo(t.e({bearing:e},n),r)}resetNorth(e,n){return this.rotateTo(0,t.e({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(t.e({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}cameraForBounds(t,e){t=k.convert(t);const n=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),n,e)}_cameraForBoxAndBearing(e,n,r,i){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(i=t.e({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding){const t=i.padding;i.padding={top:t,bottom:t,right:t,left:t}}i.padding=t.e(o,i.padding);const s=this.transform,a=s.padding,l=s.project(t.L.convert(e)),u=s.project(t.L.convert(n)),c=l.rotate(-r*Math.PI/180),h=u.rotate(-r*Math.PI/180),p=new t.P(Math.max(c.x,h.x),Math.max(c.y,h.y)),f=new t.P(Math.min(c.x,h.x),Math.min(c.y,h.y)),d=p.sub(f),g=(s.width-(a.left+a.right+i.padding.left+i.padding.right))/d.x,m=(s.height-(a.top+a.bottom+i.padding.top+i.padding.bottom))/d.y;if(m<0||g<0)return void t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const y=Math.min(s.scaleZoom(s.scale*Math.min(g,m)),i.maxZoom),_=t.P.convert(i.offset),v=new t.P((i.padding.left-i.padding.right)/2,(i.padding.top-i.padding.bottom)/2).rotate(r*Math.PI/180),x=_.add(v).mult(s.scale/s.zoomScale(y));return{center:s.unproject(l.add(u).div(2).sub(x)),zoom:y,bearing:r}}fitBounds(t,e,n){return this._fitInternal(this.cameraForBounds(t,e),e,n)}fitScreenCoordinates(e,n,r,i,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.P.convert(e)),this.transform.pointLocation(t.P.convert(n)),r,i),i,o)}_fitInternal(e,n,r){return e?(delete(n=t.e(e,n)).padding,n.linear?this.easeTo(n,r):this.flyTo(n,r)):this}jumpTo(e,n){this.stop();const r=this._getTransformForUpdate();let i=!1,o=!1,s=!1;return"zoom"in e&&r.zoom!==+e.zoom&&(i=!0,r.zoom=+e.zoom),void 0!==e.center&&(r.center=t.L.convert(e.center)),"bearing"in e&&r.bearing!==+e.bearing&&(o=!0,r.bearing=+e.bearing),"pitch"in e&&r.pitch!==+e.pitch&&(s=!0,r.pitch=+e.pitch),null==e.padding||r.isPaddingEqual(e.padding)||(r.padding=e.padding),this._applyUpdatedTransform(r),this.fire(new t.k("movestart",n)).fire(new t.k("move",n)),i&&this.fire(new t.k("zoomstart",n)).fire(new t.k("zoom",n)).fire(new t.k("zoomend",n)),o&&this.fire(new t.k("rotatestart",n)).fire(new t.k("rotate",n)).fire(new t.k("rotateend",n)),s&&this.fire(new t.k("pitchstart",n)).fire(new t.k("pitch",n)).fire(new t.k("pitchend",n)),this.fire(new t.k("moveend",n))}calculateCameraOptionsFromTo(e,n,r,i=0){const o=t.U.fromLngLat(e,n),s=t.U.fromLngLat(r,i),a=s.x-o.x,l=s.y-o.y,u=s.z-o.z,c=Math.hypot(a,l,u);if(0===c)throw new Error("Can't calculate camera options with same From and To");const h=Math.hypot(a,l),p=this.transform.scaleZoom(this.transform.cameraToCenterDistance/c/this.transform.tileSize),f=180*Math.atan2(a,-l)/Math.PI;let d=180*Math.acos(h/c)/Math.PI;return d=u<0?90-d:90+d,{center:s.toLngLat(),zoom:p,pitch:d,bearing:f}}easeTo(e,n){this._stop(!1,e.easeId),(!1===(e=t.e({offset:[0,0],duration:500,easing:t.bb},e)).animate||!e.essential&&t.h.prefersReducedMotion)&&(e.duration=0);const r=this._getTransformForUpdate(),i=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in e?+e.zoom:i,u="bearing"in e?this._normalizeBearing(e.bearing,o):o,c="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:r.padding,p=t.P.convert(e.offset);let f=r.centerPoint.add(p);const d=r.pointLocation(f),g=t.L.convert(e.center||d);this._normalizeCenter(g);const m=r.project(d),y=r.project(g).sub(m),_=r.zoomScale(l-i);let v,x;e.around&&(v=t.L.convert(e.around),x=r.locationPoint(v));const b={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==i,this._rotating=this._rotating||o!==u,this._pitching=this._pitching||c!==s,this._padding=!r.isPaddingEqual(h),this._easeId=e.easeId,this._prepareEase(n,e.noMoveStart,b),this.terrain&&this._prepareElevation(g),this._ease((d=>{if(this._zooming&&(r.zoom=t.B.number(i,l,d)),this._rotating&&(r.bearing=t.B.number(o,u,d)),this._pitching&&(r.pitch=t.B.number(s,c,d)),this._padding&&(r.interpolatePadding(a,h,d),f=r.centerPoint.add(p)),this.terrain&&!e.freezeElevation&&this._updateElevation(d),v)r.setLocationAtPoint(v,x);else{const t=r.zoomScale(r.zoom-i),e=l>i?Math.min(2,_):Math.max(.5,_),n=Math.pow(e,1-d),o=r.unproject(m.add(y.mult(d*n)).mult(t));r.setLocationAtPoint(r.renderWorldCopies?o.wrap():o,f)}this._applyUpdatedTransform(r),this._fireMoveEvents(n)}),(t=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,t)}),e),this}_prepareEase(e,n,r={}){this._moving=!0,n||r.moving||this.fire(new t.k("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.k("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.k("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.k("pitchstart",e))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&n!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(n-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=n}this.transform.elevation=t.B.number(this._elevationStart,this._elevationTarget,e)}_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(t){if(!this.transformCameraUpdate)return;const e=t.clone(),{center:n,zoom:r,pitch:i,bearing:o,elevation:s}=this.transformCameraUpdate(e);n&&(e.center=n),void 0!==r&&(e.zoom=r),void 0!==i&&(e.pitch=i),void 0!==o&&(e.bearing=o),void 0!==s&&(e.elevation=s),this.transform.apply(e)}_fireMoveEvents(e){this.fire(new t.k("move",e)),this._zooming&&this.fire(new t.k("zoom",e)),this._rotating&&this.fire(new t.k("rotate",e)),this._pitching&&this.fire(new t.k("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const r=this._zooming,i=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new t.k("zoomend",e)),i&&this.fire(new t.k("rotateend",e)),o&&this.fire(new t.k("pitchend",e)),this.fire(new t.k("moveend",e))}flyTo(e,n){if(!e.essential&&t.h.prefersReducedMotion){const r=t.F(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,n)}this.stop(),e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.bb},e);const r=this._getTransformForUpdate(),i=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in e?t.ad(+e.zoom,r.minZoom,r.maxZoom):i,u="bearing"in e?this._normalizeBearing(e.bearing,o):o,c="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:r.padding,p=r.zoomScale(l-i),f=t.P.convert(e.offset);let d=r.centerPoint.add(f);const g=r.pointLocation(d),m=t.L.convert(e.center||g);this._normalizeCenter(m);const y=r.project(g),_=r.project(m).sub(y);let v=e.curve;const x=Math.max(r.width,r.height),b=x/p,w=_.mag();if("minZoom"in e){const n=t.ad(Math.min(e.minZoom,i,l),r.minZoom,r.maxZoom),o=x/r.zoomScale(n-i);v=Math.sqrt(o/w*2)}const E=v*v;function S(t){const e=(b*b-x*x+(t?-1:1)*E*E*w*w)/(2*(t?b:x)*E*w);return Math.log(Math.sqrt(e*e+1)-e)}function I(t){return(Math.exp(t)-Math.exp(-t))/2}function C(t){return(Math.exp(t)+Math.exp(-t))/2}const T=S(!1);let P=function(t){return C(T)/C(T+v*t)},M=function(t){return x*((C(T)*(I(e=T+v*t)/C(e))-I(T))/E)/w;var e},L=(S(!0)-T)/v;if(Math.abs(w)<1e-6||!isFinite(L)){if(Math.abs(x-b)<1e-6)return this.easeTo(e,n);const t=b<x?-1:1;L=Math.abs(Math.log(b/x))/v,M=function(){return 0},P=function(e){return Math.exp(t*v*e)}}return e.duration="duration"in e?+e.duration:1e3*L/("screenSpeed"in e?+e.screenSpeed/v:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==u,this._pitching=c!==s,this._padding=!r.isPaddingEqual(h),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(m),this._ease((p=>{const g=p*L,v=1/P(g);r.zoom=1===p?l:i+r.scaleZoom(v),this._rotating&&(r.bearing=t.B.number(o,u,p)),this._pitching&&(r.pitch=t.B.number(s,c,p)),this._padding&&(r.interpolatePadding(a,h,p),d=r.centerPoint.add(f)),this.terrain&&!e.freezeElevation&&this._updateElevation(p);const x=1===p?m:r.unproject(y.add(_.mult(M(g))).mult(v));r.setLocationAtPoint(r.renderWorldCopies?x.wrap():x,d),this._applyUpdatedTransform(r),this._fireMoveEvents(n)}),(()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,n,r){!1===r.animate||0===r.duration?(e(1),n()):(this._easeStart=t.h.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,n){e=t.b5(e,-180,180);const r=Math.abs(e-n);return Math.abs(e-360-n)<r&&(e-=360),Math.abs(e+360-n)<r&&(e+=360),e}_normalizeCenter(t){const e=this.transform;if(!e.renderWorldCopies||e.lngRange)return;const n=t.lng-e.center.lng;t.lng+=n>180?-360:n<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(t.L.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}class ai{constructor(t={}){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=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=n.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=n.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=n.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(){n.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const n=this._map._getUIString(`AttributionControl.${e}`);t.title=n,t.setAttribute("aria-label",n)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const n in e){const r=e[n];if(r.used||r.usedForTerrain){const e=r.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,n)=>{for(let r=n+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0}));const n=t.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,t.length?(this._innerContainer.innerHTML=n,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class li{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=n.create("div","maplibregl-ctrl");const e=n.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){n.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ui{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,n=e?this._queue.concat(e):this._queue;for(const e of n)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const n of e)if(!n.cancelled&&(n.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const ci={"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 hi=t.Q([{name:"a_pos3d",type:"Int16",components:3}]);class pi extends t.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,n){this.sourceCache.update(e,n),this._renderableTilesKeys=[];const r={};for(const i of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))r[i.key]=!0,this._renderableTilesKeys.push(i.key),this._tiles[i.key]||(i.posMatrix=new Float64Array(16),t.aS(i.posMatrix,0,t.N,0,t.N,0,1),this._tiles[i.key]=new Z(i,this.tileSize));for(const t in this._tiles)r[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const n=this._tiles[e];(!t||n.tileID.equals(t)||n.tileID.isChildOf(t)||t.isChildOf(n.tileID))&&(n.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(e){const n={};for(const r of this._renderableTilesKeys){const i=this._tiles[r].tileID;if(i.canonical.equals(e.canonical)){const i=e.clone();i.posMatrix=new Float64Array(16),t.aS(i.posMatrix,0,t.N,0,t.N,0,1),n[r]=i}else if(i.canonical.isChildOf(e.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16);const s=i.canonical.z-e.canonical.z,a=i.canonical.x-(i.canonical.x>>s<<s),l=i.canonical.y-(i.canonical.y>>s<<s),u=t.N>>s;t.aS(o.posMatrix,0,u,0,u,0,1),t.$(o.posMatrix,o.posMatrix,[-a*u,-l*u,0]),n[r]=o}else if(e.canonical.isChildOf(i.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16);const s=e.canonical.z-i.canonical.z,a=e.canonical.x-(e.canonical.x>>s<<s),l=e.canonical.y-(e.canonical.y>>s<<s),u=t.N>>s;t.aS(o.posMatrix,0,t.N,0,t.N,0,1),t.$(o.posMatrix,o.posMatrix,[a*u,l*u,0]),t.a0(o.posMatrix,o.posMatrix,[1/2**s,1/2**s,0]),n[r]=o}}return n}getSourceTile(t,e){const n=this.sourceCache._source;let r=t.overscaledZ-this.deltaZoom;if(r>n.maxzoom&&(r=n.maxzoom),r<n.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(r).key);let i=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!i||!i.dem)&&e)for(;r>=n.minzoom&&(!i||!i.dem);)i=this.sourceCache.getTileByID(t.scaledTo(r--).key);return i}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeAdded>=t))}}class fi{constructor(t,e,n){this.painter=t,this.sourceCache=new pi(e),this.options=n,this.exaggeration="number"==typeof n.exaggeration?n.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,n,r,i=t.N){var o;if(!(n>=0&&n<i&&r>=0&&r<i))return 0;const s=this.getTerrainData(e),a=null===(o=s.tile)||void 0===o?void 0:o.dem;if(!a)return 0;const l=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t}([],[n/i*t.N,r/i*t.N],s.u_terrain_matrix),u=[l[0]*a.dim,l[1]*a.dim],c=Math.floor(u[0]),h=Math.floor(u[1]),p=u[0]-c,f=u[1]-h;return a.get(c,h)*(1-p)*(1-f)+a.get(c+1,h)*p*(1-f)+a.get(c,h+1)*(1-p)*f+a.get(c+1,h+1)*p*f}getElevationForLngLatZoom(e,n){const{tileID:r,mercatorX:i,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,n);return this.getElevation(r,i%t.N,o%t.N,t.N)}getElevation(e,n,r,i=t.N){return this.getDEMElevation(e,n,r,i)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.painter.context,n=new t.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new v(e,n,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new v(e,new t.R({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.ao([])}const n=this.sourceCache.getSourceTile(e,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const t=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new v(t,n.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),n.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const r=n&&n+n.tileID.key+e.key;if(r&&!this._demMatrixCache[r]){const r=this.sourceCache.sourceCache._source.maxzoom;let i=e.canonical.z-n.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=r?i=e.canonical.z-r:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=e.canonical.x-(e.canonical.x>>i<<i),s=e.canonical.y-(e.canonical.y>>i<<i),a=t.bc(new Float64Array(16),[1/(t.N<<i),1/(t.N<<i),0]);t.$(a,a,[o*t.N,s*t.N,0]),this._demMatrixCache[e.key]={matrix:a,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const e=this.painter,n=e.width/devicePixelRatio,r=e.height/devicePixelRatio;return!this._fbo||this._fbo.width===n&&this._fbo.height===r||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new v(e.context,{width:n,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new v(e.context,{width:n,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(n,r,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,n,r))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let r=0;r<this._coordsTextureSize;r++,e+=4)n[e+0]=255&r,n[e+1]=255&t,n[e+2]=r>>8<<4|t>>8,n[e+3]=0;const r=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),i=new v(e,r,e.gl.RGBA,{premultiply:!1});return i.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(e){const n=new Uint8Array(4),r=this.painter.context,i=r.gl;r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,n),r.bindFramebuffer.set(null);const o=n[0]+(n[2]>>4<<8),s=n[1]+((15&n[2])<<8),a=this.coordsIndex[255-n[3]],l=a&&this.sourceCache.getTileByID(a);if(!l)return null;const u=this._coordsTextureSize,c=(1<<l.tileID.canonical.z)*u;return new t.U(this._allowMercatorOverflow(e,(l.tileID.canonical.x*u+o)/c),(l.tileID.canonical.y*u+s)/c,this.getElevation(l.tileID,o,s,u))}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,n=new t.bd,r=new t.b0,i=this.meshSize,o=t.N/i,s=i*i;for(let t=0;t<=i;t++)for(let e=0;e<=i;e++)n.emplaceBack(e*o,t*o,0);for(let t=0;t<s;t+=i+1)for(let e=0;e<i;e++)r.emplaceBack(e+t,i+e+t+1,i+e+t+2),r.emplaceBack(e+t,i+e+t+2,e+t+1);const a=n.length,l=a+2*(i+1);for(const e of[0,1])for(let r=0;r<=i;r++)for(const i of[0,1])n.emplaceBack(r*o,e*t.N,i);for(let t=0;t<2*i;t+=2)r.emplaceBack(l+t,l+t+1,l+t+3),r.emplaceBack(l+t,l+t+3,l+t+2),r.emplaceBack(a+t,a+t+3,a+t+1),r.emplaceBack(a+t,a+t+2,a+t+3);const u=n.length,c=u+2*(i+1);for(const e of[0,1])for(let r=0;r<=i;r++)for(const i of[0,1])n.emplaceBack(e*t.N,r*o,i);for(let t=0;t<2*i;t+=2)r.emplaceBack(u+t,u+t+1,u+t+3),r.emplaceBack(u+t,u+t+3,u+t+2),r.emplaceBack(c+t,c+t+3,c+t+1),r.emplaceBack(c+t,c+t+2,c+t+3);return this._mesh={indexBuffer:e.createIndexBuffer(r),vertexBuffer:e.createVertexBuffer(n,hi.members),segments:t.S.simpleSegment(0,0,n.length,r.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*t.be/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(t,e){var n;const{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(t,e);return null!==(n=this.getMinMaxElevation(r).minElevation)&&void 0!==n?n:0}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,n={minElevation:null,maxElevation:null};return e&&e.dem&&(n.minElevation=e.dem.min*this.exaggeration,n.maxElevation=e.dem.max*this.exaggeration),n}_getOverscaledTileIDFromLngLatZoom(e,n){const r=t.U.fromLngLat(e.wrap()),i=(1<<n)*t.N,o=r.x*i,s=r.y*i,a=Math.floor(o/t.N),l=Math.floor(s/t.N);return{tileID:new t.O(n,0,n,a,l),mercatorX:o,mercatorY:s}}_allowMercatorOverflow(e,n){const r=e.x<this.painter.width/2;let i=t.bf(n);const o=this.painter.transform.center.lng;return r&&Math.sign(i)>0&&Math.sign(o)<0||!r&&Math.sign(i)<0&&Math.sign(o)>0?(i=360*Math.sign(o)+i,t.G(i)):n}}class di{constructor(t,e,n){this._context=t,this._size=e,this._tileSize=n,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),n=new v(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return n.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(n.texture),{id:t,fbo:e,texture:n,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e=>t.id!==e)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((t=>!t.inUse))}}const gi={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class mi{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new di(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((n=>!t._layers[n].isHidden(e))),this._coordsDescendingInv={};for(const e in t.sourceCaches){this._coordsDescendingInv[e]={};const n=t.sourceCaches[e].getVisibleCoordinates();for(const t of n){const n=this.terrain.sourceCache.getTerrainCoords(t);for(const t in n)this._coordsDescendingInv[e][t]||(this._coordsDescendingInv[e][t]=[]),this._coordsDescendingInv[e][t].push(n[t])}}this._coordsDescendingInvStr={};for(const e of t._order){const n=t._layers[e],r=n.source;if(gi[n.type]&&!this._coordsDescendingInvStr[r]){this._coordsDescendingInvStr[r]={};for(const t in this._coordsDescendingInv[r])this._coordsDescendingInvStr[r][t]=this._coordsDescendingInv[r][t].map((t=>t.key)).sort().join()}}for(const t of this._renderableTiles)for(const e in this._coordsDescendingInvStr){const n=this._coordsDescendingInvStr[e][t.tileID.key];n&&n!==t.rttCoords[e]&&(t.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const n=e.type,r=this.painter,i=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(gi[n]&&(this._prevType&&gi[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!i))return!0;if(gi[this._prevType]||gi[n]&&i){this._prevType=n;const e=this._stacks.length-1,i=this._stacks[e]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(nr(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[e]){const t=this.pool.getObjectForId(n.rtt[e].id);if(t.stamp===n.rtt[e].stamp){this.pool.useObject(t);continue}}const o=this.pool.getOrCreateFreeObject();this.pool.useObject(o),this.pool.stampObject(o),n.rtt[e]={id:o.id,stamp:o.stamp},r.context.bindFramebuffer.set(o.fbo.framebuffer),r.context.clear({color:t.aT.transparent,stencil:0}),r.currentStencilSource=void 0;for(let t=0;t<i.length;t++){const e=r.style._layers[i[t]],s=e.source?this._coordsDescendingInv[e.source][n.tileID.key]:[n.tileID];r.context.viewport.set([0,0,o.fbo.width,o.fbo.height]),r._renderTileClippingMasks(e,s),r.renderLayer(r,r.style.sourceCaches[e.source],e,s),e.source&&(n.rttCoords[e.source]=this._coordsDescendingInvStr[e.source][n.tileID.key])}}return nr(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),gi[n]}return!1}}const yi=e,_i={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:t.c.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},vi=t=>{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd},xi={showCompass:!0,showZoom:!0,visualizePitch:!1};class bi{constructor(e,r,i=!1){this.mousedown=e=>{this.startMouse(t.e({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),n.mousePos(this.element,e)),n.addEventListener(window,"mousemove",this.mousemove),n.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.moveMouse(t,n.mousePos(this.element,t))},this.mouseup=t=>{this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=n.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),n.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),n.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=n.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const o=e.dragRotate._mouseRotate.getClickTolerance(),s=e.dragRotate._mousePitch.getClickTolerance();this.element=r,this.mouseRotate=Dr({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:n=.8})=>{const r=new kr;return new Mr({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*n}),moveStateManager:r,enable:t,assignEvents:vi})})({clickTolerance:o,enable:!0}),this.map=e,i&&(this.mousePitch=Rr({clickTolerance:s,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:n=-.5})=>{const r=new kr;return new Mr({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*n}),moveStateManager:r,enable:t,assignEvents:vi})})({clickTolerance:s,enable:!0})),n.addEventListener(r,"mousedown",this.mousedown),n.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),n.addEventListener(r,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),n.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),n.disableDrag()}moveMouse(t,e){const n=this.map,{bearingDelta:r}=this.mouseRotate.dragMove(t,e)||{};if(r&&n.setBearing(n.getBearing()+r),this.mousePitch){const{pitchDelta:r}=this.mousePitch.dragMove(t,e)||{};r&&n.setPitch(n.getPitch()+r)}}moveTouch(t,e){const n=this.map,{bearingDelta:r}=this.touchRotate.dragMove(t,e)||{};if(r&&n.setBearing(n.getBearing()+r),this.touchPitch){const{pitchDelta:r}=this.touchPitch.dragMove(t,e)||{};r&&n.setPitch(n.getPitch()+r)}}off(){const t=this.element;n.removeEventListener(t,"mousedown",this.mousedown),n.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),n.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),n.removeEventListener(window,"touchend",this.touchend),n.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){n.enableDrag(),n.removeEventListener(window,"mousemove",this.mousemove),n.removeEventListener(window,"mouseup",this.mouseup),n.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),n.removeEventListener(window,"touchend",this.touchend)}}let wi;function Ei(e,n,r){if(e=new t.L(e.lng,e.lat),n){const i=new t.L(e.lng-360,e.lat),o=new t.L(e.lng+360,e.lat),s=r.locationPoint(e).distSqr(n);r.locationPoint(i).distSqr(n)<s?e=i:r.locationPoint(o).distSqr(n)<s&&(e=o)}for(;Math.abs(e.lng-r.center.lng)>180;){const t=r.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e}const Si={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 Ii(t,e,n){const r=t.classList;for(const t in Si)r.remove(`maplibregl-${n}-anchor-${t}`);r.add(`maplibregl-${n}-anchor-${e}`)}class Ci extends t.E{constructor(e){if(super(),this._onKeyPress=t=>{const e=t.code,n=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==n&&13!==n||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,n=this._element;this._popup&&(e===n||n.contains(e))&&this.togglePopup()},this._update=t=>{if(!this._map)return;const e=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==t?void 0:t.type)||"render"===(null==t?void 0:t.type)&&!e)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Ei(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),n.setTransform(this._element,`${Si[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${r}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{const t=this._map.unproject(this._pos),e=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=t.distanceTo(this._lngLat)>20*e?"0.2":"1.0",this._opacityTimeout=null}),100))},this._onMove=e=>{if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.k("dragstart"))),this.fire(new t.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),"active"===this._state&&this.fire(new t.k("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=n.create("div"),this._element.setAttribute("aria-label","Map marker");const r=n.createNS("http://www.w3.org/2000/svg","svg"),i=41,o=27;r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height",`${i}px`),r.setAttributeNS(null,"width",`${o}px`),r.setAttributeNS(null,"viewBox",`0 0 ${o} ${i}`);const s=n.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"stroke","none"),s.setAttributeNS(null,"stroke-width","1"),s.setAttributeNS(null,"fill","none"),s.setAttributeNS(null,"fill-rule","evenodd");const a=n.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=n.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const 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(const t of u){const e=n.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const c=n.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);const h=n.createNS("http://www.w3.org/2000/svg","path");h.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"),c.appendChild(h);const p=n.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const f=n.createNS("http://www.w3.org/2000/svg","path");f.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"),p.appendChild(f);const d=n.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"transform","translate(6.0, 7.0)"),d.setAttributeNS(null,"fill","#FFFFFF");const g=n.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(8.0, 8.0)");const m=n.createNS("http://www.w3.org/2000/svg","circle");m.setAttributeNS(null,"fill","#000000"),m.setAttributeNS(null,"opacity","0.25"),m.setAttributeNS(null,"cx","5.5"),m.setAttributeNS(null,"cy","5.5"),m.setAttributeNS(null,"r","5.4999962");const y=n.createNS("http://www.w3.org/2000/svg","circle");y.setAttributeNS(null,"fill","#FFFFFF"),y.setAttributeNS(null,"cx","5.5"),y.setAttributeNS(null,"cy","5.5"),y.setAttributeNS(null,"r","5.4999962"),g.appendChild(m),g.appendChild(y),a.appendChild(l),a.appendChild(c),a.appendChild(p),a.appendChild(d),a.appendChild(g),r.appendChild(a),r.setAttributeNS(null,"height",i*this._scale+"px"),r.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(r),this._offset=t.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),Ii(this._element,this._anchor,"marker"),e&&e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("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),n.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.L.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,n=13.5,r=Math.abs(n)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[r,-1*(e-n+r)],"bottom-right":[-r,-1*(e-n+r)],left:[n,-1*(e-n)],right:[-n,-1*(e-n)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ti={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Pi=0,Mi=!1;const Li={maxWidth:100,unit:"metric"};function Ai(t,e,n){const r=n&&n.maxWidth||100,i=t._container.clientHeight/2,o=t.unproject([0,i]),s=t.unproject([r,i]),a=o.distanceTo(s);if(n&&"imperial"===n.unit){const n=3.2808*a;n>5280?ki(e,r,n/5280,t._getUIString("ScaleControl.Miles")):ki(e,r,n,t._getUIString("ScaleControl.Feet"))}else n&&"nautical"===n.unit?ki(e,r,a/1852,t._getUIString("ScaleControl.NauticalMiles")):a>=1e3?ki(e,r,a/1e3,t._getUIString("ScaleControl.Kilometers")):ki(e,r,a,t._getUIString("ScaleControl.Meters"))}function ki(t,e,n,r){const i=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let n=t/e;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(n),e*n}(n);t.style.width=e*(i/n)+"px",t.innerHTML=`${i}&nbsp;${r}`}const Ni={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Di=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ri(e){if(e){if("number"==typeof e){const n=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,e),"top-left":new t.P(n,n),"top-right":new t.P(-n,n),bottom:new t.P(0,-e),"bottom-left":new t.P(n,-n),"bottom-right":new t.P(-n,-n),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){const n=t.P.convert(e);return{center:n,top:n,"top-left":n,"top-right":n,bottom:n,"bottom-left":n,"bottom-right":n,left:n,right:n}}return{center:t.P.convert(e.center||[0,0]),top:t.P.convert(e.top||[0,0]),"top-left":t.P.convert(e["top-left"]||[0,0]),"top-right":t.P.convert(e["top-right"]||[0,0]),bottom:t.P.convert(e.bottom||[0,0]),"bottom-left":t.P.convert(e["bottom-left"]||[0,0]),"bottom-right":t.P.convert(e["bottom-right"]||[0,0]),left:t.P.convert(e.left||[0,0]),right:t.P.convert(e.right||[0,0])}}return Ri(new t.P(0,0))}const Oi={extend:(e,...n)=>t.e(e,...n),run(t){t()},logToElement(t,e=!1,n="log"){const r=window.document.getElementById(n);r&&(e&&(r.innerHTML=""),r.innerHTML+=`<br>${t}`)}},zi=e;class Fi{static get version(){return zi}static get workerCount(){return tt.workerCount}static set workerCount(t){tt.workerCount=t}static get maxParallelImageRequests(){return t.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(e){t.c.MAX_PARALLEL_IMAGE_REQUESTS=e}static get workerUrl(){return t.c.WORKER_URL}static set workerUrl(e){t.c.WORKER_URL=e}static addProtocol(e,n){t.c.REGISTERED_PROTOCOLS[e]=n}static removeProtocol(e){delete t.c.REGISTERED_PROTOCOLS[e]}}return Fi.Map=class extends si{constructor(e){if(t.bg.mark(t.bh.create),null!=(e=t.e({},_i,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ar(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=e=>{e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.k("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new t.k("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=t=>{if(t.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=0===navigator.platform.indexOf("Mac")?"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 ui,this._controls=[],this._mapId=t.a2(),this._locale=t.e({},ci,e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=u.addThrottleControl((()=>this.isMoving())),this._requestManager=new h(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;const e=lr((t=>{this._trackResize&&!this._removed&&this.resize(t)._update()}),50);this._resizeObserver=new ResizeObserver((n=>{t?e(n):t=!0})),this._resizeObserver.observe(this._container)}this.handlers=new oi(this,e),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=e.hash&&new ur("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.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 ai({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new li,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.k(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.k(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.k("sourcedataabort",e))}))}_getMapId(){return this._mapId}addControl(e,n){if(void 0===n&&(n=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=e.onAdd(this);this._controls.push(e);const i=this._controlPositions[n];return-1!==n.indexOf("bottom")?i.insertBefore(r,i.firstChild):i.appendChild(r),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(e);return n>-1&&this._controls.splice(n,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,n,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,n,r)}resize(e){var n;const r=this._containerDimensions(),i=r[0],o=r[1],s=this._getClampedPixelRatio(i,o);if(this._resizeCanvas(i,o,s),this.painter.resize(i,o,s),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(i,o);this._resizeCanvas(i,o,e),this.painter.resize(i,o,e)}this.transform.resize(i,o),null===(n=this._requestedCameraState)||void 0===n||n.resize(i,o);const a=!this._moving;return a&&(this.stop(),this.fire(new t.k("movestart",e)).fire(new t.k("move",e))),this.fire(new t.k("resize",e)),a&&this.fire(new t.k("moveend",e)),this}_getClampedPixelRatio(t,e){const{0:n,1:r}=this._maxCanvasSize,i=this.getPixelRatio(),o=t*i,s=e*i;return Math.min(o>n?n/o:1,s>r?r/s:1)*i}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(k.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(t){return this._cooperativeGestures=t,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(e){return this.transform.locationPoint(t.L.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(t.P.convert(e),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,n){if("mouseenter"===t||"mouseover"===t){let r=!1;const i=i=>{const o=this.getLayer(e)?this.queryRenderedFeatures(i.point,{layers:[e]}):[];o.length?r||(r=!0,n.call(this,new _r(t,this,i.originalEvent,{features:o}))):r=!1};return{layer:e,listener:n,delegates:{mousemove:i,mouseout:()=>{r=!1}}}}if("mouseleave"===t||"mouseout"===t){let r=!1;const i=i=>{(this.getLayer(e)?this.queryRenderedFeatures(i.point,{layers:[e]}):[]).length?r=!0:r&&(r=!1,n.call(this,new _r(t,this,i.originalEvent)))},o=e=>{r&&(r=!1,n.call(this,new _r(t,this,e.originalEvent)))};return{layer:e,listener:n,delegates:{mousemove:i,mouseout:o}}}{const r=t=>{const r=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];r.length&&(t.features=r,n.call(this,t),delete t.features)};return{layer:e,listener:n,delegates:{[t]:r}}}}on(t,e,n){if(void 0===n)return super.on(t,e);const r=this._createDelegatedListener(t,e,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(r);for(const t in r.delegates)this.on(t,r.delegates[t]);return this}once(t,e,n){if(void 0===n)return super.once(t,e);const r=this._createDelegatedListener(t,e,n);for(const t in r.delegates)this.once(t,r.delegates[t]);return this}off(t,e,n){return void 0===n?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(r=>{const i=this._delegatedListeners[t];for(let t=0;t<i.length;t++){const r=i[t];if(r.layer===e&&r.listener===n){for(const t in r.delegates)this.off(t,r.delegates[t]);return i.splice(t,1),this}}})(),this)}queryRenderedFeatures(e,n){if(!this.style)return[];let r;const i=e instanceof t.P||Array.isArray(e),o=i?e:[[0,0],[this.transform.width,this.transform.height]];if(n=n||(i?{}:e)||{},o instanceof t.P||"number"==typeof o[0])r=[t.P.convert(o)];else{const e=t.P.convert(o[0]),n=t.P.convert(o[1]);r=[e,new t.P(n.x,e.y),n,new t.P(e.x,n.y),e]}return this.style.queryRenderedFeatures(r,n,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(e,n){return!1!==(n=t.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},n)).diff&&n.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,n),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._updateStyle(e,n))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(t,e)));const n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new re(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,n):this.style.loadJSON(t,e,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new re(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,n){if("string"==typeof e){const r=this._requestManager.transformRequest(e,c.Style);t.f(r,((e,r)=>{e?this.fire(new t.j(e)):r&&this._updateDiff(r,n)}))}else"object"==typeof e&&this._updateDiff(e,n)}_updateDiff(e,n){try{this.style.setState(e,n)&&this._update(!0)}catch(r){t.w(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(e,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.w("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const n=this.style&&this.style.sourceCaches[e];if(void 0!==n)return n.loaded();this.fire(new t.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){const n=this.style.sourceCaches[e.source];if(!n)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);for(const n in this.style._layers){const r=this.style._layers[n];"hillshade"===r.type&&r.source===e.source&&t.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 fi(this.painter,n,e),this.painter.renderToTexture=new mi(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=t=>{"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.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(t.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 t.k("terrain",{terrain:e})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const n=t[e]._tiles;for(const t in n){const e=n[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,n)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,n,r={}){const{pixelRatio:i=1,sdf:o=!1,stretchX:s,stretchY:a,content:l}=r;if(this._lazyInitEmptyStyle(),!(n instanceof HTMLImageElement||t.a(n))){if(void 0===n.width||void 0===n.height)return this.fire(new t.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:r,height:u,data:c}=n,h=n;return this.style.addImage(e,{data:new t.R({width:r,height:u},new Uint8Array(c)),pixelRatio:i,stretchX:s,stretchY:a,content:l,sdf:o,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e),this}}{const{width:r,height:u,data:c}=t.h.getImageData(n);this.style.addImage(e,{data:new t.R({width:r,height:u},c),pixelRatio:i,stretchX:s,stretchY:a,content:l,sdf:o,version:0})}}updateImage(e,n){const r=this.style.getImage(e);if(!r)return this.fire(new t.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const i=n instanceof HTMLImageElement||t.a(n)?t.h.getImageData(n):n,{width:o,height:s,data:a}=i;if(void 0===o||void 0===s)return this.fire(new t.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(o!==r.data.width||s!==r.data.height)return this.fire(new t.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(n instanceof HTMLImageElement||t.a(n));return r.data.replace(a,l),this.style.updateImage(e,r),this}getImage(t){return this.style.getImage(t)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.j(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t,e){u.getImage(this._requestManager.transformRequest(t,c.Image),e)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,n){return this.style.setLayerZoomRange(t,e,n),this._update(!0)}setFilter(t,e,n={}){return this.style.setFilter(t,e,n),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,n,r={}){return this.style.setPaintProperty(t,e,n,r),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,n,r={}){return this.style.setLayoutProperty(t,e,n,r),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,n,(t=>{t||this._update(!0)})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=n.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=n.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i);const o=this._controlContainer=n.create("div","maplibregl-control-container",t),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{s[t]=n.create("div",`maplibregl-ctrl-${t} `,o)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=n.create("div","maplibregl-cooperative-gesture-screen",this._container);let t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`\n <div class="maplibregl-desktop-message">${t}</div>\n <div class="maplibregl-mobile-message">${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>\n `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){n.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(t,e,n){this._canvas.width=Math.floor(n*t),this._canvas.height=Math.floor(n*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",(n=>{e={requestedAttributes:t},n&&(e.statusMessage=n.statusMessage,e.type=n.type)}),{once:!0});const n=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!n){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new rr(n,this.transform),r.testSupport(n)}_onCooperativeGesture(t,e,n){return!e&&n<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(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(e){const n=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=t.h.now();this.style.zoomHistory.update(e,i);const o=new t.a8(e,{now:i,fadeDuration:n,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),s=o.crossFadingFactor();1===s&&s===this._crossFadingFactor||(r=!0,this._crossFadingFactor=s),this.style.update(o)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._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,n,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:n,showPadding:this.showPadding}),this.fire(new t.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.bg.mark(t.bh.load),this.fire(new t.k("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const i=this._sourcesDirty||this._styleDirty||this._placementDirty;return i||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.k("idle")),!this._loaded||this._fullyLoaded||i||(this._fullyLoaded=!0,t.bg.mark(t.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(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),u.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),n.remove(this._canvasContainer),n.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),t.bg.clearMetrics(),this._removed=!0,this.fire(new t.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.h.frame((e=>{t.bg.frame(e),this._frame=null,this._render(e)})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return yi}getCameraTargetElevation(){return this.transform.elevation}},Fi.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),n=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,e)=>{const n=this._map._getUIString(`NavigationControl.${e}`);t.title=n,t.setAttribute("aria-label",n)},this.options=t.e({},xi,e),this._container=n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),n.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),n.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=n.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new bi(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){n.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const r=n.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r}},Fi.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{const n=new t.L(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,i=this._map.getBearing(),o=t.e({bearing:i},this.options.fitBoundsOptions),s=k.fromLngLat(n,r);this._map.fitBounds(s,o,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const n=new t.L(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.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=e=>{if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Mi)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=e=>{if(this._map){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=n.create("button","maplibregl-ctrl-geolocate",this._container),n.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.w("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=n.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ci({element:this._dotElement}),this._circleElement=n.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ci({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.k("trackuserlocationend")))}))}},this.options=t.e({},Ti,e)}onAdd(t){return this._map=t,this._container=n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,e=!1){void 0===wi||e?void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((e=>{wi="denied"!==e.state,t(wi)})).catch((()=>{wi=!!window.navigator.geolocation,t(wi)})):(wi=!!window.navigator.geolocation,t(wi)):t(wi)}(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),n.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Pi=0,Mi=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),n=t.coords;return e&&(n.longitude<e.getWest()||n.longitude>e.getEast()||n.latitude<e.getSouth()||n.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),n=t.getNorthEast(),r=e.distanceTo(n),i=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${i}px`,this._circleElement.style.height=`${i}px`}trigger(){if(!this._setup)return t.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 t.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Pi--,Mi=!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 t.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 t.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("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Pi++,Pi>1?(t={maximumAge:6e5,timeout:0},Mi=!0):(t=this.options.positionOptions,Mi=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},Fi.AttributionControl=ai,Fi.LogoControl=li,Fi.ScaleControl=class{constructor(e){this._onMove=()=>{Ai(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ai(this._map,this._container,this.options)},this.options=t.e({},Li,e)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=n.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){n.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},Fi.FullscreenControl=class extends t.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:t.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){n.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=n.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);n.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_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 t.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new t.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()}},Fi.TerrainControl=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=t}onAdd(t){return this._map=t,this._container=n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=n.create("button","maplibregl-ctrl-terrain",this._container),n.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(){n.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},Fi.Popup=class extends t.E{constructor(e){super(),this.remove=()=>(this._content&&n.remove(this._content),this._container&&(n.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.k("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=n.create("div","maplibregl-popup",this._map.getContainer()),this._tip=n.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);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=Ei(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let r=this.options.anchor;const i=Ri(this.options.offset);if(!r){const t=this._container.offsetWidth,n=this._container.offsetHeight;let o;o=e.y+i.bottom.y<n?["top"]:e.y>this._map.transform.height-n?["bottom"]:[],e.x<t/2?o.push("left"):e.x>this._map.transform.width-t/2&&o.push("right"),r=0===o.length?"bottom":o.join("-")}const o=e.add(i[r]).round();n.setTransform(this._container,`${Si[r]} translate(${o.x}px,${o.y}px)`),Ii(this._container,r,"popup")},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(Ni),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 t.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.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(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),n=document.createElement("body");let r;for(n.innerHTML=t;r=n.firstChild,r;)e.appendChild(r);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=n.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=n.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Di);t&&t.focus()}},Fi.Marker=Ci,Fi.Style=re,Fi.LngLat=t.L,Fi.LngLatBounds=k,Fi.Point=t.P,Fi.MercatorCoordinate=t.U,Fi.Evented=t.E,Fi.AJAXError=t.bi,Fi.config=t.c,Fi.CanvasSource=V,Fi.GeoJSONSource=z,Fi.ImageSource=B,Fi.RasterDEMTileSource=O,Fi.RasterTileSource=R,Fi.VectorTileSource=D,Fi.VideoSource=U,Fi.setRTLTextPlugin=t.bj,Fi.getRTLTextPluginStatus=t.bk,Fi.prewarm=function(){rt().acquire(Q)},Fi.clearPrewarmedResources=function(){const t=nt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Q),nt=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()"))},Oi.extend(Fi,{isSafari:t.ac,getPerformanceMetrics:t.bg.getPerformanceMetrics}),Fi})),n}()}},s={};function a(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={exports:{}};return o[t].call(n.exports,n,n.exports,a),n.exports}a.m=o,a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},n=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(t,r){if(1&r&&(t=this(t)),8&r)return t;if("object"==typeof t&&t){if(4&r&&t.__esModule)return t;if(16&r&&"function"==typeof t.then)return t}var i=Object.create(null);a.r(i);var o={};e=e||[null,n({}),n([]),n(n)];for(var s=2&r&&t;"object"==typeof s&&!~e.indexOf(s);s=n(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>t[e]));return o.default=()=>t,a.d(i,o),i},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce(((e,n)=>(a.f[n](t,e),e)),[])),a.u=t=>t+".index.js",a.miniCssF=t=>{},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r={},i="@performant-software/geospatial:",a.l=(t,e,n,o)=>{if(r[t])r[t].push(e);else{var s,l;if(void 0!==n)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var h=u[c];if(h.getAttribute("src")==t||h.getAttribute("data-webpack")==i+n){s=h;break}}s||(l=!0,(s=document.createElement("script")).type="module",s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",i+n),s.src=t),r[t]=[e];var p=(e,n)=>{s.onerror=s.onload=null,clearTimeout(f);var i=r[t];if(delete r[t],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach((t=>t(n))),e)return e(n)},f=setTimeout(p.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=p.bind(null,s.onerror),s.onload=p.bind(null,s.onload),l&&document.head.appendChild(s)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{var t={792:0};a.f.j=(e,n)=>{var r=a.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise(((n,i)=>r=t[e]=[n,i]));n.push(r[2]=i);var o=a.p+a.u(e),s=new Error;a.l(o,(n=>{if(a.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;s.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",s.name="ChunkLoadError",s.type=i,s.request=o,r[1](s)}}),"chunk-"+e,e)}};var e=(e,n)=>{var r,i,[o,s,l]=n,u=0;if(o.some((e=>0!==t[e]))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);l&&l(a)}for(e&&e(n);u<o.length;u++)i=o[u],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},n=self.webpackChunk_performant_software_geospatial=self.webpackChunk_performant_software_geospatial||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();var l={};(()=>{a.d(l,{SW:()=>U,lW:()=>Nr,Hh:()=>ri,K4:()=>Oa,T5:()=>Da,EW:()=>Jr,bk:()=>ja,Bk:()=>qa});var e={};a.r(e),a.d(e,{VERSION:()=>V,after:()=>_n,all:()=>Fn,allKeys:()=>Qt,any:()=>Bn,assign:()=>ye,before:()=>vn,bind:()=>sn,bindAll:()=>un,chain:()=>en,chunk:()=>br,clone:()=>be,collect:()=>kn,compact:()=>cr,compose:()=>yn,constant:()=>Rt,contains:()=>Un,countBy:()=>tr,create:()=>xe,debounce:()=>dn,default:()=>Sr,defaults:()=>_e,defer:()=>pn,delay:()=>hn,detect:()=>Mn,difference:()=>pr,drop:()=>lr,each:()=>An,escape:()=>Ge,every:()=>Fn,extend:()=>me,extendOwn:()=>ye,filter:()=>On,find:()=>Mn,findIndex:()=>En,findKey:()=>bn,findLastIndex:()=>Sn,findWhere:()=>Ln,first:()=>ar,flatten:()=>hr,foldl:()=>Dn,foldr:()=>Rn,forEach:()=>An,functions:()=>de,get:()=>Ce,groupBy:()=>Jn,has:()=>Te,head:()=>ar,identity:()=>Pe,include:()=>Un,includes:()=>Un,indexBy:()=>Qn,indexOf:()=>Tn,initial:()=>sr,inject:()=>Dn,intersection:()=>mr,invert:()=>fe,invoke:()=>Vn,isArguments:()=>kt,isArray:()=>Mt,isArrayBuffer:()=>xt,isBoolean:()=>ht,isDataView:()=>Pt,isDate:()=>mt,isElement:()=>pt,isEmpty:()=>$t,isEqual:()=>Jt,isError:()=>_t,isFinite:()=>Nt,isFunction:()=>Et,isMap:()=>ae,isMatch:()=>Xt,isNaN:()=>Dt,isNull:()=>ut,isNumber:()=>gt,isObject:()=>lt,isRegExp:()=>yt,isSet:()=>ue,isString:()=>dt,isSymbol:()=>vt,isTypedArray:()=>Vt,isUndefined:()=>ct,isWeakMap:()=>le,isWeakSet:()=>ce,iteratee:()=>Ne,keys:()=>qt,last:()=>ur,lastIndexOf:()=>Pn,map:()=>kn,mapObject:()=>Re,matcher:()=>Me,matches:()=>Me,max:()=>qn,memoize:()=>cn,methods:()=>de,min:()=>$n,mixin:()=>Er,negate:()=>mn,noop:()=>Oe,now:()=>Ue,object:()=>vr,omit:()=>or,once:()=>xn,pairs:()=>pe,partial:()=>on,partition:()=>er,pick:()=>ir,pluck:()=>jn,property:()=>Le,propertyOf:()=>ze,random:()=>Be,range:()=>xr,reduce:()=>Dn,reduceRight:()=>Rn,reject:()=>zn,rest:()=>lr,restArguments:()=>at,result:()=>Je,sample:()=>Yn,select:()=>On,shuffle:()=>Wn,size:()=>nr,some:()=>Bn,sortBy:()=>Hn,sortedIndex:()=>In,tail:()=>lr,take:()=>ar,tap:()=>we,template:()=>Ke,templateSettings:()=>$e,throttle:()=>fn,times:()=>Fe,toArray:()=>Zn,toPath:()=>Ee,transpose:()=>yr,unescape:()=>qe,union:()=>gr,uniq:()=>dr,unique:()=>dr,uniqueId:()=>tn,unzip:()=>yr,values:()=>he,where:()=>Gn,without:()=>fr,wrap:()=>gn,zip:()=>_r});var n=a(6843),r=a.n(n),i=a(4041);const o=i.createContext(null);function s(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 n=0;n<t.length;n++)if(!s(t[n],e[n]))return!1;return!0}if(Array.isArray(e))return!1;if("object"==typeof t&&"object"==typeof e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!e.hasOwnProperty(r))return!1;if(!s(t[r],e[r]))return!1}return!0}return!1}function u(t,e){if(!t.getProjection)return;const n=t.getProjection();s(n,e.getProjection())||e.setProjection(n)}function c(t){return{longitude:t.center.lng,latitude:t.center.lat,zoom:t.zoom,pitch:t.pitch,bearing:t.bearing,padding:t.padding}}function h(t,e){const n=e.viewState||e;let r=!1;if("longitude"in n&&"latitude"in n){const e=t.center;t.center=new e.constructor(n.longitude,n.latitude),r=r||e!==t.center}if("zoom"in n){const e=t.zoom;t.zoom=n.zoom,r=r||e!==t.zoom}if("bearing"in n){const e=t.bearing;t.bearing=n.bearing,r=r||e!==t.bearing}if("pitch"in n){const e=t.pitch;t.pitch=n.pitch,r=r||e!==t.pitch}return n.padding&&!t.isPaddingEqual(n.padding)&&(r=!0,t.padding=n.padding),r}const p=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function f(t){if(!t)return null;if("string"==typeof t)return t;if("toJS"in t&&(t=t.toJS()),!t.layers)return t;const e={};for(const n of t.layers)e[n.id]=n;const n=t.layers.map((t=>{let n=null;"interactive"in t&&(n=Object.assign({},t),delete n.interactive);const r=e[t.ref];if(r){n=n||Object.assign({},t),delete n.ref;for(const t of p)t in r&&(n[t]=r[t])}return n||t}));return{...t,layers:n}}const d={version:8,sources:{},layers:[]},g={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"},m={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"},y={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"},_=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],v=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class x{constructor(t,e,n){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=t=>{const e=this.props[y[t.type]];e?e(t):"error"===t.type&&console.error(t.error)},this._onPointerEvent=t=>{"mousemove"!==t.type&&"mouseout"!==t.type||this._updateHover(t);const e=this.props[g[t.type]];e&&(this.props.interactiveLayerIds&&"mouseover"!==t.type&&"mouseout"!==t.type&&(t.features=this._hoveredFeatures||this._queryRenderedFeatures(t.point)),e(t),delete t.features)},this._onCameraEvent=t=>{if(!this._internalUpdate){const e=this.props[m[t.type]];e&&e(t)}t.type in this._deferredEvents&&(this._deferredEvents[t.type]=!1)},this._MapClass=t,this.props=e,this._initialize(n)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){const e=this.props;this.props=t;const n=this._updateSettings(t,e);n&&this._createShadowTransform(this._map);const r=this._updateSize(t),i=this._updateViewState(t,!0);this._updateStyle(t,e),this._updateStyleComponents(t,e),this._updateHandlers(t,e),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,e){const n=x.savedMaps.pop();if(!n)return null;const r=n.map,i=r.getContainer();for(e.className=i.className;i.childNodes.length>0;)e.appendChild(i.childNodes[0]);r._container=e;const o=r._resizeObserver;o&&(o.disconnect(),o.observe(e)),n.setProps({...t,styleDiffing:!1}),r.resize();const{initialViewState:s}=t;return s&&(s.bounds?r.fitBounds(s.bounds,{...s.fitBoundsOptions,duration:0}):n._updateViewState(s,!1)),r.isStyleLoaded()?r.fire("load"):r.once("styledata",(()=>r.fire("load"))),r._update(),n}_initialize(t){const{props:e}=this,{mapStyle:n=d}=e,r={...e,...e.initialViewState,accessToken:e.mapboxAccessToken||b()||null,container:t,style:f(n)},i=r.initialViewState||r.viewState||r;if(Object.assign(r,{center:[i.longitude||0,i.latitude||0],zoom:i.zoom||0,pitch:i.pitch||0,bearing:i.bearing||0}),e.gl){const t=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=t,e.gl)}const o=new this._MapClass(r);i.padding&&o.setPadding(i.padding),e.cursor&&(o.getCanvas().style.cursor=e.cursor),this._createShadowTransform(o);const s=o._render;o._render=t=>{this._inRender=!0,s.call(o,t),this._inRender=!1};const a=o._renderTaskQueue.run;o._renderTaskQueue.run=t=>{a.call(o._renderTaskQueue,t),this._onBeforeRepaint()},o.on("render",(()=>this._onAfterRepaint()));const l=o.fire;o.fire=this._fireEvent.bind(this,l),o.on("resize",(()=>{this._renderTransform.resize(o.transform.width,o.transform.height)})),o.on("styledata",(()=>{this._updateStyleComponents(this.props,{}),u(o.transform,this._renderTransform)})),o.on("sourcedata",(()=>this._updateStyleComponents(this.props,{})));for(const t in g)o.on(t,this._onPointerEvent);for(const t in m)o.on(t,this._onCameraEvent);for(const t in y)o.on(t,this._onEvent);this._map=o}recycle(){const t=this.map.getContainer().querySelector("[mapboxgl-children]");null==t||t.remove(),x.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){const e=function(t){const e=t.clone();return e.pixelsToGLUnits=t.pixelsToGLUnits,e}(t.transform);t.painter.transform=e,this._renderTransform=e}_updateSize(t){const{viewState:e}=t;if(e){const t=this._map;if(e.width!==t.transform.width||e.height!==t.transform.height)return t.resize(),!0}return!1}_updateViewState(t,e){if(this._internalUpdate)return!1;const n=this._map,r=this._renderTransform,{zoom:i,pitch:o,bearing:s}=r,a=n.isMoving();a&&(r.cameraElevationReference="sea");const l=h(r,{...c(n.transform),...t});if(a&&(r.cameraElevationReference="ground"),l&&e){const t=this._deferredEvents;t.move=!0,t.zoom||(t.zoom=i!==r.zoom),t.rotate||(t.rotate=s!==r.bearing),t.pitch||(t.pitch=o!==r.pitch)}return a||h(n.transform,t),l}_updateSettings(t,e){const n=this._map;let r=!1;for(const i of _)if(i in t&&!s(t[i],e[i])){r=!0;const e=n[`set${i[0].toUpperCase()}${i.slice(1)}`];null==e||e.call(n,t[i])}return r}_updateStyle(t,e){if(t.cursor!==e.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==e.mapStyle){const{mapStyle:e=d,styleDiffing:n=!0}=t,r={diff:n};return"localIdeographFontFamily"in t&&(r.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(f(e),r),!0}return!1}_updateStyleComponents(t,e){const n=this._map;let r=!1;return n.isStyleLoaded()&&("light"in t&&n.setLight&&!s(t.light,e.light)&&(r=!0,n.setLight(t.light)),"fog"in t&&n.setFog&&!s(t.fog,e.fog)&&(r=!0,n.setFog(t.fog)),"terrain"in t&&n.setTerrain&&!s(t.terrain,e.terrain)&&(t.terrain&&!n.getSource(t.terrain.source)||(r=!0,n.setTerrain(t.terrain)))),r}_updateHandlers(t,e){var n,r;const i=this._map;let o=!1;for(const a of v){const l=null===(n=t[a])||void 0===n||n;s(l,null===(r=e[a])||void 0===r||r)||(o=!0,l?i[a].enable(l):i[a].disable())}return o}_queryRenderedFeatures(t){const e=this._map,n=e.transform,{interactiveLayerIds:r=[]}=this.props;try{return e.transform=this._renderTransform,e.queryRenderedFeatures(t,{layers:r.filter(e.getLayer.bind(e))})}catch(t){return[]}finally{e.transform=n}}_updateHover(t){var e;const{props:n}=this;if(n.interactiveLayerIds&&(n.onMouseMove||n.onMouseEnter||n.onMouseLeave)){const n=t.type,r=(null===(e=this._hoveredFeatures)||void 0===e?void 0:e.length)>0,i=this._queryRenderedFeatures(t.point),o=i.length>0;!o&&r&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=i,o&&!r&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=n}else this._hoveredFeatures=null}_fireEvent(t,e,n){const r=this._map,i=r.transform,o="string"==typeof e?e:e.type;return"move"===o&&this._updateViewState(this.props,!1),o in m&&("object"==typeof e&&(e.viewState=c(i)),this._map.isMoving())?(r.transform=this._renderTransform,t.call(r,e,n),r.transform=i,r):(t.call(r,e,n),r)}_onBeforeRepaint(){const t=this._map;this._internalUpdate=!0;for(const e in this._deferredEvents)this._deferredEvents[e]&&t.fire(e);this._internalUpdate=!1;const e=this._map.transform;t.transform=this._renderTransform,this._onAfterRepaint=()=>{u(this._renderTransform,e),t.transform=e}}}function b(){let t=null;if("undefined"!=typeof location){const e=/access_token=([^&\/]*)/.exec(location.search);t=e&&e[1]}try{t=t||process.env.MapboxAccessToken}catch(t){}try{t=t||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch(t){}return t}x.savedMaps=[];const w=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];const E="undefined"!=typeof document?i.useLayoutEffect:i.useEffect,S=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"],I=i.createContext(null);function C(t,e,n){const r=(0,i.useContext)(o),[s,a]=(0,i.useState)(null),l=(0,i.useRef)(),{current:u}=(0,i.useRef)({mapLib:null,map:null});(0,i.useEffect)((()=>{const e=t.mapLib;let i,o=!0;return Promise.resolve(e||n).then((e=>{if(!o)return;if(!e)throw new Error("Invalid mapLib");const n="Map"in e?e:e.default;if(!n.Map)throw new Error("Invalid mapLib");if(function(t,e){for(const n of S)n in e&&(t[n]=e[n]);const{RTLTextPlugin:n="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=e;n&&t.getRTLTextPluginStatus&&"unavailable"===t.getRTLTextPluginStatus()&&t.setRTLTextPlugin(n,(t=>{t&&console.error(t)}),!0)}(n,t),n.supported&&!n.supported(t))throw new Error("Map is not supported by this browser");t.reuseMaps&&(i=x.reuse(t,l.current)),i||(i=new x(n.Map,t,l.current)),u.map=function(t){if(!t)return null;const e=t.map,n={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:n=>{const r=e.transform;e.transform=t.transform;const i=e.project(n);return e.transform=r,i},unproject:n=>{const r=e.transform;e.transform=t.transform;const i=e.unproject(n);return e.transform=r,i},queryTerrainElevation:(n,r)=>{const i=e.transform;e.transform=t.transform;const o=e.queryTerrainElevation(n,r);return e.transform=i,o},queryRenderedFeatures:(n,r)=>{const i=e.transform;e.transform=t.transform;const o=e.queryRenderedFeatures(n,r);return e.transform=i,o}};for(const t of function(t){const e=new Set;let n=t;for(;n;){for(const r of Object.getOwnPropertyNames(n))"_"!==r[0]&&"function"==typeof t[r]&&"fire"!==r&&"setEventedParent"!==r&&e.add(r);n=Object.getPrototypeOf(n)}return Array.from(e)}(e))t in n||w.includes(t)||(n[t]=e[t].bind(e));return n}(i),u.mapLib=n,a(i),null==r||r.onMapMount(u.map,t.id)})).catch((e=>{const{onError:n}=t;n?n({type:"error",target:null,originalEvent:null,error:e}):console.error(e)})),()=>{o=!1,i&&(null==r||r.onMapUnmount(t.id),t.reuseMaps?i.recycle():i.destroy())}}),[]),E((()=>{s&&s.setProps(t)})),(0,i.useImperativeHandle)(e,(()=>u.map),[s]);const c=(0,i.useMemo)((()=>({position:"relative",width:"100%",height:"100%",...t.style})),[t.style]);return i.createElement("div",{id:t.id,ref:l,style:c},s&&i.createElement(I.Provider,{value:u},i.createElement("div",{"mapboxgl-children":"",style:{height:"100%"}},t.children)))}var T=a(3144);const P=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function M(t,e){if(!t||!e)return;const n=t.style;for(const t in e){const r=e[t];Number.isFinite(r)&&!P.test(t)?n[t]=`${r}px`:n[t]=r}}function L(t){return new Set(t?t.trim().split(/\s+/):[])}(0,i.memo)((0,i.forwardRef)((function(t,e){const{map:n,mapLib:r}=(0,i.useContext)(I),o=(0,i.useRef)({props:t});o.current.props=t;const s=(0,i.useMemo)((()=>{let e=!1;i.Children.forEach(t.children,(t=>{t&&(e=!0)}));const n={...t,element:e?document.createElement("div"):null},a=new r.Marker(n);return a.setLngLat([t.longitude,t.latitude]),a.getElement().addEventListener("click",(t=>{var e,n;null===(n=(e=o.current.props).onClick)||void 0===n||n.call(e,{type:"click",target:a,originalEvent:t})})),a.on("dragstart",(t=>{var e,n;const r=t;r.lngLat=s.getLngLat(),null===(n=(e=o.current.props).onDragStart)||void 0===n||n.call(e,r)})),a.on("drag",(t=>{var e,n;const r=t;r.lngLat=s.getLngLat(),null===(n=(e=o.current.props).onDrag)||void 0===n||n.call(e,r)})),a.on("dragend",(t=>{var e,n;const r=t;r.lngLat=s.getLngLat(),null===(n=(e=o.current.props).onDragEnd)||void 0===n||n.call(e,r)})),a}),[]);(0,i.useEffect)((()=>(s.addTo(n.getMap()),()=>{s.remove()})),[]);const{longitude:a,latitude:l,offset:u,style:c,draggable:h=!1,popup:p=null,rotation:f=0,rotationAlignment:d="auto",pitchAlignment:g="auto"}=t;return(0,i.useEffect)((()=>{M(s.getElement(),c)}),[c]),(0,i.useImperativeHandle)(e,(()=>s),[]),s.getLngLat().lng===a&&s.getLngLat().lat===l||s.setLngLat([a,l]),u&&!function(t,e){const n=Array.isArray(t)?t[0]:t?t.x:0,r=Array.isArray(t)?t[1]:t?t.y:0,i=Array.isArray(e)?e[0]:e?e.x:0,o=Array.isArray(e)?e[1]:e?e.y:0;return n===i&&r===o}(s.getOffset(),u)&&s.setOffset(u),s.isDraggable()!==h&&s.setDraggable(h),s.getRotation()!==f&&s.setRotation(f),s.getRotationAlignment()!==d&&s.setRotationAlignment(d),s.getPitchAlignment()!==g&&s.setPitchAlignment(g),s.getPopup()!==p&&s.setPopup(p),(0,T.createPortal)(t.children,s.getElement())}))),(0,i.memo)((0,i.forwardRef)((function(t,e){const{map:n,mapLib:r}=(0,i.useContext)(I),o=(0,i.useMemo)((()=>document.createElement("div")),[]),a=(0,i.useRef)({props:t});a.current.props=t;const l=(0,i.useMemo)((()=>{const e={...t},n=new r.Popup(e);return n.setLngLat([t.longitude,t.latitude]),n.once("open",(t=>{var e,n;null===(n=(e=a.current.props).onOpen)||void 0===n||n.call(e,t)})),n}),[]);if((0,i.useEffect)((()=>{const t=t=>{var e,n;null===(n=(e=a.current.props).onClose)||void 0===n||n.call(e,t)};return l.on("close",t),l.setDOMContent(o).addTo(n.getMap()),()=>{l.off("close",t),l.isOpen()&&l.remove()}}),[]),(0,i.useEffect)((()=>{M(l.getElement(),t.style)}),[t.style]),(0,i.useImperativeHandle)(e,(()=>l),[]),l.isOpen()&&(l.getLngLat().lng===t.longitude&&l.getLngLat().lat===t.latitude||l.setLngLat([t.longitude,t.latitude]),t.offset&&!s(l.options.offset,t.offset)&&l.setOffset(t.offset),l.options.anchor===t.anchor&&l.options.maxWidth===t.maxWidth||(l.options.anchor=t.anchor,l.setMaxWidth(t.maxWidth)),l.options.className!==t.className)){const e=L(l.options.className),n=L(t.className);for(const t of e)n.has(t)||l.removeClassName(t);for(const t of n)e.has(t)||l.addClassName(t);l.options.className=t.className}return(0,T.createPortal)(t.children,o)})));const A=function(t,e,n,r){const o=(0,i.useContext)(I),s=(0,i.useMemo)((()=>t(o)),[]);return(0,i.useEffect)((()=>{const t=r||n||e,i="function"==typeof e&&"function"==typeof n?e:null,a="function"==typeof n?n:"function"==typeof e?e:null,{map:l}=o;return l.hasControl(s)||(l.addControl(s,null==t?void 0:t.position),i&&i(o)),()=>{a&&a(o),l.hasControl(s)&&l.removeControl(s)}}),[]),s};function k(t,e){if(!t)throw new Error(e)}(0,i.memo)((function(t){const e=A((({mapLib:e})=>new e.AttributionControl(t)),{position:t.position});return(0,i.useEffect)((()=>{M(e._container,t.style)}),[t.style]),null})),(0,i.memo)((function(t){const e=A((({mapLib:e})=>new e.FullscreenControl({container:t.containerId&&document.getElementById(t.containerId)})),{position:t.position});return(0,i.useEffect)((()=>{M(e._controlContainer,t.style)}),[t.style]),null})),(0,i.memo)((0,i.forwardRef)((function(t,e){const n=(0,i.useRef)({props:t}),r=A((({mapLib:e})=>{const r=new e.GeolocateControl(t),i=r._setupUI;return r._setupUI=t=>{r._container.hasChildNodes()||i(t)},r.on("geolocate",(t=>{var e,r;null===(r=(e=n.current.props).onGeolocate)||void 0===r||r.call(e,t)})),r.on("error",(t=>{var e,r;null===(r=(e=n.current.props).onError)||void 0===r||r.call(e,t)})),r.on("outofmaxbounds",(t=>{var e,r;null===(r=(e=n.current.props).onOutOfMaxBounds)||void 0===r||r.call(e,t)})),r.on("trackuserlocationstart",(t=>{var e,r;null===(r=(e=n.current.props).onTrackUserLocationStart)||void 0===r||r.call(e,t)})),r.on("trackuserlocationend",(t=>{var e,r;null===(r=(e=n.current.props).onTrackUserLocationEnd)||void 0===r||r.call(e,t)})),r}),{position:t.position});return n.current.props=t,(0,i.useImperativeHandle)(e,(()=>r),[]),(0,i.useEffect)((()=>{M(r._container,t.style)}),[t.style]),null}))),(0,i.memo)((function(t){const e=A((({mapLib:e})=>new e.NavigationControl(t)),{position:t.position});return(0,i.useEffect)((()=>{M(e._container,t.style)}),[t.style]),null})),(0,i.memo)((function(t){const e=A((({mapLib:e})=>new e.ScaleControl(t)),{position:t.position}),n=(0,i.useRef)(t),r=n.current;n.current=t;const{style:o}=t;return void 0!==t.maxWidth&&t.maxWidth!==r.maxWidth&&(e.options.maxWidth=t.maxWidth),void 0!==t.unit&&t.unit!==r.unit&&e.setUnit(t.unit),(0,i.useEffect)((()=>{M(e._container,o)}),[o]),null}));let N=0;let D=0;const R=a.e(755).then(a.t.bind(a,7755,19)),O=i.forwardRef((function(t,e){return C(t,e,R)})),z=function(t){const e=(0,i.useContext)(I).map.getMap(),n=(0,i.useRef)(t),[,r]=(0,i.useState)(0),o=(0,i.useMemo)((()=>t.id||"jsx-layer-"+N++),[]);if((0,i.useEffect)((()=>{if(e){const t=()=>r((t=>t+1));return e.on("styledata",t),t(),()=>{e.off("styledata",t),e.style&&e.style._loaded&&e.getLayer(o)&&e.removeLayer(o)}}}),[e]),e&&e.style&&e.getLayer(o))try{!function(t,e,n,r){if(k(n.id===r.id,"layer id changed"),k(n.type===r.type,"layer type changed"),"custom"===n.type||"custom"===r.type)return;const{layout:i={},paint:o={},filter:a,minzoom:l,maxzoom:u,beforeId:c}=n;if(c!==r.beforeId&&t.moveLayer(e,c),i!==r.layout){const n=r.layout||{};for(const r in i)s(i[r],n[r])||t.setLayoutProperty(e,r,i[r]);for(const r in n)i.hasOwnProperty(r)||t.setLayoutProperty(e,r,void 0)}if(o!==r.paint){const n=r.paint||{};for(const r in o)s(o[r],n[r])||t.setPaintProperty(e,r,o[r]);for(const r in n)o.hasOwnProperty(r)||t.setPaintProperty(e,r,void 0)}s(a,r.filter)||t.setFilter(e,a),l===r.minzoom&&u===r.maxzoom||t.setLayerZoomRange(e,l,u)}(e,o,t,n.current)}catch(t){console.warn(t)}else!function(t,e,n){if(t.style&&t.style._loaded&&(!("source"in n)||t.getSource(n.source))){const r={...n,id:e};delete r.beforeId,t.addLayer(r,n.beforeId)}}(e,o,t);return n.current=t,null},F=function(t){const e=(0,i.useContext)(I).map.getMap(),n=(0,i.useRef)(t),[,r]=(0,i.useState)(0),o=(0,i.useMemo)((()=>t.id||"jsx-source-"+D++),[]);(0,i.useEffect)((()=>{if(e){const t=()=>setTimeout((()=>r((t=>t+1))),0);return e.on("styledata",t),t(),()=>{var n;if(e.off("styledata",t),e.style&&e.style._loaded&&e.getSource(o)){const t=null===(n=e.getStyle())||void 0===n?void 0:n.layers;if(t)for(const n of t)n.source===o&&e.removeLayer(n.id);e.removeSource(o)}}}}),[e]);let a=e&&e.style&&e.getSource(o);return a?function(t,e,n){k(e.id===n.id,"source id changed"),k(e.type===n.type,"source type changed");let r="",i=0;for(const t in e)"children"===t||"id"===t||s(n[t],e[t])||(r=t,i++);if(!i)return;const o=e.type;if("geojson"===o)t.setData(e.data);else if("image"===o)t.updateImage({url:e.url,coordinates:e.coordinates});else if("setCoordinates"in t&&1===i&&"coordinates"===r)t.setCoordinates(e.coordinates);else if("setUrl"in t)switch(r){case"url":t.setUrl(e.url);break;case"tiles":t.setTiles(e.tiles)}else console.warn(`Unable to update <Source> prop: ${r}`)}(a,t,n.current):a=function(t,e,n){if(t.style&&t.style._loaded){const r={...n};return delete r.id,delete r.children,t.addSource(e,r),t.getSource(e)}return null}(e,o,t),n.current=t,a&&i.Children.map(t.children,(t=>t&&(0,i.cloneElement)(t,{source:o})))||null},B=O,U=(0,i.forwardRef)((function(t,e){var n=A((function(){return new(r())(t)}),(function(e){var n=e.map;n.on("draw.create",t.onCreate),n.on("draw.update",t.onUpdate),n.on("draw.delete",t.onDelete)}),(function(e){var n=e.map;n.off("draw.create",t.onCreate),n.off("draw.update",t.onUpdate),n.off("draw.delete",t.onDelete)}),{position:t.position});return(0,i.useImperativeHandle)(e,(function(){return n}),[n]),null}));var V="1.13.6",j="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},G=Array.prototype,q=Object.prototype,$="undefined"!=typeof Symbol?Symbol.prototype:null,X=G.push,Z=G.slice,Y=q.toString,W=q.hasOwnProperty,H="undefined"!=typeof ArrayBuffer,K="undefined"!=typeof DataView,J=Array.isArray,Q=Object.keys,tt=Object.create,et=H&&ArrayBuffer.isView,nt=isNaN,rt=isFinite,it=!{toString:null}.propertyIsEnumerable("toString"),ot=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],st=Math.pow(2,53)-1;function at(t,e){return e=null==e?t.length-1:+e,function(){for(var n=Math.max(arguments.length-e,0),r=Array(n),i=0;i<n;i++)r[i]=arguments[i+e];switch(e){case 0:return t.call(this,r);case 1:return t.call(this,arguments[0],r);case 2:return t.call(this,arguments[0],arguments[1],r)}var o=Array(e+1);for(i=0;i<e;i++)o[i]=arguments[i];return o[e]=r,t.apply(this,o)}}function lt(t){var e=typeof t;return"function"===e||"object"===e&&!!t}function ut(t){return null===t}function ct(t){return void 0===t}function ht(t){return!0===t||!1===t||"[object Boolean]"===Y.call(t)}function pt(t){return!(!t||1!==t.nodeType)}function ft(t){var e="[object "+t+"]";return function(t){return Y.call(t)===e}}const dt=ft("String"),gt=ft("Number"),mt=ft("Date"),yt=ft("RegExp"),_t=ft("Error"),vt=ft("Symbol"),xt=ft("ArrayBuffer");var bt=ft("Function"),wt=j.document&&j.document.childNodes;"object"!=typeof Int8Array&&"function"!=typeof wt&&(bt=function(t){return"function"==typeof t||!1});const Et=bt,St=ft("Object");var It=K&&St(new DataView(new ArrayBuffer(8))),Ct="undefined"!=typeof Map&&St(new Map),Tt=ft("DataView");const Pt=It?function(t){return null!=t&&Et(t.getInt8)&&xt(t.buffer)}:Tt,Mt=J||ft("Array");function Lt(t,e){return null!=t&&W.call(t,e)}var At=ft("Arguments");!function(){At(arguments)||(At=function(t){return Lt(t,"callee")})}();const kt=At;function Nt(t){return!vt(t)&&rt(t)&&!isNaN(parseFloat(t))}function Dt(t){return gt(t)&&nt(t)}function Rt(t){return function(){return t}}function Ot(t){return function(e){var n=t(e);return"number"==typeof n&&n>=0&&n<=st}}function zt(t){return function(e){return null==e?void 0:e[t]}}const Ft=zt("byteLength"),Bt=Ot(Ft);var Ut=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;const Vt=H?function(t){return et?et(t)&&!Pt(t):Bt(t)&&Ut.test(Y.call(t))}:Rt(!1),jt=zt("length");function Gt(t,e){e=function(t){for(var e={},n=t.length,r=0;r<n;++r)e[t[r]]=!0;return{contains:function(t){return!0===e[t]},push:function(n){return e[n]=!0,t.push(n)}}}(e);var n=ot.length,r=t.constructor,i=Et(r)&&r.prototype||q,o="constructor";for(Lt(t,o)&&!e.contains(o)&&e.push(o);n--;)(o=ot[n])in t&&t[o]!==i[o]&&!e.contains(o)&&e.push(o)}function qt(t){if(!lt(t))return[];if(Q)return Q(t);var e=[];for(var n in t)Lt(t,n)&&e.push(n);return it&&Gt(t,e),e}function $t(t){if(null==t)return!0;var e=jt(t);return"number"==typeof e&&(Mt(t)||dt(t)||kt(t))?0===e:0===jt(qt(t))}function Xt(t,e){var n=qt(e),r=n.length;if(null==t)return!r;for(var i=Object(t),o=0;o<r;o++){var s=n[o];if(e[s]!==i[s]||!(s in i))return!1}return!0}function Zt(t){return t instanceof Zt?t:this instanceof Zt?void(this._wrapped=t):new Zt(t)}function Yt(t){return new Uint8Array(t.buffer||t,t.byteOffset||0,Ft(t))}Zt.VERSION=V,Zt.prototype.value=function(){return this._wrapped},Zt.prototype.valueOf=Zt.prototype.toJSON=Zt.prototype.value,Zt.prototype.toString=function(){return String(this._wrapped)};var Wt="[object DataView]";function Ht(t,e,n,r){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return!1;if(t!=t)return e!=e;var i=typeof t;return("function"===i||"object"===i||"object"==typeof e)&&Kt(t,e,n,r)}function Kt(t,e,n,r){t instanceof Zt&&(t=t._wrapped),e instanceof Zt&&(e=e._wrapped);var i=Y.call(t);if(i!==Y.call(e))return!1;if(It&&"[object Object]"==i&&Pt(t)){if(!Pt(e))return!1;i=Wt}switch(i){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!=+t?+e!=+e:0==+t?1/+t==1/e:+t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object Symbol]":return $.valueOf.call(t)===$.valueOf.call(e);case"[object ArrayBuffer]":case Wt:return Kt(Yt(t),Yt(e),n,r)}var o="[object Array]"===i;if(!o&&Vt(t)){if(Ft(t)!==Ft(e))return!1;if(t.buffer===e.buffer&&t.byteOffset===e.byteOffset)return!0;o=!0}if(!o){if("object"!=typeof t||"object"!=typeof e)return!1;var s=t.constructor,a=e.constructor;if(s!==a&&!(Et(s)&&s instanceof s&&Et(a)&&a instanceof a)&&"constructor"in t&&"constructor"in e)return!1}r=r||[];for(var l=(n=n||[]).length;l--;)if(n[l]===t)return r[l]===e;if(n.push(t),r.push(e),o){if((l=t.length)!==e.length)return!1;for(;l--;)if(!Ht(t[l],e[l],n,r))return!1}else{var u,c=qt(t);if(l=c.length,qt(e).length!==l)return!1;for(;l--;)if(!Lt(e,u=c[l])||!Ht(t[u],e[u],n,r))return!1}return n.pop(),r.pop(),!0}function Jt(t,e){return Ht(t,e)}function Qt(t){if(!lt(t))return[];var e=[];for(var n in t)e.push(n);return it&&Gt(t,e),e}function te(t){var e=jt(t);return function(n){if(null==n)return!1;var r=Qt(n);if(jt(r))return!1;for(var i=0;i<e;i++)if(!Et(n[t[i]]))return!1;return t!==oe||!Et(n[ee])}}var ee="forEach",ne=["clear","delete"],re=["get","has","set"],ie=ne.concat(ee,re),oe=ne.concat(re),se=["add"].concat(ne,ee,"has");const ae=Ct?te(ie):ft("Map"),le=Ct?te(oe):ft("WeakMap"),ue=Ct?te(se):ft("Set"),ce=ft("WeakSet");function he(t){for(var e=qt(t),n=e.length,r=Array(n),i=0;i<n;i++)r[i]=t[e[i]];return r}function pe(t){for(var e=qt(t),n=e.length,r=Array(n),i=0;i<n;i++)r[i]=[e[i],t[e[i]]];return r}function fe(t){for(var e={},n=qt(t),r=0,i=n.length;r<i;r++)e[t[n[r]]]=n[r];return e}function de(t){var e=[];for(var n in t)Et(t[n])&&e.push(n);return e.sort()}function ge(t,e){return function(n){var r=arguments.length;if(e&&(n=Object(n)),r<2||null==n)return n;for(var i=1;i<r;i++)for(var o=arguments[i],s=t(o),a=s.length,l=0;l<a;l++){var u=s[l];e&&void 0!==n[u]||(n[u]=o[u])}return n}}const me=ge(Qt),ye=ge(qt),_e=ge(Qt,!0);function ve(t){if(!lt(t))return{};if(tt)return tt(t);var e=function(){};e.prototype=t;var n=new e;return e.prototype=null,n}function xe(t,e){var n=ve(t);return e&&ye(n,e),n}function be(t){return lt(t)?Mt(t)?t.slice():me({},t):t}function we(t,e){return e(t),t}function Ee(t){return Mt(t)?t:[t]}function Se(t){return Zt.toPath(t)}function Ie(t,e){for(var n=e.length,r=0;r<n;r++){if(null==t)return;t=t[e[r]]}return n?t:void 0}function Ce(t,e,n){var r=Ie(t,Se(e));return ct(r)?n:r}function Te(t,e){for(var n=(e=Se(e)).length,r=0;r<n;r++){var i=e[r];if(!Lt(t,i))return!1;t=t[i]}return!!n}function Pe(t){return t}function Me(t){return t=ye({},t),function(e){return Xt(e,t)}}function Le(t){return t=Se(t),function(e){return Ie(e,t)}}function Ae(t,e,n){if(void 0===e)return t;switch(null==n?3:n){case 1:return function(n){return t.call(e,n)};case 3:return function(n,r,i){return t.call(e,n,r,i)};case 4:return function(n,r,i,o){return t.call(e,n,r,i,o)}}return function(){return t.apply(e,arguments)}}function ke(t,e,n){return null==t?Pe:Et(t)?Ae(t,e,n):lt(t)&&!Mt(t)?Me(t):Le(t)}function Ne(t,e){return ke(t,e,1/0)}function De(t,e,n){return Zt.iteratee!==Ne?Zt.iteratee(t,e):ke(t,e,n)}function Re(t,e,n){e=De(e,n);for(var r=qt(t),i=r.length,o={},s=0;s<i;s++){var a=r[s];o[a]=e(t[a],a,t)}return o}function Oe(){}function ze(t){return null==t?Oe:function(e){return Ce(t,e)}}function Fe(t,e,n){var r=Array(Math.max(0,t));e=Ae(e,n,1);for(var i=0;i<t;i++)r[i]=e(i);return r}function Be(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))}Zt.toPath=Ee,Zt.iteratee=Ne;const Ue=Date.now||function(){return(new Date).getTime()};function Ve(t){var e=function(e){return t[e]},n="(?:"+qt(t).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(t){return t=null==t?"":""+t,r.test(t)?t.replace(i,e):t}}const je={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},Ge=Ve(je),qe=Ve(fe(je)),$e=Zt.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var Xe=/(.)^/,Ze={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Ye=/\\|'|\r|\n|\u2028|\u2029/g;function We(t){return"\\"+Ze[t]}var He=/^\s*(\w|\$)+\s*$/;function Ke(t,e,n){!e&&n&&(e=n),e=_e({},e,Zt.templateSettings);var r=RegExp([(e.escape||Xe).source,(e.interpolate||Xe).source,(e.evaluate||Xe).source].join("|")+"|$","g"),i=0,o="__p+='";t.replace(r,(function(e,n,r,s,a){return o+=t.slice(i,a).replace(Ye,We),i=a+e.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":s&&(o+="';\n"+s+"\n__p+='"),e})),o+="';\n";var s,a=e.variable;if(a){if(!He.test(a))throw new Error("variable is not a bare identifier: "+a)}else o="with(obj||{}){\n"+o+"}\n",a="obj";o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{s=new Function(a,"_",o)}catch(t){throw t.source=o,t}var l=function(t){return s.call(this,t,Zt)};return l.source="function("+a+"){\n"+o+"}",l}function Je(t,e,n){var r=(e=Se(e)).length;if(!r)return Et(n)?n.call(t):n;for(var i=0;i<r;i++){var o=null==t?void 0:t[e[i]];void 0===o&&(o=n,i=r),t=Et(o)?o.call(t):o}return t}var Qe=0;function tn(t){var e=++Qe+"";return t?t+e:e}function en(t){var e=Zt(t);return e._chain=!0,e}function nn(t,e,n,r,i){if(!(r instanceof e))return t.apply(n,i);var o=ve(t.prototype),s=t.apply(o,i);return lt(s)?s:o}var rn=at((function(t,e){var n=rn.placeholder,r=function(){for(var i=0,o=e.length,s=Array(o),a=0;a<o;a++)s[a]=e[a]===n?arguments[i++]:e[a];for(;i<arguments.length;)s.push(arguments[i++]);return nn(t,r,this,this,s)};return r}));rn.placeholder=Zt;const on=rn,sn=at((function(t,e,n){if(!Et(t))throw new TypeError("Bind must be called on a function");var r=at((function(i){return nn(t,r,e,this,n.concat(i))}));return r})),an=Ot(jt);function ln(t,e,n,r){if(r=r||[],e||0===e){if(e<=0)return r.concat(t)}else e=1/0;for(var i=r.length,o=0,s=jt(t);o<s;o++){var a=t[o];if(an(a)&&(Mt(a)||kt(a)))if(e>1)ln(a,e-1,n,r),i=r.length;else for(var l=0,u=a.length;l<u;)r[i++]=a[l++];else n||(r[i++]=a)}return r}const un=at((function(t,e){var n=(e=ln(e,!1,!1)).length;if(n<1)throw new Error("bindAll must be passed function names");for(;n--;){var r=e[n];t[r]=sn(t[r],t)}return t}));function cn(t,e){var n=function(r){var i=n.cache,o=""+(e?e.apply(this,arguments):r);return Lt(i,o)||(i[o]=t.apply(this,arguments)),i[o]};return n.cache={},n}const hn=at((function(t,e,n){return setTimeout((function(){return t.apply(null,n)}),e)})),pn=on(hn,Zt,1);function fn(t,e,n){var r,i,o,s,a=0;n||(n={});var l=function(){a=!1===n.leading?0:Ue(),r=null,s=t.apply(i,o),r||(i=o=null)},u=function(){var u=Ue();a||!1!==n.leading||(a=u);var c=e-(u-a);return i=this,o=arguments,c<=0||c>e?(r&&(clearTimeout(r),r=null),a=u,s=t.apply(i,o),r||(i=o=null)):r||!1===n.trailing||(r=setTimeout(l,c)),s};return u.cancel=function(){clearTimeout(r),a=0,r=i=o=null},u}function dn(t,e,n){var r,i,o,s,a,l=function(){var u=Ue()-i;e>u?r=setTimeout(l,e-u):(r=null,n||(s=t.apply(a,o)),r||(o=a=null))},u=at((function(u){return a=this,o=u,i=Ue(),r||(r=setTimeout(l,e),n&&(s=t.apply(a,o))),s}));return u.cancel=function(){clearTimeout(r),r=o=a=null},u}function gn(t,e){return on(e,t)}function mn(t){return function(){return!t.apply(this,arguments)}}function yn(){var t=arguments,e=t.length-1;return function(){for(var n=e,r=t[e].apply(this,arguments);n--;)r=t[n].call(this,r);return r}}function _n(t,e){return function(){if(--t<1)return e.apply(this,arguments)}}function vn(t,e){var n;return function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=null),n}}const xn=on(vn,2);function bn(t,e,n){e=De(e,n);for(var r,i=qt(t),o=0,s=i.length;o<s;o++)if(e(t[r=i[o]],r,t))return r}function wn(t){return function(e,n,r){n=De(n,r);for(var i=jt(e),o=t>0?0:i-1;o>=0&&o<i;o+=t)if(n(e[o],o,e))return o;return-1}}const En=wn(1),Sn=wn(-1);function In(t,e,n,r){for(var i=(n=De(n,r,1))(e),o=0,s=jt(t);o<s;){var a=Math.floor((o+s)/2);n(t[a])<i?o=a+1:s=a}return o}function Cn(t,e,n){return function(r,i,o){var s=0,a=jt(r);if("number"==typeof o)t>0?s=o>=0?o:Math.max(o+a,s):a=o>=0?Math.min(o+1,a):o+a+1;else if(n&&o&&a)return r[o=n(r,i)]===i?o:-1;if(i!=i)return(o=e(Z.call(r,s,a),Dt))>=0?o+s:-1;for(o=t>0?s:a-1;o>=0&&o<a;o+=t)if(r[o]===i)return o;return-1}}const Tn=Cn(1,En,In),Pn=Cn(-1,Sn);function Mn(t,e,n){var r=(an(t)?En:bn)(t,e,n);if(void 0!==r&&-1!==r)return t[r]}function Ln(t,e){return Mn(t,Me(e))}function An(t,e,n){var r,i;if(e=Ae(e,n),an(t))for(r=0,i=t.length;r<i;r++)e(t[r],r,t);else{var o=qt(t);for(r=0,i=o.length;r<i;r++)e(t[o[r]],o[r],t)}return t}function kn(t,e,n){e=De(e,n);for(var r=!an(t)&&qt(t),i=(r||t).length,o=Array(i),s=0;s<i;s++){var a=r?r[s]:s;o[s]=e(t[a],a,t)}return o}function Nn(t){return function(e,n,r,i){var o=arguments.length>=3;return function(e,n,r,i){var o=!an(e)&&qt(e),s=(o||e).length,a=t>0?0:s-1;for(i||(r=e[o?o[a]:a],a+=t);a>=0&&a<s;a+=t){var l=o?o[a]:a;r=n(r,e[l],l,e)}return r}(e,Ae(n,i,4),r,o)}}const Dn=Nn(1),Rn=Nn(-1);function On(t,e,n){var r=[];return e=De(e,n),An(t,(function(t,n,i){e(t,n,i)&&r.push(t)})),r}function zn(t,e,n){return On(t,mn(De(e)),n)}function Fn(t,e,n){e=De(e,n);for(var r=!an(t)&&qt(t),i=(r||t).length,o=0;o<i;o++){var s=r?r[o]:o;if(!e(t[s],s,t))return!1}return!0}function Bn(t,e,n){e=De(e,n);for(var r=!an(t)&&qt(t),i=(r||t).length,o=0;o<i;o++){var s=r?r[o]:o;if(e(t[s],s,t))return!0}return!1}function Un(t,e,n,r){return an(t)||(t=he(t)),("number"!=typeof n||r)&&(n=0),Tn(t,e,n)>=0}const Vn=at((function(t,e,n){var r,i;return Et(e)?i=e:(e=Se(e),r=e.slice(0,-1),e=e[e.length-1]),kn(t,(function(t){var o=i;if(!o){if(r&&r.length&&(t=Ie(t,r)),null==t)return;o=t[e]}return null==o?o:o.apply(t,n)}))}));function jn(t,e){return kn(t,Le(e))}function Gn(t,e){return On(t,Me(e))}function qn(t,e,n){var r,i,o=-1/0,s=-1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t)for(var a=0,l=(t=an(t)?t:he(t)).length;a<l;a++)null!=(r=t[a])&&r>o&&(o=r);else e=De(e,n),An(t,(function(t,n,r){((i=e(t,n,r))>s||i===-1/0&&o===-1/0)&&(o=t,s=i)}));return o}function $n(t,e,n){var r,i,o=1/0,s=1/0;if(null==e||"number"==typeof e&&"object"!=typeof t[0]&&null!=t)for(var a=0,l=(t=an(t)?t:he(t)).length;a<l;a++)null!=(r=t[a])&&r<o&&(o=r);else e=De(e,n),An(t,(function(t,n,r){((i=e(t,n,r))<s||i===1/0&&o===1/0)&&(o=t,s=i)}));return o}var Xn=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function Zn(t){return t?Mt(t)?Z.call(t):dt(t)?t.match(Xn):an(t)?kn(t,Pe):he(t):[]}function Yn(t,e,n){if(null==e||n)return an(t)||(t=he(t)),t[Be(t.length-1)];var r=Zn(t),i=jt(r);e=Math.max(Math.min(e,i),0);for(var o=i-1,s=0;s<e;s++){var a=Be(s,o),l=r[s];r[s]=r[a],r[a]=l}return r.slice(0,e)}function Wn(t){return Yn(t,1/0)}function Hn(t,e,n){var r=0;return e=De(e,n),jn(kn(t,(function(t,n,i){return{value:t,index:r++,criteria:e(t,n,i)}})).sort((function(t,e){var n=t.criteria,r=e.criteria;if(n!==r){if(n>r||void 0===n)return 1;if(n<r||void 0===r)return-1}return t.index-e.index})),"value")}function Kn(t,e){return function(n,r,i){var o=e?[[],[]]:{};return r=De(r,i),An(n,(function(e,i){var s=r(e,i,n);t(o,e,s)})),o}}const Jn=Kn((function(t,e,n){Lt(t,n)?t[n].push(e):t[n]=[e]})),Qn=Kn((function(t,e,n){t[n]=e})),tr=Kn((function(t,e,n){Lt(t,n)?t[n]++:t[n]=1})),er=Kn((function(t,e,n){t[n?0:1].push(e)}),!0);function nr(t){return null==t?0:an(t)?t.length:qt(t).length}function rr(t,e,n){return e in n}const ir=at((function(t,e){var n={},r=e[0];if(null==t)return n;Et(r)?(e.length>1&&(r=Ae(r,e[1])),e=Qt(t)):(r=rr,e=ln(e,!1,!1),t=Object(t));for(var i=0,o=e.length;i<o;i++){var s=e[i],a=t[s];r(a,s,t)&&(n[s]=a)}return n})),or=at((function(t,e){var n,r=e[0];return Et(r)?(r=mn(r),e.length>1&&(n=e[1])):(e=kn(ln(e,!1,!1),String),r=function(t,n){return!Un(e,n)}),ir(t,r,n)}));function sr(t,e,n){return Z.call(t,0,Math.max(0,t.length-(null==e||n?1:e)))}function ar(t,e,n){return null==t||t.length<1?null==e||n?void 0:[]:null==e||n?t[0]:sr(t,t.length-e)}function lr(t,e,n){return Z.call(t,null==e||n?1:e)}function ur(t,e,n){return null==t||t.length<1?null==e||n?void 0:[]:null==e||n?t[t.length-1]:lr(t,Math.max(0,t.length-e))}function cr(t){return On(t,Boolean)}function hr(t,e){return ln(t,e,!1)}const pr=at((function(t,e){return e=ln(e,!0,!0),On(t,(function(t){return!Un(e,t)}))})),fr=at((function(t,e){return pr(t,e)}));function dr(t,e,n,r){ht(e)||(r=n,n=e,e=!1),null!=n&&(n=De(n,r));for(var i=[],o=[],s=0,a=jt(t);s<a;s++){var l=t[s],u=n?n(l,s,t):l;e&&!n?(s&&o===u||i.push(l),o=u):n?Un(o,u)||(o.push(u),i.push(l)):Un(i,l)||i.push(l)}return i}const gr=at((function(t){return dr(ln(t,!0,!0))}));function mr(t){for(var e=[],n=arguments.length,r=0,i=jt(t);r<i;r++){var o=t[r];if(!Un(e,o)){var s;for(s=1;s<n&&Un(arguments[s],o);s++);s===n&&e.push(o)}}return e}function yr(t){for(var e=t&&qn(t,jt).length||0,n=Array(e),r=0;r<e;r++)n[r]=jn(t,r);return n}const _r=at(yr);function vr(t,e){for(var n={},r=0,i=jt(t);r<i;r++)e?n[t[r]]=e[r]:n[t[r][0]]=t[r][1];return n}function xr(t,e,n){null==e&&(e=t||0,t=0),n||(n=e<t?-1:1);for(var r=Math.max(Math.ceil((e-t)/n),0),i=Array(r),o=0;o<r;o++,t+=n)i[o]=t;return i}function br(t,e){if(null==e||e<1)return[];for(var n=[],r=0,i=t.length;r<i;)n.push(Z.call(t,r,r+=e));return n}function wr(t,e){return t._chain?Zt(e).chain():e}function Er(t){return An(de(t),(function(e){var n=Zt[e]=t[e];Zt.prototype[e]=function(){var t=[this._wrapped];return X.apply(t,arguments),wr(this,n.apply(Zt,t))}})),Zt}An(["pop","push","reverse","shift","sort","splice","unshift"],(function(t){var e=G[t];Zt.prototype[t]=function(){var n=this._wrapped;return null!=n&&(e.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0]),wr(this,n)}})),An(["concat","join","slice"],(function(t){var e=G[t];Zt.prototype[t]=function(){var t=this._wrapped;return null!=t&&(t=e.apply(t,arguments)),wr(this,t)}}));const Sr=Zt;var Ir=Er(e);Ir._=Ir;const Cr=Ir;function Tr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var Pr="#CC3333",Mr="#990000",Lr={"fill-color":Pr,"fill-opacity":.2},Ar={"line-color":Mr,"line-opacity":.6},kr={"circle-radius":["interpolate",["linear"],["number",["get","point_count"],1],0,4,10,14],"circle-stroke-width":1,"circle-color":Pr,"circle-stroke-color":Mr};const Nr=function(t){var e,n,r=(e=(0,i.useState)(t.data),n=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,n)||function(t,e){if(t){if("string"==typeof t)return Tr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tr(t,e):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=r[0],s=r[1],a=(0,i.useCallback)((function(t,e){return Cr.defaults(t,e)}),[]),l=(0,i.useMemo)((function(){return a(t.fillStyle,Lr)}),[a,t.fillStyle]),u=(0,i.useMemo)((function(){return a(t.lineStyle,Ar)}),[a,t.lineStyle]),c=(0,i.useMemo)((function(){return a(t.pointStyle,kr)}),[a,t.pointStyle]);return(0,i.useEffect)((function(){t.url&&fetch(t.url).then((function(t){return t.json()})).then((function(t){return s(t)}))}),[t.url]),i.createElement(F,{data:o,type:"geojson"},i.createElement(z,{filter:["!=","$type","Point"],paint:l,type:"fill"}),i.createElement(z,{filter:["!=","$type","Point"],paint:u,type:"line"}),i.createElement(z,{filter:["==","$type","Point"],paint:c,type:"circle"}))};var Dr={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Rr=i.createContext&&i.createContext(Dr),Or=["attr","size","title"];function zr(){return zr=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},zr.apply(this,arguments)}function Fr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Br(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Fr(Object(n),!0).forEach((function(e){var r,i,o;r=t,i=e,o=n[e],(i=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(i))in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fr(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Ur(t){return t&&t.map(((t,e)=>i.createElement(t.tag,Br({key:e},t.attr),Ur(t.child))))}function Vr(t){return e=>i.createElement(jr,zr({attr:Br({},t.attr)},e),Ur(t.child))}function jr(t){var e=e=>{var n,{attr:r,size:o,title:s}=t,a=function(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}(t,Or),l=o||e.size||"1em";return e.className&&(n=e.className),t.className&&(n=(n?n+" ":"")+t.className),i.createElement("svg",zr({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},e.attr,r,a,{className:n,style:Br(Br({color:t.color||e.color},e.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),s&&i.createElement("title",null,s),t.children)};return void 0!==Rr?i.createElement(Rr.Consumer,null,(t=>e(t))):e(Dr)}function Gr(t){return Vr({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"m14.12 10.163 1.715.858c.22.11.22.424 0 .534L8.267 15.34a.598.598 0 0 1-.534 0L.165 11.555a.299.299 0 0 1 0-.534l1.716-.858 5.317 2.659c.505.252 1.1.252 1.604 0l5.317-2.66zM7.733.063a.598.598 0 0 1 .534 0l7.568 3.784a.3.3 0 0 1 0 .535L8.267 8.165a.598.598 0 0 1-.534 0L.165 4.382a.299.299 0 0 1 0-.535L7.733.063z"},child:[]},{tag:"path",attr:{d:"m14.12 6.576 1.715.858c.22.11.22.424 0 .534l-7.568 3.784a.598.598 0 0 1-.534 0L.165 7.968a.299.299 0 0 1 0-.534l1.716-.858 5.317 2.659c.505.252 1.1.252 1.604 0l5.317-2.659z"},child:[]}]})(t)}function qr(t){return Vr({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M416 128 192 384l-96-96"},child:[]}]})(t)}var $r=a(1156),Xr=a.n($r);function Zr(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Yr(t){return Yr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yr(t)}function Wr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hr(r.key),r)}}function Hr(t){var e=function(t,e){if("object"!=Yr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=Yr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Yr(e)?e:String(e)}var Kr=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._map=null,this._container=void 0,this._redraw=void 0,this._redraw=e}var e,n;return e=t,(n=[{key:"onAdd",value:function(t){return this._map=t,t.on("move",this._redraw),this._container=document.createElement("div"),this._container.className="maplibregl-ctrl-group maplibregl-ctrl",this._redraw(),this._container}},{key:"onRemove",value:function(){this._container.remove(),this._map.off("move",this._redraw),this._map=null}},{key:"getMap",value:function(){return this._map}},{key:"getElement",value:function(){return this._container}}])&&Wr(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Jr=function(t){var e,n,r=(e=(0,i.useState)(0),n=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,n)||function(t,e){if(t){if("string"==typeof t)return Zr(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zr(t,e):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1],o=(0,i.useCallback)((function(){return r((function(t){return t+1}))}),[]),s=A((function(){return new Kr(o)}),{position:t.position}),a=s.getMap(),l=i.Children.map(Cr.compact(i.Children.toArray(t.children)),(function(t){return(0,i.cloneElement)(t,{map:a})}));return(0,i.useEffect)((function(){t.mapRef&&(t.mapRef.current=a)}),[a,t.mapRef]),a&&(0,T.createPortal)(l,s.getElement())};function Qr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(t,e)||ti(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ti(t,e){if(t){if("string"==typeof t)return ei(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ei(t,e):void 0}}function ei(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var ni=function(t){var e=Qr((0,i.useState)(0),2),n=e[0],r=e[1],o=Qr((0,i.useState)(),2),s=o[0],a=o[1],l=Qr((0,i.useState)(!1),2),u=l[0],c=l[1],h=(0,i.useRef)(),p=(0,i.useCallback)((function(e){return t.names&&t.names.length>e&&t.names[e]}),[t.names]),f=(0,i.useCallback)((function(t){return Cr.includes(s,t)}),[s]),d=(0,i.useMemo)((function(){return i.Children.toArray(t.children)}),[t.children]),g=(0,i.useMemo)((function(){return Cr.filter(d,(function(t,e){return f(e)}))}),[d,f]),m=(0,i.useCallback)((function(t){var e,n;e=f(t)?Cr.without(s,t):[].concat(function(t){if(Array.isArray(t))return ei(t)}(n=s)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||ti(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[t]),a(e)}),[f,s]);return(0,i.useEffect)((function(){a(Cr.times(d.length,(function(t){return t})))}),[]),(0,i.useEffect)((function(){var t=h.current;if(t&&t._canvas){var e=h.current._canvas.offsetHeight;r(void 0===e?0:e)}}),[h.current]),Cr.isEmpty(d)?null:i.createElement(i.Fragment,null,i.createElement(Jr,{mapRef:h,position:t.position},i.createElement("button",{className:"mapbox-gl-draw_ctrl-draw-btn layer-button",onClick:function(){return c((function(t){return!t}))},type:"button"},i.createElement(Gr,{size:"1.25em"})),u&&i.createElement("div",{className:"layer-menu",style:{maxHeight:"calc(".concat(n,"px - ").concat(30,"px)")}},i.createElement("div",{className:"menu"},Cr.map(d,(function(t,e){return i.createElement("div",{"aria-selected":f(e),className:"option",role:"option",onClick:function(){return m(e)},onKeyDown:function(){return m(e)},tabIndex:e},i.createElement("div",{className:"checkmark-container"},f(e)&&i.createElement(qr,{size:"1em"})),p(e))}))))),g)};ni.defaultProps={position:"top-left"};const ri=ni,ii=(oi={MixedGeoJSONLayer:()=>t.MixedGeoJSONLayer,PulsingMarkerLayer:()=>t.PulsingMarkerLayer},si={},a.d(si,oi),si);var oi,si,ai=6371008.8,li={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:250826616.45599997,kilometers:6371.0088,kilometres:6371.0088,meters:ai,metres:ai,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:3440.069546436285,radians:1,yards:6967335.223679999};function ui(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function ci(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!fi(t[0])||!fi(t[1]))throw new Error("coordinates must contain numbers");return ui({type:"Point",coordinates:t},e,n)}function hi(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return ui({type:"Polygon",coordinates:t},e,n)}function pi(t,e){void 0===e&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function fi(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function di(t,e,n){if(null!==t)for(var r,i,o,s,a,l,u,c,h=0,p=0,f=t.type,d="FeatureCollection"===f,g="Feature"===f,m=d?t.features.length:1,y=0;y<m;y++){a=(c=!!(u=d?t.features[y].geometry:g?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var _=0;_<a;_++){var v=0,x=0;if(null!==(s=c?u.geometries[_]:u)){l=s.coordinates;var b=s.type;switch(h=!n||"Polygon"!==b&&"MultiPolygon"!==b?0:1,b){case null:break;case"Point":if(!1===e(l,p,y,v,x))return!1;p++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===e(l[r],p,y,v,x))return!1;p++,"MultiPoint"===b&&v++}"LineString"===b&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(i=0;i<l[r].length-h;i++){if(!1===e(l[r][i],p,y,v,x))return!1;p++}"MultiLineString"===b&&v++,"Polygon"===b&&x++}"Polygon"===b&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(x=0,i=0;i<l[r].length;i++){for(o=0;o<l[r][i].length-h;o++){if(!1===e(l[r][i][o],p,y,v,x))return!1;p++}x++}v++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===di(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function gi(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function mi(t,e){var n,r,i,o,s,a,l,u,c,h,p=0,f="FeatureCollection"===t.type,d="Feature"===t.type,g=f?t.features.length:1;for(n=0;n<g;n++){for(a=f?t.features[n].geometry:d?t.geometry:t,u=f?t.features[n].properties:d?t.properties:{},c=f?t.features[n].bbox:d?t.bbox:void 0,h=f?t.features[n].id:d?t.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=l?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,p,u,c,h))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],p,u,c,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,p,u,c,h))return!1;p++}}function yi(t){var e=[1/0,1/0,-1/0,-1/0];return di(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}yi.default=yi;const _i=yi;function vi(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r,i=function(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}(t),o="Feature"===(r=e).type?r.geometry:r,s=o.type,a=e.bbox,l=o.coordinates;if(a&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(i,a))return!1;"Polygon"===s&&(l=[l]);for(var u=!1,c=0;c<l.length&&!u;c++)if(xi(i,l[c][0],n.ignoreBoundary)){for(var h=!1,p=1;p<l[c].length&&!h;)xi(i,l[c][p],!n.ignoreBoundary)&&(h=!0),p++;h||(u=!0)}return u}function xi(t,e,n){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,o=e.length-1;i<e.length;o=i++){var s=e[i][0],a=e[i][1],l=e[o][0],u=e[o][1];if(t[1]*(s-l)+a*(l-t[0])+u*(t[0]-s)==0&&(s-t[0])*(l-t[0])<=0&&(a-t[1])*(u-t[1])<=0)return!n;a>t[1]!=u>t[1]&&t[0]<(l-s)*(t[1]-a)/(u-a)+s&&(r=!r)}return r}a(1513),a(9985),Object.prototype.hasOwnProperty;var bi=new ArrayBuffer(16);function wi(t,e){void 0===e&&(e={});var n=Number(t[0]),r=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[n,r];return hi([[s,[i,r],[i,o],[n,o],s]],e.properties,{bbox:t,id:e.id})}new Float64Array(bi),new Uint32Array(bi),a(4026),function(){function t(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(e=0;e<this.length-1;e++){var n=this.points[e],r=this.points[e+1];this.centers.push({x:(n.x+r.x)/2,y:(n.y+r.y)/2,z:(n.z+r.z)/2})}for(this.controls.push([this.points[0],this.points[0]]),e=0;e<this.centers.length-1;e++){var i=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,o=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,s=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+o),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+s)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+o),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+s)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}t.prototype.cacheSteps=function(t){var e=[],n=this.pos(0);e.push(0);for(var r=0;r<this.duration;r+=10){var i=this.pos(r);Math.sqrt((i.x-n.x)*(i.x-n.x)+(i.y-n.y)*(i.y-n.y)+(i.z-n.z)*(i.z-n.z))>t&&(e.push(r),n=i)}return e},t.prototype.vector=function(t){var e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}},t.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var n=e/this.duration;if(n>=1)return this.points[this.length-1];var r=Math.floor((this.points.length-1)*n);return function(t,e,n,r,i){var o=function(t){var e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(t);return{x:i.x*o[0]+r.x*o[1]+n.x*o[2]+e.x*o[3],y:i.y*o[0]+r.y*o[1]+n.y*o[2]+e.y*o[3],z:i.z*o[0]+r.z*o[1]+n.z*o[2]+e.z*o[3]}}((this.length-1)*n-r,this.points[r],this.controls[r][1],this.controls[r+1][0],this.points[r+1])}}();a(1767),a(6032);var Ei=Math.PI/180,Si=180/Math.PI,Ii=function(t,e){this.lon=t,this.lat=e,this.x=Ei*t,this.y=Ei*e};Ii.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},Ii.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new Ii(e,t)};var Ci=function(){this.coords=[],this.length=0};Ci.prototype.move_to=function(t){this.length++,this.coords.push(t)};var Ti=function(t){this.properties=t||{},this.geometries=[]};Ti.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(1===this.geometries.length)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var t=[],e=0;e<this.geometries.length;e++)t.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:t},type:"Feature",properties:this.properties}},Ti.prototype.wkt=function(){for(var t="",e="LINESTRING(",n=function(t){e+=t[0]+" "+t[1]+","},r=0;r<this.geometries.length;r++){if(0===this.geometries[r].coords.length)return"LINESTRING(empty)";this.geometries[r].coords.forEach(n),t+=e.substring(0,e.length-1)+")"}return t};var Pi=function(t,e,n){if(!t||void 0===t.x||void 0===t.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||void 0===e.x||void 0===e.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new Ii(t.x,t.y),this.end=new Ii(e.x,e.y),this.properties=n||{};var r=this.start.x-this.end.x,i=this.start.y-this.end.y,o=Math.pow(Math.sin(i/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(r/2),2);if(this.g=2*Math.asin(Math.sqrt(o)),this.g===Math.PI)throw new Error("it appears "+t.view()+" and "+e.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+t+" and "+e)};Pi.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),n=Math.sin(t*this.g)/Math.sin(this.g),r=e*Math.cos(this.start.y)*Math.cos(this.start.x)+n*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+n*Math.cos(this.end.y)*Math.sin(this.end.x),o=e*Math.sin(this.start.y)+n*Math.sin(this.end.y),s=Si*Math.atan2(o,Math.sqrt(Math.pow(r,2)+Math.pow(i,2)));return[Si*Math.atan2(i,r),s]},Pi.prototype.Arc=function(t,e){var n=[];if(!t||t<=2)n.push([this.start.lon,this.start.lat]),n.push([this.end.lon,this.end.lat]);else for(var r=1/(t-1),i=0;i<t;++i){var o=r*i,s=this.interpolate(o);n.push(s)}for(var a=!1,l=0,u=e&&e.offset?e.offset:10,c=180-u,h=-180+u,p=360-u,f=1;f<n.length;++f){var d=n[f-1][0],g=n[f][0],m=Math.abs(g-d);m>p&&(g>c&&d<h||d>c&&g<h)?a=!0:m>l&&(l=m)}var y=[];if(a&&l<u){var _=[];y.push(_);for(var v=0;v<n.length;++v){var x=parseFloat(n[v][0]);if(v>0&&Math.abs(x-n[v-1][0])>p){var b=parseFloat(n[v-1][0]),w=parseFloat(n[v-1][1]),E=parseFloat(n[v][0]),S=parseFloat(n[v][1]);if(b>-180&&b<h&&180===E&&v+1<n.length&&n[v-1][0]>-180&&n[v-1][0]<h){_.push([-180,n[v][1]]),v++,_.push([n[v][0],n[v][1]]);continue}if(b>c&&b<180&&-180===E&&v+1<n.length&&n[v-1][0]>c&&n[v-1][0]<180){_.push([180,n[v][1]]),v++,_.push([n[v][0],n[v][1]]);continue}if(b<h&&E>c){var I=b;b=E,E=I;var C=w;w=S,S=C}if(b>c&&E<h&&(E+=360),b<=180&&E>=180&&b<E){var T=(180-b)/(E-b),P=T*S+(1-T)*w;_.push([n[v-1][0]>c?180:-180,P]),(_=[]).push([n[v-1][0]>c?-180:180,P]),y.push(_)}else _=[],y.push(_);_.push([x,n[v][1]])}else _.push([n[v][0],n[v][1]])}}else{var M=[];y.push(M);for(var L=0;L<n.length;++L)M.push([n[L][0],n[L][1]])}for(var A=new Ti(this.properties),k=0;k<y.length;++k){var N=new Ci;A.geometries.push(N);for(var D=y[k],R=0;R<D.length;++R)N.move_to(D[R])}return A},a(4969);var Mi=[],Li=[],Ai=[],ki=[],Ni=[],Di=[],Ri=[],Oi=[],zi=[],Fi=[],Bi=[],Ui=[],Vi=[],ji=[],Gi=[],qi=[],$i=[],Xi=[],Zi=[],Yi=[],Wi=[],Hi=[],Ki=[],Ji=[];Ri[85]=Fi[85]=-1,Oi[85]=Bi[85]=0,zi[85]=Ui[85]=1,Zi[85]=Hi[85]=1,Yi[85]=Ki[85]=0,Wi[85]=Ji[85]=1,Mi[85]=ki[85]=0,Li[85]=Ni[85]=-1,Ai[85]=Gi[85]=0,qi[85]=Vi[85]=0,$i[85]=ji[85]=1,Di[85]=Xi[85]=1,Hi[1]=Hi[169]=0,Ki[1]=Ki[169]=-1,Ji[1]=Ji[169]=0,Vi[1]=Vi[169]=-1,ji[1]=ji[169]=0,Gi[1]=Gi[169]=0,Fi[4]=Fi[166]=0,Bi[4]=Bi[166]=-1,Ui[4]=Ui[166]=1,qi[4]=qi[166]=1,$i[4]=$i[166]=0,Xi[4]=Xi[166]=0,Ri[16]=Ri[154]=0,Oi[16]=Oi[154]=1,zi[16]=zi[154]=1,ki[16]=ki[154]=1,Ni[16]=Ni[154]=0,Di[16]=Di[154]=1,Zi[64]=Zi[106]=0,Yi[64]=Yi[106]=1,Wi[64]=Wi[106]=0,Mi[64]=Mi[106]=-1,Li[64]=Li[106]=0,Ai[64]=Ai[106]=1,Zi[2]=Zi[168]=0,Yi[2]=Yi[168]=-1,Wi[2]=Wi[168]=1,Hi[2]=Hi[168]=0,Ki[2]=Ki[168]=-1,Ji[2]=Ji[168]=0,Vi[2]=Vi[168]=-1,ji[2]=ji[168]=0,Gi[2]=Gi[168]=0,qi[2]=qi[168]=-1,$i[2]=$i[168]=0,Xi[2]=Xi[168]=1,Ri[8]=Ri[162]=0,Oi[8]=Oi[162]=-1,zi[8]=zi[162]=0,Fi[8]=Fi[162]=0,Bi[8]=Bi[162]=-1,Ui[8]=Ui[162]=1,Vi[8]=Vi[162]=1,ji[8]=ji[162]=0,Gi[8]=Gi[162]=1,qi[8]=qi[162]=1,$i[8]=$i[162]=0,Xi[8]=Xi[162]=0,Ri[32]=Ri[138]=0,Oi[32]=Oi[138]=1,zi[32]=zi[138]=1,Fi[32]=Fi[138]=0,Bi[32]=Bi[138]=1,Ui[32]=Ui[138]=0,Mi[32]=Mi[138]=1,Li[32]=Li[138]=0,Ai[32]=Ai[138]=0,ki[32]=ki[138]=1,Ni[32]=Ni[138]=0,Di[32]=Di[138]=1,Hi[128]=Hi[42]=0,Ki[128]=Ki[42]=1,Ji[128]=Ji[42]=1,Zi[128]=Zi[42]=0,Yi[128]=Yi[42]=1,Wi[128]=Wi[42]=0,Mi[128]=Mi[42]=-1,Li[128]=Li[42]=0,Ai[128]=Ai[42]=1,ki[128]=ki[42]=-1,Ni[128]=Ni[42]=0,Di[128]=Di[42]=0,Fi[5]=Fi[165]=-1,Bi[5]=Bi[165]=0,Ui[5]=Ui[165]=0,Hi[5]=Hi[165]=1,Ki[5]=Ki[165]=0,Ji[5]=Ji[165]=0,qi[20]=qi[150]=0,$i[20]=$i[150]=1,Xi[20]=Xi[150]=1,ki[20]=ki[150]=0,Ni[20]=Ni[150]=-1,Di[20]=Di[150]=1,Ri[80]=Ri[90]=-1,Oi[80]=Oi[90]=0,zi[80]=zi[90]=1,Zi[80]=Zi[90]=1,Yi[80]=Yi[90]=0,Wi[80]=Wi[90]=1,Vi[65]=Vi[105]=0,ji[65]=ji[105]=1,Gi[65]=Gi[105]=0,Mi[65]=Mi[105]=0,Li[65]=Li[105]=-1,Ai[65]=Ai[105]=0,Ri[160]=Ri[10]=-1,Oi[160]=Oi[10]=0,zi[160]=zi[10]=1,Fi[160]=Fi[10]=-1,Bi[160]=Bi[10]=0,Ui[160]=Ui[10]=0,Hi[160]=Hi[10]=1,Ki[160]=Ki[10]=0,Ji[160]=Ji[10]=0,Zi[160]=Zi[10]=1,Yi[160]=Yi[10]=0,Wi[160]=Wi[10]=1,qi[130]=qi[40]=0,$i[130]=$i[40]=1,Xi[130]=Xi[40]=1,Vi[130]=Vi[40]=0,ji[130]=ji[40]=1,Gi[130]=Gi[40]=0,Mi[130]=Mi[40]=0,Li[130]=Li[40]=-1,Ai[130]=Ai[40]=0,ki[130]=ki[40]=0,Ni[130]=Ni[40]=-1,Di[130]=Di[40]=1,Fi[37]=Fi[133]=0,Bi[37]=Bi[133]=1,Ui[37]=Ui[133]=1,Hi[37]=Hi[133]=0,Ki[37]=Ki[133]=1,Ji[37]=Ji[133]=0,Mi[37]=Mi[133]=-1,Li[37]=Li[133]=0,Ai[37]=Ai[133]=0,ki[37]=ki[133]=1,Ni[37]=Ni[133]=0,Di[37]=Di[133]=0,qi[148]=qi[22]=-1,$i[148]=$i[22]=0,Xi[148]=Xi[22]=0,Hi[148]=Hi[22]=0,Ki[148]=Ki[22]=-1,Ji[148]=Ji[22]=1,Zi[148]=Zi[22]=0,Yi[148]=Yi[22]=1,Wi[148]=Wi[22]=1,ki[148]=ki[22]=-1,Ni[148]=Ni[22]=0,Di[148]=Di[22]=1,Ri[82]=Ri[88]=0,Oi[82]=Oi[88]=-1,zi[82]=zi[88]=1,qi[82]=qi[88]=1,$i[82]=$i[88]=0,Xi[82]=Xi[88]=1,Vi[82]=Vi[88]=-1,ji[82]=ji[88]=0,Gi[82]=Gi[88]=1,Zi[82]=Zi[88]=0,Yi[82]=Yi[88]=-1,Wi[82]=Wi[88]=0,Ri[73]=Ri[97]=0,Oi[73]=Oi[97]=1,zi[73]=zi[97]=0,Fi[73]=Fi[97]=0,Bi[73]=Bi[97]=-1,Ui[73]=Ui[97]=0,Vi[73]=Vi[97]=1,ji[73]=ji[97]=0,Gi[73]=Gi[97]=0,Mi[73]=Mi[97]=1,Li[73]=Li[97]=0,Ai[73]=Ai[97]=1,Ri[145]=Ri[25]=0,Oi[145]=Oi[25]=-1,zi[145]=zi[25]=0,Vi[145]=Vi[25]=1,ji[145]=ji[25]=0,Gi[145]=Gi[25]=1,Hi[145]=Hi[25]=0,Ki[145]=Ki[25]=1,Ji[145]=Ji[25]=1,ki[145]=ki[25]=-1,Ni[145]=Ni[25]=0,Di[145]=Di[25]=0,Fi[70]=Fi[100]=0,Bi[70]=Bi[100]=1,Ui[70]=Ui[100]=0,qi[70]=qi[100]=-1,$i[70]=$i[100]=0,Xi[70]=Xi[100]=1,Zi[70]=Zi[100]=0,Yi[70]=Yi[100]=-1,Wi[70]=Wi[100]=1,Mi[70]=Mi[100]=1,Li[70]=Li[100]=0,Ai[70]=Ai[100]=0,Fi[101]=Fi[69]=0,Bi[101]=Bi[69]=1,Ui[101]=Ui[69]=0,Mi[101]=Mi[69]=1,Li[101]=Li[69]=0,Ai[101]=Ai[69]=0,Hi[149]=Hi[21]=0,Ki[149]=Ki[21]=1,Ji[149]=Ji[21]=1,ki[149]=ki[21]=-1,Ni[149]=Ni[21]=0,Di[149]=Di[21]=0,qi[86]=qi[84]=-1,$i[86]=$i[84]=0,Xi[86]=Xi[84]=1,Zi[86]=Zi[84]=0,Yi[86]=Yi[84]=-1,Wi[86]=Wi[84]=1,Ri[89]=Ri[81]=0,Oi[89]=Oi[81]=-1,zi[89]=zi[81]=0,Vi[89]=Vi[81]=1,ji[89]=ji[81]=0,Gi[89]=Gi[81]=1,Ri[96]=Ri[74]=0,Oi[96]=Oi[74]=1,zi[96]=zi[74]=0,Fi[96]=Fi[74]=-1,Bi[96]=Bi[74]=0,Ui[96]=Ui[74]=1,Zi[96]=Zi[74]=1,Yi[96]=Yi[74]=0,Wi[96]=Wi[74]=0,Mi[96]=Mi[74]=1,Li[96]=Li[74]=0,Ai[96]=Ai[74]=1,Ri[24]=Ri[146]=0,Oi[24]=Oi[146]=-1,zi[24]=zi[146]=1,qi[24]=qi[146]=1,$i[24]=$i[146]=0,Xi[24]=Xi[146]=1,Vi[24]=Vi[146]=0,ji[24]=ji[146]=1,Gi[24]=Gi[146]=1,ki[24]=ki[146]=0,Ni[24]=Ni[146]=-1,Di[24]=Di[146]=0,Fi[6]=Fi[164]=-1,Bi[6]=Bi[164]=0,Ui[6]=Ui[164]=1,qi[6]=qi[164]=-1,$i[6]=$i[164]=0,Xi[6]=Xi[164]=0,Hi[6]=Hi[164]=0,Ki[6]=Ki[164]=-1,Ji[6]=Ji[164]=1,Zi[6]=Zi[164]=1,Yi[6]=Yi[164]=0,Wi[6]=Wi[164]=0,Vi[129]=Vi[41]=0,ji[129]=ji[41]=1,Gi[129]=Gi[41]=1,Hi[129]=Hi[41]=0,Ki[129]=Ki[41]=1,Ji[129]=Ji[41]=0,Mi[129]=Mi[41]=-1,Li[129]=Li[41]=0,Ai[129]=Ai[41]=0,ki[129]=ki[41]=0,Ni[129]=Ni[41]=-1,Di[129]=Di[41]=0,qi[66]=qi[104]=0,$i[66]=$i[104]=1,Xi[66]=Xi[104]=0,Vi[66]=Vi[104]=-1,ji[66]=ji[104]=0,Gi[66]=Gi[104]=1,Zi[66]=Zi[104]=0,Yi[66]=Yi[104]=-1,Wi[66]=Wi[104]=0,Mi[66]=Mi[104]=0,Li[66]=Li[104]=-1,Ai[66]=Ai[104]=1,Ri[144]=Ri[26]=-1,Oi[144]=Oi[26]=0,zi[144]=zi[26]=0,Hi[144]=Hi[26]=1,Ki[144]=Ki[26]=0,Ji[144]=Ji[26]=1,Zi[144]=Zi[26]=0,Yi[144]=Yi[26]=1,Wi[144]=Wi[26]=1,ki[144]=ki[26]=-1,Ni[144]=Ni[26]=0,Di[144]=Di[26]=1,Fi[36]=Fi[134]=0,Bi[36]=Bi[134]=1,Ui[36]=Ui[134]=1,qi[36]=qi[134]=0,$i[36]=$i[134]=1,Xi[36]=Xi[134]=0,Mi[36]=Mi[134]=0,Li[36]=Li[134]=-1,Ai[36]=Ai[134]=1,ki[36]=ki[134]=1,Ni[36]=Ni[134]=0,Di[36]=Di[134]=0,Ri[9]=Ri[161]=-1,Oi[9]=Oi[161]=0,zi[9]=zi[161]=0,Fi[9]=Fi[161]=0,Bi[9]=Bi[161]=-1,Ui[9]=Ui[161]=0,Vi[9]=Vi[161]=1,ji[9]=ji[161]=0,Gi[9]=Gi[161]=0,Hi[9]=Hi[161]=1,Ki[9]=Ki[161]=0,Ji[9]=Ji[161]=1,Ri[136]=0,Oi[136]=1,zi[136]=1,Fi[136]=0,Bi[136]=1,Ui[136]=0,qi[136]=-1,$i[136]=0,Xi[136]=1,Vi[136]=-1,ji[136]=0,Gi[136]=0,Hi[136]=0,Ki[136]=-1,Ji[136]=0,Zi[136]=0,Yi[136]=-1,Wi[136]=1,Mi[136]=1,Li[136]=0,Ai[136]=0,ki[136]=1,Ni[136]=0,Di[136]=1,Ri[34]=0,Oi[34]=-1,zi[34]=0,Fi[34]=0,Bi[34]=-1,Ui[34]=1,qi[34]=1,$i[34]=0,Xi[34]=0,Vi[34]=1,ji[34]=0,Gi[34]=1,Hi[34]=0,Ki[34]=1,Ji[34]=1,Zi[34]=0,Yi[34]=1,Wi[34]=0,Mi[34]=-1,Li[34]=0,Ai[34]=1,ki[34]=-1,Ni[34]=0,Di[34]=0,Ri[35]=0,Oi[35]=1,zi[35]=1,Fi[35]=0,Bi[35]=-1,Ui[35]=1,qi[35]=1,$i[35]=0,Xi[35]=0,Vi[35]=-1,ji[35]=0,Gi[35]=0,Hi[35]=0,Ki[35]=-1,Ji[35]=0,Zi[35]=0,Yi[35]=1,Wi[35]=0,Mi[35]=-1,Li[35]=0,Ai[35]=1,ki[35]=1,Ni[35]=0,Di[35]=1,Ri[153]=0,Oi[153]=1,zi[153]=1,Vi[153]=-1,ji[153]=0,Gi[153]=0,Hi[153]=0,Ki[153]=-1,Ji[153]=0,ki[153]=1,Ni[153]=0,Di[153]=1,Fi[102]=0,Bi[102]=-1,Ui[102]=1,qi[102]=1,$i[102]=0,Xi[102]=0,Zi[102]=0,Yi[102]=1,Wi[102]=0,Mi[102]=-1,Li[102]=0,Ai[102]=1,Ri[155]=0,Oi[155]=-1,zi[155]=0,Vi[155]=1,ji[155]=0,Gi[155]=1,Hi[155]=0,Ki[155]=1,Ji[155]=1,ki[155]=-1,Ni[155]=0,Di[155]=0,Fi[103]=0,Bi[103]=1,Ui[103]=0,qi[103]=-1,$i[103]=0,Xi[103]=1,Zi[103]=0,Yi[103]=-1,Wi[103]=1,Mi[103]=1,Li[103]=0,Ai[103]=0,Ri[152]=0,Oi[152]=1,zi[152]=1,qi[152]=-1,$i[152]=0,Xi[152]=1,Vi[152]=-1,ji[152]=0,Gi[152]=0,Hi[152]=0,Ki[152]=-1,Ji[152]=0,Zi[152]=0,Yi[152]=-1,Wi[152]=1,ki[152]=1,Ni[152]=0,Di[152]=1,Ri[156]=0,Oi[156]=-1,zi[156]=1,qi[156]=1,$i[156]=0,Xi[156]=1,Vi[156]=-1,ji[156]=0,Gi[156]=0,Hi[156]=0,Ki[156]=-1,Ji[156]=0,Zi[156]=0,Yi[156]=1,Wi[156]=1,ki[156]=-1,Ni[156]=0,Di[156]=1,Ri[137]=0,Oi[137]=1,zi[137]=1,Fi[137]=0,Bi[137]=1,Ui[137]=0,Vi[137]=-1,ji[137]=0,Gi[137]=0,Hi[137]=0,Ki[137]=-1,Ji[137]=0,Mi[137]=1,Li[137]=0,Ai[137]=0,ki[137]=1,Ni[137]=0,Di[137]=1,Ri[139]=0,Oi[139]=1,zi[139]=1,Fi[139]=0,Bi[139]=-1,Ui[139]=0,Vi[139]=1,ji[139]=0,Gi[139]=0,Hi[139]=0,Ki[139]=1,Ji[139]=0,Mi[139]=-1,Li[139]=0,Ai[139]=0,ki[139]=1,Ni[139]=0,Di[139]=1,Ri[98]=0,Oi[98]=-1,zi[98]=0,Fi[98]=0,Bi[98]=-1,Ui[98]=1,qi[98]=1,$i[98]=0,Xi[98]=0,Vi[98]=1,ji[98]=0,Gi[98]=1,Zi[98]=0,Yi[98]=1,Wi[98]=0,Mi[98]=-1,Li[98]=0,Ai[98]=1,Ri[99]=0,Oi[99]=1,zi[99]=0,Fi[99]=0,Bi[99]=-1,Ui[99]=1,qi[99]=1,$i[99]=0,Xi[99]=0,Vi[99]=-1,ji[99]=0,Gi[99]=1,Zi[99]=0,Yi[99]=-1,Wi[99]=0,Mi[99]=1,Li[99]=0,Ai[99]=1,Fi[38]=0,Bi[38]=-1,Ui[38]=1,qi[38]=1,$i[38]=0,Xi[38]=0,Hi[38]=0,Ki[38]=1,Ji[38]=1,Zi[38]=0,Yi[38]=1,Wi[38]=0,Mi[38]=-1,Li[38]=0,Ai[38]=1,ki[38]=-1,Ni[38]=0,Di[38]=0,Fi[39]=0,Bi[39]=1,Ui[39]=1,qi[39]=-1,$i[39]=0,Xi[39]=0,Hi[39]=0,Ki[39]=-1,Ji[39]=1,Zi[39]=0,Yi[39]=1,Wi[39]=0,Mi[39]=-1,Li[39]=0,Ai[39]=1,ki[39]=1,Ni[39]=0,Di[39]=0;var Qi=function(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]},to=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]},eo=function(t){return[[t.topright,1],[1,1],[1,t.righttop]]},no=function(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]},ro=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]},io=function(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]},oo=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]},so=function(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},ao=[],lo=[],uo=[],co=[],ho=[],po=[],fo=[],go=[];co[1]=ho[1]=18,co[169]=ho[169]=18,uo[4]=lo[4]=12,uo[166]=lo[166]=12,ao[16]=go[16]=4,ao[154]=go[154]=4,po[64]=fo[64]=22,po[106]=fo[106]=22,uo[2]=po[2]=17,co[2]=ho[2]=18,uo[168]=po[168]=17,co[168]=ho[168]=18,ao[8]=co[8]=9,lo[8]=uo[8]=12,ao[162]=co[162]=9,lo[162]=uo[162]=12,ao[32]=go[32]=4,lo[32]=fo[32]=1,ao[138]=go[138]=4,lo[138]=fo[138]=1,ho[128]=go[128]=21,po[128]=fo[128]=22,ho[42]=go[42]=21,po[42]=fo[42]=22,lo[5]=ho[5]=14,lo[165]=ho[165]=14,uo[20]=go[20]=6,uo[150]=go[150]=6,ao[80]=po[80]=11,ao[90]=po[90]=11,co[65]=fo[65]=3,co[105]=fo[105]=3,ao[160]=po[160]=11,lo[160]=ho[160]=14,ao[10]=po[10]=11,lo[10]=ho[10]=14,uo[130]=go[130]=6,co[130]=fo[130]=3,uo[40]=go[40]=6,co[40]=fo[40]=3,lo[101]=fo[101]=1,lo[69]=fo[69]=1,ho[149]=go[149]=21,ho[21]=go[21]=21,uo[86]=po[86]=17,uo[84]=po[84]=17,ao[89]=co[89]=9,ao[81]=co[81]=9,ao[96]=fo[96]=0,lo[96]=po[96]=15,ao[74]=fo[74]=0,lo[74]=po[74]=15,ao[24]=uo[24]=8,co[24]=go[24]=7,ao[146]=uo[146]=8,co[146]=go[146]=7,lo[6]=po[6]=15,uo[6]=ho[6]=16,lo[164]=po[164]=15,uo[164]=ho[164]=16,co[129]=go[129]=7,ho[129]=fo[129]=20,co[41]=go[41]=7,ho[41]=fo[41]=20,uo[66]=fo[66]=2,co[66]=po[66]=19,uo[104]=fo[104]=2,co[104]=po[104]=19,ao[144]=ho[144]=10,po[144]=go[144]=23,ao[26]=ho[26]=10,po[26]=go[26]=23,lo[36]=go[36]=5,uo[36]=fo[36]=2,lo[134]=go[134]=5,uo[134]=fo[134]=2,ao[9]=ho[9]=10,lo[9]=co[9]=13,ao[161]=ho[161]=10,lo[161]=co[161]=13,lo[37]=go[37]=5,ho[37]=fo[37]=20,lo[133]=go[133]=5,ho[133]=fo[133]=20,uo[148]=ho[148]=16,po[148]=go[148]=23,uo[22]=ho[22]=16,po[22]=go[22]=23,ao[82]=uo[82]=8,co[82]=po[82]=19,ao[88]=uo[88]=8,co[88]=po[88]=19,ao[73]=fo[73]=0,lo[73]=co[73]=13,ao[97]=fo[97]=0,lo[97]=co[97]=13,ao[145]=co[145]=9,ho[145]=go[145]=21,ao[25]=co[25]=9,ho[25]=go[25]=21,lo[70]=fo[70]=1,uo[70]=po[70]=17,lo[100]=fo[100]=1,uo[100]=po[100]=17,ao[34]=co[34]=9,lo[34]=uo[34]=12,ho[34]=go[34]=21,po[34]=fo[34]=22,ao[136]=go[136]=4,lo[136]=fo[136]=1,uo[136]=po[136]=17,co[136]=ho[136]=18,ao[35]=go[35]=4,lo[35]=uo[35]=12,co[35]=ho[35]=18,po[35]=fo[35]=22,ao[153]=go[153]=4,co[153]=ho[153]=18,lo[102]=uo[102]=12,po[102]=fo[102]=22,ao[155]=co[155]=9,ho[155]=go[155]=23,lo[103]=fo[103]=1,uo[103]=po[103]=17,ao[152]=go[152]=4,uo[152]=po[152]=17,co[152]=ho[152]=18,ao[156]=uo[156]=8,co[156]=ho[156]=18,po[156]=go[156]=23,ao[137]=go[137]=4,lo[137]=fo[137]=1,co[137]=ho[137]=18,ao[139]=go[139]=4,lo[139]=co[139]=13,ho[139]=fo[139]=20,ao[98]=co[98]=9,lo[98]=uo[98]=12,po[98]=fo[98]=22,ao[99]=fo[99]=0,lo[99]=uo[99]=12,co[99]=po[99]=19,lo[38]=uo[38]=12,ho[38]=go[38]=21,po[38]=fo[38]=22,lo[39]=go[39]=5,uo[39]=ho[39]=16,po[39]=fo[39]=22;var mo=[];function yo(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0];return function(t){return(t>0)-(t<0)||+t}(r*(n[1]-e[1])-o*i)}function _o(t,e){return e.geometry.coordinates[0].every((function(e){return vi(ci(e),t)}))}mo[1]=mo[169]=Qi,mo[4]=mo[166]=to,mo[16]=mo[154]=eo,mo[64]=mo[106]=no,mo[168]=mo[2]=ro,mo[162]=mo[8]=io,mo[138]=mo[32]=oo,mo[42]=mo[128]=so,mo[5]=mo[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},mo[20]=mo[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},mo[80]=mo[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},mo[65]=mo[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},mo[160]=mo[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},mo[130]=mo[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},mo[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},mo[101]=mo[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},mo[149]=mo[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},mo[86]=mo[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},mo[89]=mo[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},mo[96]=mo[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},mo[24]=mo[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},mo[6]=mo[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},mo[129]=mo[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},mo[66]=mo[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},mo[144]=mo[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},mo[36]=mo[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},mo[9]=mo[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},mo[37]=mo[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},mo[148]=mo[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},mo[82]=mo[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},mo[73]=mo[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},mo[145]=mo[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},mo[70]=mo[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},mo[34]=function(t){return[so(t),io(t)]},mo[35]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},mo[136]=function(t){return[oo(t),ro(t)]},mo[153]=function(t){return[eo(t),Qi(t)]},mo[102]=function(t){return[to(t),no(t)]},mo[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},mo[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},mo[152]=function(t){return[eo(t),ro(t)]},mo[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},mo[137]=function(t){return[oo(t),Qi(t)]},mo[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},mo[98]=function(t){return[io(t),no(t)]},mo[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},mo[38]=function(t){return[to(t),so(t)]},mo[39]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]};const vo=function(){function t(e){this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return t.buildId=function(t){return t.join(",")},t.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter((function(e){return e.from.id!==t.from.id}))},t.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter((function(e){return e.to.id!==t.to.id}))},t.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},t.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort((function(e,n){var r=e.to,i=n.to;if(r.coordinates[0]-t.coordinates[0]>=0&&i.coordinates[0]-t.coordinates[0]<0)return 1;if(r.coordinates[0]-t.coordinates[0]<0&&i.coordinates[0]-t.coordinates[0]>=0)return-1;if(r.coordinates[0]-t.coordinates[0]==0&&i.coordinates[0]-t.coordinates[0]==0)return r.coordinates[1]-t.coordinates[1]>=0||i.coordinates[1]-t.coordinates[1]>=0?r.coordinates[1]-i.coordinates[1]:i.coordinates[1]-r.coordinates[1];var o=yo(t.coordinates,r.coordinates,i.coordinates);return o<0?1:o>0?-1:Math.pow(r.coordinates[0]-t.coordinates[0],2)+Math.pow(r.coordinates[1]-t.coordinates[1],2)-(Math.pow(i.coordinates[0]-t.coordinates[0],2)+Math.pow(i.coordinates[1]-t.coordinates[1],2))})),this.outerEdgesSorted=!0)},t.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},t.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},t.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},t}(),xo=function(){function t(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return t.prototype.getSymetric=function(){return this.symetric||(this.symetric=new t(this.to,this.from),this.symetric.symetric=this),this.symetric},t.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},t.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},t.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},t.prototype.toLineString=function(){return function(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return ui({type:"LineString",coordinates:t},e,n)}([this.from.coordinates,this.to.coordinates])},t.prototype.compareTo=function(t){return yo(t.from.coordinates,t.to.coordinates,this.to.coordinates)},t}();var bo=function(){function t(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return t.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},t.prototype.get=function(t){return this.edges[t]},Object.defineProperty(t.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),t.prototype.forEach=function(t){this.edges.forEach(t)},t.prototype.map=function(t){return this.edges.map(t)},t.prototype.some=function(t){return this.edges.some(t)},t.prototype.isValid=function(){return!0},t.prototype.isHole=function(){var t=this,e=this.edges.reduce((function(e,n,r){return n.from.coordinates[1]>t.edges[e].from.coordinates[1]&&(e=r),e}),0),n=(0===e?this.length:e)-1,r=(e+1)%this.length,i=yo(this.edges[n].from.coordinates,this.edges[e].from.coordinates,this.edges[r].from.coordinates);return 0===i?this.edges[n].from.coordinates[0]>this.edges[r].from.coordinates[0]:i>0},t.prototype.toMultiPoint=function(){return t=this.edges.map((function(t){return t.from.coordinates})),void 0===n&&(n={}),ui({type:"MultiPoint",coordinates:t},e,n);var t,e,n},t.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map((function(t){return t.from.coordinates}));return t.push(this.edges[0].from.coordinates),this.polygon=hi([t])},t.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=(t=this.toPolygon(),wi(_i(t)));var t},t.findEdgeRingContaining=function(t,e){var n,r,i=t.getEnvelope();return e.forEach((function(e){var o,s,a,l,u,c,h=e.getEnvelope();if(r&&(n=r.getEnvelope()),s=i,a=(o=h).geometry.coordinates[0].map((function(t){return t[0]})),l=o.geometry.coordinates[0].map((function(t){return t[1]})),u=s.geometry.coordinates[0].map((function(t){return t[0]})),c=s.geometry.coordinates[0].map((function(t){return t[1]})),(Math.max.apply(null,a)!==Math.max.apply(null,u)||Math.max.apply(null,l)!==Math.max.apply(null,c)||Math.min.apply(null,a)!==Math.min.apply(null,u)||Math.min.apply(null,l)!==Math.min.apply(null,c))&&_o(h,i)){for(var p=t.map((function(t){return t.from.coordinates})),f=void 0,d=function(t){e.some((function(e){return n=t,r=e.from.coordinates,n[0]===r[0]&&n[1]===r[1];var n,r}))||(f=t)},g=0,m=p;g<m.length;g++)d(m[g]);f&&e.inside(ci(f))&&(r&&!_o(n,h)||(r=e))}})),r},t.prototype.inside=function(t){return vi(t,this.toPolygon())},t}();const wo=bo;function Eo(t){for(var e=t,n=[];e.parent;)n.unshift(e),e=e.parent;return n}!function(){function t(){this.edges=[],this.nodes={}}t.fromGeoJson=function(e){!function(t){if(!t)throw new Error("No geojson passed");if("FeatureCollection"!==t.type&&"GeometryCollection"!==t.type&&"MultiLineString"!==t.type&&"LineString"!==t.type&&"Feature"!==t.type)throw new Error("Invalid input type '"+t.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}(e);var n,r=new t;return n=function(t){var e,n,i;!function(t,e,n){if(!t)throw new Error("No feature passed");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}(t,"LineString","Graph::fromGeoJson"),e=function(t,e){if(t){var n=r.getNode(t),i=r.getNode(e);r.addEdge(n,i)}return e},i=n,di(t,(function(t,n,r,o,s){i=0===n?t:e(i,t)}),void 0)},mi(e,(function(t,e,r,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==n(ui(t,r,{bbox:i,id:o}),e,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<t.coordinates.length;l++){var u=t.coordinates[l];if(!1===n(ui({type:s,coordinates:u},r),e,l))return!1}})),r},t.prototype.getNode=function(t){var e=vo.buildId(t),n=this.nodes[e];return n||(n=this.nodes[e]=new vo(t)),n},t.prototype.addEdge=function(t,e){var n=new xo(t,e),r=n.getSymetric();this.edges.push(n),this.edges.push(r)},t.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map((function(e){return t.nodes[e]})).forEach((function(e){return t._removeIfDangle(e)}))},t.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var n=t.getOuterEdges().map((function(t){return t.to}));this.removeNode(t),n.forEach((function(t){return e._removeIfDangle(t)}))}},t.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach((function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))}))},t.prototype._computeNextCWEdges=function(t){var e=this;void 0===t?Object.keys(this.nodes).forEach((function(t){return e._computeNextCWEdges(e.nodes[t])})):t.getOuterEdges().forEach((function(e,n){t.getOuterEdge((0===n?t.getOuterEdges().length:n)-1).symetric.next=e}))},t.prototype._computeNextCCWEdges=function(t,e){for(var n,r,i=t.getOuterEdges(),o=i.length-1;o>=0;--o){var s=i[o],a=s.symetric,l=void 0,u=void 0;s.label===e&&(l=s),a.label===e&&(u=a),l&&u&&(u&&(r=u),l&&(r&&(r.next=l,r=void 0),n||(n=l)))}r&&(r.next=n)},t.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach((function(n){if(!(n.label>=0)){t.push(n);var r=n;do{r.label=e,r=r.next}while(!n.isEqual(r));e++}})),t},t.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach((function(t){t.label=void 0})),this._findLabeledEdgeRings().forEach((function(e){t._findIntersectionNodes(e).forEach((function(n){t._computeNextCCWEdges(n,e.label)}))}));var e=[];return this.edges.forEach((function(n){n.ring||e.push(t._findEdgeRing(n))})),e},t.prototype._findIntersectionNodes=function(t){var e=[],n=t,r=function(){var r=0;n.from.getOuterEdges().forEach((function(e){e.label===t.label&&++r})),r>1&&e.push(n.from),n=n.next};do{r()}while(!t.isEqual(n));return e},t.prototype._findEdgeRing=function(t){var e=t,n=new wo;do{n.push(e),e.ring=n,e=e.next}while(!t.isEqual(e));return n},t.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach((function(t){return e.removeEdge(t)})),t.innerEdges.forEach((function(t){return e.removeEdge(t)})),delete this.nodes[t.id]},t.prototype.removeEdge=function(t){this.edges=this.edges.filter((function(e){return!e.isEqual(t)})),t.deleteEdge()}}(),a(3084),a(1631),a(3883);var So={search:function(t,e,n,r){t.cleanDirty();var i=(r=r||{}).heuristic||So.heuristics.manhattan,o=r.closest||!1,s=new To((function(t){return t.f})),a=e;for(e.h=i(e,n),s.push(e);s.size()>0;){var l=s.pop();if(l===n)return Eo(l);l.closed=!0;for(var u=t.neighbors(l),c=0,h=u.length;c<h;++c){var p=u[c];if(!p.closed&&!p.isWall()){var f=l.g+p.getCost(l),d=p.visited;(!d||f<p.g)&&(p.visited=!0,p.parent=l,p.h=p.h||i(p,n),p.g=f,p.f=p.g+p.h,t.markDirty(p),o&&(p.h<a.h||p.h===a.h&&p.g<a.g)&&(a=p),d?s.rescoreElement(p):s.push(p))}}}return o?Eo(a):[]},heuristics:{manhattan:function(t,e){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},diagonal:function(t,e){var n=Math.sqrt(2),r=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return 1*(r+i)+(n-2)*Math.min(r,i)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function Io(t,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var n=0;n<t.length;n++){this.grid[n]=[];for(var r=0,i=t[n];r<i.length;r++){var o=new Co(n,r,i[r]);this.grid[n][r]=o,this.nodes.push(o)}}this.init()}function Co(t,e,n){this.x=t,this.y=e,this.weight=n}function To(t){this.content=[],this.scoreFunction=t}function Po(){this._=null}function Mo(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Lo(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function Ao(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function ko(t){for(;t.L;)t=t.L;return t}Io.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)So.cleanNode(this.nodes[t])},Io.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)So.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},Io.prototype.markDirty=function(t){this.dirtyNodes.push(t)},Io.prototype.neighbors=function(t){var e=[],n=t.x,r=t.y,i=this.grid;return i[n-1]&&i[n-1][r]&&e.push(i[n-1][r]),i[n+1]&&i[n+1][r]&&e.push(i[n+1][r]),i[n]&&i[n][r-1]&&e.push(i[n][r-1]),i[n]&&i[n][r+1]&&e.push(i[n][r+1]),this.diagonal&&(i[n-1]&&i[n-1][r-1]&&e.push(i[n-1][r-1]),i[n+1]&&i[n+1][r-1]&&e.push(i[n+1][r-1]),i[n-1]&&i[n-1][r+1]&&e.push(i[n-1][r+1]),i[n+1]&&i[n+1][r+1]&&e.push(i[n+1][r+1])),e},Io.prototype.toString=function(){for(var t,e,n,r,i=[],o=this.grid,s=0,a=o.length;s<a;s++){for(t=[],n=0,r=(e=o[s]).length;n<r;n++)t.push(e[n].weight);i.push(t.join(" "))}return i.join("\n")},Co.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},Co.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},Co.prototype.isWall=function(){return 0===this.weight},To.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),n=this.content.pop();e!==this.content.length-1&&(this.content[e]=n,this.scoreFunction(n)<this.scoreFunction(t)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(t){this.sinkDown(this.content.indexOf(t))},sinkDown:function(t){for(var e=this.content[t];t>0;){var n=(t+1>>1)-1,r=this.content[n];if(!(this.scoreFunction(e)<this.scoreFunction(r)))break;this.content[n]=e,this.content[t]=r,t=n}},bubbleUp:function(t){for(var e=this.content.length,n=this.content[t],r=this.scoreFunction(n);;){var i,o=t+1<<1,s=o-1,a=null;if(s<e){var l=this.content[s];(i=this.scoreFunction(l))<r&&(a=s)}if(o<e){var u=this.content[o];this.scoreFunction(u)<(null===a?r:i)&&(a=o)}if(null===a)break;this.content[t]=this.content[a],this.content[a]=n,t=a}}},Po.prototype={constructor:Po,insert:function(t,e){var n,r,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else this._?(t=ko(this._),e.P=null,e.N=t,t.P=t.L=e,n=t):(e.P=e.N=null,this._=e,n=null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&&n.C;)n===(r=n.U).L?(i=r.R)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.R&&(Lo(this,n),n=(t=n).U),n.C=!1,r.C=!0,Ao(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(Ao(this,n),n=(t=n).U),n.C=!1,r.C=!0,Lo(this,r)),n=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,n,r,i=t.U,o=t.L,s=t.R;if(n=o?s?ko(s):o:s,i?i.L===t?i.L=n:i.R=n:this._=n,o&&s?(r=n.C,n.C=t.C,n.L=o,o.U=n,n!==s?(i=n.U,n.U=t.U,t=n.R,i.L=t,n.R=s,s.U=n):(n.U=i,i=n,t=n.R)):(r=t.C,t=n),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&&(e.C=!1,i.C=!0,Lo(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,Ao(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,Lo(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,Ao(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,Lo(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,Ao(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};const No=Po;function Do(t,e,n,r){var i=[null,null],o=is.push(i)-1;return i.left=t,i.right=e,n&&Oo(i,t,e,n),r&&Oo(i,e,t,r),ns[t.index].halfedges.push(o),ns[e.index].halfedges.push(o),i}function Ro(t,e,n){var r=[e,n];return r.left=t,r}function Oo(t,e,n,r){t[0]||t[1]?t.left===n?t[1]=r:t[0]=r:(t[0]=r,t.left=e,t.right=n)}function zo(t,e,n,r,i){var o,s=t[0],a=t[1],l=s[0],u=s[1],c=0,h=1,p=a[0]-l,f=a[1]-u;if(o=e-l,p||!(o>0)){if(o/=p,p<0){if(o<c)return;o<h&&(h=o)}else if(p>0){if(o>h)return;o>c&&(c=o)}if(o=r-l,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>c&&(c=o)}else if(p>0){if(o<c)return;o<h&&(h=o)}if(o=n-u,f||!(o>0)){if(o/=f,f<0){if(o<c)return;o<h&&(h=o)}else if(f>0){if(o>h)return;o>c&&(c=o)}if(o=i-u,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>c&&(c=o)}else if(f>0){if(o<c)return;o<h&&(h=o)}return!(c>0||h<1)||(c>0&&(t[0]=[l+c*p,u+c*f]),h<1&&(t[1]=[l+h*p,u+h*f]),!0)}}}}}function Fo(t,e,n,r,i){var o=t[1];if(o)return!0;var s,a,l=t[0],u=t.left,c=t.right,h=u[0],p=u[1],f=c[0],d=c[1],g=(h+f)/2,m=(p+d)/2;if(d===p){if(g<e||g>=r)return;if(h>f){if(l){if(l[1]>=i)return}else l=[g,n];o=[g,i]}else{if(l){if(l[1]<n)return}else l=[g,i];o=[g,n]}}else if(a=m-(s=(h-f)/(d-p))*g,s<-1||s>1)if(h>f){if(l){if(l[1]>=i)return}else l=[(n-a)/s,n];o=[(i-a)/s,i]}else{if(l){if(l[1]<n)return}else l=[(i-a)/s,i];o=[(n-a)/s,n]}else if(p<d){if(l){if(l[0]>=r)return}else l=[e,s*e+a];o=[r,s*r+a]}else{if(l){if(l[0]<e)return}else l=[r,s*r+a];o=[e,s*e+a]}return t[0]=l,t[1]=o,!0}function Bo(t,e){var n=t.site,r=e.left,i=e.right;return n===i&&(i=r,r=n),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(n===r?(r=e[1],i=e[0]):(r=e[0],i=e[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function Uo(t,e){return e[+(e.left!==t.site)]}function Vo(t,e){return e[+(e.left===t.site)]}var jo,Go=[];function qo(){Mo(this),this.x=this.y=this.arc=this.site=this.cy=null}function $o(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,o=n.site;if(r!==o){var s=i[0],a=i[1],l=r[0]-s,u=r[1]-a,c=o[0]-s,h=o[1]-a,p=2*(l*h-u*c);if(!(p>=-ss)){var f=l*l+u*u,d=c*c+h*h,g=(h*f-u*d)/p,m=(l*d-c*f)/p,y=Go.pop()||new qo;y.arc=t,y.site=i,y.x=g+s,y.y=(y.cy=m+a)+Math.sqrt(g*g+m*m),t.circle=y;for(var _=null,v=rs._;v;)if(y.y<v.y||y.y===v.y&&y.x<=v.x){if(!v.L){_=v.P;break}v=v.L}else{if(!v.R){_=v;break}v=v.R}rs.insert(_,y),_||(jo=y)}}}}function Xo(t){var e=t.circle;e&&(e.P||(jo=e.N),rs.remove(e),Go.push(e),Mo(e),t.circle=null)}var Zo=[];function Yo(){Mo(this),this.edge=this.site=this.circle=null}function Wo(t){var e=Zo.pop()||new Yo;return e.site=t,e}function Ho(t){Xo(t),es.remove(t),Zo.push(t),Mo(t)}function Ko(t){var e=t.circle,n=e.x,r=e.cy,i=[n,r],o=t.P,s=t.N,a=[t];Ho(t);for(var l=o;l.circle&&Math.abs(n-l.circle.x)<os&&Math.abs(r-l.circle.cy)<os;)o=l.P,a.unshift(l),Ho(l),l=o;a.unshift(l),Xo(l);for(var u=s;u.circle&&Math.abs(n-u.circle.x)<os&&Math.abs(r-u.circle.cy)<os;)s=u.N,a.push(u),Ho(u),u=s;a.push(u),Xo(u);var c,h=a.length;for(c=1;c<h;++c)u=a[c],l=a[c-1],Oo(u.edge,l.site,u.site,i);l=a[0],(u=a[h-1]).edge=Do(l.site,u.site,null,i),$o(l),$o(u)}function Jo(t){for(var e,n,r,i,o=t[0],s=t[1],a=es._;a;)if((r=Qo(a,s)-o)>os)a=a.L;else{if(!((i=o-ts(a,s))>os)){r>-os?(e=a.P,n=a):i>-os?(e=a,n=a.N):e=n=a;break}if(!a.R){e=a;break}a=a.R}!function(t){ns[t.index]={site:t,halfedges:[]}}(t);var l=Wo(t);if(es.insert(e,l),e||n){if(e===n)return Xo(e),n=Wo(e.site),es.insert(l,n),l.edge=n.edge=Do(e.site,l.site),$o(e),void $o(n);if(n){Xo(e),Xo(n);var u=e.site,c=u[0],h=u[1],p=t[0]-c,f=t[1]-h,d=n.site,g=d[0]-c,m=d[1]-h,y=2*(p*m-f*g),_=p*p+f*f,v=g*g+m*m,x=[(m*_-f*v)/y+c,(p*v-g*_)/y+h];Oo(n.edge,u,d,x),l.edge=Do(u,t,null,x),n.edge=Do(t,d,null,x),$o(e),$o(n)}else l.edge=Do(e.site,l.site)}}function Qo(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var s=t.P;if(!s)return-1/0;var a=(n=s.site)[0],l=n[1],u=l-e;if(!u)return a;var c=a-r,h=1/o-1/u,p=c/u;return h?(-p+Math.sqrt(p*p-2*h*(c*c/(-2*u)-l+u/2+i-o/2)))/h+r:(r+a)/2}function ts(t,e){var n=t.N;if(n)return Qo(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var es,ns,rs,is,os=1e-6,ss=1e-12;function as(t,e){return e[1]-t[1]||e[0]-t[0]}function ls(t,e){var n,r,i,o=t.sort(as).pop();for(is=[],ns=new Array(t.length),es=new No,rs=new No;;)if(i=jo,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===n&&o[1]===r||(Jo(o),n=o[0],r=o[1]),o=t.pop();else{if(!i)break;Ko(i.arc)}if(function(){for(var t,e,n,r,i=0,o=ns.length;i<o;++i)if((t=ns[i])&&(r=(e=t.halfedges).length)){var s=new Array(r),a=new Array(r);for(n=0;n<r;++n)s[n]=n,a[n]=Bo(t,is[e[n]]);for(s.sort((function(t,e){return a[e]-a[t]})),n=0;n<r;++n)a[n]=e[s[n]];for(n=0;n<r;++n)e[n]=a[n]}}(),e){var s=+e[0][0],a=+e[0][1],l=+e[1][0],u=+e[1][1];!function(t,e,n,r){for(var i,o=is.length;o--;)Fo(i=is[o],t,e,n,r)&&zo(i,t,e,n,r)&&(Math.abs(i[0][0]-i[1][0])>os||Math.abs(i[0][1]-i[1][1])>os)||delete is[o]}(s,a,l,u),function(t,e,n,r){var i,o,s,a,l,u,c,h,p,f,d,g,m=ns.length,y=!0;for(i=0;i<m;++i)if(o=ns[i]){for(s=o.site,a=(l=o.halfedges).length;a--;)is[l[a]]||l.splice(a,1);for(a=0,u=l.length;a<u;)d=(f=Vo(o,is[l[a]]))[0],g=f[1],h=(c=Uo(o,is[l[++a%u]]))[0],p=c[1],(Math.abs(d-h)>os||Math.abs(g-p)>os)&&(l.splice(a,0,is.push(Ro(s,f,Math.abs(d-t)<os&&r-g>os?[t,Math.abs(h-t)<os?p:r]:Math.abs(g-r)<os&&n-d>os?[Math.abs(p-r)<os?h:n,r]:Math.abs(d-n)<os&&g-e>os?[n,Math.abs(h-n)<os?p:e]:Math.abs(g-e)<os&&d-t>os?[Math.abs(p-e)<os?h:t,e]:null))-1),++u);u&&(y=!1)}if(y){var _,v,x,b=1/0;for(i=0,y=null;i<m;++i)(o=ns[i])&&(x=(_=(s=o.site)[0]-t)*_+(v=s[1]-e)*v)<b&&(b=x,y=o);if(y){var w=[t,e],E=[t,r],S=[n,r],I=[n,e];y.halfedges.push(is.push(Ro(s=y.site,w,E))-1,is.push(Ro(s,E,S))-1,is.push(Ro(s,S,I))-1,is.push(Ro(s,I,w))-1)}}for(i=0;i<m;++i)(o=ns[i])&&(o.halfedges.length||delete ns[i])}(s,a,l,u)}this.edges=is,this.cells=ns,es=rs=is=ns=null}ls.prototype={constructor:ls,polygons:function(){var t=this.edges;return this.cells.map((function(e){var n=e.halfedges.map((function(n){return Uo(e,t[n])}));return n.data=e.site.data,n}))},triangles:function(){var t=[],e=this.edges;return this.cells.forEach((function(n,r){if(o=(i=n.halfedges).length)for(var i,o,s,a,l,u,c=n.site,h=-1,p=e[i[o-1]],f=p.left===c?p.right:p.left;++h<o;)s=f,f=(p=e[i[h]]).left===c?p.right:p.left,s&&f&&r<s.index&&r<f.index&&(l=s,u=f,((a=c)[0]-u[0])*(l[1]-a[1])-(a[0]-l[0])*(u[1]-a[1])<0)&&t.push([c.data,s.data,f.data])})),t},links:function(){return this.edges.filter((function(t){return t.right})).map((function(t){return{source:t.left.data,target:t.right.data}}))},find:function(t,e,n){for(var r,i,o=this,s=o._found||0,a=o.cells.length;!(i=o.cells[s]);)if(++s>=a)return null;var l=t-i.site[0],u=e-i.site[1],c=l*l+u*u;do{i=o.cells[r=s],s=null,i.halfedges.forEach((function(n){var r=o.edges[n],a=r.left;if(a!==i.site&&a||(a=r.right)){var l=t-a[0],u=e-a[1],h=l*l+u*u;h<c&&(c=h,s=a.index)}}))}while(null!==s);return o._found=r,null==n||c<=n*n?i.site:null}},a(2235);var us=a(4712);function cs(){return new hs}function hs(){this.reset()}hs.prototype={constructor:hs,reset:function(){this.s=this.t=0},add:function(t){fs(ps,t,this.t),fs(this,ps.s,this.s),this.s?this.t+=ps.t:this.s=ps.t},valueOf:function(){return this.s}};var ps=new hs;function fs(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var ds=1e-6,gs=Math.PI,ms=gs/2,ys=gs/4,_s=2*gs,vs=180/gs,xs=gs/180,bs=Math.abs,ws=Math.atan,Es=Math.atan2,Ss=Math.cos,Is=(Math.ceil,Math.exp,Math.floor,Math.log,Math.pow,Math.sin),Cs=(Math.sign,Math.sqrt);Math.tan;function Ts(t){return t>1?0:t<-1?gs:Math.acos(t)}function Ps(t){return t>1?ms:t<-1?-ms:Math.asin(t)}function Ms(){}function Ls(t,e){t&&Ds.hasOwnProperty(t.type)&&Ds[t.type](t,e)}var As,ks,Ns={Feature:function(t,e){Ls(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)Ls(n[r].geometry,e)}},Ds={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Rs(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Rs(n[r],e,0)},Polygon:function(t,e){Os(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Os(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)Ls(n[r],e)}};function Rs(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Os(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Rs(t[n],e,1);e.polygonEnd()}function zs(t){return[Es(t[1],t[0]),Ps(t[2])]}function Fs(t){var e=t[0],n=t[1],r=Ss(n);return[r*Ss(e),r*Is(e),Is(n)]}function Bs(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Us(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Vs(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function js(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Gs(t){var e=Cs(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function qs(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function $s(t,e){return[t>gs?t-_s:t<-gs?t+_s:t,e]}function Xs(t){return function(e,n){return[(e+=t)>gs?e-_s:e<-gs?e+_s:e,n]}}function Zs(t){var e=Xs(t);return e.invert=Xs(-t),e}function Ys(t,e){var n=Ss(t),r=Is(t),i=Ss(e),o=Is(e);function s(t,e){var s=Ss(e),a=Ss(t)*s,l=Is(t)*s,u=Is(e),c=u*n+a*r;return[Es(l*i-c*o,a*n-u*r),Ps(c*i+l*o)]}return s.invert=function(t,e){var s=Ss(e),a=Ss(t)*s,l=Is(t)*s,u=Is(e),c=u*i-l*o;return[Es(l*i+u*o,a*n+c*r),Ps(c*n-a*r)]},s}function Ws(t,e){(e=Fs(e))[0]-=t,Gs(e);var n=Ts(-e[1]);return((-e[2]<0?-n:n)+_s-ds)%_s}function Hs(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:Ms,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Ks(t,e){return bs(t[0]-e[0])<ds&&bs(t[1]-e[1])<ds}function Js(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Qs(t,e,n,r,i){var o,s,a=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],s=t[e];if(Ks(r,s)){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else a.push(n=new Js(r,t,null,!0)),l.push(n.o=new Js(r,null,n,!1)),a.push(n=new Js(s,t,null,!1)),l.push(n.o=new Js(s,null,n,!0))}})),a.length){for(l.sort(e),ta(a),ta(l),o=0,s=l.length;o<s;++o)l[o].e=n=!n;for(var u,c,h=a[0];;){for(var p=h,f=!0;p.v;)if((p=p.n)===h)return;u=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(f)for(o=0,s=u.length;o<s;++o)i.point((c=u[o])[0],c[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(f)for(u=p.p.z,o=u.length-1;o>=0;--o)i.point((c=u[o])[0],c[1]);else r(p.x,p.p.x,-1,i);p=p.p}u=(p=p.o).z,f=!f}while(!p.v);i.lineEnd()}}}function ta(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function ea(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}cs(),cs(),cs(),$s.invert=$s,1===(As=ea).length&&(ks=As,As=function(t,e){return ea(ks(t),e)});var na=Array.prototype;function ra(t){for(var e,n,r,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(n=new Array(s);--i>=0;)for(e=(r=t[i]).length;--e>=0;)n[--s]=r[e];return n}na.slice,na.map,Math.sqrt(50),Math.sqrt(10),Math.sqrt(2);var ia=1e9,oa=-ia;var sa=cs();cs(),cs(),cs();var aa=1/0,la=aa,ua=-aa,ca=ua,ha={point:function(t,e){t<aa&&(aa=t),t>ua&&(ua=t),e<la&&(la=e),e>ca&&(ca=e)},lineStart:Ms,lineEnd:Ms,polygonStart:Ms,polygonEnd:Ms,result:function(){var t=[[aa,la],[ua,ca]];return ua=ca=-(la=aa=1/0),t}};const pa=ha;function fa(t,e,n,r){return function(i,o){var s,a,l,u=e(o),c=i.invert(r[0],r[1]),h=Hs(),p=e(h),f=!1,d={point:g,lineStart:y,lineEnd:_,polygonStart:function(){d.point=v,d.lineStart=x,d.lineEnd=b,a=[],s=[]},polygonEnd:function(){d.point=g,d.lineStart=y,d.lineEnd=_,a=ra(a);var t=function(t,e){var n=e[0],r=e[1],i=[Is(n),-Ss(n),0],o=0,s=0;sa.reset();for(var a=0,l=t.length;a<l;++a)if(c=(u=t[a]).length)for(var u,c,h=u[c-1],p=h[0],f=h[1]/2+ys,d=Is(f),g=Ss(f),m=0;m<c;++m,p=_,d=x,g=b,h=y){var y=u[m],_=y[0],v=y[1]/2+ys,x=Is(v),b=Ss(v),w=_-p,E=w>=0?1:-1,S=E*w,I=S>gs,C=d*x;if(sa.add(Es(C*E*Is(S),g*b+C*Ss(S))),o+=I?w+E*_s:w,I^p>=n^_>=n){var T=Us(Fs(h),Fs(y));Gs(T);var P=Us(i,T);Gs(P);var M=(I^w>=0?-1:1)*Ps(P[2]);(r>M||r===M&&(T[0]||T[1]))&&(s+=I^w>=0?1:-1)}}return(o<-ds||o<ds&&sa<-ds)^1&s}(s,c);a.length?(f||(o.polygonStart(),f=!0),Qs(a,ga,t,n,o)):t&&(f||(o.polygonStart(),f=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),f&&(o.polygonEnd(),f=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function g(e,n){var r=i(e,n);t(e=r[0],n=r[1])&&o.point(e,n)}function m(t,e){var n=i(t,e);u.point(n[0],n[1])}function y(){d.point=m,u.lineStart()}function _(){d.point=g,u.lineEnd()}function v(t,e){l.push([t,e]);var n=i(t,e);p.point(n[0],n[1])}function x(){p.lineStart(),l=[]}function b(){v(l[0][0],l[0][1]),p.lineEnd();var t,e,n,r,i=p.clean(),u=h.result(),c=u.length;if(l.pop(),s.push(l),l=null,c)if(1&i){if((e=(n=u[0]).length-1)>0){for(f||(o.polygonStart(),f=!0),o.lineStart(),t=0;t<e;++t)o.point((r=n[t])[0],r[1]);o.lineEnd()}}else c>1&&2&i&&u.push(u.pop().concat(u.shift())),a.push(u.filter(da))}return d}}function da(t){return t.length>1}function ga(t,e){return((t=t.x)[0]<0?t[1]-ms-ds:ms-t[1])-((e=e.x)[0]<0?e[1]-ms-ds:ms-e[1])}cs();const ma=fa((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?gs:-gs,l=bs(o-n);bs(l-gs)<ds?(t.point(n,r=(r+s)/2>0?ms:-ms),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&l>=gs&&(bs(n-i)<ds&&(n-=i*ds),bs(o-a)<ds&&(o-=a*ds),r=function(t,e,n,r){var i,o,s=Is(t-n);return bs(s)>ds?ws((Is(e)*(o=Ss(r))*Is(n)-Is(r)*(i=Ss(e))*Is(t))/(i*o*s)):(e+r)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=o,r=s),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*ms,r.point(-gs,i),r.point(0,i),r.point(gs,i),r.point(gs,0),r.point(gs,-i),r.point(0,-i),r.point(-gs,-i),r.point(-gs,0),r.point(-gs,i);else if(bs(t[0]-e[0])>ds){var o=t[0]<e[0]?gs:-gs;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])}),[-gs,-ms]);function ya(t){return t}function _a(t){return function(e){var n=new va;for(var r in t)n[r]=t[r];return n.stream=e,n}}function va(){}function xa(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&Ns.hasOwnProperty(t.type)?Ns[t.type](t,e):Ls(t,e)}(n,t.stream(pa));var s=pa.result(),a=Math.min(r/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),l=+e[0][0]+(r-a*(s[1][0]+s[0][0]))/2,u=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([l,u])}va.prototype={constructor:va,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var ba=16,wa=Ss(30*xs);function Ea(t,e){return+e?function(t,e){function n(r,i,o,s,a,l,u,c,h,p,f,d,g,m){var y=u-r,_=c-i,v=y*y+_*_;if(v>4*e&&g--){var x=s+p,b=a+f,w=l+d,E=Cs(x*x+b*b+w*w),S=Ps(w/=E),I=bs(bs(w)-1)<ds||bs(o-h)<ds?(o+h)/2:Es(b,x),C=t(I,S),T=C[0],P=C[1],M=T-r,L=P-i,A=_*M-y*L;(A*A/v>e||bs((y*M+_*L)/v-.5)>.3||s*p+a*f+l*d<wa)&&(n(r,i,o,s,a,l,T,P,I,x/=E,b/=E,w,g,m),m.point(T,P),n(T,P,I,x,b,w,u,c,h,p,f,d,g,m))}}return function(e){var r,i,o,s,a,l,u,c,h,p,f,d,g={point:m,lineStart:y,lineEnd:v,polygonStart:function(){e.polygonStart(),g.lineStart=x},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function m(n,r){n=t(n,r),e.point(n[0],n[1])}function y(){c=NaN,g.point=_,e.lineStart()}function _(r,i){var o=Fs([r,i]),s=t(r,i);n(c,h,u,p,f,d,c=s[0],h=s[1],u=r,p=o[0],f=o[1],d=o[2],ba,e),e.point(c,h)}function v(){g.point=m,e.lineEnd()}function x(){y(),g.point=b,g.lineEnd=w}function b(t,e){_(r=t,e),i=c,o=h,s=p,a=f,l=d,g.point=_}function w(){n(c,h,u,p,f,d,i,o,r,s,a,l,ba,e),g.lineEnd=v,v()}return g}}(t,e):function(t){return _a({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Sa=_a({point:function(t,e){this.stream.point(t*xs,e*xs)}});function Ia(t){return function(t){var e,n,r,i,o,s,a,l,u,c,h=150,p=480,f=250,d=0,g=0,m=0,y=0,_=0,v=null,x=ma,b=null,w=ya,E=.5,S=Ea(T,E);function I(t){return[(t=o(t[0]*xs,t[1]*xs))[0]*h+n,r-t[1]*h]}function C(t){return(t=o.invert((t[0]-n)/h,(r-t[1])/h))&&[t[0]*vs,t[1]*vs]}function T(t,i){return[(t=e(t,i))[0]*h+n,r-t[1]*h]}function P(){o=qs(i=function(t,e,n){return(t%=_s)?e||n?qs(Zs(t),Ys(e,n)):Zs(t):e||n?Ys(e,n):$s}(m,y,_),e);var t=e(d,g);return n=p-t[0]*h,r=f+t[1]*h,M()}function M(){return u=c=null,I}return I.stream=function(t){return u&&c===t?u:u=Sa(x(i,S(w(c=t))))},I.clipAngle=function(t){return arguments.length?(x=+t?function(t,e){var n=Ss(t),r=n>0,i=bs(n)>ds;function o(t,e){return Ss(t)*Ss(e)>n}function s(t,e,r){var i=[1,0,0],o=Us(Fs(t),Fs(e)),s=Bs(o,o),a=o[0],l=s-a*a;if(!l)return!r&&t;var u=n*s/l,c=-n*a/l,h=Us(i,o),p=js(i,u);Vs(p,js(o,c));var f=h,d=Bs(p,f),g=Bs(f,f),m=d*d-g*(Bs(p,p)-1);if(!(m<0)){var y=Cs(m),_=js(f,(-d-y)/g);if(Vs(_,p),_=zs(_),!r)return _;var v,x=t[0],b=e[0],w=t[1],E=e[1];b<x&&(v=x,x=b,b=v);var S=b-x,I=bs(S-gs)<ds;if(!I&&E<w&&(v=w,w=E,E=v),I||S<ds?I?w+E>0^_[1]<(bs(_[0]-x)<ds?w:E):w<=_[1]&&_[1]<=E:S>gs^(x<=_[0]&&_[0]<=b)){var C=js(f,(-d+y)/g);return Vs(C,p),[_,zs(C)]}}}function a(e,n){var i=r?t:gs-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return fa(o,(function(t){var e,n,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,p){var f,d=[h,p],g=o(h,p),m=r?g?0:a(h,p):g?a(h+(h<0?gs:-gs),p):0;if(!e&&(u=l=g)&&t.lineStart(),g!==l&&(!(f=s(e,d))||Ks(e,f)||Ks(d,f))&&(d[0]+=ds,d[1]+=ds,g=o(d[0],d[1])),g!==l)c=0,g?(t.lineStart(),f=s(d,e),t.point(f[0],f[1])):(f=s(e,d),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&r^g){var y;m&n||!(y=s(d,e,!0))||(c=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!g||e&&Ks(e,d)||t.point(d[0],d[1]),e=d,l=g,n=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(u&&l)<<1}}}),(function(n,r,i,o){!function(t,e,n,r,i,o){if(n){var s=Ss(e),a=Is(e),l=r*n;null==i?(i=e+r*_s,o=e-l/2):(i=Ws(s,i),o=Ws(s,o),(r>0?i<o:i>o)&&(i+=r*_s));for(var u,c=i;r>0?c>o:c<o;c-=l)u=zs([s,-a*Ss(c),-a*Is(c)]),t.point(u[0],u[1])}}(o,t,e,i,n,r)}),r?[0,-t]:[-gs,t-gs])}(v=t*xs,6*xs):(v=null,ma),M()):v*vs},I.clipExtent=function(t){return arguments.length?(w=null==t?(b=s=a=l=null,ya):function(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,a,u){var c=0,h=0;if(null==i||(c=s(i,a))!==(h=s(o,a))||l(i,o)<0^a>0)do{u.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+a+4)%4)!==h);else u.point(o[0],o[1])}function s(r,i){return bs(r[0]-t)<ds?i>0?0:3:bs(r[0]-n)<ds?i>0?2:1:bs(r[1]-e)<ds?i>0?1:0:i>0?3:2}function a(t,e){return l(t.x,e.x)}function l(t,e){var n=s(t,1),r=s(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){var l,u,c,h,p,f,d,g,m,y,_,v=s,x=Hs(),b={point:w,lineStart:function(){b.point=E,u&&u.push(c=[]),y=!0,m=!1,d=g=NaN},lineEnd:function(){l&&(E(h,p),f&&m&&x.rejoin(),l.push(x.result())),b.point=w,m&&v.lineEnd()},polygonStart:function(){v=x,l=[],u=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=u.length;n<i;++n)for(var o,s,a=u[n],l=1,c=a.length,h=a[0],p=h[0],f=h[1];l<c;++l)o=p,s=f,p=(h=a[l])[0],f=h[1],s<=r?f>r&&(p-o)*(r-s)>(f-s)*(t-o)&&++e:f<=r&&(p-o)*(r-s)<(f-s)*(t-o)&&--e;return e}(),n=_&&e,i=(l=ra(l)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&Qs(l,a,e,o,s),s.polygonEnd()),v=s,l=u=c=null}};function w(t,e){i(t,e)&&v.point(t,e)}function E(o,s){var a=i(o,s);if(u&&c.push([o,s]),y)h=o,p=s,f=a,y=!1,a&&(v.lineStart(),v.point(o,s));else if(a&&m)v.point(o,s);else{var l=[d=Math.max(oa,Math.min(ia,d)),g=Math.max(oa,Math.min(ia,g))],x=[o=Math.max(oa,Math.min(ia,o)),s=Math.max(oa,Math.min(ia,s))];!function(t,e,n,r,i,o){var s,a=t[0],l=t[1],u=0,c=1,h=e[0]-a,p=e[1]-l;if(s=n-a,h||!(s>0)){if(s/=h,h<0){if(s<u)return;s<c&&(c=s)}else if(h>0){if(s>c)return;s>u&&(u=s)}if(s=i-a,h||!(s<0)){if(s/=h,h<0){if(s>c)return;s>u&&(u=s)}else if(h>0){if(s<u)return;s<c&&(c=s)}if(s=r-l,p||!(s>0)){if(s/=p,p<0){if(s<u)return;s<c&&(c=s)}else if(p>0){if(s>c)return;s>u&&(u=s)}if(s=o-l,p||!(s<0)){if(s/=p,p<0){if(s>c)return;s>u&&(u=s)}else if(p>0){if(s<u)return;s<c&&(c=s)}return u>0&&(t[0]=a+u*h,t[1]=l+u*p),c<1&&(e[0]=a+c*h,e[1]=l+c*p),!0}}}}}(l,x,t,e,n,r)?a&&(v.lineStart(),v.point(o,s),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(x[0],x[1]),a||v.lineEnd(),_=!1)}d=o,g=s,m=a}return b}}(b=+t[0][0],s=+t[0][1],a=+t[1][0],l=+t[1][1]),M()):null==b?null:[[b,s],[a,l]]},I.scale=function(t){return arguments.length?(h=+t,P()):h},I.translate=function(t){return arguments.length?(p=+t[0],f=+t[1],P()):[p,f]},I.center=function(t){return arguments.length?(d=t[0]%360*xs,g=t[1]%360*xs,P()):[d*vs,g*vs]},I.rotate=function(t){return arguments.length?(m=t[0]%360*xs,y=t[1]%360*xs,_=t.length>2?t[2]%360*xs:0,P()):[m*vs,y*vs,_*vs]},I.precision=function(t){return arguments.length?(S=Ea(T,E=t*t),M()):Cs(E)},I.fitExtent=function(t,e){return xa(I,t,e)},I.fitSize=function(t,e){return function(t,e,n){return xa(t,[[0,0],e],n)}(I,t,e)},function(){return e=t.apply(this,arguments),I.invert=e.invert&&C,P()}}((function(){return t}))()}function Ca(t){return function(e,n){var r=Ss(e),i=Ss(n),o=t(r*i);return[o*i*Is(e),o*Is(n)]}}function Ta(t){return function(e,n){var r=Cs(e*e+n*n),i=t(r),o=Is(i),s=Ss(i);return[Es(e*o,r*s),Ps(r&&n*o/r)]}}Ca((function(t){return Cs(2/(1+t))})).invert=Ta((function(t){return 2*Ps(t/2)}));var Pa=Ca((function(t){return(t=Ts(t))&&t/Is(t)}));function Ma(t,e){return[t,e]}function La(t,e,n,r){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return mi(t,(function(t){var i=La(t,e,n,r);i&&s.push(i)})),pi(s)}var a=function(t){var e=function(t,e){void 0===e&&(e={});var n=_i(t);return ci([(n[0]+n[2])/2,(n[1]+n[3])/2],e.properties,e)}(t).geometry.coordinates,n=[-e[0],-e[1]];return Ia(Pa).scale(79.4188).clipAngle(179.999).rotate(n).scale(ai)}(o),l={type:o.type,coordinates:ka(o.coordinates,a)},u=(new us.GeoJSONReader).read(l),c=function(t,e){void 0===e&&(e="kilometers");var n=li[e];if(!n)throw new Error(e+" units is invalid");return t*n}(function(t,e){void 0===e&&(e="kilometers");var n=li[e];if(!n)throw new Error(e+" units is invalid");return t/n}(e,n),"meters"),h=us.BufferOp.bufferOp(u,c,r);if(!Aa((h=(new us.GeoJSONWriter).write(h)).coordinates))return ui({type:h.type,coordinates:Na(h.coordinates,a)},i)}function Aa(t){return Array.isArray(t[0])?Aa(t[0]):isNaN(t[0])}function ka(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return ka(t,e)}))}function Na(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return Na(t,e)}))}Pa.invert=Ta((function(t){return t})),Ma.invert=Ma,Ta(ws),Ta(Ps),Ta((function(t){return 2*ws(t)}));const Da={getBoundingBox:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=wi(_i(t));return e=n?function(t,e,n){var r=(n=n||{}).units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof n)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return mi(t,(function(t){var n=La(t,e,r,i);n&&o.push(n)})),pi(o);case"FeatureCollection":return gi(t,(function(t){var n=La(t,e,r,i);n&&gi(n,(function(t){t&&o.push(t)}))})),pi(o)}return La(t,e,r,i)}(r,n,{units:"miles"}):r,_i(e)}};var Ra=function(t){return(0,i.useEffect)((function(){if(t.map&&t.data){var e=Da.getBoundingBox(t.data,t.buffer);t.map.fitBounds(e)}}),[t.buffer,t.data,t.map]),i.createElement(i.Fragment,null,i.createElement(ii.PulsingMarkerLayer,{id:"current",data:t.data}),i.createElement(ii.MixedGeoJSONLayer,{id:"current",data:t.data,fillStyle:t.fillStyle,strokeStyle:t.strokeStyle,pointStyle:t.pointStyle}))};Ra.defaultProps={buffer:2,fillStyle:{type:"fill",paint:{"fill-color":"#ff623b","fill-opacity":.2}},pointStyle:{type:"circle",paint:{"circle-radius":["interpolate",["linear"],["number",["get","point_count"],1],0,4,10,14],"circle-stroke-width":1,"circle-color":["case",["boolean",["feature-state","hover"],!1],"#3b62ff","#ff623b"],"circle-stroke-color":"#8d260c"}},strokeStyle:{type:"line",paint:{"line-color":"#ff623b","line-opacity":.6}}};const Oa=Ra;function za(t){return za="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},za(t)}function Fa(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ba(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,s,a=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ua(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ua(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ua(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}r().constants.classes.CONTROL_BASE="maplibregl-ctrl",r().constants.classes.CONTROL_PREFIX="maplibregl-ctrl-",r().constants.classes.CONTROL_GROUP="maplibregl-ctrl-group";var Va=function(t){var e=Ba((0,i.useState)(!1),2),n=e[0],r=e[1],o=(0,i.useRef)(),s=(0,i.useRef)(),a=(0,i.useCallback)((function(){t.onChange(o.current.getAll())}),[t.onChange]),l=(0,i.useMemo)((function(){return function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Fa(Object(n),!0).forEach((function(e){var r,i,o,s;r=t,i=e,o=n[e],s=function(t,e){if("object"!=za(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=za(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(i),(i="symbol"==za(s)?s:String(s))in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fa(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({height:500,width:"100%"},t.style||{})}),[t.style]);return(0,i.useEffect)((function(){if(n&&t.data){var e=Da.getBoundingBox(t.data,t.buffer);if(Cr.every(e,Cr.isFinite)){var r=Ba(e,4),i=[[r[0],r[1]],[r[2],r[3]]];s.current.fitBounds(i,{duration:t.zoomDuration})}"GeometryCollection"===t.data.type?Cr.each(t.data.geometries,(function(t){o.current.add(ui(t))})):o.current.add(t.data)}}),[n,t.data]),i.createElement(B,{attributionControl:!1,onLoad:function(){return r(!0)},mapLib:Xr(),ref:s,style:l,mapStyle:t.mapStyle},i.createElement(U,{ref:o,controls:{line_string:!0,point:!0,polygon:!0,trash:!0},displayControlsDefault:!1,onCreate:a,onUpdate:a,onDelete:a,position:"bottom-left"}),t.children)};Va.defaultProps={buffer:2,zoomDuration:1e3};const ja=Va;var Ga=function(t){return i.createElement(F,{tileSize:t.tileSize,tiles:[t.url],type:"raster"},i.createElement(z,{type:"raster",paint:{"raster-opacity":t.opacity},minzoom:t.minzoom,maxzoom:t.maxzoom}))};Ga.defaultProps={maxzoom:22,minzoom:0,opacity:.7,tileSize:256};const qa=Ga})();var u=l.SW,c=l.lW,h=l.Hh,p=l.K4,f=l.T5,d=l.EW,g=l.bk,m=l.Bk;export{u as DrawControl,c as GeoJsonLayer,h as LayerMenu,p as LocationMarker,f as Map,d as MapControl,g as MapDraw,m as RasterLayer};
1
+ import*as e from"react";import*as t from"react-dom";var r={n:e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},d:(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},n={};r.d(n,{SW:()=>s,lW:()=>S,Hh:()=>D,K4:()=>U,T5:()=>N,EW:()=>M,bk:()=>K,Bk:()=>X});const o=require("@mapbox/mapbox-gl-draw");var a=r.n(o);const i=(u={Children:()=>e.Children,cloneElement:()=>e.cloneElement,default:()=>e.default,forwardRef:()=>e.forwardRef,useCallback:()=>e.useCallback,useEffect:()=>e.useEffect,useImperativeHandle:()=>e.useImperativeHandle,useMemo:()=>e.useMemo,useRef:()=>e.useRef,useState:()=>e.useState},c={},r.d(c,u),c),l=require("react-map-gl");var u,c,f=r.n(l);const s=(0,i.forwardRef)((function(e,t){var r=(0,l.useControl)((function(){return new(a())(e)}),(function(t){var r=t.map;r.on("draw.create",e.onCreate),r.on("draw.update",e.onUpdate),r.on("draw.delete",e.onDelete)}),(function(t){var r=t.map;r.off("draw.create",e.onCreate),r.off("draw.update",e.onUpdate),r.off("draw.delete",e.onDelete)}),{position:e.position});return(0,i.useImperativeHandle)(t,(function(){return r}),[r]),null})),m=require("underscore");var y=r.n(m);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var d="#CC3333",b="#990000",v={"fill-color":d,"fill-opacity":.2},h={"line-color":b,"line-opacity":.6},g={"circle-radius":["interpolate",["linear"],["number",["get","point_count"],1],0,4,10,14],"circle-stroke-width":1,"circle-color":d,"circle-stroke-color":b};const S=function(e){var t,r,n=(t=(0,i.useState)(e.data),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(t,r)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],a=n[1],u=(0,i.useCallback)((function(e,t){return y().defaults(e,t)}),[]),c=(0,i.useMemo)((function(){return u(e.fillStyle,v)}),[u,e.fillStyle]),f=(0,i.useMemo)((function(){return u(e.lineStyle,h)}),[u,e.lineStyle]),s=(0,i.useMemo)((function(){return u(e.pointStyle,g)}),[u,e.pointStyle]);return(0,i.useEffect)((function(){e.url&&fetch(e.url).then((function(e){return e.json()})).then((function(e){return a(e)}))}),[e.url]),i.default.createElement(l.Source,{data:o,type:"geojson"},i.default.createElement(l.Layer,{filter:["!=","$type","Point"],paint:c,type:"fill"}),i.default.createElement(l.Layer,{filter:["!=","$type","Point"],paint:f,type:"line"}),i.default.createElement(l.Layer,{filter:["==","$type","Point"],paint:s,type:"circle"}))},w=require("react-icons/bs"),E=require("react-icons/io5"),O=require("maplibre-gl");var j=r.n(O);const C=(e=>{var t={};return r.d(t,e),t})({createPortal:()=>t.createPortal});function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function P(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_(n.key),n)}}function _(e){var t=function(e,t){if("object"!=A(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=A(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==A(t)?t:String(t)}var x=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._map=null,this._container=void 0,this._redraw=void 0,this._redraw=t}var t,r;return t=e,(r=[{key:"onAdd",value:function(e){return this._map=e,e.on("move",this._redraw),this._container=document.createElement("div"),this._container.className="maplibregl-ctrl-group maplibregl-ctrl",this._redraw(),this._container}},{key:"onRemove",value:function(){this._container.remove(),this._map.off("move",this._redraw),this._map=null}},{key:"getMap",value:function(){return this._map}},{key:"getElement",value:function(){return this._container}}])&&P(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const M=function(e){var t,r,n=(t=(0,i.useState)(0),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(t,r)||function(e,t){if(e){if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1],o=(0,i.useCallback)((function(){return n((function(e){return e+1}))}),[]),a=(0,l.useControl)((function(){return new x(o)}),{position:e.position}),u=a.getMap(),c=i.Children.map(y().compact(i.Children.toArray(e.children)),(function(e){return(0,i.cloneElement)(e,{map:u})}));return(0,i.useEffect)((function(){e.mapRef&&(e.mapRef.current=u)}),[u,e.mapRef]),u&&(0,C.createPortal)(c,a.getElement())};function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(e,t)||R(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,t){if(e){if("string"==typeof e)return L(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L(e,t):void 0}}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var z=function(e){var t=I((0,i.useState)(0),2),r=t[0],n=t[1],o=I((0,i.useState)(),2),a=o[0],l=o[1],u=I((0,i.useState)(!1),2),c=u[0],f=u[1],s=(0,i.useRef)(),m=(0,i.useCallback)((function(t){return e.names&&e.names.length>t&&e.names[t]}),[e.names]),p=(0,i.useCallback)((function(e){return y().includes(a,e)}),[a]),d=(0,i.useMemo)((function(){return i.Children.toArray(e.children)}),[e.children]),b=(0,i.useMemo)((function(){return y().filter(d,(function(e,t){return p(t)}))}),[d,p]),v=(0,i.useCallback)((function(e){var t,r;t=p(e)?y().without(a,e):[].concat(function(e){if(Array.isArray(e))return L(e)}(r=a)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||R(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[e]),l(t)}),[p,a]);return(0,i.useEffect)((function(){l(y().times(d.length,(function(e){return e})))}),[]),(0,i.useEffect)((function(){var e=s.current;if(e&&e._canvas){var t=s.current._canvas.offsetHeight;n(void 0===t?0:t)}}),[s.current]),y().isEmpty(d)?null:i.default.createElement(i.default.Fragment,null,i.default.createElement(M,{mapRef:s,position:e.position},i.default.createElement("button",{className:"mapbox-gl-draw_ctrl-draw-btn layer-button",onClick:function(){return f((function(e){return!e}))},type:"button"},i.default.createElement(w.BsStack,{size:"1.25em"})),c&&i.default.createElement("div",{className:"layer-menu",style:{maxHeight:"calc(".concat(r,"px - ").concat(30,"px)")}},i.default.createElement("div",{className:"menu"},y().map(d,(function(e,t){return i.default.createElement("div",{"aria-selected":p(t),className:"option",role:"option",onClick:function(){return v(t)},onKeyDown:function(){return v(t)},tabIndex:t},i.default.createElement("div",{className:"checkmark-container"},p(t)&&i.default.createElement(E.IoCheckmarkOutline,{size:"1em"})),m(t))}))))),b)};z.defaultProps={position:"top-left"};const D=z,T=require("@peripleo/maplibre"),B=require("@turf/turf"),N={getBoundingBox:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=(0,B.bbox)(e),o=(0,B.bboxPolygon)(n);return t=r?(0,B.buffer)(o,r,{units:"miles"}):o,(0,B.bbox)(t)}};var q=function(e){return(0,i.useEffect)((function(){if(e.map&&e.data){var t=N.getBoundingBox(e.data,e.buffer);e.map.fitBounds(t)}}),[e.buffer,e.data,e.map]),i.default.createElement(i.default.Fragment,null,i.default.createElement(T.PulsingMarkerLayer,{id:"current",data:e.data}),i.default.createElement(T.MixedGeoJSONLayer,{id:"current",data:e.data,fillStyle:e.fillStyle,strokeStyle:e.strokeStyle,pointStyle:e.pointStyle}))};q.defaultProps={buffer:2,fillStyle:{type:"fill",paint:{"fill-color":"#ff623b","fill-opacity":.2}},pointStyle:{type:"circle",paint:{"circle-radius":["interpolate",["linear"],["number",["get","point_count"],1],0,4,10,14],"circle-stroke-width":1,"circle-color":["case",["boolean",["feature-state","hover"],!1],"#3b62ff","#ff623b"],"circle-stroke-color":"#8d260c"}},strokeStyle:{type:"line",paint:{"line-color":"#ff623b","line-opacity":.6}}};const U=q;function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}function $(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return F(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?F(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}a().constants.classes.CONTROL_BASE="maplibregl-ctrl",a().constants.classes.CONTROL_PREFIX="maplibregl-ctrl-",a().constants.classes.CONTROL_GROUP="maplibregl-ctrl-group";var G=function(e){var t=W((0,i.useState)(!1),2),r=t[0],n=t[1],o=(0,i.useRef)(),a=(0,i.useRef)(),l=(0,i.useCallback)((function(){e.onChange(o.current.getAll())}),[e.onChange]),u=(0,i.useMemo)((function(){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$(Object(r),!0).forEach((function(t){var n,o,a,i;n=e,o=t,a=r[t],i=function(e,t){if("object"!=H(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o),(o="symbol"==H(i)?i:String(i))in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({height:500,width:"100%"},e.style||{})}),[e.style]);return(0,i.useEffect)((function(){if(r&&e.data){var t=N.getBoundingBox(e.data,e.buffer);if(y().every(t,y().isFinite)){var n=W(t,4),i=[[n[0],n[1]],[n[2],n[3]]];a.current.fitBounds(i,{duration:e.zoomDuration})}"GeometryCollection"===e.data.type?y().each(e.data.geometries,(function(e){o.current.add((0,B.feature)(e))})):o.current.add(e.data)}}),[r,e.data]),i.default.createElement(f(),{attributionControl:!1,onLoad:function(){return n(!0)},mapLib:j(),ref:a,style:u,mapStyle:e.mapStyle},i.default.createElement(s,{ref:o,controls:{line_string:!0,point:!0,polygon:!0,trash:!0},displayControlsDefault:!1,onCreate:l,onUpdate:l,onDelete:l,position:"bottom-left"}),e.children)};G.defaultProps={buffer:2,zoomDuration:1e3};const K=G;var J=function(e){return i.default.createElement(l.Source,{tileSize:e.tileSize,tiles:[e.url],type:"raster"},i.default.createElement(l.Layer,{type:"raster",paint:{"raster-opacity":e.opacity},minzoom:e.minzoom,maxzoom:e.maxzoom}))};J.defaultProps={maxzoom:22,minzoom:0,opacity:.7,tileSize:256};const X=J;var Q=n.SW,V=n.lW,Y=n.Hh,Z=n.K4,ee=n.T5,te=n.EW,re=n.bk,ne=n.Bk;export{Q as DrawControl,V as GeoJsonLayer,Y as LayerMenu,Z as LocationMarker,ee as Map,te as MapControl,re as MapDraw,ne as RasterLayer};
3
2
  //# sourceMappingURL=index.js.map