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

/***/ 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
  }
}


/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

/***/ 332:
/***/ (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_vue_loader_lib_index_js_vue_loader_options_Identify_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(333);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_Identify_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_Identify_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_Identify_vue_vue_type_script_lang_js___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_vue_loader_lib_index_js_vue_loader_options_Identify_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
 /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_Identify_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default.a); 

/***/ }),

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

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _Theme = _interopRequireDefault(__webpack_require__(4));
var _mapGetter = _interopRequireDefault(__webpack_require__(7));
var _IdentifyViewModel = _interopRequireDefault(__webpack_require__(783));
var _CircleStyle = _interopRequireDefault(__webpack_require__(33));
var _FillStyle = _interopRequireDefault(__webpack_require__(40));
var _LineStyle = _interopRequireDefault(__webpack_require__(41));
var _util = __webpack_require__(12);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var _default2 = exports.default = {
  name: 'SmIdentify',
  mixins: [_mapGetter.default, _Theme.default],
  props: {
    layers: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    fields: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    clickTolerance: {
      type: Number,
      default: 5
    },
    layerStyle: {
      type: Object,
      default: function _default() {
        return {
          line: new _LineStyle.default({
            'line-width': 3,
            'line-color': '#409eff',
            'line-opacity': 1
          }),
          circle: new _CircleStyle.default({
            'circle-color': '#409eff',
            'circle-opacity': 0.6,
            'circle-radius': 8,
            'circle-stroke-width': 2,
            'circle-stroke-color': '#409eff',
            'circle-stroke-opacity': 1
          }),
          fill: new _FillStyle.default({
            'fill-color': '#409eff',
            'fill-opacity': 0.6,
            'fill-outline-color': '#409eff'
          }),
          stokeLine: new _LineStyle.default({
            'line-width': 3,
            'line-color': '#409eff',
            'line-opacity': 1
          })
        };
      }
    },
    autoResize: {
      type: Boolean,
      default: true
    },
    keyMaxWidth: {
      type: [Number, String],
      default: 110
    },
    valueMaxWidth: {
      type: [Number, String],
      default: 170
    },
    keyWidth: {
      type: [Number, String],
      default: 110
    },
    valueWidth: {
      type: [Number, String],
      default: 170
    }
  },
  data: function data() {
    return {
      isHide: true,
      // 消除style里block
      popupProps: {}
    };
  },
  computed: {
    getWidthStyle: function getWidthStyle() {
      var style = {
        keyWidth: {},
        valueWidth: {}
      };
      if (!this.autoResize) {
        if (this.keyWidth) {
          style.keyWidth.width = this.keyWidth + 'px';
        }
        if (this.valueWidth) {
          style.valueWidth.width = this.valueWidth + 'px';
        }
        return style;
      } else {
        if (this.keyMaxWidth) {
          style.keyWidth.maxWidth = this.keyMaxWidth + 'px';
        }
        if (this.valueMaxWidth) {
          style.valueWidth.maxWidth = this.valueMaxWidth + 'px';
        }
      }
      return style;
    }
  },
  watch: {
    layers: {
      handler: function handler(val, oldVal) {
        this.viewModel && this.viewModel.removed(oldVal);
        this.removeCursorEvent(oldVal);
        this.setViewModel();
      }
    },
    layerStyle: function layerStyle() {
      this.setViewModel();
    }
  },
  loaded: function loaded() {
    var _this = this;
    // 每次地图加载，就要隐藏（md的切换地图）
    this.isHide = true;
    // this.changeCursorPointer = () => {
    //   this.changeCursor('pointer', this.map);
    //   console.log('enter');
    // };
    this.changeCursorGrab = function () {
      return _this.changeCursor('grab', _this.map);
    };
    this.setViewModel();
  },
  removed: function removed() {
    if (this.map) {
      this.map.off('click', this.sourceMapClickFn);
      this.map.off('mousemove', this.changeCursorPointer);
      this.map.off('mouseleave', this.changeCursorGrab);
    }
    // 清除旧的高亮的图层
    this.viewModel && this.viewModel.removed();
  },
  beforeDestroy: function beforeDestroy() {
    this.$options.removed.call(this);
  },
  methods: {
    setViewModel: function setViewModel() {
      if (this.layers) {
        this.viewModel = new _IdentifyViewModel.default(this.map, {
          mapTarget: this.getTargetName(),
          layers: this.layers,
          layerStyle: this.layerStyle
        });
        this.map && this.bindMapClick(this.map);
        this.changeClickedLayersCursor(this.layers);
      }
    },
    // 给图层绑定popup和高亮
    bindMapClick: function bindMapClick(map) {
      map.on('click', this.sourceMapClickFn);
    },
    // 给source中的图层绑定popup
    sourceMapClickFn: function sourceMapClickFn(e) {
      // 如果点击其他的要素，移除之前的高亮
      this.viewModel.removeOverlayer(this.layers);
      // 获取点中图层的features
      var features = this.bindQueryRenderedFeatures(e);
      if (features[0]) {
        var index = this.layers && this.layers.indexOf(features[0].layer.id);
        var fields;
        if (this.fields instanceof Array) {
          // 如果是二维数组
          fields = this.fields[index];
          // 兼容一维数组
          if (typeof fields === 'string') {
            fields = this.fields;
          }
        } else if (this.fields instanceof Object && index === 0) {
          fields = this.fields;
        }
        this.layersMapClickFn(e, fields || [], features[0]);
      }
    },
    // 给layer绑定queryRenderedFeatures
    bindQueryRenderedFeatures: function bindQueryRenderedFeatures(e, layers) {
      if (layers === void 0) {
        layers = this.layers;
      }
      var map = e.target;
      var layersOnMap = layers.filter(function (item) {
        return !!map.getLayer(item);
      });
      var bbox = [[e.point.x - this.clickTolerance, e.point.y - this.clickTolerance], [e.point.x + this.clickTolerance, e.point.y + this.clickTolerance]];
      var features = map.queryRenderedFeatures(bbox, {
        layers: layersOnMap
      });
      return features;
    },
    // 给点击的图层添加popup和高亮
    layersMapClickFn: function layersMapClickFn(e, fields, feature) {
      var map = e.target;
      // 添加popup
      this.addPopup(feature, fields);
      // 高亮过滤(所有字段)
      var filter = ['all'];
      var filterKeys = ['smx', 'smy', 'lon', 'lat', 'longitude', 'latitude', 'x', 'y', 'usestyle', 'featureinfo'];
      feature._vectorTileFeature._keys.forEach(function (key) {
        if (filterKeys.indexOf(key.toLowerCase()) === -1 && feature.properties[key] !== undefined) {
          filter.push(['==', key, feature.properties[key]]);
        }
      });
      // 添加高亮图层
      this.addOverlayToMap(feature.layer, filter);
      // 给图层加上高亮
      if (map.getLayer(feature.layer.id + '-identify-SM-highlighted')) {
        map.setFilter(feature.layer.id + '-identify-SM-highlighted', filter);
      }
    },
    // 过滤数据， 添加popup
    addPopup: function addPopup(feature, fields) {
      var _this2 = this;
      this.popupProps = {};
      if (feature.properties) {
        // 过滤字段
        if (fields.length > 0) {
          fields.forEach(function (field) {
            if (Object.prototype.hasOwnProperty.call(feature.properties, field)) {
              _this2.popupProps[field] = feature.properties[field];
            }
          });
        } else {
          // 默认是读取layer的全部字段
          this.popupProps = feature.properties;
        }
        // 添加popup
        var coordinates = (0, _util.getFeatureCenter)(feature);
        this.$nextTick(function () {
          _this2.isHide = false; // 显示内容
          _this2.viewModel.addPopup(coordinates, _this2.$refs.Popup);
          (0, _util.setPopupArrowStyle)(_this2.tablePopupBgData);
        });
      }
    },
    // 添加高亮图层
    addOverlayToMap: function addOverlayToMap(layer, filter) {
      // 先移除之前的高亮layer
      this.viewModel.addOverlayToMap(layer, filter);
    },
    changeClickedLayersCursor: function changeClickedLayersCursor(layers, map) {
      var _this3 = this;
      if (layers === void 0) {
        layers = [];
      }
      if (map === void 0) {
        map = this.map;
      }
      layers && layers.forEach(function (layer) {
        map.on('mousemove', layer, _this3.changeCursorPointer);
        map.on('mouseleave', layer, _this3.changeCursorGrab);
      });
    },
    changeCursor: function changeCursor(cursorType, map) {
      if (cursorType === void 0) {
        cursorType = 'grab';
      }
      if (map === void 0) {
        map = this.map;
      }
      if (map && map.getCanvas()) {
        map.getCanvas().style.cursor = cursorType;
      }
    },
    changeCursorPointer: function changeCursorPointer() {
      this.changeCursor('pointer', this.map);
    },
    removeCursorEvent: function removeCursorEvent(layers) {
      var _this4 = this;
      if (layers === void 0) {
        layers = this.layers;
      }
      if (!this.map) {
        return;
      }
      var layersOnMap = layers.filter(function (item) {
        return !!_this4.map.getLayer(item);
      });
      this.map.off('click', this.sourceMapClickFn);
      layersOnMap.forEach(function (layer) {
        _this4.map.off('mousemove', layer, _this4.changeCursorPointer);
        _this4.map.off('mouseleave', layer, _this4.changeCursorGrab);
        _this4.changeCursor('grab', _this4.map);
      });
    }
  }
};

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

