/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory(require("echarts"));
	else if(typeof define === 'function' && define.amd)
		define(["echarts"], factory);
	else if(typeof exports === 'object')
		exports["EchartsLayer"] = factory(require("echarts"));
	else
		root["EchartsLayer"] = factory(root["echarts"]);
})(self, function(__WEBPACK_EXTERNAL_MODULE_echarts__) {
return /******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./index.js":
/*!******************!*\
  !*** ./index.js ***!
  \******************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

eval("__webpack_require__(/*! ./lib/GLMap.js */ \"./lib/GLMap.js\")\nvar EchartsLayer=__webpack_require__(/*! ./lib/EchartsLayer.js */ \"./lib/EchartsLayer.js\")\nmodule.exports=EchartsLayer;\n\n//# sourceURL=webpack://%5Bname%5D/./index.js?");

/***/ }),

/***/ "./lib/EchartsLayer.js":
/*!*****************************!*\
  !*** ./lib/EchartsLayer.js ***!
  \*****************************/
/***/ ((module) => {

eval("function EchartsLayer(map) {\n  const mapContainer = map.getCanvasContainer();\n  this._container = document.createElement('div');\n  this._container.style.width = map.getCanvas().style.width;\n  this._container.style.height = map.getCanvas().style.height;\n  this._container.setAttribute('id', 'echarts');\n  this._container.setAttribute('class', 'echartMap');\n  this._map = map;\n  mapContainer.appendChild(this._container);\n  this.chart = echarts.init(this._container);\n  echarts.glMap = map;\n  this.resize();\n}\nEchartsLayer.prototype.remove = function() {\n  var _this = this;\n  this._map._listeners.move.forEach(function(element) {\n    if (element.name === 'moveHandler') {\n      _this._map.off('move', element);\n    }\n  });\n  this._map._listeners.move.forEach(function(element) {\n    if (element.name === 'zoomEndHandler') {\n      _this._map.off('zoomend', element);\n    }\n  });\n\n  // this._map.off('move', this._map._listeners.move[1]);\n  // this._map.off('zoomend', this._map._listeners.moveend[1]);\n  this.chart.clear();\n  if(this._container.parentNode)\n  this._container.parentNode.removeChild(this._container);\n  this._map = undefined;\n};\nEchartsLayer.prototype.resize = function() {\n  const me = this;\n  window.onresize = function() {\n    me._container.style.width = me._map.getCanvas().style.width;\n    me._container.style.height = me._map.getCanvas().style.height;\n    me.chart.resize();\n  };\n};\nmodule.exports = EchartsLayer;\n\n\n//# sourceURL=webpack://%5Bname%5D/./lib/EchartsLayer.js?");

/***/ }),

/***/ "./lib/GLMap.js":
/*!**********************!*\
  !*** ./lib/GLMap.js ***!
  \**********************/
/***/ ((module, exports, __webpack_require__) => {

eval("var __WEBPACK_AMD_DEFINE_RESULT__;/**\n * GLMap component extension\n */\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n  (__webpack_require__(/*! echarts */ \"echarts\").registerCoordinateSystem)(\n    'GLMap', __webpack_require__(/*! ./GLMapCoordSys */ \"./lib/GLMapCoordSys.js\")\n  )\n  __webpack_require__(/*! ./GLMapModel */ \"./lib/GLMapModel.js\")\n  __webpack_require__(/*! ./GLMapView */ \"./lib/GLMapView.js\")\n\n  // Action\n  __webpack_require__(/*! echarts */ \"echarts\").registerAction({\n    type: 'GLMapRoam',\n    event: 'GLMapRoam',\n    update: 'updateLayout'\n  }, function (payload, ecModel) {})\n\n  return {\n    version: '1.0.0'\n  }\n}).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n\n\n\n\n//# sourceURL=webpack://%5Bname%5D/./lib/GLMap.js?");

/***/ }),

