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

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


/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

/***/ 296:
/***/ (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_DataFlowLayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(297);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_DataFlowLayer_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_DataFlowLayer_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_DataFlowLayer_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_DataFlowLayer_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_DataFlowLayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default.a); 

/***/ }),

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

"use strict";


var _interopRequireDefault = __webpack_require__(0);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(__webpack_require__(18));
var _mapGetter = _interopRequireDefault(__webpack_require__(7));
var _layer = _interopRequireDefault(__webpack_require__(20));
var _DataFlowLayerViewModel = _interopRequireDefault(__webpack_require__(719));
var _CircleStyle = _interopRequireDefault(__webpack_require__(33));
var _FillStyle = _interopRequireDefault(__webpack_require__(40));
var _LineStyle = _interopRequireDefault(__webpack_require__(41));
var _Message = _interopRequireDefault(__webpack_require__(26));
/**
 * @module DataFlowLayer
 * @category Components Layer
 * @desc 数据流图层组件。
 * @vue-prop {String} serviceUrl - 数据流服务地址。
 * @vue-prop {String} [registerToken] -  SuperMap iServer 提供的一种基于 Token（令牌）的用户身份验证机制。
 * @vue-prop {GeoJSONObject} [geometry] - 指定几何范围，该范围内的要素才能被订阅。
 * @vue-prop {String} [excludeField] - 排除字段。
 * @vue-prop {Object} [layerStyle] - 图层样式配置。
 * @vue-prop {SuperMap.Components.commontypes.LineStyle} [layerStyle.line] - 线图层样式配置。
 * @vue-prop {SuperMap.Components.commontypes.CircleStyle} [layerStyle.circle] - 点图层样式配置。
 * @vue-prop {SuperMap.Components.commontypes.FillStyle} [layerStyle.fill] - 面图层样式配置。
 */
var _default2 = exports.default = {
  name: 'SmDataFlowLayer',
  mixins: [_mapGetter.default, _layer.default],
  viewModelProps: ['layerStyle'],
  props: {
    serviceUrl: {
      type: String,
      required: true
    },
    registerToken: {
      type: String
    },
    geometry: {
      type: Object
    },
    excludeField: {
      type: Object
    },
    layerStyle: {
      type: Object,
      default: function _default() {
        return {
          line: new _LineStyle.default(),
          circle: new _CircleStyle.default(),
          fill: new _FillStyle.default()
        };
      }
    }
  },
  loaded: function loaded() {},
  created: function created() {
    var options = JSON.parse(JSON.stringify(this.$props));
    delete options.serviceUrl;
    this.viewModel = new _DataFlowLayerViewModel.default(this.serviceUrl, (0, _extends2.default)({}, options));
    this.registerEvents();
  },
  beforeDestroy: function beforeDestroy() {
    this.viewModel.off('subscribefailed', this.subscribefailedFn);
    this.viewModel.off('subscribesucceeded', this.subscribesucceededFn);
    this.viewModel.off('dataupdated', this.dataupdatedFn);
  },
  methods: {
    registerEvents: function registerEvents() {
      this.viewModel.on('subscribefailed', this.subscribefailedFn);
      this.viewModel.on('subscribesucceeded', this.subscribesucceededFn);
      this.viewModel.on('dataupdated', this.dataupdatedFn);
    },
    subscribefailedFn: function subscribefailedFn(e) {
      // @ts-ignore
      _Message.default.error(this.$t('dataFlow.dataSubscriptionFailed'));
      /**
       * @event subscribeFailed
       * @desc 数据订阅失败后触发。
       * @property {Object} e  - 事件对象。
       */
      this.$emit('subscribe-failed', e);
    },
    subscribesucceededFn: function subscribesucceededFn(e) {
      /**
       * @event subscribeSucceeded
       * @desc 数据订阅失败后触发。
       * @property {Object} e  - 事件对象。
       */
      this.$emit('subscribe-succeeded', e);
    },
    dataupdatedFn: function dataupdatedFn(e) {
      /**
       * @event dataUpdated
       * @desc 数据更新成功后触发。
       * @property {GeoJSONObject} data - 更新的数据。
       * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
       */
      this.$emit('data-updated', e);
    }
  },
  render: function render() {}
};

/***/ }),

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

/***/ }),

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

/***/ }),

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

/***/ }),

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

"use strict";


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

/***/ }),

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

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _DataFlowLayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(296);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _DataFlowLayer_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 _DataFlowLayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
var render, staticRenderFns




/* normalize component */

var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(
  _DataFlowLayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"],
  render,
  staticRenderFns,
  false,
  null,
  null,
  null
  
)

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

/***/ }),

/***/ 719:
/***/ (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));
var _lodash = _interopRequireDefault(__webpack_require__(19));
__webpack_require__(15);
/**
 * @class DataFlowLayerViewModel
 * @category ViewModel
 * @classdesc 数据流图层组件功能类。
 * @param {mapboxgl.Map} map - mapboxgl map 对象。
 * @param {String} serviceUrl - 数据流服务地址。
 * @param {Object} [options] - 可选参数。
 * @param {String} [options.layerId] - 图层 ID。
 * @param {Object} [options.layerStyle] - 指定图层样式。
 * @param {GeoJSONObject} [options.geometry] - 指定几何范围，该范围内的要素才能被订阅。
 * @param {String} [options.excludeField] - 排除字段。
 * @param {Object} [options.styleOptions] - style OPtion
 * @fires DataFlowLayerViewModel#subscribesucceeded
 * @fires DataFlowLayerViewModel#subscribefailed
 * @fires DataFlowLayerViewModel#dataUpdated
 */
