module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "lib/mapboxgl/";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 775);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/interopRequireDefault");

/***/ }),

/***/ 1:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
/* globals __VUE_SSR_CONTEXT__ */

// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.

function normalizeComponent(
  scriptExports,
  render,
  staticRenderFns,
  functionalTemplate,
  injectStyles,
  scopeId,
  moduleIdentifier /* server only */,
  shadowMode /* vue-cli only */
) {
  // Vue.extend constructor export interop
  var options =
    typeof scriptExports === 'function' ? scriptExports.options : scriptExports

  // render functions
  if (render) {
    options.render = render
    options.staticRenderFns = staticRenderFns
    options._compiled = true
  }

  // functional template
  if (functionalTemplate) {
    options.functional = true
  }

  // scopedId
  if (scopeId) {
    options._scopeId = 'data-v-' + scopeId
  }

  var hook
  if (moduleIdentifier) {
    // server build
    hook = function (context) {
      // 2.3 injection
      context =
        context || // cached call
        (this.$vnode && this.$vnode.ssrContext) || // stateful
        (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
      // 2.2 with runInNewContext: true
      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
        context = __VUE_SSR_CONTEXT__
      }
      // inject component styles
      if (injectStyles) {
        injectStyles.call(this, context)
      }
      // register component module identifier for async chunk inferrence
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier)
      }
    }
    // used by ssr in case component is cached and beforeCreate
    // never gets called
    options._ssrRegister = hook
  } else if (injectStyles) {
    hook = shadowMode
      ? function () {
          injectStyles.call(
            this,
            (options.functional ? this.parent : this).$root.$options.shadowRoot
          )
        }
      : injectStyles
  }

  if (hook) {
    if (options.functional) {
      // for template-only hot-reload because in that case the render fn doesn't
      // go through the normalizer
      options._injectStyles = hook
      // register for functional component in vue file
      var originalRender = options.render
      options.render = function renderWithStyleInjection(h, context) {
        hook.call(context)
        return originalRender(h, context)
      }
    } else {
      // inject component registration as beforeCreate hook
      var existing = options.beforeCreate
      options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
    }
  }

  return {
    exports: scriptExports,
    options: options
  }
}


/***/ }),

/***/ 117:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_types/draw-event.js");

/***/ }),

/***/ 16:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_lang/index.js");

/***/ }),

/***/ 17:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_mixin/control.js");

/***/ }),

/***/ 2:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/init.js");

/***/ }),

/***/ 21:
/***/ (function(module, exports) {

module.exports = require("lodash.uniqueid");

/***/ }),

/***/ 22:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_mixin/Card.js");

/***/ }),

/***/ 3:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/inheritsLoose");

/***/ }),

/***/ 328:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_Draw_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(329);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_Draw_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_babel_loader_lib_index_js_node_modules_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_Draw_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_babel_loader_lib_index_js_node_modules_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_Draw_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_babel_loader_lib_index_js_node_modules_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_Draw_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
 /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_node_modules_ts_loader_index_js_ref_0_1_node_modules_vue_loader_lib_index_js_vue_loader_options_Draw_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_0___default.a); 

/***/ }),