/***/ "./lib/GLMapCoordSys.js":
/*!******************************!*\
  !*** ./lib/GLMapCoordSys.js ***!
  \******************************/
/***/ ((module, exports, __webpack_require__) => {

eval("var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n    var echarts = __webpack_require__(/*! echarts */ \"echarts\")\n\n    function GLMapCoordSys(GLMap, api) {\n        this._GLMap = GLMap\n        this.dimensions = ['lng', 'lat']\n        this._mapOffset = [0, 0]\n\n        this._api = api\n    }\n\n    GLMapCoordSys.prototype.dimensions = ['lng', 'lat']\n\n    GLMapCoordSys.prototype.setMapOffset = function (mapOffset) {\n        this._mapOffset = mapOffset\n    }\n\n    GLMapCoordSys.prototype.getBMap = function () {\n        return this._GLMap\n    }\n\n    GLMapCoordSys.prototype.fixLat=function(lat) {\n        if(lat>=90){\n            return 89.99999999999999;\n        }\n        if(lat<=-90){\n            return -89.99999999999999;\n        }\n        return  lat;\n    }\n\n    GLMapCoordSys.prototype.dataToPoint = function (data) {\n        data[1]= this.fixLat(data[1]);\n        var px = this._GLMap.project(data)\n\n        var mapOffset = this._mapOffset\n\n        return [px.x - mapOffset[0], px.y - mapOffset[1]]\n    }\n\n    GLMapCoordSys.prototype.pointToData = function (pt) {\n        var mapOffset = this._mapOffset\n        var pt = this._bmap.project(\n            [pt[0] + mapOffset[0],\n                pt[1] + mapOffset[1]]\n        )\n        return [pt.lng, pt.lat]\n    }\n\n    GLMapCoordSys.prototype.getViewRect = function () {\n        var api = this._api\n        return new echarts.graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight())\n    }\n\n    GLMapCoordSys.prototype.getRoamTransform = function () {\n        return echarts.matrix.create()\n    }\n\n    GLMapCoordSys.prototype.prepareCustoms = function (data) {\n        var zrUtil = echarts.util;\n\n        var rect = this.getViewRect();\n        return {\n            coordSys: {\n                // The name exposed to user is always 'cartesian2d' but not 'grid'.\n                type: 'GLMap',\n                x: rect.x,\n                y: rect.y,\n                width: rect.width,\n                height: rect.height\n            },\n            api: {\n                coord: zrUtil.bind(this.dataToPoint, this),\n                size: zrUtil.bind(dataToCoordSize, this)\n            }\n        };\n\n        function dataToCoordSize(dataSize, dataItem) {\n            dataItem = dataItem || [0, 0];\n            return zrUtil.map([0, 1], function (dimIdx) {\n                var val = dataItem[dimIdx];\n                var halfSize = dataSize[dimIdx] / 2;\n                var p1 = [];\n                var p2 = [];\n                p1[dimIdx] = val - halfSize;\n                p2[dimIdx] = val + halfSize;\n                p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];\n                return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);\n            }, this);\n        }\n    }\n\n    // For deciding which dimensions to use when creating list data\n    GLMapCoordSys.dimensions = GLMapCoordSys.prototype.dimensions\n\n    GLMapCoordSys.create = function (ecModel, api) {\n        var coordSys;\n\n        ecModel.eachComponent('GLMap', function (GLMapModel) {\n            var viewportRoot = api.getZr().painter.getViewportRoot()\n            var GLMap = echarts.glMap;\n            coordSys = new GLMapCoordSys(GLMap, api)\n            coordSys.setMapOffset(GLMapModel.__mapOffset || [0, 0])\n            GLMapModel.coordinateSystem = coordSys\n        })\n\n        ecModel.eachSeries(function (seriesModel) {\n            if (seriesModel.get('coordinateSystem') === 'GLMap') {\n                seriesModel.coordinateSystem = coordSys\n            }\n        })\n    }\n\n    return GLMapCoordSys\n}).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n\n\n//# sourceURL=webpack://%5Bname%5D/./lib/GLMapCoordSys.js?");

/***/ }),

