UNPKG

basb-cli

Version:
2 lines (1 loc) 20.7 kB
import{r as t,f as e,h as o,u as i,i as n}from"./install23.js";import{_ as s,bV as r,dd as a,du as l,J as h,dq as d,I as p,dv as u,aR as f,d as c,e as g,Y as y,D as _,dw as m,da as v,dx as x,N as w,M as T,a9 as C,R as b,dy as S,bT as M,c4 as I,g as D,ct as O,aK as k,cg as z,dc as B,dz as H,h as A,dA as P,bh as Y,dB as R,dC as X,E as L,ap as W,bU as N,aJ as V,dD as j,dE as E,dF as F,b9 as U,aN as Z}from"./index.js";import"./AxisView.js";import"./AxisBuilder.js";import"./labelLayoutHelper.js";var q=function(t){function e(){var o=null!==t&&t.apply(this,arguments)||this;return o.type=e.type,o}return s(e,t),e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e}(r);function Q(t){var e=t.get("confine");return null!=e?!!e:"richText"===t.get("renderMode")}function G(t){if(a.domSupported)for(var e=document.documentElement.style,o=0,i=t.length;o<i;o++)if(t[o]in e)return t[o]}var J=G(["transform","webkitTransform","OTransform","MozTransform","msTransform"]);function K(t,e){if(!t)return e;e=l(e,!0);var o=t.indexOf(e);return(t=-1===o?e:"-"+t.slice(0,o)+"-"+e).toLowerCase()}var $=K(G(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),"transition"),tt=K(J,"transform"),et="position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;"+(a.transform3dSupported?"will-change:transform;":"");function ot(t,e,o){var i=t.toFixed(0)+"px",n=e.toFixed(0)+"px";if(!a.transformSupported)return o?"top:"+n+";left:"+i+";":[["top",n],["left",i]];var s=a.transform3dSupported,r="translate"+(s?"3d":"")+"("+i+","+n+(s?",0":"")+")";return o?"top:0;left:0;"+tt+":"+r+";":[["top",0],["left",0],[J,r]]}function it(t,e,o){var i=[],n=t.get("transitionDuration"),s=t.get("backgroundColor"),r=t.get("shadowBlur"),h=t.get("shadowColor"),d=t.get("shadowOffsetX"),p=t.get("shadowOffsetY"),u=t.getModel("textStyle"),f=m(t,"html"),c=d+"px "+p+"px "+r+"px "+h;return i.push("box-shadow:"+c),e&&n&&i.push(function(t,e){var o="cubic-bezier(0.23,1,0.32,1)",i=" "+t/2+"s "+o,n="opacity"+i+",visibility"+i;return e||(i=" "+t+"s "+o,n+=a.transformSupported?","+tt+i:",left"+i+",top"+i),$+":"+n}(n,o)),s&&i.push("background-color:"+s),g(["width","color","radius"],(function(e){var o="border-"+e,n=l(o),s=t.get(n);null!=s&&i.push(o+":"+s+("color"===e?"":"px"))})),i.push(function(t){var e=[],o=t.get("fontSize"),i=t.getTextColor();i&&e.push("color:"+i),e.push("font:"+t.getFont()),o&&e.push("line-height:"+Math.round(3*o/2)+"px");var n=t.get("textShadowColor"),s=t.get("textShadowBlur")||0,r=t.get("textShadowOffsetX")||0,a=t.get("textShadowOffsetY")||0;return n&&s&&e.push("text-shadow:"+r+"px "+a+"px "+s+"px "+n),g(["decoration","align"],(function(o){var i=t.get(o);i&&e.push("text-"+o+":"+i)})),e.join(";")}(u)),null!=f&&i.push("padding:"+v(f).join("px ")+"px"),i.join(";")+";"}function nt(t,e,o,i,n){var s=e&&e.painter;if(o){var r=s&&s.getViewportRoot();r&&x(t,r,o,i,n)}else{t[0]=i,t[1]=n;var a=s&&s.getViewportRootOffset();a&&(t[0]+=a.offsetLeft,t[1]+=a.offsetTop)}t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}var st=function(){function t(t,e){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,a.wxa)return null;var o=document.createElement("div");o.domBelongToZr=!0,this.el=o;var i=this._zr=t.getZr(),n=e.appendTo,s=n&&(h(n)?document.querySelector(n):d(n)?n:p(n)&&n(t.getDom()));nt(this._styleCoord,i,s,t.getWidth()/2,t.getHeight()/2),(s||t.getDom()).appendChild(o),this._api=t,this._container=s;var r=this;o.onmouseenter=function(){r._enterable&&(clearTimeout(r._hideTimeout),r._show=!0),r._inContent=!0},o.onmousemove=function(t){if(t=t||window.event,!r._enterable){var e=i.handler,o=i.painter.getViewportRoot();u(o,t,!0),e.dispatch("mousemove",t)}},o.onmouseleave=function(){r._inContent=!1,r._enterable&&r._show&&r.hideLater(r._hideDelay)}}return t.prototype.update=function(t){if(!this._container){var e=this._api.getDom(),o=(s="position",(r=(n=e).currentStyle||document.defaultView&&document.defaultView.getComputedStyle(n))?s?r[s]:r:null),i=e.style;"absolute"!==i.position&&"absolute"!==o&&(i.position="relative")}var n,s,r,a=t.get("alwaysShowContent");a&&this._moveIfResized(),this._alwaysShowContent=a,this.el.className=t.get("className")||""},t.prototype.show=function(t,e){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var o=this.el,i=o.style,n=this._styleCoord;o.innerHTML?i.cssText=et+it(t,!this._firstShow,this._longHide)+ot(n[0],n[1],!0)+"border-color:"+f(e)+";"+(t.get("extraCssText")||"")+";pointer-events:"+(this._enterable?"auto":"none"):i.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},t.prototype.setContent=function(t,e,o,i,n){var s=this.el;if(null!=t){var r="";if(h(n)&&"item"===o.get("trigger")&&!Q(o)&&(r=function(t,e,o){if(!h(o)||"inside"===o)return"";var i=t.get("backgroundColor"),n=t.get("borderWidth");e=f(e);var s,r,a="left"===(s=o)?"right":"right"===s?"left":"top"===s?"bottom":"top",l=Math.max(1.5*Math.round(n),6),d="",p=tt+":";_(["left","right"],a)>-1?(d+="top:50%",p+="translateY(-50%) rotate("+(r="left"===a?-225:-45)+"deg)"):(d+="left:50%",p+="translateX(-50%) rotate("+(r="top"===a?225:45)+"deg)");var u=r*Math.PI/180,c=l+n,g=c*Math.abs(Math.cos(u))+c*Math.abs(Math.sin(u)),y=e+" solid "+n+"px;";return'<div style="'+["position:absolute;width:"+l+"px;height:"+l+"px;z-index:-1;",(d+=";"+a+":-"+Math.round(100*((g-Math.SQRT2*n)/2+Math.SQRT2*n-(g-c)/2))/100+"px")+";"+p+";","border-bottom:"+y,"border-right:"+y,"background-color:"+i+";"].join("")+'"></div>'}(o,i,n)),h(t))s.innerHTML=t+r;else if(t){s.innerHTML="",c(t)||(t=[t]);for(var a=0;a<t.length;a++)d(t[a])&&t[a].parentNode!==s&&s.appendChild(t[a]);if(r&&s.childNodes.length){var l=document.createElement("div");l.innerHTML=r,s.appendChild(l)}}}else s.innerHTML=""},t.prototype.setEnterable=function(t){this._enterable=t},t.prototype.getSize=function(){var t=this.el;return[t.offsetWidth,t.offsetHeight]},t.prototype.moveTo=function(t,e){var o=this._styleCoord;if(nt(o,this._zr,this._container,t,e),null!=o[0]&&null!=o[1]){var i=this.el.style,n=ot(o[0],o[1]);g(n,(function(t){i[t[0]]=t[1]}))}},t.prototype._moveIfResized=function(){var t=this._styleCoord[2],e=this._styleCoord[3];this.moveTo(t*this._zr.getWidth(),e*this._zr.getHeight())},t.prototype.hide=function(){var t=this,e=this.el.style;e.visibility="hidden",e.opacity="0",a.transform3dSupported&&(e.willChange=""),this._show=!1,this._longHideTimeout=setTimeout((function(){return t._longHide=!0}),500)},t.prototype.hideLater=function(t){!this._show||this._inContent&&this._enterable||this._alwaysShowContent||(t?(this._hideDelay=t,this._show=!1,this._hideTimeout=setTimeout(y(this.hide,this),t)):this.hide())},t.prototype.isShow=function(){return this._show},t.prototype.dispose=function(){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var t=this.el.parentNode;t&&t.removeChild(this.el),this.el=this._container=null},t}(),rt=function(){function t(t){this._show=!1,this._styleCoord=[0,0,0,0],this._alwaysShowContent=!1,this._enterable=!0,this._zr=t.getZr(),ht(this._styleCoord,this._zr,t.getWidth()/2,t.getHeight()/2)}return t.prototype.update=function(t){var e=t.get("alwaysShowContent");e&&this._moveIfResized(),this._alwaysShowContent=e},t.prototype.show=function(){this._hideTimeout&&clearTimeout(this._hideTimeout),this.el.show(),this._show=!0},t.prototype.setContent=function(t,e,o,i,n){var s=this;w(t)&&T("Passing DOM nodes as content is not supported in richText tooltip!"),this.el&&this._zr.remove(this.el);var r=o.getModel("textStyle");this.el=new C({style:{rich:e.richTextStyles,text:t,lineHeight:22,borderWidth:1,borderColor:i,textShadowColor:r.get("textShadowColor"),fill:o.get(["textStyle","color"]),padding:m(o,"richText"),verticalAlign:"top",align:"left"},z:o.get("z")}),g(["backgroundColor","borderRadius","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"],(function(t){s.el.style[t]=o.get(t)})),g(["textShadowBlur","textShadowOffsetX","textShadowOffsetY"],(function(t){s.el.style[t]=r.get(t)||0})),this._zr.add(this.el);var a=this;this.el.on("mouseover",(function(){a._enterable&&(clearTimeout(a._hideTimeout),a._show=!0),a._inContent=!0})),this.el.on("mouseout",(function(){a._enterable&&a._show&&a.hideLater(a._hideDelay),a._inContent=!1}))},t.prototype.setEnterable=function(t){this._enterable=t},t.prototype.getSize=function(){var t=this.el,e=this.el.getBoundingRect(),o=lt(t.style);return[e.width+o.left+o.right,e.height+o.top+o.bottom]},t.prototype.moveTo=function(t,e){var o=this.el;if(o){var i=this._styleCoord;ht(i,this._zr,t,e),t=i[0],e=i[1];var n=o.style,s=at(n.borderWidth||0),r=lt(n);o.x=t+s+r.left,o.y=e+s+r.top,o.markRedraw()}},t.prototype._moveIfResized=function(){var t=this._styleCoord[2],e=this._styleCoord[3];this.moveTo(t*this._zr.getWidth(),e*this._zr.getHeight())},t.prototype.hide=function(){this.el&&this.el.hide(),this._show=!1},t.prototype.hideLater=function(t){!this._show||this._inContent&&this._enterable||this._alwaysShowContent||(t?(this._hideDelay=t,this._show=!1,this._hideTimeout=setTimeout(y(this.hide,this),t)):this.hide())},t.prototype.isShow=function(){return this._show},t.prototype.dispose=function(){this._zr.remove(this.el)},t}();function at(t){return Math.max(0,t)}function lt(t){var e=at(t.shadowBlur||0),o=at(t.shadowOffsetX||0),i=at(t.shadowOffsetY||0);return{left:at(e-o),right:at(e+o),top:at(e-i),bottom:at(e+i)}}function ht(t,e,o,i){t[0]=o,t[1]=i,t[2]=t[0]/e.getWidth(),t[3]=t[1]/e.getHeight()}var dt=new b({shape:{x:-1,y:-1,width:2,height:2}});function pt(t,e,o){var i,n=e.ecModel;o?(i=new V(o,n,n),i=new V(e.option,i,n)):i=e;for(var s=t.length-1;s>=0;s--){var r=t[s];r&&(r instanceof V&&(r=r.get("tooltip",!0)),h(r)&&(r={formatter:r}),r&&(i=new V(r,i,n)))}return i}function ut(t,e){return t.dispatchAction||y(e.dispatchAction,e)}function ft(t){return"center"===t||"middle"===t}var ct=function(n){function r(){var t=null!==n&&n.apply(this,arguments)||this;return t.type=r.type,t}return s(r,n),r.prototype.init=function(t,e){if(!a.node&&e.getDom()){var o=t.getComponent("tooltip"),i=this._renderMode=S(o.get("renderMode"));this._tooltipContent="richText"===i?new rt(e):new st(e,{appendTo:o.get("appendToBody",!0)?"body":o.get("appendTo",!0)})}},r.prototype.render=function(t,e,o){if(!a.node&&o.getDom()){this.group.removeAll(),this._tooltipModel=t,this._ecModel=e,this._api=o;var i=this._tooltipContent;i.update(t),i.setEnterable(t.get("enterable")),this._initGlobalListener(),this._keepShow(),"richText"!==this._renderMode&&t.get("transitionDuration")?M(this,"_updatePosition",50,"fixRate"):I(this,"_updatePosition")}},r.prototype._initGlobalListener=function(){var e=this._tooltipModel.get("triggerOn");t("itemTooltip",this._api,y((function(t,o,i){"none"!==e&&(e.indexOf(t)>=0?this._tryShow(o,i):"leave"===t&&this._hide(i))}),this))},r.prototype._keepShow=function(){var t=this._tooltipModel,e=this._ecModel,o=this._api,i=t.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==i&&"click"!==i){var n=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout((function(){!o.isDisposed()&&n.manuallyShowTip(t,e,o,{x:n._lastX,y:n._lastY,dataByCoordSys:n._lastDataByCoordSys})}))}},r.prototype.manuallyShowTip=function(t,o,i,n){if(n.from!==this.uid&&!a.node&&i.getDom()){var s=ut(n,i);this._ticket="";var r=n.dataByCoordSys,l=function(t,e,o){var i=j(t).queryOptionMap,n=i.keys()[0];if(!n||"series"===n)return;var s=E(e,n,i.get(n),{useDefault:!1,enableAll:!1,enableNone:!1}),r=s.models[0];if(!r)return;var a,l=o.getViewOfComponentModel(r);if(l.group.traverse((function(e){var o=D(e).tooltipConfig;if(o&&o.name===t.name)return a=e,!0})),a)return{componentMainType:n,componentIndex:r.componentIndex,el:a}}(n,o,i);if(l){var h=l.el.getBoundingRect().clone();h.applyTransform(l.el.transform),this._tryShow({offsetX:h.x+h.width/2,offsetY:h.y+h.height/2,target:l.el,position:n.position,positionDefault:"bottom"},s)}else if(n.tooltip&&null!=n.x&&null!=n.y){var d=dt;d.x=n.x,d.y=n.y,d.update(),D(d).tooltipConfig={name:null,option:n.tooltip},this._tryShow({offsetX:n.x,offsetY:n.y,target:d},s)}else if(r)this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,dataByCoordSys:r,tooltipOption:n.tooltipOption},s);else if(null!=n.seriesIndex){if(this._manuallyAxisShowTip(t,o,i,n))return;var p=e(n,o),u=p.point[0],f=p.point[1];null!=u&&null!=f&&this._tryShow({offsetX:u,offsetY:f,target:p.el,position:n.position,positionDefault:"bottom"},s)}else null!=n.x&&null!=n.y&&(i.dispatchAction({type:"updateAxisPointer",x:n.x,y:n.y}),this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,target:i.getZr().findHover(n.x,n.y).target},s))}},r.prototype.manuallyHideTip=function(t,e,o,i){var n=this._tooltipContent;this._tooltipModel&&n.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(ut(i,o))},r.prototype._manuallyAxisShowTip=function(t,e,o,i){var n=i.seriesIndex,s=i.dataIndex,r=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=n&&null!=s&&null!=r){var a=e.getSeriesByIndex(n);if(a)if("axis"===pt([a.getData().getItemModel(s),a,(a.coordinateSystem||{}).model],this._tooltipModel).get("trigger"))return o.dispatchAction({type:"updateAxisPointer",seriesIndex:n,dataIndex:s,position:i.position}),!0}},r.prototype._tryShow=function(t,e){var o=t.target;if(this._tooltipModel){this._lastX=t.offsetX,this._lastY=t.offsetY;var i=t.dataByCoordSys;if(i&&i.length)this._showAxisTooltip(i,t);else if(o){var n,s;if("legend"===D(o).ssrType)return;this._lastDataByCoordSys=null,O(o,(function(t){return null!=D(t).dataIndex?(n=t,!0):null!=D(t).tooltipConfig?(s=t,!0):void 0}),!0),n?this._showSeriesItemTooltip(t,n,e):s?this._showComponentItemTooltip(t,s,e):this._hide(e)}else this._lastDataByCoordSys=null,this._hide(e)}},r.prototype._showOrMove=function(t,e){var o=t.get("showDelay");e=y(e,this),clearTimeout(this._showTimout),o>0?this._showTimout=setTimeout(e,o):e()},r.prototype._showAxisTooltip=function(t,e){var i=this._ecModel,n=this._tooltipModel,s=[e.offsetX,e.offsetY],r=pt([e.tooltipOption],n),a=this._renderMode,l=[],h=k("section",{blocks:[],noHeader:!0}),d=[],p=new F;g(t,(function(t){g(t.dataByAxis,(function(t){var e=i.getComponent(t.axisDim+"Axis",t.axisIndex),s=t.value;if(e&&null!=s){var r=o(s,e.axis,i,t.seriesDataIndices,t.valueLabelOpt),u=k("section",{header:r,noHeader:!z(r),sortBlocks:!0,blocks:[]});h.blocks.push(u),g(t.seriesDataIndices,(function(o){var h=i.getSeriesByIndex(o.seriesIndex),c=o.dataIndexInside,g=h.getDataParams(c);if(!(g.dataIndex<0)){g.axisDim=t.axisDim,g.axisIndex=t.axisIndex,g.axisType=t.axisType,g.axisId=t.axisId,g.axisValue=B(e.axis,{value:s}),g.axisValueLabel=r,g.marker=p.makeTooltipMarker("item",f(g.color),a);var y=H(h.formatTooltip(c,!0,null)),_=y.frag;if(_){var m=pt([h],n).get("valueFormatter");u.blocks.push(m?A({valueFormatter:m},_):_)}y.text&&d.push(y.text),l.push(g)}}))}}))})),h.blocks.reverse(),d.reverse();var u=e.position,c=r.get("order"),y=P(h,p,a,c,i.get("useUTC"),r.get("textStyle"));y&&d.unshift(y);var _="richText"===a?"\n\n":"<br/>",m=d.join(_);this._showOrMove(r,(function(){this._updateContentNotChangedOnAxis(t,l)?this._updatePosition(r,u,s[0],s[1],this._tooltipContent,l):this._showTooltipContent(r,m,l,Math.random()+"",s[0],s[1],u,null,p)}))},r.prototype._showSeriesItemTooltip=function(t,e,o){var i=this._ecModel,n=D(e),s=n.seriesIndex,r=i.getSeriesByIndex(s),a=n.dataModel||r,l=n.dataIndex,h=n.dataType,d=a.getData(h),p=this._renderMode,u=t.positionDefault,c=pt([d.getItemModel(l),a,r&&(r.coordinateSystem||{}).model],this._tooltipModel,u?{position:u}:null),g=c.get("trigger");if(null==g||"item"===g){var y=a.getDataParams(l,h),_=new F;y.marker=_.makeTooltipMarker("item",f(y.color),p);var m=H(a.formatTooltip(l,!1,h)),v=c.get("order"),x=c.get("valueFormatter"),w=m.frag,T=w?P(x?A({valueFormatter:x},w):w,_,p,v,i.get("useUTC"),c.get("textStyle")):m.text,C="item_"+a.name+"_"+l;this._showOrMove(c,(function(){this._showTooltipContent(c,T,y,C,t.offsetX,t.offsetY,t.position,t.target,_)})),o({type:"showTip",dataIndexInside:l,dataIndex:d.getRawIndex(l),seriesIndex:s,from:this.uid})}},r.prototype._showComponentItemTooltip=function(t,e,o){var i=D(e),n=i.tooltipConfig.option||{};if(h(n)){n={content:n,formatter:n}}var s=[n],r=this._ecModel.getComponent(i.componentMainType,i.componentIndex);r&&s.push(r),s.push({formatter:n.content});var a=t.positionDefault,l=pt(s,this._tooltipModel,a?{position:a}:null),d=l.get("content"),p=Math.random()+"",u=new F;this._showOrMove(l,(function(){var o=Y(l.get("formatterParams")||{});this._showTooltipContent(l,d,o,p,t.offsetX,t.offsetY,t.position,e,u)})),o({type:"showTip",from:this.uid})},r.prototype._showTooltipContent=function(t,e,o,i,n,s,r,a,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var d=this._tooltipContent;d.setEnterable(t.get("enterable"));var u=t.get("formatter");r=r||t.get("position");var f=e,g=this._getNearestPoint([n,s],o,t.get("trigger"),t.get("borderColor")).color;if(u)if(h(u)){var _=t.ecModel.get("useUTC"),m=c(o)?o[0]:o;f=u,m&&m.axisType&&m.axisType.indexOf("time")>=0&&(f=R(m.axisValue,f,_)),f=X(f,o,!0)}else if(p(u)){var v=y((function(e,i){e===this._ticket&&(d.setContent(i,l,t,g,r),this._updatePosition(t,r,n,s,d,o,a))}),this);this._ticket=i,f=u(o,i,v)}else f=u;d.setContent(f,l,t,g,r),d.show(t,g),this._updatePosition(t,r,n,s,d,o,a)}},r.prototype._getNearestPoint=function(t,e,o,i){return"axis"===o||c(e)?{color:i||("html"===this._renderMode?"#fff":"none")}:c(e)?void 0:{color:i||e.color||e.borderColor}},r.prototype._updatePosition=function(t,e,o,i,n,s,r){var a=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var d=n.getSize(),u=t.get("align"),f=t.get("verticalAlign"),g=r&&r.getBoundingRect().clone();if(r&&g.applyTransform(r.transform),p(e)&&(e=e([o,i],s,n.el,g,{viewSize:[a,l],contentSize:d.slice()})),c(e))o=L(e[0],a),i=L(e[1],l);else if(w(e)){var y=e;y.width=d[0],y.height=d[1];var _=W(y,{width:a,height:l});o=_.x,i=_.y,u=null,f=null}else if(h(e)&&r){var m=function(t,e,o,i){var n=o[0],s=o[1],r=Math.ceil(Math.SQRT2*i)+8,a=0,l=0,h=e.width,d=e.height;switch(t){case"inside":a=e.x+h/2-n/2,l=e.y+d/2-s/2;break;case"top":a=e.x+h/2-n/2,l=e.y-s-r;break;case"bottom":a=e.x+h/2-n/2,l=e.y+d+r;break;case"left":a=e.x-n-r,l=e.y+d/2-s/2;break;case"right":a=e.x+h+r,l=e.y+d/2-s/2}return[a,l]}(e,g,d,t.get("borderWidth"));o=m[0],i=m[1]}else{m=function(t,e,o,i,n,s,r){var a=o.getSize(),l=a[0],h=a[1];null!=s&&(t+l+s+2>i?t-=l+s:t+=s);null!=r&&(e+h+r>n?e-=h+r:e+=r);return[t,e]}(o,i,n,a,l,u?null:20,f?null:20);o=m[0],i=m[1]}if(u&&(o-=ft(u)?d[0]/2:"right"===u?d[0]:0),f&&(i-=ft(f)?d[1]/2:"bottom"===f?d[1]:0),Q(t)){m=function(t,e,o,i,n){var s=o.getSize(),r=s[0],a=s[1];return t=Math.min(t+r,i)-r,e=Math.min(e+a,n)-a,t=Math.max(t,0),e=Math.max(e,0),[t,e]}(o,i,n,a,l);o=m[0],i=m[1]}n.moveTo(o,i)},r.prototype._updateContentNotChangedOnAxis=function(t,e){var o=this._lastDataByCoordSys,i=this._cbParamsList,n=!!o&&o.length===t.length;return n&&g(o,(function(o,s){var r=o.dataByAxis||[],a=(t[s]||{}).dataByAxis||[];(n=n&&r.length===a.length)&&g(r,(function(t,o){var s=a[o]||{},r=t.seriesDataIndices||[],l=s.seriesDataIndices||[];(n=n&&t.value===s.value&&t.axisType===s.axisType&&t.axisId===s.axisId&&r.length===l.length)&&g(r,(function(t,e){var o=l[e];n=n&&t.seriesIndex===o.seriesIndex&&t.dataIndex===o.dataIndex})),i&&g(t.seriesDataIndices,(function(t){var o=t.seriesIndex,s=e[o],r=i[o];s&&r&&r.data!==s.data&&(n=!1)}))}))})),this._lastDataByCoordSys=t,this._cbParamsList=e,!!n},r.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},r.prototype.dispose=function(t,e){!a.node&&e.getDom()&&(I(this,"_updatePosition"),this._tooltipContent.dispose(),i("itemTooltip",e))},r.type="tooltip",r}(N);function gt(t){U(n),t.registerComponentModel(q),t.registerComponentView(ct),t.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Z),t.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Z)}export{gt as install};