/***/ 329:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(3));
var _drawEvent = _interopRequireDefault(__webpack_require__(117));
var _Theme = _interopRequireDefault(__webpack_require__(4));
var _Card = _interopRequireDefault(__webpack_require__(22));
var _mapGetter = _interopRequireDefault(__webpack_require__(7));
var _control = _interopRequireDefault(__webpack_require__(17));
var _DrawViewModel = _interopRequireDefault(__webpack_require__(777));
var _lodash = _interopRequireDefault(__webpack_require__(21));
var _vuePropertyDecorator = __webpack_require__(9);
__webpack_require__(90);
var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
  var c = arguments.length,
    r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
    d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var Draw = /*#__PURE__*/function (_Mixins) {
  (0, _inheritsLoose2.default)(Draw, _Mixins);
  function Draw() {
    var _this;
    _this = _Mixins.apply(this, arguments) || this;
    _this.activeMode = null;
    _this.modes = [{
      icon: 'point',
      value: 'draw_point',
      title: 'Point Tool'
    }, {
      icon: 'line',
      value: 'draw_line_string',
      title: 'LineString Tool'
    }, {
      icon: 'ploygon',
      value: 'draw_polygon',
      title: 'Polygon Tool'
    }, {
      icon: 'delete',
      value: 'trash',
      title: 'Delete'
    }];
    return _this;
  }
  var _proto = Draw.prototype;
  _proto.created = function created() {
    this.componentName = (0, _lodash.default)(this.$options.name);
    this.viewModel = new _DrawViewModel.default(this.componentName, this.defaultLayerStyle);
    this.initEvent();
  };
  _proto.beforeDestroy = function beforeDestroy() {
    this.viewModel.off('draw-create', this.drawCreateFn);
  };
  _proto.initEvent = function initEvent() {
    this.viewModel.on('draw-create', this.drawCreateFn);
  };
  _proto.drawCreateFn = function drawCreateFn(data) {
    this.activeMode = null;
    this.$emit('draw-created', data.popupInfo);
  };
  _proto.updateMode = function updateMode(mode) {
    var _this2 = this;
    setTimeout(function () {
      var mapNotLoaded = _this2.mapNotLoadedTip();
      if (mapNotLoaded) return;
      if (_this2.map && _this2.map.loaded()) {
        _this2.activeMode = mode;
        if (mode === 'trash') {
          _this2.viewModel.trash();
          _this2.activeMode = null;
          _this2.$emit('draw-removed', {});
          return;
        }
        _this2.viewModel.openDraw(mode);
        _drawEvent.default.$emit('draw-reset', {
          componentName: _this2.$options.name
        });
      }
    }, 0);
  };
  _proto.clear = function clear() {
    this.activeMode = null;
    this.viewModel && this.viewModel.clearAllFeatures();
  };
  return Draw;
}((0, _vuePropertyDecorator.Mixins)(_mapGetter.default, _control.default, _Theme.default, _Card.default));
__decorate([(0, _vuePropertyDecorator.Prop)({
  default: 'sm-components-icon-edit'
})], Draw.prototype, "iconClass", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)({
  default: function _default() {
    return this.$t('draw.draw');
  }
})], Draw.prototype, "headerName", void 0);
__decorate([(0, _vuePropertyDecorator.Prop)()], Draw.prototype, "defaultLayerStyle", void 0);
Draw = __decorate([(0, _vuePropertyDecorator.Component)({
  name: 'SmDraw',
  removed: function removed() {
    this.activeMode = null;
    var targetName = this.getTargetName();
    _drawEvent.default.$options.deleteDrawingState(targetName, this.componentName);
  }
})], Draw);
var _default2 = exports.default = Draw;

/***/ }),

/***/ 4:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_mixin/Theme.js");

/***/ }),

/***/ 405:
/***/ (function(module, exports) {

module.exports = require("@turf/length");

/***/ }),

/***/ 406:
/***/ (function(module, exports) {

module.exports = require("@turf/area");

/***/ }),

/***/ 453:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ render; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ staticRenderFns; });

// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/mapboxgl/web-map/control/draw/Draw.vue?vue&type=template&id=4bad988f&scoped=true&
var render = function () {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  return _c(
    "sm-collapse-card",
    {
      directives: [
        {
          name: "show",
          rawName: "v-show",
          value: _vm.isShow,
          expression: "isShow",
        },
      ],
      staticClass: "sm-component-draw",
      attrs: {
        "icon-class": _vm.iconClass,
        "icon-position": _vm.position,
        "header-name": _vm.headerName,
        "auto-rotate": _vm.autoRotate,
        collapsed: _vm.collapsed,
        "split-line": _vm.splitLine,
      },
    },
    [
      _c(
        "div",
        {
          staticClass: "sm-component-draw__panel",
          style: _vm.getTextColorStyle,
        },
        _vm._l(_vm.modes, function (item) {
          return _c(
            "span",
            {
              key: item.icon,
              class: [
                "sm-component-draw__draw-item",
                {
                  "sm-component-draw__draw-active":
                    _vm.activeMode && _vm.activeMode === item.value,
                },
              ],
              style: _vm.collapseCardHeaderBgStyle,
              attrs: { title: item.title },
              on: {
                click: function ($event) {
                  return _vm.updateMode(item.value)
                },
              },
            },
            [_c("i", { class: "sm-components-icon-" + item.icon })]
          )
        }),
        0
      ),
    ]
  )
}
var staticRenderFns = []
render._withStripped = true


// CONCATENATED MODULE: ./src/mapboxgl/web-map/control/draw/Draw.vue?vue&type=template&id=4bad988f&scoped=true&


/***/ }),

/***/ 5:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/static/libs/mapboxgl/mapbox-gl-enhance.js");

/***/ }),

/***/ 7:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/lib/_mixin/map-getter.js");

/***/ }),