/***/ "./lib/GLMapModel.js":
/*!***************************!*\
  !*** ./lib/GLMapModel.js ***!
  \***************************/
/***/ ((module, exports, __webpack_require__) => {

eval("var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\n    return (__webpack_require__(/*! echarts */ \"echarts\").extendComponentModel)({\n        type: 'GLMap',\n\n        getBMap: function () {\n            // __bmap is injected when creating BMapCoordSys\n            return this.__GLMap;\n        },\n\n        defaultOption: {\n            roam: false\n        }\n    });\n}).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n//# sourceURL=webpack://%5Bname%5D/./lib/GLMapModel.js?");

/***/ }),

/***/ "./lib/GLMapView.js":
/*!**************************!*\
  !*** ./lib/GLMapView.js ***!
  \**************************/
/***/ ((module, exports, __webpack_require__) => {

eval("var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n  return (__webpack_require__(/*! echarts */ \"echarts\").extendComponentView)({\n    type: 'GLMap',\n\n    render: function (GLMapModel, ecModel, api) {\n      var rendering = true\n\n      var glMap = echarts.glMap\n\n\n      var viewportRoot = api.getZr().painter.getViewportRoot()\n      var coordSys = GLMapModel.coordinateSystem\n      var moveHandler = function (type, target) {\n        if (rendering) {\n          return\n        }\n        // var offsetEl = viewportRoot.parentNode.parentNode.parentNode\n        var offsetEl = document.getElementsByClassName('mapboxgl-map')[0];\n\n        var mapOffset = [\n          -parseInt(offsetEl.style.left, 10) || 0,\n          -parseInt(offsetEl.style.top, 10) || 0\n        ]\n        viewportRoot.style.left = mapOffset[0] + 'px'\n        viewportRoot.style.top = mapOffset[1] + 'px'\n\n        coordSys.setMapOffset(mapOffset)\n        GLMapModel.__mapOffset = mapOffset\n\n        api.dispatchAction({\n          type: 'GLMapRoam'\n        })\n      }\n\n      function zoomEndHandler () {\n        if (rendering) {\n          return\n        }\n        api.dispatchAction({\n          type: 'GLMapRoam'\n        })\n      }\n\n      glMap.off('move', this._oldMoveHandler)\n      // FIXME\n      // Moveend may be triggered by centerAndZoom method when creating coordSys next time\n      // glMap.removeEventListener('moveend', this._oldMoveHandler)\n      glMap.off('zoomend', this._oldZoomEndHandler)\n      glMap.on('move', moveHandler)\n      // glMap.addEventListener('moveend', moveHandler)\n      glMap.on('zoomend', zoomEndHandler)\n\n      this._oldMoveHandler = moveHandler\n      this._oldZoomEndHandler = zoomEndHandler\n\n      var roam = GLMapModel.get('roam')\n      if (roam && roam !== 'scale') {\n        // todo 允许拖拽\n      }else {\n        // todo 不允许拖拽\n      }\n      if (roam && roam !== 'move') {\n        // todo 允许移动\n      }else {\n        // todo 不允许允许移动\n      }\n\n\n\n      rendering = false\n    }\n  })\n}).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n\n\n//# sourceURL=webpack://%5Bname%5D/./lib/GLMapView.js?");

/***/ }),

/***/ "echarts":
/*!**************************!*\
  !*** external "echarts" ***!
  \**************************/
/***/ ((module) => {

"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE_echarts__;

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module is referenced by other modules so it can't be inlined
/******/ 	var __webpack_exports__ = __webpack_require__("./index.js");
/******/ 	
/******/ 	return __webpack_exports__;
/******/ })()
;
});