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

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

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

/***/ }),

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

module.exports = require("vue");

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

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

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

/***/ }),

/***/ 870:
/***/ (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 _mapEvent = _interopRequireDefault(__webpack_require__(55));
var _globalEvent = _interopRequireDefault(__webpack_require__(46));
var _Message = _interopRequireDefault(__webpack_require__(26));
var _vue = _interopRequireDefault(__webpack_require__(13));
var _vuePropertyDecorator = __webpack_require__(9);
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;
};
function callHook(vm, hook) {
  var _options$hook;
  for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
    params[_key - 2] = arguments[_key];
  }
  var options = vm.constructor.options;
  options.mixins && options.mixins.forEach(function (mixin) {
    var _mixin$hook;
    mixin[hook] && (_mixin$hook = mixin[hook]).call.apply(_mixin$hook, [vm].concat(params));
  });
  options[hook] && (_options$hook = options[hook]).call.apply(_options$hook, [vm].concat(params));
}
var MapGetter = /*#__PURE__*/function (_Vue) {
  (0, _inheritsLoose2.default)(MapGetter, _Vue);
  function MapGetter() {
    return _Vue.apply(this, arguments) || this;
  }
  var _proto = MapGetter.prototype;
  _proto.mapTargetChanged = function mapTargetChanged(newVal, oldVal) {
    if (newVal && oldVal && newVal !== oldVal) {
      var prevTarget = oldVal || this.firstDefaultTarget;
      var prevMap = _mapEvent.default.$options.getMap(prevTarget);
      if (prevMap) {
        this.removeMap(prevMap, prevTarget);
      }
      if (_mapEvent.default.$options.getMap(newVal)) {
        this.loadMap(newVal);
      }
    }
  };
  _proto.mounted = function mounted() {
    var targetName = this.getTargetName();
    this.firstDefaultTarget = targetName;
    if (_mapEvent.default.$options.getMap(targetName)) {
      this.loadMap(targetName);
    }
    _mapEvent.default.$on('load-map', this.loadMapSucceed);
    _globalEvent.default.$on('delete-map', this.removeMapSucceed);
  };
  _proto.beforeDestroy = function beforeDestroy() {
    this.removeMap();
    _mapEvent.default.$off('load-map', this.loadMapSucceed);
    _globalEvent.default.$off('delete-map', this.removeMapSucceed);
  };
  _proto.getFirstTarget = function getFirstTarget() {
    var targetName;
    var mapList = _mapEvent.default.$options.getAllMaps();
    for (var target in mapList) {
      if (target) {
        targetName = target;
        break;
      }
    }
    return targetName;
  };
  _proto.getTargetName = function getTargetName() {
    var selfParent = this.$parent;
    var parentTarget = selfParent && selfParent.$options.name && ['smwebmap', 'smncpmap'].includes(selfParent.$options.name.toLowerCase()) && selfParent.target;
    return this.mapTarget || parentTarget || this.getFirstTarget();
  };
  _proto.loadMap = function loadMap(targetName) {
    var _this = this;
    if (!this.firstDefaultTarget) {
      this.firstDefaultTarget = targetName;
    }
    this.map = _mapEvent.default.$options.getMap(targetName);
    this.webmap = _mapEvent.default.$options.getWebMap(targetName);
    this.viewModel && typeof this.viewModel.setMap === 'function' && this.viewModel.setMap({
      map: this.map,
      webmap: this.webmap,
      mapTarget: targetName
    });
    callHook(this, 'loaded', this.map, targetName);
    this.$nextTick(function () {
      _this.$emit('loaded');
    });
  };
  _proto.removeMap = function removeMap(map, target) {
    if (map === void 0) {
      map = this.map;
    }
    if (target === void 0) {
      target = this.getTargetName();
    }
    if (map) {
      this.viewModel && this.viewModel.removed && this.viewModel.removed();
      callHook(this, 'removed', map, target);
      this.map = null;
      this.webmap = null;
      this.firstDefaultTarget = null;
    }
  };
  _proto.loadMapSucceed = function loadMapSucceed(map, target) {
    var targetName = this.getTargetName();
    if (target === targetName) {
      this.loadMap(target);
    }
  };
  _proto.removeMapSucceed = function removeMapSucceed(target) {
    var targetName = this.getTargetName();
    if (target === targetName) {
      this.removeMap();
    }
  };
  _proto.mapNotLoadedTip = function mapNotLoadedTip() {
    if (!this.map) {
      _Message.default.destroy();
      _Message.default.warning(this.$t('warning.unassociatedMap'));
      return true;
    }
    return false;
  };
  return MapGetter;
}(_vue.default);
__decorate([(0, _vuePropertyDecorator.Prop)()], MapGetter.prototype, "mapTarget", void 0);
__decorate([(0, _vuePropertyDecorator.Watch)('mapTarget')], MapGetter.prototype, "mapTargetChanged", null);
MapGetter = __decorate([_vuePropertyDecorator.Component], MapGetter);
var _default = exports.default = MapGetter;

/***/ }),

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

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

/***/ })

/******/ });