/***/ 454:
/***/ (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/identify/Identify.vue?vue&type=template&id=fa8e8eee&
var render = function () {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  return _c(
    "div",
    {
      directives: [
        { name: "show", rawName: "v-show", value: false, expression: "false" },
      ],
      ref: "Popup",
      staticClass: "sm-component-identify",
      style: [_vm.tablePopupBgStyle, _vm.getTextColorStyle],
    },
    [
      _c(
        "ul",
        {
          class: [
            _vm.autoResize
              ? "sm-component-identify__auto"
              : "sm-component-identify__custom",
            "sm-component-identify__content",
          ],
        },
        _vm._l(_vm.popupProps, function (value, key, index) {
          return _c("li", { key: index, staticClass: "content" }, [
            _c(
              "div",
              {
                staticClass: "left ellipsis",
                style: _vm.getWidthStyle.keyWidth,
                attrs: { title: key },
              },
              [_vm._v(_vm._s(key))]
            ),
            _c(
              "div",
              {
                staticClass: "right ellipsis",
                style: _vm.getWidthStyle.valueWidth,
                attrs: { title: value },
              },
              [_vm._v(_vm._s(value))]
            ),
          ])
        }),
        0
      ),
    ]
  )
}
var staticRenderFns = []
render._withStripped = true


// CONCATENATED MODULE: ./src/mapboxgl/web-map/control/identify/Identify.vue?vue&type=template&id=fa8e8eee&


/***/ }),