/***/ 775:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _Draw = _interopRequireDefault(__webpack_require__(776));
var _init = _interopRequireDefault(__webpack_require__(2));
_Draw.default.install = function (Vue, opts) {
  (0, _init.default)(Vue, opts);
  Vue.component(_Draw.default.options ? _Draw.default.options.name : _Draw.default.name, _Draw.default);
};
var _default = exports.default = _Draw.default;

/***/ }),

/***/ 776:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Draw_vue_vue_type_template_id_4bad988f_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(453);
/* harmony import */ var _Draw_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(328);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _Draw_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_1__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _Draw_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);





/* normalize component */

var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(
  _Draw_vue_vue_type_script_lang_ts___WEBPACK_IMPORTED_MODULE_1__["default"],
  _Draw_vue_vue_type_template_id_4bad988f_scoped_true___WEBPACK_IMPORTED_MODULE_0__[/* render */ "a"],
  _Draw_vue_vue_type_template_id_4bad988f_scoped_true___WEBPACK_IMPORTED_MODULE_0__[/* staticRenderFns */ "b"],
  false,
  null,
  "4bad988f",
  null
  
)

/* harmony default export */ __webpack_exports__["default"] = (component.exports);

/***/ }),

/***/ 777:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(3));
var _length = _interopRequireDefault(__webpack_require__(405));
var _area = _interopRequireDefault(__webpack_require__(406));
var _helpers = __webpack_require__(89);
var _mapboxGlEnhance = _interopRequireDefault(__webpack_require__(5));
var _drawEvent = _interopRequireDefault(__webpack_require__(117));
var _index = __webpack_require__(16);
var DrawViewModel = exports.default = /*#__PURE__*/function (_mapboxgl$Evented) {
  (0, _inheritsLoose2.default)(DrawViewModel, _mapboxgl$Evented);
  function DrawViewModel(componentName, drawInitStyles) {
    var _this;
    _this = _mapboxgl$Evented.call(this) || this;
    _this.componentName = componentName;
    _this.featureIds = [];
    _this.activeFeature = {};
    _this.dashedLayerIds = [];
    _this.layerStyleList = {};
    _this.drawInitStyles = drawInitStyles;
    return _this;
  }
  var _proto = DrawViewModel.prototype;
  _proto.setMap = function setMap(mapInfo) {
    var map = mapInfo.map,
      mapTarget = mapInfo.mapTarget;
    this.map = map;
    this.mapTarget = mapTarget;
    this._addDrawControl();
  };
  _proto._addDrawControl = function _addDrawControl() {
    var _this2 = this;
    this.draw = _drawEvent.default.$options.getDraw({
      mapTarget: this.mapTarget,
      styles: this.drawInitStyles
    });
    _drawEvent.default.$options.setDrawingState(this.mapTarget, this.componentName, false);
    this.map.on('draw.create', this._drawCreate.bind(this));
    this.map.on('draw.selectionchange', this._selectionChange.bind(this));
    this.map.on('mouseover', 'draw-line-static.cold', function (e) {
      var feature = e.features[0];
      var id = feature.properties.id;
      if (_this2.featureIds.includes(id)) {
        _this2.map.setFilter('draw-line-hover.cold', ['all', ['==', '$type', 'LineString'], ['==', 'id', id]]);
        _this2.map.setFilter('draw-line-hover.hot', ['all', ['==', '$type', 'LineString'], ['==', 'id', id]]);
      }
    });
    this.map.on('mouseout', 'draw-line-hover.cold', function () {
      _this2.map.setFilter('draw-line-hover.cold', ['all', ['==', '$type', 'LineString'], ['==', 'id', '']]);
      _this2.map.setFilter('draw-line-hover.hot', ['all', ['==', '$type', 'LineString'], ['==', 'id', '']]);
    });
  };
  _proto._drawCreate = function _drawCreate(e) {
    if (this._isDrawing()) {
      var features = e.features;
      var feature = features[0] || {};
      this.featureIds.push(feature.id);
    }
  };
  _proto._selectionChange = function _selectionChange(e) {
    if (this._isDrawing()) {
      var features = e.features;
      var feature = features[0];
      if (feature) {
        this._getDefaultStyle();
        this.activeFeature = feature;
        this._calcResult(feature);
      }
    }
  };
  _proto._calcResult = function _calcResult(feature) {
    var _feature$geometry = feature.geometry,
      geometry = _feature$geometry === void 0 ? {} : _feature$geometry;
    var coordinates = geometry.coordinates;
    var result;
    var unit;
    var coordinateOfMaxLatitude = [];
    if (geometry.type === 'Point') {
      result = (0, _length.default)(feature, {
        units: 'kilometers'
      });
      coordinateOfMaxLatitude = coordinates;
    } else if (geometry.type === 'LineString') {
      result = (0, _length.default)(feature, {
        units: 'kilometers'
      });
      unit = (0, _index.geti18n)().t('unit.kilometers');
      coordinateOfMaxLatitude = this._calcMaxLatitudeInCoordinate(coordinates);
    } else if (geometry.type === 'Polygon') {
      var area = (0, _area.default)(feature);
      result = (0, _helpers.convertArea)(area, 'meters', 'kilometers');
      unit = (0, _index.geti18n)().t('unit.squarekilometers');
      coordinateOfMaxLatitude = this._calcMaxLatitudeInCoordinate(coordinates[0]);
    }
    var layerStyle = this._getFetureStyle(feature.id);
    this.fire('draw-create', {
      popupInfo: {
        resultInfo: {
          feature: feature,
          layerStyle: layerStyle,
          result: result,
          unit: unit
        },
        trash: this.trash.bind(this),
        map: this.map,
        coordinate: coordinateOfMaxLatitude
      }
    });
  };
  _proto._calcMaxLatitudeInCoordinate = function _calcMaxLatitudeInCoordinate(data) {
    if (data === void 0) {
      data = [];
    }
    var indexOfMax = 0;
    var compareNum = data[indexOfMax] && data[indexOfMax][1];
    for (var i = 0; i < data.length; i++) {
      if (data[i] && data[i][1] > compareNum) {
        compareNum = data[i][1];
        indexOfMax = i;
      }
    }
    return data[indexOfMax];
  };
  _proto._getFetureStyle = function _getFetureStyle(id) {
    var layerStyle;
    for (var key in this.layerStyleList) {
      if (this.layerStyleList[key] && this.layerStyleList[key][id]) {
        layerStyle = Object.assign(this.layerStyleList[key][id], layerStyle);
      }
    }
    return layerStyle;
  };
  _proto.openDraw = function openDraw(mode) {
    _drawEvent.default.$options.setDrawingState(this.mapTarget, this.componentName, true);
    this.draw.changeMode(mode);
  };
  _proto.trash = function trash(id) {
    var _this3 = this;
    if (id) {
      this.draw.delete(id);
      for (var key in this.layerStyleList) {
        if (this.layerStyleList[key] && this.layerStyleList[key][id]) {
          delete this.layerStyleList[key][id];
          break;
        }
      }
      var matchIndex = this.dashedLayerIds.findIndex(function (item) {
        return item === id;
      });
      matchIndex > -1 && this.dashedLayerIds.splice(matchIndex, 1);
      return;
    }
    var selectedIds = this.draw.getSelectedIds();
    selectedIds.forEach(function (item) {
      var matchIndex = _this3.featureIds.findIndex(function (id) {
        return id === item;
      });
      if (matchIndex > -1) {
        _this3.featureIds.splice(matchIndex, 1);
        _this3.draw.delete(item);
      }
    });
  };
  _proto.setLayerStyle = function setLayerStyle(layerStyle) {
    var id = this.activeFeature.id;
    if (!id) return;
    for (var key in layerStyle) {
      var paint = layerStyle[key];
      this.layerStyleList[key] = this.layerStyleList[key] || {};
      this.layerStyleList[key][id] = Object.assign(this.layerStyleList[id] || {}, layerStyle[key]);
      var isDashedLayer = Object.keys(paint).includes('line-dasharray');
      var matchIndex = this.dashedLayerIds.findIndex(function (item) {
        return item === id;
      });
      if (isDashedLayer) {
        matchIndex < 0 && this.dashedLayerIds.push(id);
      } else {
        key === 'LineString' && matchIndex > -1 && this.dashedLayerIds.splice(matchIndex, 1);
      }
      this.setFilter();
      this.setPaintProperty(key, paint, isDashedLayer);
    }
  };
  _proto.setDashFilterData = function setDashFilterData(init) {
    var newFilter = this.dashedLayerIds.reduce(function (filter, layerId) {
      filter.push(layerId);
      return filter;
    }, init);
    return newFilter;
  };
  _proto.setFilter = function setFilter() {
    if (!this.linesStaticFilter) {
      this.linesStaticFilter = this.map.getFilter('draw-line-static.cold');
    }
    var notDashedFilter = this.setDashFilterData(['!in', 'id']);
    var dashedFilter = this.setDashFilterData(['in', 'id']);
    this.map.setFilter('draw-line-dashed.cold', dashedFilter);
    this.map.setFilter('draw-line-dashed.hot', dashedFilter);
    this.map.setFilter('draw-line-static.cold', ['all', this.linesStaticFilter, notDashedFilter]);
    this.map.setFilter('draw-line-static.hot', ['all', this.linesStaticFilter, notDashedFilter]);
  };
  _proto.setPaintProperty = function setPaintProperty(key, paint, isDashedLayer) {
    for (var name in paint) {
      var value = this.setValueOfPaintKey(key, name);
      switch (key) {
        case 'LineString':
          if (name === 'line-color') {
            var vertexValue = value.slice();
            vertexValue[1] = ['get', 'parent'];
            this.map.setPaintProperty('draw-vertex-active.hot', 'circle-color', vertexValue);
            this.map.setPaintProperty('draw-vertex-active.cold', 'circle-color', vertexValue);
            this.map.setPaintProperty('draw-line-hover.cold', name, value);
            this.map.setPaintProperty('draw-line-hover.hot', name, value);
          }
          if (isDashedLayer) {
            this.map.setPaintProperty('draw-line-dashed.cold', name, value);
            this.map.setPaintProperty('draw-line-dashed.hot', name, value);
            continue;
          }
          this.map.setPaintProperty('draw-line-static.cold', name, value);
          this.map.setPaintProperty('draw-line-static.hot', name, value);
          break;
        case 'Polygon':
          this.map.setPaintProperty('draw-polygon-static.cold', name, value);
          this.map.setPaintProperty('draw-polygon-static.hot', name, value);
          break;
        case 'Point':
          this.map.setPaintProperty('draw-point-static.cold', name, value);
          this.map.setPaintProperty('draw-point-static.hot', name, value);
          break;
        default:
          break;
      }
    }
  };
  _proto.setValueOfPaintKey = function setValueOfPaintKey(key, name) {
    var data = [];
    var featureStyle = this.layerStyleList[key];
    for (var id in featureStyle) {
      var info = featureStyle[id];
      data.push(id);
      data.push(info[name]);
    }
    switch (name) {
      case 'circle-color':
      case 'line-color':
      case 'fill-color':
      case 'fill-outline-color':
        return ['match', ['get', 'id']].concat(data, [this.defaultStyle['line-color']]);
      case 'line-dasharray':
        return featureStyle[this.activeFeature.id][name] || this.defaultStyle[name];
      default:
        return ['match', ['get', 'id']].concat(data, [this.defaultStyle[name]]);
    }
  };
  _proto._getDefaultStyle = function _getDefaultStyle() {
    if (!this.defaultStyle) {
      var defaultStyle = {};
      defaultStyle['line-color'] = this.map.getPaintProperty('draw-line-static.cold', 'line-color');
      defaultStyle['line-width'] = this.map.getPaintProperty('draw-line-static.cold', 'line-width');
      defaultStyle['line-dasharray'] = this.map.getPaintProperty('draw-line-static.cold', 'line-dasharray');
      defaultStyle['fill-opacity'] = this.map.getPaintProperty('draw-polygon-static.cold', 'fill-opacity');
      defaultStyle['circle-radius'] = this.map.getPaintProperty('draw-point-static.cold', 'circle-radius');
      this.defaultStyle = defaultStyle;
    }
  };
  _proto.removed = function removed() {
    this.clearAllFeatures();
    this.draw = null;
  };
  _proto.clearAllFeatures = function clearAllFeatures() {
    this.featureIds && this.draw.delete(this.featureIds);
    this.featureIds = [];
    this.activeFeature = {};
    this.dashedLayerIds = [];
    this.layerStyleList = {};
  };
  _proto._isDrawing = function _isDrawing() {
    return this.draw && _drawEvent.default.$options.getDrawingState(this.mapTarget, this.componentName);
  };
  return DrawViewModel;
}(_mapboxGlEnhance.default.Evented);

/***/ }),

/***/ 89:
/***/ (function(module, exports) {

module.exports = require("@turf/helpers");

/***/ }),

/***/ 9:
/***/ (function(module, exports) {

module.exports = require("vue-property-decorator");

/***/ }),

/***/ 90:
/***/ (function(module, exports) {

module.exports = require("@supermap/vue-iclient-mapboxgl/static/libs/mapbox-gl-draw/mapbox-gl-draw.js");

/***/ })

/******/ });