vue-softpro-ui
Version:
Основні компоненти вью
1 lines • 1.55 MB
JavaScript
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define("VueSoftProUI",[],e):"object"===typeof exports?exports["VueSoftProUI"]=e():t["VueSoftProUI"]=e()})("undefined"!==typeof self?self:this,(function(){return function(){var t={1307:function(t,e,n){!function(e,n){t.exports=n()}(0,(function(){"use strict";var t=function(t,e){var n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},i={on:function(t,e,i){if(void 0===n[t])throw new Error("Invalid event type: "+t);n[t].push({selector:e,fn:i})},render:function(t){e.store.featureChanged(t)}},r=function(t,r){for(var o=n[t],s=o.length;s--;){var a=o[s];if(a.selector(r)){a.fn.call(i,r)||e.store.render(),e.ui.updateMapClasses();break}}};return t.start.call(i),{render:t.render,stop:function(){t.stop&&t.stop()},trash:function(){t.trash&&(t.trash(),e.store.render())},combineFeatures:function(){t.combineFeatures&&t.combineFeatures()},uncombineFeatures:function(){t.uncombineFeatures&&t.uncombineFeatures()},drag:function(t){r("drag",t)},click:function(t){r("click",t)},mousemove:function(t){r("mousemove",t)},mousedown:function(t){r("mousedown",t)},mouseup:function(t){r("mouseup",t)},mouseout:function(t){r("mouseout",t)},keydown:function(t){r("keydown",t)},keyup:function(t){r("keyup",t)},touchstart:function(t){r("touchstart",t)},touchmove:function(t){r("touchmove",t)},touchend:function(t){r("touchend",t)},tap:function(t){r("tap",t)}}};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){if(this instanceof t){var n=[null];n.push.apply(n,arguments);var i=Function.bind.apply(e,n);return new i}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 i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),n}var r={},o={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142},s=o;function a(t){var e=0;if(t&&t.length>0){e+=Math.abs(l(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(l(t[n]))}return e}function l(t){var e,n,i,r,o,a,l=0,c=t.length;if(c>2){for(a=0;a<c;a++)a===c-2?(i=c-2,r=c-1,o=0):a===c-1?(i=c-1,r=0,o=1):(i=a,r=a+1,o=a+2),e=t[i],n=t[r],l+=(u(t[o][0])-u(e[0]))*Math.sin(u(n[1]));l=l*s.RADIUS*s.RADIUS/2}return l}function u(t){return t*Math.PI/180}r.geometry=function t(e){var n,i=0;switch(e.type){case"Polygon":return a(e.coordinates);case"MultiPolygon":for(n=0;n<e.coordinates.length;n++)i+=a(e.coordinates[n]);return i;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(n=0;n<e.geometries.length;n++)i+=t(e.geometries[n]);return i}},r.ring=l;var c={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"},h={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},d={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},f={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"},g={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select",STATIC:"static"},m={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"},v={MOVE:"move",CHANGE_COORDINATES:"change_coordinates"},y={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},b={ACTIVE:"true",INACTIVE:"false"},x=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],w=-85,E=Object.freeze({__proto__:null,classes:c,sources:h,cursors:d,types:f,geojsonTypes:p,modes:g,events:m,updateActions:v,meta:y,activeStates:b,interactions:x,LAT_MIN:-90,LAT_RENDERED_MIN:w,LAT_MAX:90,LAT_RENDERED_MAX:85,LNG_MIN:-270,LNG_MAX:270}),C={Point:0,LineString:1,MultiLineString:1,Polygon:2};function I(t,e){var n=C[t.geometry.type]-C[e.geometry.type];return 0===n&&t.geometry.type===p.POLYGON?t.area-e.area:n}function S(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(I).map((function(t){return delete t.area,t}))}function k(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 N(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)}N.prototype.add=function(t){return this.has(t)||(this._length++,"string"==typeof t?this._items[t]=this._length:this._nums[t]=this._length),this},N.prototype.delete=function(t){return!1===this.has(t)||(this._length--,delete this._items[t],delete this._nums[t]),this},N.prototype.has=function(t){return("string"==typeof t||"number"==typeof t)&&(void 0!==this._items[t]||void 0!==this._nums[t])},N.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}))},N.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};var T=[y.FEATURE,y.MIDPOINT,y.VERTEX],M={click:function(t,e,n){return A(t,e,n,n.options.clickBuffer)},touch:function(t,e,n){return A(t,e,n,n.options.touchBuffer)}};function A(t,e,n,i){if(null===n.map)return[];var r=t?k(t,i):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(r,o).filter((function(t){return-1!==T.indexOf(t.properties.meta)})),a=new N,l=[];return s.forEach((function(t){var e=t.properties.id;a.has(e)||(a.add(e),l.push(t))})),S(l)}function O(t,e){var n=M.click(t,null,e),i={mouse:d.NONE};return n[0]&&(i.mouse=n[0].properties.active===b.ACTIVE?d.MOVE:d.POINTER,i.feature=n[0].properties.meta),-1!==e.events.currentModeName().indexOf("draw")&&(i.mouse=d.ADD),e.ui.queueMapClasses(i),e.ui.updateMapClasses(),n[0]}function L(t,e){var n=t.x-e.x,i=t.y-e.y;return Math.sqrt(n*n+i*i)}function R(t,e,n){void 0===n&&(n={});var i=null!=n.fineTolerance?n.fineTolerance:4,r=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<i||s<r&&e.time-t.time<o}function P(t,e,n){void 0===n&&(n={});var i=null!=n.tolerance?n.tolerance:25,r=null!=n.interval?n.interval:250;return t.point=t.point||e.point,t.time=t.time||e.time,L(t.point,e.point)<i&&e.time-t.time<r}var D={exports:{}},F=D.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),i=2;n===1/0;i*=2)n=Math.log(Math.pow(2,t/i))/Math.log(e)*i;var r=n-Math.floor(n),o="";for(i=0;i<Math.floor(n);i++)o=Math.floor(Math.random()*e).toString(e)+o;if(r){var s=Math.pow(e,r);o=Math.floor(Math.random()*s).toString(e)+o}var a=parseInt(o,e);return a!==1/0&&a>=Math.pow(2,t)?F(t,e):o};F.rack=function(t,e,n){var i=function(i){var o=0;do{if(o++>10){if(!n)throw new Error("too many ID collisions, use more bits");t+=n}var s=F(t,e)}while(Object.hasOwnProperty.call(r,s));return r[s]=i,s},r=i.hats={};return i.get=function(t){return i.hats[t]},i.set=function(t,e){return i.hats[t]=e,i},i.bits=t||128,i.base=e||16,i};var _=e(D.exports),B=function(t,e){this.ctx=t,this.properties=e.properties||{},this.coordinates=e.geometry.coordinates,this.id=e.id||_(),this.type=e.geometry.type};B.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},B.prototype.incomingCoords=function(t){this.setCoordinates(t)},B.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},B.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},B.prototype.setProperty=function(t,e){this.properties[t]=e},B.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:p.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},B.prototype.internal=function(t){var e={id:this.id,meta:y.FEATURE,"meta:type":this.type,active:b.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){B.call(this,t,e)};(z.prototype=Object.create(B.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 V=function(t,e){B.call(this,t,e)};(V.prototype=Object.create(B.prototype)).isValid=function(){return this.coordinates.length>1},V.prototype.addCoordinate=function(t,e,n){this.changed();var i=parseInt(t,10);this.coordinates.splice(i,0,[e,n])},V.prototype.getCoordinate=function(t){var e=parseInt(t,10);return JSON.parse(JSON.stringify(this.coordinates[e]))},V.prototype.removeCoordinate=function(t){this.changed(),this.coordinates.splice(parseInt(t,10),1)},V.prototype.updateCoordinate=function(t,e,n){var i=parseInt(t,10);this.coordinates[i]=[e,n],this.changed()};var j=function(t,e){B.call(this,t,e),this.coordinates=this.coordinates.map((function(t){return t.slice(0,-1)}))};(j.prototype=Object.create(B.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((function(t){return t.length>2}))},j.prototype.incomingCoords=function(t){this.coordinates=t.map((function(t){return t.slice(0,-1)})),this.changed()},j.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},j.prototype.addCoordinate=function(t,e,n){this.changed();var i=t.split(".").map((function(t){return parseInt(t,10)}));this.coordinates[i[0]].splice(i[1],0,[e,n])},j.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))},j.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]]))},j.prototype.getCoordinates=function(){return this.coordinates.map((function(t){return t.concat([t[0]])}))},j.prototype.updateCoordinate=function(t,e,n){this.changed();var i=t.split("."),r=parseInt(i[0],10),o=parseInt(i[1],10);void 0===this.coordinates[r]&&(this.coordinates[r]=[]),this.coordinates[r][o]=[e,n]};var U={MultiPoint:z,MultiLineString:V,MultiPolygon:j},q=function(t,e,n,i,r){var o=n.split("."),s=parseInt(o[0],10),a=o[1]?o.slice(1).join("."):null;return t[s][e](a,i,r)},G=function(t,e){if(B.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 H(t){this.map=t.map,this.drawConfig=JSON.parse(JSON.stringify(t.options||{})),this._ctx=t}(G.prototype=Object.create(B.prototype))._coordinatesToFeatures=function(t){var e=this,n=this.model.bind(this);return t.map((function(t){return new n(e.ctx,{id:_(),type:p.FEATURE,properties:{},geometry:{coordinates:t,type:e.type.replace("Multi","")}})}))},G.prototype.isValid=function(){return this.features.every((function(t){return t.isValid()}))},G.prototype.setCoordinates=function(t){this.features=this._coordinatesToFeatures(t),this.changed()},G.prototype.getCoordinate=function(t){return q(this.features,"getCoordinate",t)},G.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((function(t){return t.type===p.POLYGON?t.getCoordinates():t.coordinates}))))},G.prototype.updateCoordinate=function(t,e,n){q(this.features,"updateCoordinate",t,e,n),this.changed()},G.prototype.addCoordinate=function(t,e,n){q(this.features,"addCoordinate",t,e,n),this.changed()},G.prototype.removeCoordinate=function(t){q(this.features,"removeCoordinate",t),this.changed()},G.prototype.getFeatures=function(){return this.features},H.prototype.setSelected=function(t){return this._ctx.store.setSelected(t)},H.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}),{})},H.prototype.getSelected=function(){return this._ctx.store.getSelected()},H.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},H.prototype.isSelected=function(t){return this._ctx.store.isSelected(t)},H.prototype.getFeature=function(t){return this._ctx.store.get(t)},H.prototype.select=function(t){return this._ctx.store.select(t)},H.prototype.deselect=function(t){return this._ctx.store.deselect(t)},H.prototype.deleteFeature=function(t,e){return void 0===e&&(e={}),this._ctx.store.delete(t,e)},H.prototype.addFeature=function(t){return this._ctx.store.add(t)},H.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},H.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},H.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)},H.prototype.changeMode=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._ctx.events.changeMode(t,e,n)},H.prototype.updateUIClasses=function(t){return this._ctx.ui.queueMapClasses(t)},H.prototype.activateUIButton=function(t){return this._ctx.ui.setActiveButton(t)},H.prototype.featuresAt=function(t,e,n){if(void 0===n&&(n="click"),"click"!==n&&"touch"!==n)throw new Error("invalid buffer type");return M[n](t,e,this._ctx)},H.prototype.newFeature=function(t){var e=t.geometry.type;return e===p.POINT?new z(this._ctx,t):e===p.LINE_STRING?new V(this._ctx,t):e===p.POLYGON?new j(this._ctx,t):new G(this._ctx,t)},H.prototype.isInstanceOf=function(t,e){if(t===p.POINT)return e instanceof z;if(t===p.LINE_STRING)return e instanceof V;if(t===p.POLYGON)return e instanceof j;if("MultiFeature"===t)return e instanceof G;throw new Error("Unknown feature class: "+t)},H.prototype.doRender=function(t){return this._ctx.store.featureChanged(t)},H.prototype.onSetup=function(){},H.prototype.onDrag=function(){},H.prototype.onClick=function(){},H.prototype.onMouseMove=function(){},H.prototype.onMouseDown=function(){},H.prototype.onMouseUp=function(){},H.prototype.onMouseOut=function(){},H.prototype.onKeyUp=function(){},H.prototype.onKeyDown=function(){},H.prototype.onTouchStart=function(){},H.prototype.onTouchMove=function(){},H.prototype.onTouchEnd=function(){},H.prototype.onTap=function(){},H.prototype.onStop=function(){},H.prototype.onTrash=function(){},H.prototype.onCombineFeature=function(){},H.prototype.onUncombineFeature=function(){},H.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var X={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},Z=Object.keys(X);function W(t){var e=Object.keys(t);return function(n,i){void 0===i&&(i={});var r={},o=e.reduce((function(e,n){return e[n]=t[n],e}),new H(n));return{start:function(){var e=this;r=o.onSetup(i),Z.forEach((function(n){var i,s=X[n],a=function(){return!1};t[s]&&(a=function(){return!0}),e.on(n,a,(i=s,function(t){return o[i](r,t)}))}))},stop:function(){o.onStop(r)},trash:function(){o.onTrash(r)},combineFeatures:function(){o.onCombineFeatures(r)},uncombineFeatures:function(){o.onUncombineFeatures(r)},render:function(t,e){o.toDisplayFeatures(r,t,e)}}}}function K(t){return[].concat(t).filter((function(t){return void 0!==t}))}function Y(){var t=this;if(!t.ctx.map||void 0===t.ctx.map.getSource(h.HOT))return l();var e=t.ctx.events.currentModeName();t.ctx.ui.queueMapClasses({mode:e});var n=[],i=[];t.isDirty?i=t.getAllIds():(n=t.getChangedIds().filter((function(e){return void 0!==t.get(e)})),i=t.sources.hot.filter((function(e){return e.properties.id&&-1===n.indexOf(e.properties.id)&&void 0!==t.get(e.properties.id)})).map((function(t){return t.properties.id}))),t.sources.hot=[];var r=t.sources.cold.length;t.sources.cold=t.isDirty?[]:t.sources.cold.filter((function(t){var e=t.properties.id||t.properties.parent;return-1===n.indexOf(e)}));var o=r!==t.sources.cold.length||i.length>0;function s(n,i){var r=t.get(n).internal(e);t.ctx.events.currentModeRender(r,(function(e){t.sources[i].push(e)}))}if(n.forEach((function(t){return s(t,"hot")})),i.forEach((function(t){return s(t,"cold")})),o&&t.ctx.map.getSource(h.COLD).setData({type:p.FEATURE_COLLECTION,features:t.sources.cold}),t.ctx.map.getSource(h.HOT).setData({type:p.FEATURE_COLLECTION,features:t.sources.hot}),t._emitSelectionChange&&(t.ctx.map.fire(m.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(m.DELETE,{features:a})}function l(){t.isDirty=!1,t.clearChangedIds()}l(),t.ctx.map.fire(m.RENDER,{})}function J(t){var e,n=this;this._features={},this._featureIds=new N,this._selectedFeatureIds=new N,this._selectedCoordinates=[],this._changedFeatureIds=new N,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=t,this.sources={hot:[],cold:[]},this.render=function(){e||(e=requestAnimationFrame((function(){e=null,Y.call(n)})))},this.isDirty=!1}function Q(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}J.prototype.createRenderBatch=function(){var t=this,e=this.render,n=0;return this.render=function(){n++},function(){t.render=e,n>0&&t.render()}},J.prototype.setDirty=function(){return this.isDirty=!0,this},J.prototype.featureChanged=function(t){return this._changedFeatureIds.add(t),this},J.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},J.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},J.prototype.getAllIds=function(){return this._featureIds.values()},J.prototype.add=function(t){return this.featureChanged(t.id),this._features[t.id]=t,this._featureIds.add(t.id),this},J.prototype.delete=function(t,e){var n=this;return void 0===e&&(e={}),K(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)})),Q(this,e),this},J.prototype.get=function(t){return this._features[t]},J.prototype.getAll=function(){var t=this;return Object.keys(this._features).map((function(e){return t._features[e]}))},J.prototype.select=function(t,e){var n=this;return void 0===e&&(e={}),K(t).forEach((function(t){n._selectedFeatureIds.has(t)||(n._selectedFeatureIds.add(t),n._changedFeatureIds.add(t),e.silent||(n._emitSelectionChange=!0))})),this},J.prototype.deselect=function(t,e){var n=this;return void 0===e&&(e={}),K(t).forEach((function(t){n._selectedFeatureIds.has(t)&&(n._selectedFeatureIds.delete(t),n._changedFeatureIds.add(t),e.silent||(n._emitSelectionChange=!0))})),Q(this,e),this},J.prototype.clearSelected=function(t){return void 0===t&&(t={}),this.deselect(this._selectedFeatureIds.values(),{silent:t.silent}),this},J.prototype.setSelected=function(t,e){var n=this;return void 0===e&&(e={}),t=K(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},J.prototype.setSelectedCoordinates=function(t){return this._selectedCoordinates=t,this._emitSelectionChange=!0,this},J.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},J.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},J.prototype.getSelected=function(){var t=this;return this._selectedFeatureIds.values().map((function(e){return t.get(e)}))},J.prototype.getSelectedCoordinates=function(){var t=this;return this._selectedCoordinates.map((function(e){return{coordinates:t.get(e.feature_id).getCoordinate(e.coord_path)}}))},J.prototype.isSelected=function(t){return this._selectedFeatureIds.has(t)},J.prototype.setFeatureProperty=function(t,e,n){this.get(t).setProperty(e,n),this.featureChanged(t)},J.prototype.storeMapConfig=function(){var t=this;x.forEach((function(e){t.ctx.map[e]&&(t._mapInitialConfig[e]=t.ctx.map[e].isEnabled())}))},J.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()}))},J.prototype.getInitialConfigValue=function(t){return void 0===this._mapInitialConfig[t]||this._mapInitialConfig[t]};var $=function(){for(var t=arguments,e={},n=0;n<arguments.length;n++){var i=t[n];for(var r in i)tt.call(i,r)&&(e[r]=i[r])}return e},tt=Object.prototype.hasOwnProperty,et=e($),nt=["mode","feature","mouse"];function it(e){var n=null,i=null,r={onRemove:function(){return e.map.off("load",r.connect),clearInterval(i),r.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",r.connect),clearInterval(i),r.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=[et({},{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]=W(e.options.modes[n]),t}),{}),i={},r={},o={},s=null,a=null;o.drag=function(t,n){n({point:t.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:d.DRAG}),a.drag(t)):t.originalEvent.stopPropagation()},o.mousedrag=function(t){o.drag(t,(function(t){return!R(i,t)}))},o.touchdrag=function(t){o.drag(t,(function(t){return!P(r,t)}))},o.mousemove=function(t){if(1===(void 0!==t.originalEvent.buttons?t.originalEvent.buttons:t.originalEvent.which))return o.mousedrag(t);var n=O(t,e);t.featureTarget=n,a.mousemove(t)},o.mousedown=function(t){i={time:(new Date).getTime(),point:t.point};var n=O(t,e);t.featureTarget=n,a.mousedown(t)},o.mouseup=function(t){var n=O(t,e);t.featureTarget=n,R(i,{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){r={time:(new Date).getTime(),point:t.point};var n=M.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=M.touch(t,null,e)[0];t.featureTarget=n,P(r,{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(i,r,o){void 0===o&&(o={}),a.stop();var l=n[i];if(void 0===l)throw new Error(i+" is not valid");s=i;var u=l(e,r);a=t(u,e),o.silent||e.map.fire(m.MODE_CHANGE,{mode:i}),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(g.DRAW_POINT):50===t.keyCode&&e.options.controls.line_string?u(g.DRAW_LINE_STRING):51===t.keyCode&&e.options.controls.polygon&&u(g.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,i=e.map,r=e.options,o=e.store;r.styles.some((function(t){return i.getLayer(t.id)}))||(n.addLayers(),o.setDirty(),o.render())}};var c={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===c[e])throw new Error("Invalid action type");c[e]!==t[e]&&(n=!0),c[e]=t[e]})),n&&e.map.fire(m.ACTIONABLE,{actions:c})},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,i={mode:null,feature:null,mouse:null},r={mode:null,feature:null,mouse:null};function o(t){r=et(r,t)}function s(){var e,n;if(t.container){var o=[],s=[];nt.forEach((function(t){r[t]!==i[t]&&(o.push(t+"-"+i[t]),null!==r[t]&&s.push(t+"-"+r[t]))})),o.length>0&&(e=t.container.classList).remove.apply(e,o),s.length>0&&(n=t.container.classList).add.apply(n,s),i=et(i,r)}}function a(t,e){void 0===e&&(e={});var i=document.createElement("button");return i.className=c.CONTROL_BUTTON+" "+e.className,i.setAttribute("title",e.title),e.container.appendChild(i),i.addEventListener("click",(function(i){if(i.preventDefault(),i.stopPropagation(),i.target===n)return l(),void e.onDeactivate();u(t),e.onActivate()}),!0),i}function l(){n&&(n.classList.remove(c.ACTIVE_BUTTON),n=null)}function u(t){l();var i=e[t];i&&i&&"trash"!==t&&(i.classList.add(c.ACTIVE_BUTTON),n=i)}return{setActiveButton:u,queueMapClasses:o,updateMapClasses:s,clearMapClasses:function(){o({mode:null,feature:null,mouse:null}),s()},addButtons:function(){var n=t.options.controls,i=document.createElement("div");return i.className=c.CONTROL_GROUP+" "+c.CONTROL_BASE,n?(n[f.LINE]&&(e[f.LINE]=a(f.LINE,{container:i,className:c.CONTROL_BUTTON_LINE,title:"LineString tool "+(t.options.keybindings?"(l)":""),onActivate:function(){return t.events.changeMode(g.DRAW_LINE_STRING)},onDeactivate:function(){return t.events.trash()}})),n[f.POLYGON]&&(e[f.POLYGON]=a(f.POLYGON,{container:i,className:c.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(t.options.keybindings?"(p)":""),onActivate:function(){return t.events.changeMode(g.DRAW_POLYGON)},onDeactivate:function(){return t.events.trash()}})),n[f.POINT]&&(e[f.POINT]=a(f.POINT,{container:i,className:c.CONTROL_BUTTON_POINT,title:"Marker tool "+(t.options.keybindings?"(m)":""),onActivate:function(){return t.events.changeMode(g.DRAW_POINT)},onDeactivate:function(){return t.events.trash()}})),n.trash&&(e.trash=a("trash",{container:i,className:c.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:function(){t.events.trash()}})),n.combine_features&&(e.combine_features=a("combineFeatures",{container:i,className:c.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:function(){t.events.combineFeatures()}})),n.uncombine_features&&(e.uncombine_features=a("uncombineFeatures",{container:i,className:c.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:function(){t.events.uncombineFeatures()}})),i):i},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 J(e),n=e.ui.addButtons(),e.options.boxSelect&&(e.boxZoomInitial=o.boxZoom.isEnabled(),o.boxZoom.disable(),o.dragPan.disable(),o.dragPan.enable()),o.loaded()?r.connect():(o.on("load",r.connect),i=setInterval((function(){o.loaded()&&r.connect()}),16)),e.events.start(),n},addLayers:function(){e.map.addSource(h.COLD,{data:{type:p.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(h.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(h.COLD)&&e.map.removeSource(h.COLD),e.map.getSource(h.HOT)&&e.map.removeSource(h.HOT)}};return e.setup=r,r}var rt=[{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 ot(t){return function(e){var n=e.featureTarget;return!!n&&!!n.properties&&n.properties.meta===t}}function st(t){return!!t.originalEvent&&!!t.originalEvent.shiftKey&&0===t.originalEvent.button}function at(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.active===b.ACTIVE&&t.featureTarget.properties.meta===y.FEATURE}function lt(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.active===b.INACTIVE&&t.featureTarget.properties.meta===y.FEATURE}function ut(t){return void 0===t.featureTarget}function ct(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.meta===y.FEATURE}function ht(t){var e=t.featureTarget;return!!e&&!!e.properties&&e.properties.meta===y.VERTEX}function dt(t){return!!t.originalEvent&&!0===t.originalEvent.shiftKey}function ft(t){return 27===t.keyCode}function pt(t){return 13===t.keyCode}var gt=Object.freeze({__proto__:null,isOfMetaType:ot,isShiftMousedown:st,isActiveFeature:at,isInactiveFeature:lt,noTarget:ut,isFeature:ct,isVertex:ht,isShiftDown:dt,isEscapeKey:ft,isEnterKey:pt,isTrue:function(){return!0}}),mt=vt;function vt(t,e){this.x=t,this.y=e}vt.prototype={clone:function(){return new vt(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),i=e*this.x-n*this.y,r=n*this.x+e*this.y;return this.x=i,this.y=r,this},_rotateAround:function(t,e){var n=Math.cos(t),i=Math.sin(t),r=e.x+n*(this.x-e.x)-i*(this.y-e.y),o=e.y+i*(this.x-e.x)+n*(this.y-e.y);return this.x=r,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},vt.convert=function(t){return t instanceof vt?t:Array.isArray(t)?new vt(t[0],t[1]):t};var yt=e(mt);function bt(t,e){var n=e.getBoundingClientRect();return new yt(t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0))}function xt(t,e,n,i){return{type:p.FEATURE,properties:{meta:y.VERTEX,parent:t,coord_path:n,active:i?b.ACTIVE:b.INACTIVE},geometry:{type:p.POINT,coordinates:e}}}function wt(t,e,n){var i=e.geometry.coordinates,r=n.geometry.coordinates;if(i[1]>85||i[1]<w||r[1]>85||r[1]<w)return null;var o={lng:(i[0]+r[0])/2,lat:(i[1]+r[1])/2};return{type:p.FEATURE,properties:{meta:y.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 Et(t,e,n){void 0===e&&(e={}),void 0===n&&(n=null);var i,r=t.geometry,o=r.type,s=r.coordinates,a=t.properties&&t.properties.id,l=[];function u(t,n){var i="",r=null;t.forEach((function(t,o){var s=null!=n?n+"."+o:String(o),u=xt(a,t,s,c(s));if(e.midpoints&&r){var h=wt(a,r,u);h&&l.push(h)}r=u;var d=JSON.stringify(t);i!==d&&l.push(u),0===o&&(i=d)}))}function c(t){return!!e.selectedPaths&&-1!==e.selectedPaths.indexOf(t)}return o===p.POINT?l.push(xt(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)&&(i=o.replace(p.MULTI_PREFIX,""),s.forEach((function(n,r){var o={type:p.FEATURE,properties:t.properties,geometry:{type:i,coordinates:n}};l=l.concat(Et(o,e,r))}))),l}var Ct={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)}},It={exports:{}},St=function(t){if(!t||!t.type)return null;var e=kt[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},kt={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"},Nt=e(St),Tt=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]}}}),Mt=St,At=i(Tt),Ot=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)};At instanceof Function||(At=At.default);var Lt={exports:{}},Rt=Lt.exports=function(t){return new Pt(t)};function Pt(t){this.value=t}function Dt(t,e,n){var i=[],r=[],o=!0;return function t(s){var a=n?Ft(s):s,l={},u=!0,c={node:a,node_:s,path:[].concat(i),parent:r[r.length-1],parents:r,key:i.slice(-1)[0],isRoot:0===i.length,level:i.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){zt(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=_t(c.node)),c.isLeaf=0==c.keys.length;for(var t=0;t<r.length;t++)if(r[t].node_===s){c.circular=r[t];break}}else c.isLeaf=!0,c.keys=null;c.notLeaf=!c.isLeaf,c.notRoot=!c.isRoot}h();var d=e.call(c,c.node);return void 0!==d&&c.update&&c.update(d),l.before&&l.before.call(c,c.node),u?("object"!=typeof c.node||null===c.node||c.circular||(r.push(c),h(),Vt(c.keys,(function(e,r){i.push(e),l.pre&&l.pre.call(c,c.node[e],e);var o=t(c.node[e]);n&&jt.call(c.node,e)&&(c.node[e]=o.node),o.isLast=r==c.keys.length-1,o.isFirst=0==r,l.post&&l.post.call(c,o),i.pop()})),r.pop()),l.after&&l.after.call(c,c.node),c):c}(t).node}function Ft(t){if("object"==typeof t&&null!==t){var e;if(zt(t))e=[];else if("[object Date]"===Bt(t))e=new Date(t.getTime?t.getTime():t);else if(function(t){return"[object RegExp]"===Bt(t)}(t))e=new RegExp(t);else if(function(t){return"[object Error]"===Bt(t)}(t))e={message:t.message};else if(function(t){return"[object Boolean]"===Bt(t)}(t))e=new Boolean(t);else if(function(t){return"[object Number]"===Bt(t)}(t))e=new Number(t);else if(function(t){return"[object String]"===Bt(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__||{},i=function(){};i.prototype=n,e=new i}return Vt(_t(t),(function(n){e[n]=t[n]})),e}return t}Pt.prototype.get=function(t){for(var e=this.value,n=0;n<t.length;n++){var i=t[n];if(!e||!jt.call(e,i)){e=void 0;break}e=e[i]}return e},Pt.prototype.has=function(t){for(var e=this.value,n=0;n<t.length;n++){var i=t[n];if(!e||!jt.call(e,i))return!1;e=e[i]}return!0},Pt.prototype.set=function(t,e){for(var n=this.value,i=0;i<t.length-1;i++){var r=t[i];jt.call(n,r)||(n[r]={}),n=n[r]}return n[t[i]]=e,e},Pt.prototype.map=function(t){return Dt(this.value,t,!0)},Pt.prototype.forEach=function(t){return this.value=Dt(this.value,t,!1),this.value},Pt.prototype.reduce=function(t,e){var n=1===arguments.length,i=n?this.value:e;return this.forEach((function(e){this.isRoot&&n||(i=t.call(this,i,e))})),i},Pt.prototype.paths=function(){var t=[];return this.forEach((function(e){t.push(this.path)})),t},Pt.prototype.nodes=function(){var t=[];return this.forEach((function(e){t.push(this.node)})),t},Pt.prototype.clone=function(){var t=[],e=[];return function n(i){for(var r=0;r<t.length;r++)if(t[r]===i)return e[r];if("object"==typeof i&&null!==i){var o=Ft(i);return t.push(i),e.push(o),Vt(_t(i),(function(t){o[t]=n(i[t])})),t.pop(),e.pop(),o}return i}(this.value)};var _t=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function Bt(t){return Object.prototype.toString.call(t)}var zt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},Vt=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;n<t.length;n++)e(t[n],n,t)};Vt(_t(Pt.prototype),(function(t){Rt[t]=function(e){var n=[].slice.call(arguments,1),i=new Pt(e);return i[t].apply(i,n)}}));var jt=Object.hasOwnProperty||function(t,e){return e in t},Ut=Lt.exports,qt=Gt;function Gt(t){if(!(this instanceof Gt))return new Gt(t);this._bbox=t||[1/0,1/0,-1/0,-1/0],this._valid=!!t}Gt.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},Gt.prototype.equals=function(t){var e;return e=t instanceof Gt?t.bbox():t,this._bbox[0]==e[0]&&this._bbox[1]==e[1]&&this._bbox[2]==e[2]&&this._bbox[3]==e[3]},Gt.prototype.center=function(t){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},Gt.prototype.union=function(t){var e;return this._valid=!0,e=t instanceof Gt?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},Gt.prototype.bbox=function(){return this._valid?this._bbox:null},Gt.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},Gt.prototype.intersect=function(t){return this._valid?(e=t instanceof Gt?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},Gt.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)},Gt.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 Ht=function(t){if(!t)return[];var e=At(Mt(t)),n=[];return e.features.forEach((function(t){t.geometry&&(n=n.concat(Ot(t.geometry.coordinates)))})),n},Xt=Ut,Zt=qt,Wt={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},Kt=Object.keys(Wt);function Yt(t){for(var e=Zt(),n=Ht(t),i=0;i<n.length;i++)e.include(n[i]);return e}It.exports=function(t){return Yt(t).bbox()},It.exports.polygon=function(t){return Yt(t).polygon()},It.exports.bboxify=function(t){return Xt(t).map((function(t){t&&Kt.some((function(e){return!!t[e]&&-1!==Wt[e].indexOf(t.type)}))&&(t.bbox=Yt(t).bbox(),this.update(t))}))};var Jt=e(It.exports),Qt=-90;function $t(t,e){var n=Qt,i=90,r=Qt,o=90,s=270,a=-270;t.forEach((function(t){var e=Jt(t),l=e[1],u=e[3],c=e[0],h=e[2];l>n&&(n=l),u<i&&(i=u),u>r&&(r=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),r+l.lat>90&&(l.lat=90-r),i+l.lat<-85&&(l.lat=-85-i),o+l.lat<Qt&&(l.lat=Qt-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 te(t,e){var n=$t(t.map((function(t){return t.toGeoJSON()})),e);t.forEach((function(t){var e,i=t.getCoordinates(),r=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 r(t)}))};t.type===p.POINT?e=r(i):t.type===p.LINE_STRING||t.type===p.MULTI_POINT?e=i.map(r):t.type===p.POLYGON||t.type===p.MULTI_LINE_STRING?e=i.map(o):t.type===p.MULTI_POLYGON&&(e=i.map((function(t){return t.map((function(t){return o(t)}))}))),t.incomingCoords(e)}))}var ee={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(m.UPDATE,{action:v.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)})),i=!1;if(e.length>1){i=!0;var r=e[0].type.replace("Multi","");e.forEach((function(t){t.type.replace("Multi","")!==r&&(i=!1)}))}var o=n.length>0,s=e.length>0;this.setActionableState({combineFeatures:i,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 N).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(){Ct.enable(this)},onMouseMove:function(t,e){return ct(e)&&t.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(t),!0},onMouseOut:function(t){return!t.dragMoving||this.fireUpdate()}};ee.onTap=ee.onClick=function(t,e){return ut(e)?this.clickAnywhere(t,e):ot(y.VERTEX)(e)?this.clickOnVertex(t,e):ct(e)?this.clickOnFeature(t,e):void 0},ee.clickAnywhere=function(t){var e=this,n=this.getSelectedIds();n.length&&(this.clearSelectedFeatures(),n.forEach((function(t){return e.doRender(t)}))),Ct.enable(this),this.stopExtendedInteractions(t)},ee.clickOnVertex=fu