/***/ 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");

/***/ }),

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

"use strict";


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

/***/ }),

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

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Identify_vue_vue_type_template_id_fa8e8eee___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(454);
/* harmony import */ var _Identify_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(332);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _Identify_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _Identify_vue_vue_type_script_lang_js___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"])(
  _Identify_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  _Identify_vue_vue_type_template_id_fa8e8eee___WEBPACK_IMPORTED_MODULE_0__[/* render */ "a"],
  _Identify_vue_vue_type_template_id_fa8e8eee___WEBPACK_IMPORTED_MODULE_0__[/* staticRenderFns */ "b"],
  false,
  null,
  null,
  null
  
)

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

/***/ }),

/***/ 783:
/***/ (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 _mapboxGlEnhance = _interopRequireDefault(__webpack_require__(5));
/**
 * @class IdentifyViewModel
 * @description 点选 viewModel.
 * @param {Object} map - map 对象。
 * @param {Object} [options.layerStyle] - 查询结果图层样式配置。
 * @param {Object} [options.layerStyle.line] - 线图层样式配置。
 * @param {Object} [options.layerStyle.circle] - 点图层样式配置。
 * @param {Object} [options.layerStyle.fill] - 面图层样式配置。
 * @param {Object} [options.layerStyle.stokeLine] - 面图层样式配置。
 * @extends mapboxgl.Evented
 */
var HIGHLIGHT_COLOR = '#01ffff';
var defaultPaintTypes = {
  circle: ['circle-radius', 'circle-stroke-width'],
  line: ['line-width'],
  fill: ['line-width']
};
var IdentifyViewModel = exports.default = /*#__PURE__*/function (_mapboxgl$Evented) {
  (0, _inheritsLoose2.default)(IdentifyViewModel, _mapboxgl$Evented);
  function IdentifyViewModel(map, options) {
    var _this;
    _this = _mapboxgl$Evented.call(this) || this;
    _this.map = map;
    _this.layers = options.layers || [];
    _this.layerStyle = options.layerStyle || {};
    _this.popup = null;
    return _this;
  }

  /**
   * @function IdentifyViewModel.prototype.addPopup
   * @desc 添加弹窗。
   * @param {Array} coordinates - 弹窗坐标。
   * @param {HTMLElement} popupContainer - 弹窗 DOM 对象。
   */
  var _proto = IdentifyViewModel.prototype;
  _proto.addPopup = function addPopup(coordinates, popupContainer) {
    if (popupContainer) {
      popupContainer.style.display = 'block';
      this.popup = new _mapboxGlEnhance.default.Popup({
        maxWidth: 'none',
        className: 'sm-mapboxgl-identify-popup sm-mapboxgl-tabel-popup',
        closeButton: false
      }).setLngLat(coordinates).setDOMContent(popupContainer).addTo(this.map);
    }
    return this.popup;
  }

  /**
   * @function IdentifyViewModel.prototype.addOverlayToMap
   * @desc 添加高亮图层。
   * @param {Object} layer - layer。
   */;
  _proto.addOverlayToMap = function addOverlayToMap(layer, filter) {
    var mbglStyle = {
      circle: {
        'circle-color': HIGHLIGHT_COLOR,
        'circle-opacity': 0.6,
        'circle-stroke-color': HIGHLIGHT_COLOR,
        'circle-stroke-opacity': 1
      },
      line: {
        'line-color': HIGHLIGHT_COLOR,
        'line-opacity': 1
      },
      fill: {
        'fill-color': HIGHLIGHT_COLOR,
        'fill-opacity': 0.6,
        'fill-outline-color': HIGHLIGHT_COLOR
      },
      symbol: {
        layout: {
          'icon-size': 5
        }
      }
    };
    var type = layer.type,
      id = layer.id,
      paint = layer.paint;
    // 如果是面的strokline,处理成面
    if (id.includes('-strokeLine') && type === 'line') {
      type = 'fill';
      paint = {};
    }
    var layerStyle = this._setDefaultPaintWidth(this.map, type, id, defaultPaintTypes[type], this.layerStyle);
    if (type === 'circle' || type === 'line' || type === 'fill') {
      var _layerStyle = layerStyle[type];
      var highlightLayer = Object.assign({}, layer, {
        id: id + '-identify-SM-highlighted',
        type: type,
        paint: _layerStyle && _layerStyle.paint || Object.assign({}, paint, mbglStyle[type]),
        layout: _layerStyle && _layerStyle.layout || {
          visibility: 'visible'
        },
        filter: filter
      });
      this.map.addLayer(highlightLayer);
    }
    if (type === 'fill') {
      var strokeLayerID = id + '-identify-SM-StrokeLine';
      var stokeLineStyle = layerStyle.strokeLine || layerStyle.stokeLine || {};
      var lineStyle = stokeLineStyle && stokeLineStyle.paint || {
        'line-width': 3,
        'line-color': HIGHLIGHT_COLOR,
        'line-opacity': 1
      };
      var _highlightLayer = Object.assign({}, layer, {
        id: strokeLayerID,
        type: 'line',
        paint: lineStyle,
        layout: {
          visibility: 'visible'
        },
        filter: filter
      });
      this.map.addLayer(_highlightLayer);
    }
    // if(type === 'symbol') {
    //   let layout = Object.assign({}, layer.layout, {'icon-size': layer.layout['icon-size'] + 2})
    //   let highlightLayer = Object.assign({}, layer, {
    //     id: layerID + '-highlighted',
    //     layout,
    //     filter
    //   });
    //   this.map.addLayer(highlightLayer);
    // }
  }

  /**
   * @function IdentifyViewModel.prototype.removed
   * @desc 清除popup和高亮图层。
   */;
  _proto.removed = function removed(layers) {
    if (layers === void 0) {
      layers = this.layers;
    }
    // 移除高亮图层
    this.removePopup();
    this.removeOverlayer(layers);
  };
  _proto.removePopup = function removePopup() {
    if (this.popup) {
      this.popup.remove() && (this.popup = null);
    }
  };
  _proto.removeOverlayer = function removeOverlayer(layers) {
    var _this2 = this;
    if (layers === void 0) {
      layers = this.layers;
    }
    layers && layers.forEach(function (layerId) {
      _this2.map && _this2.map.getLayer(layerId + '-identify-SM-highlighted') && _this2.map.removeLayer(layerId + '-identify-SM-highlighted');
      _this2.map && _this2.map.getLayer(layerId + '-identify-SM-StrokeLine') && _this2.map.removeLayer(layerId + '-identify-SM-StrokeLine');
    });
  };
  _proto._setDefaultPaintWidth = function _setDefaultPaintWidth(map, type, layerId, paintTypes, layerStyle) {
    if (!paintTypes) {
      return;
    }
    paintTypes.forEach(function (paintType) {
      var mapPaintProperty;
      if (type !== 'fill') {
        mapPaintProperty = map.getLayer(layerId) && map.getPaintProperty(layerId, paintType);
      } else {
        type = 'stokeLine';
      }
      layerStyle[type].paint[paintType] = layerStyle[type].paint[paintType] || mapPaintProperty;
      if (layerStyle[type].paint[paintType] === void 0 || layerStyle[type].paint[paintType] === '') {
        layerStyle[type].paint[paintType] = paintType === 'circle-stroke-width' || type === 'stokeLine' ? 2 : 8;
      }
    });
    return layerStyle;
  };
  return IdentifyViewModel;
}(_mapboxGlEnhance.default.Evented);

/***/ })

/******/ });