var DataFlowLayerViewModel = exports.default = /*#__PURE__*/function (_mapboxgl$Evented) {
  (0, _inheritsLoose2.default)(DataFlowLayerViewModel, _mapboxgl$Evented);
  function DataFlowLayerViewModel(serviceUrl, options) {
    var _this;
    _this = _mapboxgl$Evented.call(this) || this;
    _this.options = options || {};
    _this.serviceUrl = serviceUrl;
    _this.sourceID = options.layerId || 'dataFlow' + new Date().getTime();
    _this.layerStyle = options.layerStyle || {};
    return _this;
  }
  var _proto = DataFlowLayerViewModel.prototype;
  _proto.setMap = function setMap(mapInfo) {
    var map = mapInfo.map;
    if (!map) {
      throw new Error('map is requierd');
    }
    this.map = map;
    if (this.options.registerToken) {
      SuperMap.SecurityManager.registerToken(this.serviceUrl, this.options.registerToken);
    }
    this._initializeDataFlow();
  };
  _proto.setLayerStyle = function setLayerStyle(layerStyle) {
    this.layerStyle = layerStyle;
  }

  /**
   * @function DataFlowLayerViewModel.prototype.setExcludeField
   * @description 设置唯一字段。
   * @param {string} excludeField - 唯一字段。
   */;
  _proto.setExcludeField = function setExcludeField(excludeField) {
    this.dataService.setExcludeField(excludeField);
    this.options.excludeField = excludeField;
    return this;
  }

  /**
   * @function DataFlowLayerViewModel.prototype.setGeometry
   * @description 设置集合要素。
   * @param {GeoJSONObject} geometry - 待设置的 GeoJSON 几何要素对象。
   */;
  _proto.setGeometry = function setGeometry(geometry) {
    this.dataService.setGeometry(geometry);
    this.options.geometry = geometry;
    return this;
  };
  _proto._initializeDataFlow = function _initializeDataFlow() {
    var _this2 = this;
    var dataService = new _mapboxGlEnhance.default.supermap.DataFlowService(this.serviceUrl, {
      geometry: this.options.geometry,
      excludeField: this.options.excludeField
    }).initSubscribe();
    dataService.on('subscribeSocketConnected', function (e) {
      /**
       * @event DataFlowLayerViewModel#subscribesucceeded
       * @description 数据订阅成功后触发。
       * @property {Object} e  - 事件对象。
       */
      _this2.fire('subscribesucceeded', e);
    });
    dataService.on('subscribeSocketError', function (e) {
      /**
       * @event DataFlowLayerViewModel#subscribefailed
       * @description 数据订阅失败后触发。
       * @property {Object} e  - 事件对象。
       */
      _this2.fire('subscribefailed', e);
    });
    dataService.on('messageSucceeded', function (msg) {
      _this2._addLayer(msg);
    });
    this.dataService = dataService;
  };
  _proto._addLayer = function _addLayer(msg) {
    if (!msg.featureResult) {
      return;
    }
    var feature = msg.featureResult;
    var type = feature.geometry.type;
    var layerStyle = this.layerStyle;
    if (!this.map.getSource(this.sourceID)) {
      this.map.addSource(this.sourceID, {
        type: 'geojson',
        data: {
          type: 'FeatureCollection',
          features: [feature]
        }
      });
      if (type === 'Point') {
        var pointType = 'circle';
        var pointPaint = {
          'circle-radius': 6,
          'circle-color': 'red'
        };
        if (layerStyle.symbol) {
          pointType = 'symbol';
          pointPaint = {};
        }
        this.map.addLayer({
          id: this.sourceID,
          type: pointType,
          source: this.sourceID,
          paint: layerStyle[pointType] && layerStyle[pointType].paint || pointPaint,
          layout: layerStyle[pointType] && layerStyle[pointType].layout || {}
        });
      } else if (type === 'MultiPolygon' || type === 'Polygon') {
        this.map.addLayer({
          id: this.sourceID,
          type: 'fill',
          paint: layerStyle.fill && layerStyle.fill.paint || {
            'fill-color': 'red',
            'fill-opacity': 1
          },
          layout: layerStyle.fill && layerStyle.fill.layout || {},
          source: this.sourceID
        });
      } else if (type === 'LineString' || type === 'Line' || type === 'MultiLineString') {
        this.map.addLayer({
          id: this.sourceID,
          type: 'line',
          paint: layerStyle.line && layerStyle.line.paint || {
            'line-width': 5,
            'line-color': 'red',
            'line-opacity': 1
          },
          layout: layerStyle.line && layerStyle.line.layout || {},
          source: this.sourceID
        });
      }
    } else {
      // update layer
      var features = (0, _lodash.default)(this.map.getSource(this.sourceID)._data.features);
      var has = false;
      features.forEach(function (item, index) {
        if (item.properties.id === feature.properties.id) {
          has = true;
          features[index] = feature;
        }
      });
      if (!has) {
        features.push(feature);
      }
      this.map.getSource(this.sourceID).setData({
        type: 'FeatureCollection',
        features: features
      });

      /**
       * @event DataFlowLayerViewModel#dataUpdated
       * @description 数据更新成功后触发。
       * @property {GeoJSONObject} data - 更新的数据。
       * @property {mapboxgl.Map} map - MapBoxGL Map 对象。
       */
      this.fire('dataupdated', {
        data: feature,
        map: this.map
      });
    }
  };
  _proto.removed = function removed() {
    var map = this.map,
      sourceID = this.sourceID;
    if (map && sourceID && map.getSource(sourceID)) {
      map.getLayer(sourceID) && map.removeLayer(sourceID);
      map.removeSource(sourceID);
    }
  };
  return DataFlowLayerViewModel;
}(_mapboxGlEnhance.default.Evented);

/***/ })

/******/ });