!function(t,e){"object"==typeofexports&&"undefined"!=typeofmodule?e(exports,require("echarts")):"function"==typeofdefine&&define.amd?define(["exports","echarts"],e):e((t=t||self).bmap={},t.echarts)}(this,function(t,e){"use strict";functiond(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=newBMap.MercatorProjection}functiono(i,a){returna=a||[0,0],e.util.map([0,1],function(t){vare=a[t],o=i[t]/2,n=[],r=[];returnn[t]=e-o,r[t]=e+o,n[1-t]=r[1-t]=a[1-t],Math.abs(this.dataToPoint(n)[t]-this.dataToPoint(r)[t])},this)}vary;d.prototype.dimensions=["lng","lat"],d.prototype.setZoom=function(t){this._zoom=t},d.prototype.setCenter=function(t){this._center=this._projection.lngLatToPoint(newBMap.Point(t[0],t[1]))},d.prototype.setMapOffset=function(t){this._mapOffset=t},d.prototype.getBMap=function(){returnthis._bmap},d.prototype.dataToPoint=function(t){vare=newBMap.Point(t[0],t[1]),o=this._bmap.pointToOverlayPixel(e),n=this._mapOffset;return[o.x-n[0],o.y-n[1]]},d.prototype.pointToData=function(t){vare=this._mapOffset;return[(t=this._bmap.overlayPixelToPoint({x:t[0]+e[0],y:t[1]+e[1]})).lng,t.lat]},d.prototype.getViewRect=function(){vart=this._api;returnnewe.graphic.BoundingRect(0,0,t.getWidth(),t.getHeight())},d.prototype.getRoamTransform=function(){returne.matrix.create()},d.prototype.prepareCustoms=function(){vart=this.getViewRect();return{coordSys:{type:"bmap",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:e.util.bind(this.dataToPoint,this),size:e.util.bind(o,this)}}},d.dimensions=d.prototype.dimensions,d.create=function(t,m){varl,f=m.getDom();t.eachComponent("bmap",function(t){vare,o,n,r=m.getZr().painter,i=r.getViewportRoot();if("undefined"==typeofBMap)thrownewError("BMap api is not loaded");functiona(t){this._root=t}if(y=y||((a.prototype=newBMap.Overlay).initialize=function(t){returnt.getPanes().labelPane.appendChild(this._root),this._root},a.prototype.draw=function(){},a),l)thrownewError("Only one bmap component can exist");t.__bmap||((o=f.querySelector(".ec-extension-bmap"))&&(i.style.left="0px",i.style.top="0px",f.removeChild(o)),(o=document.createElement("div")).style.cssText="width:100%;height:100%",o.classList.add("ec-extension-bmap"),f.appendChild(o),e=t.__bmap=newBMap.Map(o),n=newy(i),e.addOverlay(n),r.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}),e=t.__bmap;varp,s=t.get("center"),c=t.get("zoom");s&&c&&(p=newBMap.Point(s[0],s[1]),e.centerAndZoom(p,c)),(l=newd(e,m)).setMapOffset(t.__mapOffset||[0,0]),l.setZoom(c),l.setCenter(s),t.coordinateSystem=l}),t.eachSeries(function(t){"bmap"===t.get("coordinateSystem")&&(t.coordinateSystem=l)})},e.extendComponentModel({type:"bmap",getBMap:function(){returnthis.__bmap},setCenterAndZoom:function(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged:function(t,e){varo,n,r=this.option;returno=t,n=r.center,!(o&&n&&o[0]===n[0]&&o[1]===n[1]&&e===r.zoom)},defaultOption:{center:[104.114129,37.550339],zoom:5,mapStyle:{},mapStyleV2:{},roam:!1}});vars={"[object Function]":!0,"[object RegExp]":!0,"[object Date]":!0,"[object Error]":!0,"[object CanvasGradient]":!0,"[object CanvasPattern]":!0,"[object Image]":!0,"[object Canvas]":!0},c={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0},m=Object.prototype.toString,n=Array.prototype.slice,r=function(){}.constructor,i=r?r.prototype:null;functionh(t){if(null==t||"object"!=typeoft)returnt;vare,o=t,n=m.call(t);if("[object Array]"===n){if(!l(t)){o=[];for(varr=0,i=t.length;r<i;r++)o[r]=h(t[r])}}elseif(c[n]){if(!l(t)){vara=t.constructor;if(a.from)o=a.from(t);else{o=newa(t.length);for(r=0,i=t.length;r<i;r++)o[r]=h(t[r])}}}elseif(!s[n]&&!l(t)&&("object"!=typeof(e=t)||"number"!=typeofe.nodeType||"object"!=typeofe.ownerDocument))for(varpino={},t)t.hasOwnProperty(p)&&(o[p]=h(t[p]));returno}i&&"function"==typeofi.bind&&i.call.bind(i.bind);vara="__ec_primitive__";functionl(t){returnt[a]}e.extendComponentView({type:"bmap",render:function(r,t,i){functione(t,e){varo,n;a||(o=p.parentNode.parentNode.parentNode,n=[-parseInt(o.style.left,10)||0,-parseInt(o.style.top,10)||0],p.style.left=n[0]+"px",p.style.top=n[1]+"px",s.setMapOffset(n),r.__mapOffset=n,i.dispatchAction({type:"bmapRoam",animation:{duration:0}}))}vara=!0,o=r.getBMap(),p=i.getZr().painter.getViewportRoot(),s=r.coordinateSystem;functionn(){a||i.dispatchAction({type:"bmapRoam",animation:{duration:0}})}o.removeEventListener("moving",this._oldMoveHandler),o.removeEventListener("zoomend",this._oldZoomEndHandler),o.addEventListener("moving",e),o.addEventListener("zoomend",n),this._oldMoveHandler=e,this._oldZoomEndHandler=n;varc=r.get("roam");c&&"scale"!==c?o.enableDragging():o.disableDragging(),c&&"move"!==c?(o.enableScrollWheelZoom(),o.enableDoubleClickZoom(),o.enablePinchToZoom()):(o.disableScrollWheelZoom(),o.disableDoubleClickZoom(),o.disablePinchToZoom());varm=r.__mapStyle,l=r.get("mapStyle")||{},f=JSON.stringify(l);JSON.stringify(m)!==f&&(Object.keys(l).length&&o.setMapStyle(h(l)),r.__mapStyle=JSON.parse(f));vard=r.__mapStyle2,y=r.get("mapStyleV2")||{},u=JSON.stringify(y);JSON.stringify(d)!==u&&(Object.keys(y).length&&o.setMapStyleV2(h(y)),r.__mapStyle2=JSON.parse(u)),a=!1}}),e.registerCoordinateSystem("bmap",d),e.registerAction({type:"bmapRoam",event:"bmapRoam",update:"updateLayout"},function(t,e){e.eachComponent("bmap",function(t){vare=t.getBMap(),o=e.getCenter();t.setCenterAndZoom([o.lng,o.lat],e.getZoom())})});t.version="1.0.0",Object.defineProperty(t,"__esModule",{value:!0})});
\ No newline at end of file
!function(e,t){"object"==typeofexports&&"undefined"!=typeofmodule?t(exports,require("echarts")):"function"==typeofdefine&&define.amd?define(["exports","echarts"],t):t((e=e||self).bmap={},e.echarts)}(this,function(e,d){"use strict";functionl(e,t){this._bmap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t,this._projection=newBMap.MercatorProjection}functiont(a,r){returnr=r||[0,0],d.util.map([0,1],function(e){vart=r[e],o=a[e]/2,n=[],i=[];returnn[e]=t-o,i[e]=t+o,n[1-e]=i[1-e]=r[1-e],Math.abs(this.dataToPoint(n)[e]-this.dataToPoint(i)[e])},this)}varc;functionf(e){for(vartine)if(e.hasOwnProperty(t))return;return1}l.prototype.dimensions=["lng","lat"],l.prototype.setZoom=function(e){this._zoom=e},l.prototype.setCenter=function(e){this._center=this._projection.lngLatToPoint(newBMap.Point(e[0],e[1]))},l.prototype.setMapOffset=function(e){this._mapOffset=e},l.prototype.getBMap=function(){returnthis._bmap},l.prototype.dataToPoint=function(e){vart=newBMap.Point(e[0],e[1]),e=this._bmap.pointToOverlayPixel(t),t=this._mapOffset;return[e.x-t[0],e.y-t[1]]},l.prototype.pointToData=function(e){vart=this._mapOffset;return[(e=this._bmap.overlayPixelToPoint({x:e[0]+t[0],y:e[1]+t[1]})).lng,e.lat]},l.prototype.getViewRect=function(){vare=this._api;returnnewd.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},l.prototype.getRoamTransform=function(){returnd.matrix.create()},l.prototype.prepareCustoms=function(){vare=this.getViewRect();return{coordSys:{type:"bmap",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:d.util.bind(this.dataToPoint,this),size:d.util.bind(t,this)}}},l.dimensions=l.prototype.dimensions,l.create=function(e,p){vars,m=p.getDom();e.eachComponent("bmap",function(e){vart,o=p.getZr().painter,n=o.getViewportRoot();if("undefined"==typeofBMap)thrownewError("BMap api is not loaded");functioni(e){this._root=e}if(c=c||((i.prototype=newBMap.Overlay).initialize=function(e){returne.getPanes().labelPane.appendChild(this._root),this._root},i.prototype.draw=function(){},i),s)thrownewError("Only one bmap component can exist");e.__bmap||((a=m.querySelector(".ec-extension-bmap"))&&(n.style.left="0px",n.style.top="0px",m.removeChild(a)),(a=document.createElement("div")).className="ec-extension-bmap",a.style.cssText="position:absolute;width:100%;height:100%",m.appendChild(a),(r=e.get("mapOptions"))&&delete(r=d.util.clone(r)).mapType,t=e.__bmap=newBMap.Map(a,r),a=newc(n),t.addOverlay(a),o.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}),t=e.__bmap;vara,r=e.get("center"),n=e.get("zoom");r&&n&&(a=t.getCenter(),o=t.getZoom(),e.centerOrZoomChanged([a.lng,a.lat],o)&&(o=newBMap.Point(r[0],r[1]),t.centerAndZoom(o,n))),(s=newl(t,p)).setMapOffset(e.__mapOffset||[0,0]),s.setZoom(n),s.setCenter(r),e.coordinateSystem=s}),e.eachSeries(function(e){"bmap"===e.get("coordinateSystem")&&(e.coordinateSystem=s)})},d.extendComponentModel({type:"bmap",getBMap:function(){returnthis.__bmap},setCenterAndZoom:function(e,t){this.option.center=e,this.option.zoom=t},centerOrZoomChanged:function(e,t){varo,n=this.option;returno=e,e=n.center,!(o&&e&&o[0]===e[0]&&o[1]===e[1]&&t===n.zoom)},defaultOption:{center:[104.114129,37.550339],zoom:5,mapStyle:{},mapStyleV2:{},mapOptions:{},roam:!1}}),d.extendComponentView({type:"bmap",render:function(r,e,p){vars=!0,t=r.getBMap(),m=p.getZr().painter.getViewportRoot(),l=r.coordinateSystem,o=function(e,t){varo,n,i,a;s||(a=m.parentNode.parentNode.parentNode,o=[-parseInt(a.style.left,10)||0,-parseInt(a.style.top,10)||0],n=m.style,i=o[0]+"px",a=o[1]+"px",n.left!==i&&(n.left=i),n.top!==a&&(n.top=a),l.setMapOffset(o),r.__mapOffset=o,p.dispatchAction({type:"bmapRoam",animation:{duration:0}}))};functionn(){s||p.dispatchAction({type:"bmapRoam",animation:{duration:0}})}t.removeEventListener("moving",this._oldMoveHandler),t.removeEventListener("moveend",this._oldMoveHandler),t.removeEventListener("zoomend",this._oldZoomEndHandler),t.addEventListener("moving",o),t.addEventListener("moveend",o),t.addEventListener("zoomend",n),this._oldMoveHandler=o,this._oldZoomEndHandler=n;vari=r.get("roam");i&&"scale"!==i?t.enableDragging():t.disableDragging(),i&&"move"!==i?(t.enableScrollWheelZoom(),t.enableDoubleClickZoom(),t.enablePinchToZoom()):(t.disableScrollWheelZoom(),t.disableDoubleClickZoom(),t.disablePinchToZoom());vara=r.__mapStyle,o=r.get("mapStyle")||{},i=JSON.stringify(o);JSON.stringify(a)!==i&&(f(o)||t.setMapStyle(d.util.clone(o)),r.__mapStyle=JSON.parse(i));a=r.__mapStyle2,o=r.get("mapStyleV2")||{},i=JSON.stringify(o);JSON.stringify(a)!==i&&(f(o)||t.setMapStyleV2(d.util.clone(o)),r.__mapStyle2=JSON.parse(i)),s=!1}}),d.registerCoordinateSystem("bmap",l),d.registerAction({type:"bmapRoam",event:"bmapRoam",update:"updateLayout"},function(e,t){t.eachComponent("bmap",function(e){vart=e.getBMap(),o=t.getCenter();e.setCenterAndZoom([o.lng,o.lat],t.getZoom())})});e.version="1.0.0",Object.defineProperty(e,"__esModule",{value:!0})});