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 = 916);
/******/ })
/************************************************************************/
/******/ ({

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

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

/***/ }),

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

module.exports = require("vue");

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.defaultStyles = exports.default = void 0;
var _extends2 = _interopRequireDefault(__webpack_require__(18));
var _vue = _interopRequireDefault(__webpack_require__(13));
var _mapboxGlDraw = _interopRequireDefault(__webpack_require__(90));
var _mapEvent = _interopRequireDefault(__webpack_require__(55));
var _lodash = _interopRequireDefault(__webpack_require__(917));
var _lodash2 = _interopRequireDefault(__webpack_require__(23));
/**
 * drawList 结构为 { [mapTarget1]: [draw1], [mapTarget2]: [draw2] }
 * drawStates 结构如下，每个地图上必须保证只有一个组件的绘画状态为true
 * {
 *  [mapTarget1]: {[component1]: true/false, [component2]: true/false},
 *  [mapTarget2]: {[component1]: true/false, [component2]: true/false}
 * }
 */

var mainColor = '#f75564';
var haloColor = '#fff';
var defaultStyles = exports.defaultStyles = {
  'line-static': {
    'line-color': mainColor,
    'line-width': 3
  },
  'line-hover': {
    'line-color': mainColor,
    'line-width': 33,
    'line-opacity': 0.2
  },
  'line-drawing': {
    'line-color': mainColor,
    'line-dasharray': [0.4, 2],
    'line-width': 3
  },
  'fill-static': {
    'fill-color': mainColor,
    'fill-outline-color': mainColor,
    'fill-opacity': 0.4
  },
  'fill-drawing': {
    'fill-color': mainColor,
    'fill-outline-color': mainColor,
    'fill-opacity': 0.6
  },
  'vertex-static': {
    'circle-radius': 4,
    'circle-color': mainColor
  },
  'vertex-halo-static': {
    'circle-radius': 6,
    'circle-color': haloColor
  },
  'circle-static': {
    'circle-radius': 6,
    'circle-color': mainColor
  },
  'circle-drawing': {
    'circle-radius': 4,
    'circle-color': haloColor
  },
  'circle-halo-drawing': {
    'circle-radius': 6,
    'circle-color': mainColor
  }
};
var _default = exports.default = new _vue.default({
  mapList: {},
  drawList: {},
  drawStates: {},
  _createDraw: function _createDraw(mapTarget, styles) {
    if (styles === void 0) {
      styles = defaultStyles;
    }
    var drawOptions = {
      displayControlsDefault: false,
      touchEnabled: false,
      boxSelect: false,
      modes: (0, _extends2.default)({}, _mapboxGlDraw.default.modes, {
        simple_select: (0, _lodash.default)(_mapboxGlDraw.default.modes.simple_select, {
          dragMove: function dragMove() {},
          clickOnVertex: function clickOnVertex() {},
          clickOnFeature: function clickOnFeature(state, e) {
            var _this = this;
            this.stopExtendedInteractions(state);
            var isShiftClick = e.originalEvent && e.originalEvent.shiftKey;
            var selectedFeatureIds = this.getSelectedIds();
            var featureId = e.featureTarget.properties.id;
            var isFeatureSelected = this.isSelected(featureId);

            // Shift-click on an unselected feature
            if (!isFeatureSelected && !isShiftClick) {
              // Make it the only selected feature
              selectedFeatureIds.forEach(function (id) {
                return _this.doRender(id);
              });
              this.setSelected(featureId);
            }

            // No matter what, re-render the clicked feature
            this.doRender(featureId);
          }
        }),
        direct_select: (0, _lodash.default)(_mapboxGlDraw.default.modes.direct_select, {
          dragFeature: function dragFeature() {}
        })
      }),
      styles: [
      // line stroke
      {
        id: 'draw-line-static',
        type: 'line',
        filter: ['any', ['==', 'active', 'false'], ['all', ['==', 'active', 'true'], ['==', 'mode', 'simple_select']]],
        layout: {
          'line-cap': 'round',
          'line-join': 'round'
        },
        paint: (0, _extends2.default)({}, defaultStyles['line-static'], styles['line-static'])
      }, {
        id: 'draw-line-hover',
        type: 'line',
        filter: ['all', ['==', '$type', 'LineString'], ['==', 'id', '']],
        layout: {
          'line-cap': 'round',
          'line-join': 'round'
        },
        paint: (0, _extends2.default)({}, defaultStyles['line-hover'], styles['line-hover'])
      }, {
        id: 'draw-line-drawing',
        type: 'line',
        filter: ['all', ['==', 'active', 'true'], ['!=', 'mode', 'simple_select']],
        layout: {
          'line-cap': 'round',
          'line-join': 'round'
        },
        paint: (0, _extends2.default)({}, defaultStyles['line-drawing'], styles['line-drawing'])
      }, {
        id: 'draw-line-dashed',
        type: 'line',
        filter: ['all', ['==', 'id', '']],
        layout: {
          'line-cap': 'round',
          'line-join': 'round'
        },
        paint: (0, _extends2.default)({}, defaultStyles['line-drawing'], styles['line-drawing'])
      },
      // polygon fill
      {
        id: 'draw-polygon-active',
        type: 'fill',
        filter: ['all', ['==', '$type', 'Polygon'], ['==', 'active', 'true'], ['!=', 'mode', 'simple_select']],
        paint: (0, _extends2.default)({}, defaultStyles['fill-drawing'], styles['fill-drawing'])
      }, {
        id: 'draw-polygon-static',
        type: 'fill',
        filter: ['all', ['==', '$type', 'Polygon'], ['any', ['==', 'active', 'false'], ['all', ['==', 'active', 'true'], ['==', 'mode', 'simple_select']]]],
        paint: (0, _extends2.default)({}, defaultStyles['fill-static'], styles['fill-static'])
      },
      // vertex point halos
      {
        id: 'draw-vertex-halo-active',
        type: 'circle',
        filter: ['all', ['==', '$type', 'Point'], ['==', 'meta', 'vertex']],
        paint: (0, _extends2.default)({}, defaultStyles['vertex-halo-static'], styles['vertex-halo-static'])
      },
      // vertex points
      {
        id: 'draw-vertex-active',
        type: 'circle',
        filter: ['all', ['==', '$type', 'Point'], ['==', 'meta', 'vertex']],
        paint: (0, _extends2.default)({}, defaultStyles['vertex-static'], styles['vertex-static'])
      },
      // point
      {
        id: 'draw-point-static',
        type: 'circle',
        filter: ['all', ['==', '$type', 'Point'], ['==', 'meta', 'feature'], ['==', 'active', 'false']],
        paint: (0, _extends2.default)({}, defaultStyles['circle-static'], styles['circle-static'])
      },
      // point-active
      {
        id: 'draw-point-halo-static-active',
        type: 'circle',
        filter: ['all', ['==', '$type', 'Point'], ['==', 'meta', 'feature'], ['==', 'active', 'true']],
        paint: (0, _extends2.default)({}, defaultStyles['circle-halo-drawing'], styles['circle-halo-drawing'])
      }, {
        id: 'draw-point-static-active',
        type: 'circle',
        filter: ['all', ['==', '$type', 'Point'], ['==', 'meta', 'feature'], ['==', 'active', 'true']],
        paint: (0, _extends2.default)({}, defaultStyles['circle-drawing'], styles['circle-drawing'])
      }]
    };
    var draw = new _mapboxGlDraw.default(drawOptions);
    this.drawList[mapTarget] = draw;
    return draw;
  },
  getDraw: function getDraw(_ref) {
    var mapTarget = _ref.mapTarget,
      _ref$create = _ref.create,
      create = _ref$create === void 0 ? true : _ref$create,
      _ref$styles = _ref.styles,
      styles = _ref$styles === void 0 ? defaultStyles : _ref$styles;
    var draw = this.drawList[mapTarget];
    var map = _mapEvent.default.$options.getMap(mapTarget);
    var prevMap = this.mapList[mapTarget];
    var isSame = (0, _lodash2.default)(map, prevMap);
    if (map && !isSame && create) {
      draw = this._createDraw(mapTarget, styles);
      draw.onAdd(map);
      this.mapList[mapTarget] = map;
    }
    return draw;
  },
  getDrawingState: function getDrawingState(mapTarget, componentName) {
    return this.drawStates[mapTarget] && this.drawStates[mapTarget][componentName];
  },
  setDrawingState: function setDrawingState(mapTarget, componentName, drawing) {
    this.drawStates[mapTarget] = this.drawStates[mapTarget] || {};
    if (drawing) {
      for (var key in this.drawStates[mapTarget]) {
        this.drawStates[mapTarget][key] = false;
      }
    }
    this.drawStates[mapTarget][componentName] = drawing;
  },
  deleteDrawingState: function deleteDrawingState(mapTarget, componentName) {
    var mapDrawStates = this.drawStates[mapTarget];
    if (mapDrawStates) {
      if (componentName in mapDrawStates) {
        delete mapDrawStates[componentName];
      }
      // 如果当前map上有关draw的组件都销毁 则把当前map上的draw图层销毁 同时把组件状态也销毁
      var componentsLen = Object.keys(this.drawStates[mapTarget]).length;
      if (!componentsLen) {
        this.deleteDrawOfMap(mapTarget);
      }
    }
  },
  deleteDrawOfMap: function deleteDrawOfMap(mapTarget) {
    var draw = this.getDraw({
      mapTarget: mapTarget,
      create: false
    });
    var map = this.mapList[mapTarget];
    if (draw && map) {
      draw.onRemove(map);
      delete this.drawList[mapTarget];
      delete this.mapList[mapTarget];
      delete this.drawStates[mapTarget];
    }
  }
});

/***/ }),

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

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

/***/ })

/******/ });