!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var r in i)("object"==typeof exports?exports:t)[r]=i[r]}}(window,(function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=15)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(2),n=i(1),a=i(7),s=i(17),o=i(18),h=i(19),l=i(20);var u;!function(t){t[t.IMMED=0]="IMMED",t[t.TICK=1]="TICK",t[t.ANIMATED=2]="ANIMATED"}(u=e.zrenderUpdateType||(e.zrenderUpdateType={}));class c{constructor(t,e,i){this.zr=null,this.animatePropsQueue=[],this.lastAnimatePropsQueue=[],this.propsQueue=[],this.isLastUpdateInterrupt=!1,this.viewModel=e,this.zr=c.zrender.init(t),this.animations=new h.Animations(i.animation),this.globalShape=new s.GlobalShape(this),this.offscreen=new l.OffScreen(this.globalShape.id,this),this.viewOption=i,this.container=t,this.containerWidth=t.offsetWidth,this.containerHeight=t.offsetHeight,this.zr.add(this.globalShape.getZrenderShape())}setAttribute(t,e,i){let a=this.viewOption.animation.enableAnimation,s=t instanceof r.Shape?t.zrenderShape:t.getZrenderShape();if(null!==s){if(void 0===i&&(i=a?u.ANIMATED:u.TICK),i===u.TICK||i===u.ANIMATED){let t=i===u.ANIMATED?this.animatePropsQueue:this.propsQueue,r=t.find(t=>s.id===t.zrenderShape.id);r?n.Util.extends(r.props,e):t.push({zrenderShape:s,props:e})}else s.attr(e);this.offscreen.update(t.id,e)}}renderZrenderShapes(t,e){let i,s;for(s=0;s{t.mountState===r.mountState.NEEDUNMOUNT&&(t.mountState=r.mountState.UNMOUNTED,t.visible=!1,t.updateZrenderShape("hide",{fn:(t=>()=>{this.globalShape.remove(t),n.Util.removeFromList(this.viewModel.getShapeList(),e=>t.id===e.id)})(t)}),this.getOffScreen().remove(t.id))})}updateZrenderShapes(t){let e=this.viewOption.animation;this.propsQueue.length&&(this.propsQueue.map(t=>{Object.keys(t.props).map(e=>{"callback"!==e&&t.zrenderShape.attr(e,t.props[e])}),t.props.callback&&t.props.callback()}),this.propsQueue.length=0,!1===e.enableAnimation&&t&&t()),setTimeout(()=>{if(this.animatePropsQueue.length){this.lastAnimatePropsQueue=this.animatePropsQueue,this.animatePropsQueue=[];let i=this.lastAnimatePropsQueue,r=i.length;i.map((n,a)=>{n.zrenderShape.animateTo(n.props,e.duration,e.timingFunction,()=>{a===r-1&&!1===this.isLastUpdateInterrupt&&(i.length=0,t&&t()),n.props.callback&&n.props.callback()})})}},0)}skipUpdateZrenderShapes(t){this.lastAnimatePropsQueue.length&&(this.isLastUpdateInterrupt=!0,this.lastAnimatePropsQueue.map(t=>{t.zrenderShape.stopAnimation(!0),t.props.callback&&t.props.callback()}),t&&t(),this.lastAnimatePropsQueue.length=0,this.isLastUpdateInterrupt=!1)}resizeGlobalShape(t){if(this.viewModel.isViewUpdating)return;let e="auto"===t.width?this.container.offsetWidth:t.width,i="auto"===t.height?this.container.offsetHeight:t.height,r=this.globalShape.getBound();e===this.containerWidth&&i===this.containerHeight&&!1===t.force||(this.containerWidth=e,this.containerHeight=i,this.zr.resize(t),this.setGlobalShapePosition(r),this.setGlobalShapeScale(r),this.updateZrenderShapes())}setGlobalShapePosition(t){let e,i,r=this.viewOption.position,n=this.viewModel.isFirstRender,a=t.x+t.width/2,s=t.y+t.height/2;void 0!==r&&!1!==r&&(Array.isArray(r)&&(e=r[0]-a,i=r[1]-s),"auto"===r&&(e=this.containerWidth/2-a,i=this.containerHeight/2-s),this.globalShape.translate(e,i,n?u.TICK:u.ANIMATED))}setGlobalShapeScale(t){let e,i,r=this.viewOption.scale,n=this.viewModel.isFirstRender;if(void 0!==r&&!1!==r){if(Array.isArray(r)&&(r[0]>4&&(r[0]=4),r[0]<.25&&(r[0]=.25),r[1]>4&&(r[1]=4),r[1]<.25&&(r[1]=.25),e=r[0],i=r[1]),"auto"===r){let r,n,a=this.globalShape.getScale(),s=t.width,o=t.height,h=.75;s-this.containerWidth>o-this.containerHeight?(n=s,r=this.containerWidth):(n=o,r=this.containerHeight);let l=r*h/n;e=a[0]*l,i=a[1]*l,e>1&&(e=1),i>1&&(i=1),e<.25&&(e=.25),i<.25&&(i=.25)}this.globalShape.scale(e,i,n?u.TICK:u.ANIMATED)}}toggleAutoPosition(t){this.viewOption.position=t}toggleAutoScale(t){this.viewOption.scale=t}getAnimationProps(t,e){return this.animations[e](t)}getOffScreen(){return this.offscreen}getGlobalShape(){return this.globalShape}getContainer(){return this.container}getContainerWidth(){return this.containerWidth}getContainerHeight(){return this.containerHeight}getZrender(){return this.zr}clear(){this.animatePropsQueue.length=0,this.propsQueue.length=0,this.globalShape.clear()}}e.Renderer=c,c.zrender=o},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(3);e.Util={generateId:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){let e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})),extends(t,i){null!=i&&("object"!=typeof t||Array.isArray(t)||Object.keys(i).map(r=>{null===i[r]||"object"!=typeof i[r]||Array.isArray(i[r])?t[r]=i[r]:(void 0===t[r]&&(t[r]={}),e.Util.extends(t[r],i[r]))}))},merge(t,i){null!=i&&Object.keys(i).map(r=>{void 0!==t[r]&&void 0!==i[r]&&("object"!=typeof i[r]||Array.isArray(i[r])?t[r]=i[r]:null===t[r]||"object"!=typeof t[r]||Array.isArray(t[r])?t[r]=i[r]:e.Util.merge(t[r],i[r]))})},removeFromList(t,e){for(let i=0;it[t.findIndex(e)],sign:t=>t<0?-1:1,getPathCenter(t){let e=-1/0,i=1/0,r=-1/0,n=1/0;return t.map(t=>{t[0]>e&&(e=t[0]),t[0]r&&(r=t[1]),t[1]t.prototype.constructor.toString().split(" ")[1],textParser(t){let e=/\[[^\]]*\]/g;if(e.test(t)){return t.match(e).map(t=>t.replace(/\[|\]/g,""))}return t},clamp:(t,e,i)=>t<=e&&t>=i?t:t>e?e:t{}}),e.fn&&(i.callback=e.fn),"composite"===this.type||"polyLine"===this.name){let t=this.zrenderShape.getBoundingRect(),e=[t.x+t.width/2,t.y+t.height/2];this.zrenderShape.attr("origin",e),this.renderer.getOffScreen().update(this.id,"origin",e)}this.renderer.setAttribute(this,i,e.type)}createZrenderShape(){}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Vector={add:(t,e)=>[t[0]+e[0],t[1]+e[1]],subtract:(t,e)=>[t[0]-e[0],t[1]-e[1]],dot:(t,e)=>t[0]*e[0]+t[1]*e[1],scale:(t,e)=>[t[0]*e,t[1]*e],length:t=>Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)),rotation(t,e,i=[0,0]){if(0===t)return e;t=-t;let r=Math.cos(t),n=Math.sin(t),a=[e[0]-i[0],e[1]-i[1]],s=[0,0];return s[0]=i[0]+(a[0]*r-a[1]*n),s[1]=i[1]+(a[0]*n+a[1]*r),s},tangent:t=>[-t[1],t[0]],normalize(t){let i=e.Vector.length(t);return 0===i?[0,0]:1===i?t:[t[0]/i,t[1]/i]},location:(t,i,r)=>e.Vector.add(t,e.Vector.scale(e.Vector.normalize(i),r)),negative:t=>e.Vector.scale(t,-1)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(3);e.Bound={fromPoints(t){let e=-1/0,i=1/0,r=-1/0,n=1/0;return t.map(t=>{t[0]>e&&(e=t[0]),t[0]r&&(r=t[1]),t[1][[t.x,t.y],[t.x+t.width,t.y],[t.x+t.width,t.y+t.height],[t.x,t.y+t.height]],union:(...t)=>t.length>1?t.reduce((t,e)=>{let i=t.xe.x&&(i=t.xe.y&&(r=t.yr.Vector.rotation(i,t,[n,a])))},isOverlap(t,e){let i=t.x+t.width,r=t.y+t.height,n=e.x+e.width,a=e.y+e.height;return t.x{if(!t[e])return;let i={label:e,shape:null,shapeName:t[e].shapeName,draw:t[e].draw,init:t[e].init},r=this.subShapes.findIndex(t=>t.label===e);r>=0?this.subShapes[r]=Object.assign(Object.assign({},this.subShapes[r]),t[e]):this.subShapes.push(i)})}getSubShape(t){return this.subShapes.find(e=>e.label===t).shape}updateSubShapes(){this.subShapes.map(t=>{t.shape.applyShapeOption({style:this.style}),t.init&&t.shape.applyShapeOption(t.init(this.option,this.style)),t.draw(this,t.shape),t.shape.x-=this.x,t.shape.y-=this.y,t.shape.isDirty=this.isDirty,t.shape.element=this.element,this.rotation&&this.subShapes.map(t=>{let e=a.Vector.rotation(this.rotation,[t.shape.x,t.shape.y],[-this.width/2,-this.height/2]);t.shape.x=e[0],t.shape.y=e[1],t.shape.rotation=this.rotation})})}createZrenderShape(){let t=new n.Renderer.zrender.Group({position:[this.x,this.y],z:this.option.zIndex});return this.subShapes.map(e=>{let i=e.shape.createZrenderShape();null===e.shape.zrenderShape&&(e.shape.zrenderShape=i),this.zrenderShape?(i.shapeId=e.shape.id,t.add(i)):t.add(e.shape.zrenderShape)}),t}}e.Composite=s},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.Interaction=class{constructor(t,e,i){this.name=t,this.interactionModel=e,this.engine=i,this.elementList=i.getElementList(),this.renderer=i.getRenderer(),this.zr=this.renderer.getZrender(),this.isEnable=!0}setOptionVal(t){this.optionValue=t}update(){}init(){}trigger(t){}handler(t){return null}finish(t){}triggerCondition(){return!0}emitHandler(t){this.isEnable&&this.interactionModel.handler(this.name,t)}emitTrigger(t){this.isEnable&&this.triggerCondition()&&this.trigger(t)}emitFinish(t){this.isEnable&&this.finish(t)}setData(t,e){this.interactionModel.dataStore[t]=e}getData(t){return this.interactionModel.dataStore[t]}toggleEnable(t){this.isEnable=t}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(2),n=i(0);class a extends r.Shape{constructor(t,e,i){super(t,e,i)}defaultOption(t){return Object.assign(Object.assign({},t),{zIndex:2})}defaultStyle(t){return Object.assign(Object.assign({},t),{textBackgroundColor:"#fff",textBorderRadius:0,textPadding:[4,4,4,4]})}updateTextSize(){let t=this.getBound(!1);this.width=t.width,this.height=t.height}updateText(){let t={position:[this.x,this.y],origin:[this.width/2,this.height/2],rotation:this.rotation};this.renderer.setAttribute(this,t,n.zrenderUpdateType.IMMED)}createZrenderShape(){let t=new n.Renderer.zrender.Text({style:this.style,z:this.option.zIndex}),e=new n.Renderer.zrender.Text({style:this.style,z:this.option.zIndex});return this.renderer.getOffScreen().add(e,this.id),this.updateTextSize(),this.updateText(),t}}e.Text=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(2),n=i(0),a=i(1),s=i(4);class o extends r.Shape{constructor(t,e,i){super(t,e,i),this.path=[],this.prevPath=[],this.animationsTable=Object.assign(Object.assign({},this.animationsTable),{path:"path"})}restoreData(){super.restoreData(),this.path=[]}defaultStyle(t){return Object.assign(Object.assign({},t),{smooth:0,lineDash:null})}getBound(){return s.Bound.fromPoints(this.path)}createZrenderShape(){return new n.Renderer.zrender.Polyline({position:[this.x,this.y],origin:a.Util.getPathCenter(this.path),shape:{points:this.path,smooth:this.style.smooth},style:this.style,z:this.option.zIndex})}}e.PolyLine=o},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(4);e.Element=class{constructor(t){this.name="element",this.x=0,this.y=0,this.rotation=0,this.width=0,this.height=0,this.style={},this.anchors=null,this.lastX=0,this.lastY=0,this.shape=null,this.effectLinks=[],this.effectRefer=null,this.isObsolete=!1,this.isDragged=!1,Object.keys(t).map(e=>{this[e]=t[e]})}getBound(){let t=this.width,e=this.height,i={x:this.x-t/2,y:this.y-e/2,width:t,height:e};return this.rotation?r.Bound.rotation(i,this.rotation):i}onLinkTo(t,e){}onLinkFrom(t,e){}onUnlinkTo(t){}onUnlinkFrom(t){}onRefer(t,e,i){}onUnrefer(t){}onChange(t){}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(16),n=i(1),a=i(22),s=i(25),o=i(9),h=i(26),l=i(27),u=i(28);class c{constructor(t,e){this.name="engine",this.sources=null,this.stringifySources=null,this.dataModel=null,this.viewModel=null,this.interactionModel=null,this.sourcesProxy=null,this.defaultOption=null,this.structOption={element:o.Element,link:[],pointer:[]},this.viewOption={element:{},link:{},pointer:{},layout:{},animation:{enableSkip:!0,enableAnimation:!0,timingFunction:"quinticOut",duration:1e3},position:"auto",scale:"auto"},this.interactOption={zoomView:!0,moveView:!1,drag:!1,focus:!1,frameSelect:!1},this.proxySources=null,n.Util.assert(!t,"HTML元素不存在"),this.id=n.Util.generateId(),this.name=e.name,this.viewModel=new r.ViewModel(this,t),this.dataModel=new a.DataModel(this,this.viewModel),this.interactionModel=new u.InteractionModel(this),this.sourcesProxy=new l.SourcesProxy(this),this.defaultOption=e.defaultOption,this.initViewOption(e.defaultOption.struct),this.applyOptions(e.defaultOption,!1)}reset(){this.dataModel.resetData(),this.viewModel.resetData()}initViewOption(t){t.element&&"object"==typeof t.element&&(this.viewOption.element={},Object.keys(t.element).forEach(t=>{this.viewOption.element[t]={}})),t.link&&Array.isArray(t.link)&&t.link.forEach(t=>{this.viewOption.link[t]=new s.DefaultLinkOption}),t.pointer&&Array.isArray(t.pointer)&&t.pointer.forEach(t=>{this.viewOption.pointer[t]=new s.DefaultPointerOption})}updateEngine(t){this.reset(),this.beforeUpdate(),this.viewModel.isViewUpdating=!0,this.dataModel.constructElements(t),this.dataModel.layoutElements(this.render.bind(this),this.viewModel.renderer.getContainerWidth(),this.viewModel.renderer.getContainerHeight()),this.dataModel.updateShapes(),this.viewModel.reconciliation(),this.viewModel.renderShapes(!0)}updateElement(t,e=!1){void 0===e&&(e=this.viewOption.animation.enableAnimation),void 0===t&&(t=this.dataModel.getElementList());let i=this.viewOption.animation.enableAnimation;this.viewOption.animation.enableAnimation=e,this.dataModel.updateShapes(t),this.viewModel.reconciliation(!0),this.viewModel.renderShapes(!1),this.viewOption.animation.enableAnimation=i}source(t,e=!1){if(!this.viewOption.animation.enableSkip&&this.viewModel.isViewUpdating)return;if(void 0===t)return;let i=JSON.stringify(t);return i!==this.stringifySources?(this.sources=t,this.stringifySources=i,this.viewModel.structuralUpdate=!0,this.updateEngine(t),!1===e&&this.proxySources&&this.sourcesProxy.revoke(this.proxySources),e&&t!==this.proxySources?(this.proxySources=this.sourcesProxy.proxy(t),this.proxySources):void 0):void 0}applyOptions(t,e=!0){t&&0!==Object.keys(t).length&&(t.struct&&n.Util.extends(this.structOption,t.struct),t.view&&Object.keys(t.view).forEach(e=>{Array.isArray(this.viewOption[e])||"object"!=typeof this.viewOption[e]?this.viewOption[e]=t.view[e]:n.Util.extends(this.viewOption[e],t.view[e])}),t.interact&&(Object.keys(t.interact).forEach(e=>{this.interactOption[e]=t.interact[e]}),this.interactionModel.applyInteractions(this.interactOption)),!1!==e&&null!==this.sources&&this.updateEngine(this.sources))}clear(){this.dataModel.resetData(),this.viewModel.resetData(),this.viewModel.clearShapes(),this.stringifySources=null,this.proxySources&&(this.sourcesProxy.revoke(this.proxySources),this.proxySources=null)}getRenderer(){return this.viewModel.renderer}getElementList(){return this.dataModel.getElementList()}getId(){return this.id}getName(){return this.name}getDefaultOption(){return this.defaultOption}isViewUpdating(){return this.viewModel.isViewUpdating}link(t,e,i,r=null){this.dataModel.addLink(t,e,i,r)}refer(t,e,i){this.dataModel.addPointer(t,e,i)}text(t,e){return this.viewModel.createShape("staticText#"+this.viewModel.staticTextId++,"text",{content:t,style:e})}group(...t){return new h.Group(...t)}resize(t){void 0===t?t={width:"auto",height:"auto",force:!1}:(t.width=t.width||"auto",t.height=t.height||"auto",t.force=void 0!==t.force&&t.force),this.viewModel.renderer.resizeGlobalShape(t)}render(t,e,i){}beforeUpdate(){}afterUpdate(){}}e.Engine=c,c.ShapesTable={},e.RegisterShape=function(t,e){c.ShapesTable[e]=t,t.prototype.name=e}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(2),n=i(0);class a extends r.Shape{constructor(t,e,i){super(t,e,i)}updateSize(t){this.updateZrenderShape("position")}createZrenderShape(){return new n.Renderer.zrender.Rect({position:[this.x,this.y],rotation:this.rotation,shape:{x:-this.width/2,y:-this.height/2,width:this.width,height:this.height},style:this.style,z:this.option.zIndex})}}e.Rect=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(2),n=i(0);class a extends r.Shape{constructor(t,e,i){super(t,e,i)}defaultOption(t){return Object.assign(Object.assign({},t),{edges:5})}createZrenderShape(){return new n.Renderer.zrender.Isogon({position:[this.x,this.y],rotation:this.rotation,shape:{x:0,y:0,n:this.option.edges,r:this.width/2},style:this.style,z:this.option.zIndex})}}e.Isogon=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(2),n=i(0);class a extends r.Shape{constructor(t,e,i){super(t,e,i)}createZrenderShape(){return new n.Renderer.zrender.Circle({position:[this.x,this.y],rotation:this.rotation,shape:{cx:0,cy:0,r:this.width/2},style:this.style,z:this.option.zIndex})}}e.Circle=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(8),n=i(0),a=i(1);class s extends r.PolyLine{constructor(t,e,i){super(t,e,i),this.controlPoint=null,this.animationsTable=Object.assign(Object.assign({},this.animationsTable),{path:"curve"})}defaultOption(t){return Object.assign(Object.assign({},t),{curveness:.2})}calcControlPoint(t,e){return this.controlPoint?this.controlPoint:[(t.x+e.x)/2-(t.y-e.y)*this.option.curveness,(t.y+e.y)/2-(e.x-t.x)*this.option.curveness]}restoreData(){super.restoreData(),this.controlPoint=null}createZrenderShape(){let t=this.path[0][0],e=this.path[0][1],i=this.path[1][0],r=this.path[1][1];return new n.Renderer.zrender.BezierCurve({origin:a.Util.getPathCenter(this.path),shape:{x1:t,y1:e,x2:i,y2:r,cpx1:this.controlPoint[0],cpy1:this.controlPoint[1]},style:this.style,z:this.option.zIndex})}}e.Curve=s},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(10),n=i(1),a=i(5),s=i(9),o=i(13),h=i(12),l=i(8),u=i(11),c=i(7),d=i(4),p=i(34),f=i(35),g=i(36),v=i(37),m=i(14),y=i(3);r.RegisterShape(a.Composite,"composite"),r.RegisterShape(o.Circle,"circle"),r.RegisterShape(h.Isogon,"isogon"),r.RegisterShape(l.PolyLine,"polyLine"),r.RegisterShape(u.Rect,"rect"),r.RegisterShape(c.Text,"text"),r.RegisterShape(p.Arrow,"arrow"),r.RegisterShape(m.Curve,"curve"),r.RegisterShape(f.Line,"line"),r.RegisterShape(g.Node,"node"),r.RegisterShape(v.DualNode,"dualNode"),e.SV={Engine:r.Engine,Util:n.Util,Bound:d.Bound,Vector:y.Vector,Element:s.Element,Composite:a.Composite,registerShape:r.RegisterShape,create(t,e,i){e.id=n.Util.generateId();let r=new e(t);return i&&r.applyOptions(i,!1),r}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(10),n=i(0),a=i(21),s=i(2),o=i(1),h=i(5),l=i(7);e.ViewModel=class{constructor(t,e){this.engine=t,this.shapeContainer={},this.shapeList=[],this.removeList=[],this.staticTextId=0,this.isViewUpdating=!1,this.isFirstRender=!0,this.structuralUpdate=!1,this.reconciler=new a.Reconciler(this),this.renderer=new n.Renderer(e,this,t.viewOption)}createShape(t,e,i){let n=null,a=null;"string"==typeof e?(n=r.Engine.ShapesTable[e],a=e):(n=e,a=n.prototype.constructor.name.toLowerCase()),o.Util.assert(void 0===n,"图形 "+a+" 未注册!");let s=this.reuseShape(t,a,i);return null===s&&(s=new n(t,a,i)),s instanceof h.Composite&&this.createCompositeSubShapes(s),s.renderer=this.renderer,this.shapeList.push(s),"text"===a&&null===s.zrenderShape&&(s.zrenderShape=s.createZrenderShape()),s}createCompositeSubShapes(t){t.subShapes.map((e,i)=>{let r={style:{}};o.Util.extends(r,t.option),o.Util.extends(r.style,t.style),e.init&&o.Util.extends(r,e.init(t.option,t.style)),e.shape=this.createShape(t.id+"#"+i,e.shapeName,r),e.shape.parentShape=t})}addShape(t){let e=this.shapeContainer,i=t.name;void 0===e[i]&&(e[i]=[]),e[i].push(t)}removeShape(t){o.Util.removeFromList(this.shapeContainer[t.name],e=>e.id===t.id),t.mountState=s.mountState.NEEDUNMOUNT,0===this.shapeContainer[t.name].length&&delete this.shapeContainer[t.name],this.removeList.push(t)}reuseShape(t,e,i){if(void 0===this.shapeContainer[e])return null;let r=this.shapeContainer[e].find(e=>e.id===t);return r?(r.restoreData(),r.applyShapeOption(i),r.visible=!0,r instanceof l.Text&&r.updateTextSize(),r):null}reconciliation(t=!1){if(this.shapeList.forEach(t=>{t instanceof h.Composite&&t.isDirty&&t.updateSubShapes()}),t)for(let t=0;t{this.addShape(t)}):this.reconciler.reconcileShapeList(this.shapeContainer,this.shapeList)}renderShapes(t=!0){if(this.isViewUpdating&&this.renderer.skipUpdateZrenderShapes(this.afterUpdate.bind(this)),this.structuralUpdate&&this.renderer.renderZrenderShapes(this.shapeList,this.removeList),t){let t=this.renderer.getGlobalShape();this.renderer.setGlobalShapePosition(t.getBound()),this.renderer.setGlobalShapeScale(t.getBound())}this.renderer.updateZrenderShapes(this.afterUpdate.bind(this)),this.isFirstRender&&(this.isFirstRender=!1)}resetData(){Object.keys(this.shapeContainer).map(t=>{this.shapeContainer[t].map(t=>t.visited&&(t.visited=!1))}),this.staticTextId=0,this.shapeList.length=0,this.removeList.length=0}clearShapes(){this.shapeContainer={},this.shapeList.length=0,this.removeList.length=0,this.renderer.clear()}getShapeList(){return this.shapeList.filter(t=>t.mountState!==s.mountState.NEEDUNMOUNT)}getShape(t){return this.shapeList.find(e=>e.id===t)}afterUpdate(){this.renderer.getGlobalShape().updateOriginToCenter(),this.structuralUpdate=!1,this.isViewUpdating=!1,this.shapeList.forEach(t=>{t.isDirty=!1}),this.engine.afterUpdate()}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(0);e.GlobalShape=class{constructor(t){this.renderer=null,this.zrenderGroup=null,this.renderer=t,this.zrenderGroup=new r.Renderer.zrender.Group,this.id=this.zrenderGroup.id.toString()}add(t){Array.isArray(t)?t.map(t=>this.add(t)):null===t.parentShape&&(this.zrenderGroup.add(t.zrenderShape),"text"!==t.name&&this.renderer.getOffScreen().add(t.createZrenderShape(),t.id))}remove(t){t instanceof Array?t.map(t=>this.remove(t)):(this.zrenderGroup.remove(t.zrenderShape),t.zrenderShape=null)}clear(){this.zrenderGroup.removeAll()}scale(t,e,i=r.zrenderUpdateType.ANIMATED){let n={scale:[t,e]};this.renderer.setAttribute(this,n,i)}translate(t,e,i=r.zrenderUpdateType.ANIMATED){let n=this.getPosition(),a={position:[n[0]+t,n[1]+e]};this.renderer.setAttribute(this,a,i)}getPosition(){return this.zrenderGroup.position}getScale(){return this.zrenderGroup.scale}getOrigin(){return this.renderer.getOffScreen().getOrigin()}getBound(){return this.renderer.getOffScreen().getBound()}getNaiveBound(){return this.renderer.getOffScreen().getNaiveBound()}getZrenderShape(){return this.zrenderGroup}updateOriginToCenter(){this.renderer.getOffScreen().updateOriginToCenter();let[t,e]=this.getOrigin(),[i,r]=this.getPosition();if(this.zrenderGroup.attr("origin",[t,e]),void 0!==this.originX&&void 0!==this.originY){let n,a,[s,o]=this.getScale();n=(this.originX-t)*(1-s),a=(this.originY-e)*(1-o),this.zrenderGroup.attr("position",[i+n,r+a])}this.originX=t,this.originY=e}}},function(t,e,i){!function(t){"use strict";function e(){return r++}var i,r=2311,n="object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?{browser:{},os:{},node:!1,wxa:!0,canvasSupported:!0,svgSupported:!1,touchEventsSupported:!0,domSupported:!1}:"undefined"==typeof document&&"undefined"!=typeof self?{browser:{},os:{},node:!1,worker:!0,canvasSupported:!0,domSupported:!1}:"undefined"==typeof navigator?{browser:{},os:{},node:!0,worker:!1,canvasSupported:!0,svgSupported:!0,domSupported:!1}:function(t){var e={},i=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),n=t.match(/Edge\/([\d.]+)/),a=/micromessenger/i.test(t);return i&&(e.firefox=!0,e.version=i[1]),r&&(e.ie=!0,e.version=r[1]),n&&(e.edge=!0,e.version=n[1]),a&&(e.weChat=!0),{browser:e,os:{},node:!1,canvasSupported:!!document.createElement("canvas").getContext,svgSupported:"undefined"!=typeof SVGRect,touchEventsSupported:"ontouchstart"in window&&!e.ie&&!e.edge,pointerEventsSupported:"onpointerdown"in window&&(e.edge||e.ie&&11<=e.version),domSupported:"undefined"!=typeof document}}(navigator.userAgent),a={"[object Function]":1,"[object RegExp]":1,"[object Date]":1,"[object Error]":1,"[object CanvasGradient]":1,"[object CanvasPattern]":1,"[object Image]":1,"[object Canvas]":1},s={"[object Int8Array]":1,"[object Uint8Array]":1,"[object Uint8ClampedArray]":1,"[object Int16Array]":1,"[object Uint16Array]":1,"[object Int32Array]":1,"[object Uint32Array]":1,"[object Float32Array]":1,"[object Float64Array]":1},o=Object.prototype.toString,h=Array.prototype,l=h.forEach,u=h.filter,c=h.slice,d=h.map,p=h.reduce,f={};function g(t){if(null==t||"object"!=typeof t)return t;var e=t,i=o.call(t);if("[object Array]"===i){if(!N(t)){e=[];for(var r=0,n=t.length;r>1)%2;s.style.cssText=["position:absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","width:0","height:0",r[o]+":0",n[h]+":0",r[1-o]+":auto",n[1-h]+":auto",""].join("!important;"),t.appendChild(s),i.push(s)}return i}(t,o),o);if(h)return h(yt,r,a),i.zrX=yt[0],void(i.zrY=yt[1])}i.zrX=i.zrY=0}function bt(t){return t||window.event}function wt(t,e,i){if(null!=(e=bt(e)).zrX)return e;var r=e.type;if(r&&0<=r.indexOf("touch")){var n="touchend"!==r?e.targetTouches[0]:e.changedTouches[0];n&&_t(t,n,e,i)}else _t(t,e,e,i),e.zrDelta=e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;var a=e.button;return null==e.which&&void 0!==a&&vt.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}function St(){this._track=[]}var kt=gt?function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0}:function(t){t.returnValue=!1,t.cancelBubble=!0};function Pt(t){var e=t[1][0]-t[0][0],i=t[1][1]-t[0][1];return Math.sqrt(e*e+i*i)}St.prototype={constructor:St,recognize:function(t,e,i){return this._doTrack(t,e,i),this._recognize(t)},clear:function(){return this._track.length=0,this},_doTrack:function(t,e,i){var r=t.touches;if(r){for(var n={points:[],touches:[],target:e,event:t},a=0,s=r.length;ar.getWidth()||i<0||i>r.getHeight()}At.prototype={constructor:At,setHandlerProxy:function(t){this.proxy&&this.proxy.dispose(),t&&(P(Ct,(function(e){t.on&&t.on(e,this[e],this)}),this),t.handler=this),this.proxy=t},mousemove:function(t){var e=t.zrX,i=t.zrY,r=zt(this,e,i),n=this._hovered,a=n.target;a&&!a.__zr&&(a=(n=this.findHover(n.x,n.y)).target);var s=this._hovered=r?{x:e,y:i}:this.findHover(e,i),o=s.target,h=this.proxy;h.setCursor&&h.setCursor(o?o.cursor:"default"),a&&o!==a&&this.dispatchToElement(n,"mouseout",t),this.dispatchToElement(s,"mousemove",t),o&&o!==a&&this.dispatchToElement(s,"mouseover",t)},mouseout:function(t){var e=t.zrEventControl,i=t.zrIsToLocalDOM;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&(i||this.trigger("globalout",{type:"globalout",event:t}))},resize:function(t){this._hovered={}},dispatch:function(t,e){var i=this[t];i&&i.call(this,e)},dispose:function(){this.proxy.dispose(),this.storage=this.proxy=this.painter=null},setCursorStyle:function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},dispatchToElement:function(t,e,i){var r=(t=t||{}).target;if(!r||!r.silent){for(var n="on"+e,a=function(t,e,i){return{type:t,event:i,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:i.zrX,offsetY:i.zrY,gestureEvent:i.gestureEvent,pinchX:i.pinchX,pinchY:i.pinchY,pinchScale:i.pinchScale,wheelDelta:i.zrDelta,zrByTouch:i.zrByTouch,which:i.which,stop:Tt}}(e,t,i);r&&(r[n]&&(a.cancelBubble=r[n].call(r,a)),r.trigger(e,a),r=r.parent,!a.cancelBubble););a.cancelBubble||(this.trigger(e,a),this.painter&&this.painter.eachOtherLayer((function(t){"function"==typeof t[n]&&t[n].call(t,a),t.trigger&&t.trigger(e,a)})))}},findHover:function(t,e,i){for(var r=this.storage.getDisplayList(),n={x:t,y:e},a=r.length-1;0<=a;a--){var s;if(r[a]!==i&&!r[a].ignore&&(s=Lt(r[a],t,e))&&(n.topTarget||(n.topTarget=r[a]),"silent"!==s)){n.target=r[a];break}}return n},processGesture:function(t,e){this._gestureMgr||(this._gestureMgr=new St);var i=this._gestureMgr;"start"===e&&i.clear();var r=i.recognize(t,this.findHover(t.zrX,t.zrY,null).target,this.proxy.dom);if("end"===e&&i.clear(),r){var n=r.type;t.gestureEvent=n,this.dispatchToElement({target:r.target},n,r.event)}}},P(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(t){At.prototype[t]=function(e){var i,r,n=e.zrX,a=e.zrY,s=zt(this,n,a);if("mouseup"===t&&s||(r=(i=this.findHover(n,a)).target),"mousedown"===t)this._downEl=r,this._downPoint=[e.zrX,e.zrY],this._upEl=r;else if("mouseup"===t)this._upEl=r;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||4=this._maxSize&&0>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1),fe(t,e),e):void ue(e,0,0,0,1):7===n.length?0<=(r=parseInt(n.substr(1),16))&&r<=16777215?(ue(e,(16711680&r)>>16,(65280&r)>>8,255&r,1),fe(t,e),e):void ue(e,0,0,0,1):void 0;var a=n.indexOf("("),s=n.indexOf(")");if(-1!==a&&s+1===n.length){var o=n.substr(0,a),h=n.substr(a+1,s-(a+1)).split(","),l=1;switch(o){case"rgba":if(4!==h.length)return void ue(e,0,0,0,1);l=oe(h.pop());case"rgb":return 3!==h.length?void ue(e,0,0,0,1):(ue(e,se(h[0]),se(h[1]),se(h[2]),l),fe(t,e),e);case"hsla":return 4!==h.length?void ue(e,0,0,0,1):(h[3]=oe(h[3]),ve(h,e),fe(t,e),e);case"hsl":return 3!==h.length?void ue(e,0,0,0,1):(ve(h,e),fe(t,e),e);default:return}}ue(e,0,0,0,1)}}function ve(t,e){var i=(parseFloat(t[0])%360+360)%360/360,r=oe(t[1]),n=oe(t[2]),a=n<=.5?n*(r+1):n+r-n*r,s=2*n-a;return ue(e=e||[],ne(255*he(s,a,i+1/3)),ne(255*he(s,a,i)),ne(255*he(s,a,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}function me(t){var e=ge(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function ye(t,e,i){if(e&&e.length&&0<=t&&t<=1){i=i||[];var r=t*(e.length-1),n=Math.floor(r),a=Math.ceil(r),s=e[n],o=e[a],h=r-n;return i[0]=ne(le(s[0],o[0],h)),i[1]=ne(le(s[1],o[1],h)),i[2]=ne(le(s[2],o[2],h)),i[3]=ae(le(s[3],o[3],h)),i}}var _e=ye;function xe(t,e,i){if(e&&e.length&&0<=t&&t<=1){var r=t*(e.length-1),n=Math.floor(r),a=Math.ceil(r),s=ge(e[n]),o=ge(e[a]),h=r-n,l=we([ne(le(s[0],o[0],h)),ne(le(s[1],o[1],h)),ne(le(s[2],o[2],h)),ae(le(s[3],o[3],h))],"rgba");return i?{color:l,leftIndex:n,rightIndex:a,value:r}:l}}var be=xe;function we(t,e){if(t&&t.length){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}}var Se=(Object.freeze||Object)({parse:ge,lift:function(t,e){var i=ge(t);if(i){for(var r=0;r<3;r++)i[r]=e<0?i[r]*(1-e)|0:(255-i[r])*e+i[r]|0,255e);i++);i=Math.min(i-1,l-2)}C=e;var r=g[(A=i)+1]-g[i];if(0!=r)if(S=(e-g[i])/r,h)if(M=v[i],P=v[0===i?i:i-1],T=v[l-2>>1])<0?h=a:o=1+a;var l=r-o;switch(l){case 3:t[o+3]=t[o+2];case 2:t[o+2]=t[o+1];case 1:t[o+1]=t[o];break;default:for(;0>>1);0>>1);a(t,e[i+u])<0?h=u:s=u+1}return h}function ni(t,e){var i,r,n=7,a=0,s=[];function o(o){var h=i[o],l=r[o],u=i[o+1],c=r[o+1];r[o]=l+c,o===a-3&&(i[o+1]=i[o+2],r[o+1]=r[o+2]),a--;var d=ri(t[u],t,h,l,0,e);h+=d,0!=(l-=d)&&0!==(c=ii(t[h+l-1],t,u,c,c-1,e))&&(l<=c?function(i,r,a,o){var h=0;for(h=0;hr[t+1])break;o(t)}},this.forceMergeRuns=function(){for(;1>=1;return t+e}(n);do{if((a=ti(t,i,r,e))=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},clone:function(){return new Ke(this.x,this.y,this.width,this.height)},copy:function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},Je.prototype={constructor:Je,isGroup:!0,type:"group",silent:!(Ke.create=function(t){return new Ke(t.x,t.y,t.width,t.height)}),children:function(){return this._children.slice()},childAt:function(t){return this._children[t]},childOfName:function(t){for(var e=this._children,i=0;i=e.maxIterations){t+=e.ellipsis;break}var o=0===s?Hi(t,n,e.ascCharWidth,e.cnCharWidth):0p)return{lines:[],width:0,height:0};A.textWidth=Ii(A.text,b);var S=_.textWidth,k=null==S||"auto"===S;if("string"==typeof S&&"%"===S.charAt(S.length-1))A.percentWidth=S,l.push(A),S=0;else{if(k){S=A.textWidth;var P=_.textBackgroundColor,M=P&&P.image;M&&Ai(M=Mi(M))&&(S=Math.max(S,M.width*w/M.height))}var T=x?x[1]+x[3]:0;S+=T;var O=null!=d?d-m:null;null!=O&&Or[0]){for(s=0;st);s++);a=i[r[s]]}if(r.splice(s+1,0,t),!(i[t]=e).virtual)if(a){var h=a.dom;h.nextSibling?o.insertBefore(e.dom,h.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom)}else Ue("Layer of zlevel "+t+" is not valid")},eachLayer:function(t,e){var i,r,n=this._zlevelList;for(r=0;rthis._ux||Bn(e-this._yi)>this._uy||this._len<5;return this.addData(Tn.L,t,e),this._ctx&&i&&(this._needsDash()?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),i&&(this._xi=t,this._yi=e),this},bezierCurveTo:function(t,e,i,r,n,a){return this.addData(Tn.C,t,e,i,r,n,a),this._ctx&&(this._needsDash()?this._dashedBezierTo(t,e,i,r,n,a):this._ctx.bezierCurveTo(t,e,i,r,n,a)),this._xi=n,this._yi=a,this},quadraticCurveTo:function(t,e,i,r){return this.addData(Tn.Q,t,e,i,r),this._ctx&&(this._needsDash()?this._dashedQuadraticTo(t,e,i,r):this._ctx.quadraticCurveTo(t,e,i,r)),this._xi=i,this._yi=r,this},arc:function(t,e,i,r,n,a){return this.addData(Tn.A,t,e,i,i,r,n-r,0,a?0:1),this._ctx&&this._ctx.arc(t,e,i,r,n,a),this._xi=Dn(n)*i+t,this._yi=In(n)*i+e,this},arcTo:function(t,e,i,r,n){return this._ctx&&this._ctx.arcTo(t,e,i,r,n),this},rect:function(t,e,i,r){return this._ctx&&this._ctx.rect(t,e,i,r),this.addData(Tn.R,t,e,i,r),this},closePath:function(){this.addData(Tn.Z);var t=this._ctx,e=this._x0,i=this._y0;return t&&(this._needsDash()&&this._dashedLineTo(e,i),t.closePath()),this._xi=e,this._yi=i,this},fill:function(t){t&&t.fill(),this.toStatic()},stroke:function(t){t&&t.stroke(),this.toStatic()},setLineDash:function(t){if(t instanceof Array){this._lineDash=t;for(var e=this._dashIdx=0,i=0;ie.length&&(this._expandData(),e=this.data);for(var i=0;ih||Bn(s-n)>l||c===u-1)&&(t.lineTo(a,s),r=a,n=s);break;case Tn.C:t.bezierCurveTo(o[c++],o[c++],o[c++],o[c++],o[c++],o[c++]),r=o[c-2],n=o[c-1];break;case Tn.Q:t.quadraticCurveTo(o[c++],o[c++],o[c++],o[c++]),r=o[c-2],n=o[c-1];break;case Tn.A:var p=o[c++],f=o[c++],g=o[c++],v=o[c++],m=o[c++],y=o[c++],_=o[c++],x=o[c++],b=v=Qn[r=0]+t&&s<=Qn[1]+t?u:0}a?(h=r,r=Wn(n),n=Wn(h)):(r=Wn(r),n=Wn(n)),nMath.PI/2&&f<1.5*Math.PI&&(u=-u),c+=u)}}return c}function ea(t,e,i,r,n){for(var a=0,s=0,o=0,h=0,l=0,u=0;u=n&&a<=l+1){for(var u=[],c=0;c=n&&a<=c+1)return $s(0,o.components);h[i]=o}else h[i]=void 0}var f;s++}for(;s<=o;){var p=d();if(p)return p}},pushComponent:function(t,e,i){var r=t[t.length-1];r&&r.added===e&&r.removed===i?t[t.length-1]={count:r.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon:function(t,e,i,r){for(var n=e.length,a=i.length,s=t.newPos,o=s-r,h=0;s+1')}}catch(t){po=function(t){return mo.createElement("<"+t+' xmlns="'+fo+'" class="zrvml">')}}var _o,xo=Nn.CMD,bo=Math.round,wo=Math.sqrt,So=Math.abs,ko=Math.cos,Po=Math.sin,Mo=Math.max;if(!n.canvasSupported){var To=",",Oo="progid:DXImageTransform.Microsoft",Ao=21600,Co=Ao/2,Lo=function(t){t.style.cssText="position:absolute;left:0;top:0;width:1px;height:1px;",t.coordsize=Ao+","+Ao,t.coordorigin="0,0"},zo=function(t,e,i){return"rgb("+[t,e,i].join(",")+")"},Eo=function(t,e){e&&t&&e.parentNode!==t&&t.appendChild(e)},Do=function(t,e){e&&t&&e.parentNode===t&&t.removeChild(e)},Io=function(t,e,i){return 1e5*(parseFloat(t)||0)+1e3*(parseFloat(e)||0)+i},Ro=pr,Bo=function(t,e,i){var r=ge(e);i=+i,isNaN(i)&&(i=1),r&&(t.color=zo(r[0],r[1],r[2]),t.opacity=i*r[3])},Fo=function(t,e,i,r){var n="fill"===e,a=t.getElementsByTagName(e)[0];null!=i[e]&&"none"!==i[e]&&(n||!n&&i.lineWidth)?(t[n?"filled":"stroked"]="true",i[e]instanceof Da&&Do(t,a),a=a||yo(e),n?function(t,e,i){var r,n=e.fill;if(null!=n)if(n instanceof Da){var a,s=0,o=[0,0],h=0,l=1,u=i.getBoundingRect(),c=u.width,d=u.height;if("linear"===n.type){a="gradient";var p=i.transform,f=[n.x*c,n.y*d],g=[n.x2*c,n.y2*d];p&&(nt(f,f,p),nt(g,g,p));var v=g[0]-f[0],m=g[1]-f[1];(s=180*Math.atan2(v,m)/Math.PI)<0&&(s+=360),s<1e-6&&(s=0)}else{a="gradientradial",f=[n.x*c,n.y*d],p=i.transform;var y=i.scale,_=c,x=d;o=[(f[0]-u.x)/_,(f[1]-u.y)/x],p&&nt(f,f,p),_/=y[0]*Ao,x/=y[1]*Ao;var b=Mo(_,x);h=0/b,l=2*n.r/b-h}var w=n.colorStops.slice();w.sort((function(t,e){return t.offset-e.offset}));for(var S=w.length,k=[],P=[],M=0;M{for(let a=0;a{for(let n=0;n{for(let r=0;r{t.attr(i,e[i])}):t.attr(e,i)}updateOriginToCenter(){let t,e,[i,r]=this.zrenderShape.position,n=this.getNaiveBound();if(t=n.x+n.width/2,e=n.y+n.height/2,this.zrenderShape.attr("origin",[t,e]),void 0!==this.originX&&void 0!==this.originY){let n,a,[s,o]=this.zrenderShape.scale;n=(this.originX-t)*(1-s),a=(this.originY-e)*(1-o),this.zrenderShape.attr("position",[i+n,r+a])}this.originX=t,this.originY=e}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(8);var n;!function(t){t[t.ADD=0]="ADD",t[t.REMOVE=1]="REMOVE",t[t.POSITION=2]="POSITION",t[t.ROTATION=3]="ROTATION",t[t.SIZE=4]="SIZE",t[t.STYLE=5]="STYLE"}(n=e.patchType||(e.patchType={}));e.Reconciler=class{constructor(t){this.viewModel=t}reconcileStyle(t,e){let i=[];return Object.keys(e).map(r=>{e[r]!==t[r]&&i.push({name:r,old:t[r],new:e[r]})}),i}reconcileShape(t,e){let i=[];!1===t.isDirty&&!1===e.isDirty||(t instanceof r.PolyLine&&e instanceof r.PolyLine?JSON.stringify(t.prevPath)!==JSON.stringify(e.path)&&i.push({type:n.POSITION,newShape:e,oldShape:t}):t.prevX===e.x&&t.prevY===e.y||i.push({type:n.POSITION,newShape:e,oldShape:t}),t.prevRotation!==e.rotation&&i.push({type:n.ROTATION,newShape:e,oldShape:t}),t.prevWidth===e.width&&t.prevHeight===e.height||i.push({type:n.SIZE,newShape:e,oldShape:t}),this.reconcileStyle(t.prevStyle,e.style).length&&i.push({type:n.STYLE,newShape:e,oldShape:t}),this.patch(i))}reconcileShapeList(t,e){let i=[];for(let r=0;rt.id===a.id);e?(e.visited=!0,this.reconcileShape(e,a)):i.push({type:n.ADD,newShape:a,oldShape:null})}}Object.keys(t).forEach(e=>{t[e].forEach(t=>{!1===t.visited&&i.push({type:n.REMOVE,newShape:null,oldShape:t})})}),this.patch(i)}patch(t){let e,i,a,s;for(s=0;s{t&&this.elementContainer.element.push(this.createElement(t,"element"))})):Object.keys(t).map(e=>{this.elementContainer[e]=[],t[e].map(t=>{t&&this.elementContainer[e].push(this.createElement(t,e))})}),this.linkModel.constructLinks(this.engine.structOption.link,this.elementContainer,this.elementList),this.pointerModel.constructPointers(this.engine.structOption.pointer,this.elementList)}layoutElements(t,e,i){let r=this.elementContainer;1===Object.keys(r).length&&r.element&&(r=r.element),t(r,e,i);for(let t=0;tt===e.elementId)&&(e.x=e.shape.prevX,e.y=e.shape.prevY),e.lastX=e.x,e.lastY=e.y}this.linkModel.drawLinks(),this.pointerModel.drawPointers()}updateShapes(t=[]){let e=t.length?t:this.elementList;for(let t=0;t{t.isDirty=!0}),t.commaShapes.forEach(t=>{t.isDirty=!0})}i.lastX=i.x,i.lastY=i.y}}}getElements(){return this.elementContainer}getElementList(){return this.elementList}createElement(t,e){let i=this.engine.structOption.element,a=e+"#"+t.id,s=null,o=null,h=this.engine.viewOption;s="object"==typeof i?i[e]:i,void 0===s&&(s=r.Element),o=new s(t),o.elementId=a,o.name=e;let l=null,u=null,c=null,d=null;return l=h.element,void 0===l.shape&&(l=l[o.name]),c=l.shape,n.Util.assert(void 0===c,`(${e}) 未指定 shape!`),u=Array.isArray(l.content)?l.content.map(t=>this.parserElementContent(o,t)):this.parserElementContent(o,l.content),d=this.viewModel.createShape(o.elementId,c,Object.assign(Object.assign({},l),{content:u})),o.shape=d,o.width=d.width,o.height=d.height,o.rotation=d.rotation,o.style=d.style,o.layoutOption=h.layout,d.element=o,this.elementList.push(o),o}parserElementContent(t,e){if(e){let i=n.Util.textParser(e);if(Array.isArray(i)){i.map(e=>t[e]).map((t,r)=>{e=e.replace("["+i[r]+"]",t)})}return e}e=null}addLink(t,e,i,r=null,n=null){t[i]&&!Array.isArray(t[i])?t[i]=[t[i],e]:t[i]&&Array.isArray(t[i])?t[i].push(e):t[i]=e,this.linkModel.addLinkPair({element:t,target:e,linkName:i,label:r?r.toString():null,anchorPair:n,sourceLinkTarget:null})}addPointer(t,e,i){this.pointerModel.addPointerPair(t,e,i)}resetData(){this.elementList.forEach(t=>{t.isObsolete=!0}),this.elementList.length=0,this.elementContainer={},this.linkModel.clear(),this.pointerModel.clear()}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(1),n=i(4),a=i(3);e.LinkModel=class{constructor(t,e,i){this.lastLinkPairs=[],this.linkPairs=[],this.labelList=[],this.labelAvoidLevel=2,this.dataModel=t,this.viewModel=e,this.linkOptions=i}constructLinks(t,e,i){0!==t.length&&(t.forEach(t=>{for(let r=0;r(o=this.fetchTargetElements(e,n,i),this.addLinkPair({element:n,target:o,linkName:t,anchorPair:null,label:s,index:r,sourceLinkTarget:i}),o)):(o=this.fetchTargetElements(e,n,a),this.addLinkPair({element:n,target:o,linkName:t,anchorPair:null,label:s,sourceLinkTarget:a}),n[t]=o))}}),this.applyCanceledLink(i),this.lastLinkPairs=this.linkPairs)}addLinkPair(t){if(null===t.target)return;let{element:e,target:i,linkName:r,label:n,index:a,anchorPair:s,sourceLinkTarget:o}=t,h={id:`${e.elementId}-${i.elementId}`,linkName:r,linkShape:null,element:e,target:i,anchorPair:s,anchorPosPair:null,label:n,labelShape:null,index:a,linkShapeStyle:{},sourceLinkTarget:o};this.linkPairs.push(h),e.effectLinks.push(h),i.effectLinks.push(h),e.onLinkTo(i,{style:h.linkShapeStyle,name:r,index:a,label:n}),i.onLinkFrom(e,{style:h.linkShapeStyle,name:r,index:a,label:n})}drawLinks(){for(let t=0;tt.id===i),n||null):(r=t[i.element||e.name],void 0===r?Array.isArray(i)?Array.from(new Array(i.length)).map(t=>null):null:(n=r.find(t=>t.id===i.target),n||null))}getAnchorPair(t,e,i,r){let n=this.contactSolver(this.linkOptions[i].contact,r);return n?[this.getElementAnchor(t,n[0]),this.getElementAnchor(e,n[1])]:null}contactSolver(t,e){return t?Array.isArray(t[0])?void 0===e?t[0]:t[e]:"function"==typeof t&&void 0!==e?t(e):t:null}anchorAvoid(t){let e=this.linkPairs.find(e=>!!e.anchorPosPair&&(e.anchorPosPair[0].toString()===t[1].toString()&&e.anchorPosPair[1].toString()===t[0].toString()));if(e){let i=a.Vector.tangent(a.Vector.subtract(t[1],t[0])),r=a.Vector.tangent(a.Vector.subtract(e.anchorPosPair[1],e.anchorPosPair[0])),n=-6,s=[a.Vector.location(t[0],i,n),a.Vector.location(t[1],i,n)],o=[a.Vector.location(e.anchorPosPair[0],r,n),a.Vector.location(e.anchorPosPair[1],r,n)];return e.linkShape.start.x=o[0][0],e.linkShape.start.y=o[0][1],e.linkShape.end.x=o[1][0],e.linkShape.end.y=o[1][1],e.anchorPosPair=o,s}return t}labelSolver(t,e){if(!t)return null;if(t&&null===e)return t;let i=t,n=r.Util.textParser(t);if(Array.isArray(n)){let t=n.map(t=>{let i=e[t];return void 0===i?null:i});for(let e=0;e{r[t]=i[t]}),r[e]}getDynamicAnchorPos(t,e){let i=[t.x,t.y],r=(t.width>t.height?t.width:t.height)/2,n=[e.x,e.y],s=(e.width>e.height?e.width:e.height)/2,o=a.Vector.subtract(i,n);return[a.Vector.location(i,a.Vector.negative(o),r),a.Vector.location(n,o,s)]}getAnchorPos(t,e){let i=t.x,n=t.y,a=t.shape.width/2,s=t.shape.height/2;return r.Util.anchor2position(i,n,2*a,2*s,t.rotation,e)}applyCanceledLink(t){if(0===this.lastLinkPairs.length)return;let e,i=this.lastLinkPairs.length;for(let r=0;rt.id===e.id)){let i=t.find(t=>t.elementId===e.element.elementId),r=t.find(t=>t.elementId===e.target.elementId);i&&i.onUnlinkTo(e.linkName),r&&r.onUnlinkFrom(e.linkName)}}clear(){this.linkPairs=[],this.labelList.length=0}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(1);e.PointerModel=class{constructor(t,e,i){this.lastPointerPairs=[],this.pointerPairs=[],this.dataModel=t,this.viewModel=e,this.pointerOptions=i}constructPointers(t,e){0!==t.length&&(t.forEach(t=>{for(let i=0;i{let r={id:e+"#"+i,pointerShape:null,label:i,labelShapes:[],commaShapes:[],target:t,pointerName:e,branchPairs:null,masterPair:null,pointerShapeStyle:{}};return t.onRefer(r.pointerShapeStyle,e,i),r});let n=r.shift();r.map(t=>t.masterPair=n),n.branchPairs=r,n.pointerShape=null,this.pointerPairs.push(n,...r),t.effectRefer=n}else{let r={id:e+"#"+i,pointerShape:null,label:i,labelShapes:[],commaShapes:[],target:t,pointerName:e,branchPairs:null,masterPair:null,pointerShapeStyle:{}};this.pointerPairs.push(r),t.effectRefer=r,t.onRefer(r.pointerShapeStyle,e,i)}}drawPointers(){const t={top:(t,e,i)=>[0,-e/2-i],right:(t,e,i)=>[t/2+i,0],bottom:(t,e,i)=>[0,e/2+i],left:(t,e,i)=>[-t/2-i,0]};for(let e=0;ethis.viewModel.createShape(s+"-"+t.label+"-text","text",{style:p,content:t.label,show:f})));let P=0;v.map((t,e)=>{let r="left"===d?-1:1,n=0===e?g.style.lineWidth+4:l;t.y=S[1],t.x=S[0]+r*(P+n),P=P+t.width+n,e>0&&h.showComma&&i.commaShapes.push(this.drawComma(t,h))}),i.labelShapes=v}}drawComma(t,e){let i=t.id+"-comma",r=this.viewModel.createShape(i,"text",{content:",",show:e.show,style:Object.assign(Object.assign({},e.labelStyle),{textBackgroundColor:"transparent",textFill:"#000",textPadding:[0,0,0,0],fontSize:20})}),n=r.style.fontSize;return r.x=t.x-e.labelInterval/2-n/8,r.y=t.y+t.height/2-n/2,r}updateReferPos(t){if(t.masterPair)return;let e=t.pointerShape,i=t.labelShapes,r=t.target,n=t.commaShapes,a=r.x-r.lastX,s=r.y-r.lastY;e.start.x+=a,e.start.y+=s,e.end.x+=a,e.end.y+=s,i.map(t=>{t.x+=a,t.y+=s}),n.map(t=>{t.x+=a,t.y+=s})}applyCanceledRefer(t){if(0===this.lastPointerPairs.length)return;let e,i=this.lastPointerPairs.length;for(let r=0;rt.id===e.id)){let i=t.find(t=>t.elementId===e.target.elementId);i&&i.onUnrefer(e.pointerName)}}clear(){this.pointerPairs=[]}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.DefaultLinkOption=class{constructor(){this.markers=null,this.curveness=0,this.contact=null,this.label=null,this.style={fill:"#000",lineWidth:2},this.labelStyle={textBackgroundColor:"rgba(0, 0, 0, 1)",textFill:"#fff"},this.show="scale"}};e.DefaultPointerOption=class{constructor(){this.length=30,this.offset=15,this.labelInterval=10,this.position="top",this.markers="arrow",this.labelStyle={textBackgroundColor:"rgba(0, 0, 0, 1)",textFill:"#fff",textPadding:[4,4,4,4]},this.style={fill:"#666",lineWidth:4},this.showComma=!0,this.show="scale"}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(1),n=i(4),a=i(3);class s{constructor(...t){this.elements=[],this.elementId=r.Util.generateId(),t&&this.add(...t)}add(...t){t.map(t=>{this.elements.push(t)})}remove(t){r.Util.removeFromList(this.elements,e=>e.elementId===t.elementId)}getBound(){return n.Bound.union(...this.elements.map(t=>t.getBound()))}getWidth(){return this.getBound().width}getHeight(){return this.getBound().height}translate(t,e){this.elements.map(i=>{i instanceof s?i.translate(t,e):(i.x+=t,i.y+=e)})}rotate(t,e){if(0===t)return;let{x:i,y:r,width:n,height:o}=this.getBound(),h=i+n/2,l=r+o/2;e&&(h=e[0],l=e[1]),this.elements.map(e=>{if(e instanceof s)e.rotate(t,[h,l]);else{let i=a.Vector.rotation(t,[e.x,e.y],[h,l]);e.x=i[0],e.y=i[1],e.rotation=t}})}clear(){this.elements.length=0}}e.Group=s},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.SourcesProxy=class{constructor(t){this.revocableObject=null,this.updateEngineRequest=0,this.updateEngineDelayCount=0,this.engine=t}proxy(t){return Object.keys(t).map(e=>{"object"==typeof t[e]&&null!==t[e]&&(t[e]=this.proxy(t[e]))}),this.revocableObject=Proxy.revocable(t,{set:(t,e,i)=>(this.updateEngineRequest++,this.updateEngine(),Reflect.set(t,e,i)),deleteProperty:(t,e)=>(this.updateEngineRequest++,this.updateEngine(),Reflect.deleteProperty(t,e)),defineProperty:(t,e,i)=>(this.updateEngineRequest++,this.updateEngine(),Reflect.defineProperty(t,e,i))}),this.revocableObject.proxy}revoke(t){this.revocableObject.revoke(t)}updateEngine(){requestAnimationFrame(()=>{this.updateEngineDelayCount++,this.updateEngineDelayCount===this.updateEngineRequest&&(this.engine.source(this.engine.proxySources,!0),this.updateEngineRequest=this.updateEngineDelayCount=0)})}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(29),n=i(30),a=i(31),s=i(32),o=i(33);e.InteractionModel=class{constructor(t){this.interactionConstructorMap={zoomView:r.Zoom,moveView:n.Move,drag:a.Drag,focus:s.Focus,frameSelect:o.Zone},this.interactionMap={},this.dataStore={selectedElements:null},this.engine=t}applyInteractions(t){Object.keys(t).map(e=>{if(void 0===this.interactionMap[e]){if(!t[e])return;let i=this.interactionConstructorMap[e];if(void 0===i)return;let r=new i(e,this,this.engine);this.interactionMap[e]=r,r.setOptionVal(t[e]),r.init()}else this.interactionMap[e].setOptionVal(t[e]),this.interactionMap[e].update(),t[e]?this.interactionMap[e].toggleEnable(!0):this.interactionMap[e].toggleEnable(!1)})}getInteraction(t){return this.interactionMap[t]}trigger(t,e){this.interactionMap[t]&&this.interactionMap[t].isEnable&&this.interactionMap[t].trigger(e)}handler(t,e){if(!1===this.engine.isViewUpdating()&&this.interactionMap[t]&&this.interactionMap[t].isEnable){let i=this.interactionMap[t].handler(e);if(!1===i||void 0===i)return;this.engine.updateElement(Array.isArray(i)?i:[],!1)}}finish(t,e){this.interactionMap[t]&&this.interactionMap[t].isEnable&&this.interactionMap[t].finish(e)}getData(t){return this.dataStore[t]}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(6),n=i(1),a=i(0);class s extends r.Interaction{constructor(){super(...arguments),this.zoomDelta=.25,this.maxZoomValue=4,this.minZoomValue=.25}init(){let t=this.optionValue,e=this.renderer.getContainer();Array.isArray(t)&&this.clampZoomRange(t),e.addEventListener("mousewheel",t=>this.emitTrigger(t))}update(){let t=this.optionValue;Array.isArray(t)&&this.clampZoomRange(t)}handler(t){if(this.getData("moving"))return;let e=this.renderer.getGlobalShape(),[i,r]=e.getScale();return i+=t*this.zoomDelta,r+=t*this.zoomDelta,i=n.Util.clamp(i,this.maxZoomValue,this.minZoomValue),r=n.Util.clamp(r,this.maxZoomValue,this.minZoomValue),i!==this.minZoomValue&&i!==this.maxZoomValue&&r!==this.minZoomValue&&r!==this.maxZoomValue?(e.scale(i,r,a.zrenderUpdateType.TICK),this.renderer.toggleAutoScale(!1),!0):void 0}trigger(t){this.emitHandler(t.wheelDelta>0?1:-1)}triggerCondition(){return!this.getData("enableFrameSelect")}clampZoomRange(t){this.minZoomValue=t[0],this.maxZoomValue=t[1],this.minZoomValue=n.Util.clamp(this.minZoomValue,0,1/0),this.maxZoomValue=n.Util.clamp(this.maxZoomValue,0,1/0)}}e.Zoom=s},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(6),n=i(0);class a extends r.Interaction{constructor(){super(...arguments),this.enableMove=!1}init(){this.container=this.renderer.getContainer(),this.container.addEventListener("mousedown",t=>this.emitTrigger(t)),this.container.addEventListener("mousemove",t=>this.emitHandler(t)),this.container.addEventListener("mouseup",()=>this.emitFinish()),this.container.addEventListener("mouseleave",()=>this.emitFinish())}trigger(t){this.globalShape=this.renderer.getGlobalShape(),this.curX=t.clientX,this.curY=t.clientY,this.moveFactorX=1,this.moveFactorY=1,this.enableMove=!0,this.setData("moving",!0)}handler(t){if(!1===this.enableMove)return;let e=t.clientX,i=t.clientY,r=(e-this.curX)*this.moveFactorX,a=(i-this.curY)*this.moveFactorY;return this.curX=e,this.curY=i,this.globalShape.translate(r,a,n.zrenderUpdateType.TICK),!0}finish(){this.enableMove&&(this.enableMove=!1,this.renderer.toggleAutoPosition(!1),this.setData("moving",!1))}triggerCondition(){return!this.getData("dragging")&&!this.getData("enableFrameSelect")}}e.Move=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(6);class n extends r.Interaction{constructor(){super(...arguments),this.draggableShapes={},this.curDraggableShapes=[]}init(){let t=this.renderer.getContainer();this.zr.on("mousedown",t=>this.emitTrigger(t)),t.addEventListener("mousemove",t=>{let e=t.offsetX,i=t.offsetY;this.emitHandler({x:e,y:i})}),this.zr.on("mouseup",()=>this.emitFinish()),this.globalShape=this.renderer.getGlobalShape()}trigger(t){let e=t.offsetX,i=t.offsetY,r=this.optionValue,n=this.getData("selectedElements"),a=[];if(n)a=Array.isArray(r)?n.filter(t=>r.find(e=>e===t.name)):n;else{let e=t.topTarget,i=e?e.svShape.element:null;if(null==e||null===i)return;if(Array.isArray(r)&&void 0===r.find(t=>t===i.name))return;a=[i]}a.forEach(t=>{void 0===this.draggableShapes[t.elementId]&&(this.draggableShapes[t.elementId]={lastX:0,lastY:0,element:null}),t.isDragged=!0,this.draggableShapes[t.elementId].lastX=e,this.draggableShapes[t.elementId].lastY=i,this.draggableShapes[t.elementId].element=t,this.curDraggableShapes.push(this.draggableShapes[t.elementId])}),this.setData("dragging",!0)}handler(t){if(!this.getData("dragging"))return;let e=t.x,i=t.y,r=this.globalShape.getScale();for(let t=0;tt.element)}finish(){this.curDraggableShapes.length=0,this.setData("dragging",!1),this.renderer.toggleAutoScale(!1),this.renderer.toggleAutoPosition(!1)}triggerCondition(){return!this.getData("enableFrameSelect")}getDraggableZrenderShape(t,e){let i=[];return!0===e?i=t:t.forEach(t=>{e.find(e=>e===t.name)&&i.push(t)}),i.map(t=>t.shape.zrenderShape)}}e.Drag=n},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(6),n=i(1);class a extends r.Interaction{constructor(){super(...arguments),this.lastFocusElements=[],this.curFocusElements=[]}init(){this.zr.on("mousedown",t=>this.emitTrigger(t))}trigger(t){let e=this.getData("selectedElements");if(e)this.emitHandler(e);else{let e=t.target,i=e?e.svShape.element:null;if(void 0===e){if(0===this.curFocusElements.length)return;return void this.emitHandler(null)}if(null===i)return;if(this.lastFocusElements.length&&this.lastFocusElements.find(t=>t.element.elementId===i.elementId))return;this.emitHandler([i])}}handler(t){let e=[];if(null===t)return e=this.curFocusElements,this.restoreLast(e),this.curFocusElements=[],this.lastFocusElements=[],e.map(t=>t.element);{let e=[];return this.lastFocusElements.length&&(this.restoreLast(this.lastFocusElements),e.push(...this.lastFocusElements)),this.curFocusElements=[],t.forEach(t=>{let e=this.optionValue;this.curFocusElements.push({element:t,originStyle:JSON.stringify(t.style)}),n.Util.merge(t.style,e)}),this.lastFocusElements=this.curFocusElements,e.push(...this.curFocusElements),e.map(t=>t.element)}}triggerCondition(){return!this.getData("enableFrameSelect")}restoreLast(t){t.forEach(t=>{t.element.style=JSON.parse(t.originStyle)})}}e.Focus=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(6),n=i(0);class a extends r.Interaction{constructor(){super(...arguments),this.selectRect=null,this.finishSizing=!1,this.frameSelecting=!1,this.enableMoveRect=!1}init(){let t=this.renderer.getContainer();t.addEventListener("mousedown",t=>this.emitTrigger(t)),t.addEventListener("mousemove",t=>this.emitHandler(t)),t.addEventListener("mouseup",()=>this.emitFinish()),this.globalShape=this.renderer.getGlobalShape(),this.selectRect=new n.Renderer.zrender.Rect({position:[0,0],shape:{x:0,y:0,width:0,height:0},style:this.optionValue,z:2}),this.renderer.getZrender().add(this.selectRect),this.selectRect.hide(),this.setData("enableFrameSelect",!0)}update(){!1===this.optionValue||void 0===this.optionValue?(this.restoreSelect(),this.setData("enableFrameSelect",!1)):this.setData("enableFrameSelect",!0)}trigger(t){let e=t.offsetX,i=t.offsetY;if(this.finishSizing){if(this.selectRect.contain(e,i))return this.lastRectX=e,this.lastRectY=i,this.enableMoveRect=!0,void this.interactionModel.trigger("drag",{offsetX:e,offsetY:i});this.restoreSelect()}this.selectRect.attr("shape",{x:e,y:i}),this.selectRect.attr("style",this.optionValue),this.downX=e,this.downY=i,this.selectRect.show(),this.frameSelecting=!0}handler(t){if(!this.frameSelecting)return;let e=t.offsetX,i=t.offsetY;if(this.finishSizing)this.moveRect(e,i);else{let t=e-this.downX,r=i-this.downY;this.selectRect.attr("shape",{width:t,height:r})}return!1}finish(){if(this.getData("enableFrameSelect")){if(this.frameSelecting){if(!1===this.finishSizing){let t=this.calcSelectedElements();this.finishSizing=!0,this.setData("selectedElements",t),this.interactionModel.trigger("focus")}}else this.finishSizing=!1;this.enableMoveRect&&(this.enableMoveRect=!1)}}moveRect(t,e){if(!this.enableMoveRect)return;let i=t-this.lastRectX,r=e-this.lastRectY,n=this.selectRect.shape.x,a=this.selectRect.shape.y;this.lastRectX=t,this.lastRectY=e,this.selectRect.attr("shape",{x:n+i,y:a+r}),this.interactionModel.handler("drag",{x:t,y:e})}restoreSelect(){this.selectRect.hide(),this.selectRect.attr("shape",{width:0,height:0}),this.finishSizing=!1,this.frameSelecting=!1,this.setData("selectedElements",null),this.interactionModel.finish("drag")}calcSelectedElements(){let{x:t,y:e,width:i,height:r}=this.selectRect.getBoundingRect();return this.globalShape.getZrenderShape().updateTransform(),this.elementList.filter(n=>{let a=n.shape.zrenderShape,s=null;return a.updateTransform(),s=a.getBoundingRect(),s.applyTransform(a.transform),s.x>=t&&s.y>=e&&s.x+s.width<=t+i&&s.y+s.height<=e+r})}}e.Zone=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(2);let n=i(0).Renderer.zrender.Path.extend({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.height,r=e.width,n=e.x,a=e.y,s=r/3*2;t.moveTo(n,a),t.lineTo(n+s,a+i),t.lineTo(n,a+i/4*3),t.lineTo(n-s,a+i),t.lineTo(n,a),t.closePath()}});class a extends r.Shape{constructor(t,e,i){super(t,e,i)}createZrenderShape(){return new n({position:[this.x,this.y],rotation:this.rotation,shape:{x:0,y:-this.height/2,width:this.width,height:this.height},style:this.style,z:this.option.zIndex})}}e.Arrow=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(5),n=i(1),a=i(14);class s extends r.Composite{constructor(t,e,i){let r,n;super(t,e,i),this.start={x:0,y:0},this.end={x:0,y:0},this.option.markers&&("string"==typeof this.option.markers?n=this.option.markers:(r=this.option.markers[0],n=this.option.markers[1])),this.addSubShape({line:{shapeName:this.option.curveness?"curve":"polyLine",init:(t,e)=>({style:{stroke:e.fill,fill:null}}),draw:(t,e)=>{let i=t.start,r=t.end;e.path=[[i.x,i.y],[r.x,r.y]],e instanceof a.Curve&&(e.controlPoint=e.calcControlPoint(i,r))}},fromMarker:r?{shapeName:r,init:()=>({zIndex:2}),draw:(t,e)=>{let i=t.start;e.x=i.x,e.y=i.y,e.rotation=t.tangentAt(0)+Math.PI,e.width=t.getSubShape("line").style.lineWidth+5,e.height=e.width}}:null,toMarker:n?{shapeName:n,init:()=>({zIndex:2}),draw:(t,e)=>{let i=t.end;e.x=i.x,e.y=i.y,e.rotation=t.tangentAt(1),e.width=t.getSubShape("line").style.lineWidth+5,e.height=e.width}}:null})}defaultOption(t){return Object.assign(Object.assign({},t),{curveness:0,markers:"",zIndex:0})}defaultStyle(t){return Object.assign(Object.assign({},t),{smooth:0,lineDash:null})}pointAt(t){let e=this.getSubShape("line"),i=this.start.x,r=this.start.y,n=this.end.x,a=this.end.y;if("polyLine"===e.name)return[i*(1-t)+n*t,r*(1-t)+a*t];if("curve"===e.name){let[s,o]=e.calcControlPoint(this.start,this.end);return[(1-t)*((1-t)*i+2*t*s)+Math.pow(t,2)*n,(1-t)*((1-t)*r+2*t*o)+Math.pow(t,2)*a]}}tangentAt(t){let e=this.getSubShape("line"),i=this.start.x,r=this.start.y,a=this.end.x,s=this.end.y;if("polyLine"===e.name){if(a===i)return r{let i=t.width/6;e.y=t.y,e.x=t.x-i,e.height=t.height,e.width=4*i}},fieldBlock:{shapeName:"rect",init:(t,e)=>({zIndex:-1,content:"^",style:{fill:e.fieldColor,textFill:e.fieldEmpty?"#000":"rgba(0, 0, 0, 0)"}}),draw:(t,e)=>{let i=t.width/6;e.y=t.y,e.x=t.x+2*i,e.width=t.width/3,e.height=t.height}}})}defaultStyle(t){return Object.assign(Object.assign({},t),{fieldColor:"#eee",fieldEmpty:!0})}defaultAnchors(t,e){return Object.assign(Object.assign({},t),{1:[e/3,0]})}}e.Node=n},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=i(5),n={shapeName:"rect",init:(t,e)=>({zIndex:-1,content:"^",style:{fill:"#eee",textFill:e.leftFieldEmpty?"#000":"rgba(0, 0, 0, 0)"}}),draw:(t,e)=>{let i=t.width/8;e.y=t.y,e.x=t.x-3*i,e.width=t.width/4,e.height=t.height}};class a extends r.Composite{constructor(t,e,i){super(t,e,i),this.addSubShape({block:{shapeName:"rect",draw:(t,e)=>{let i=t.width/4;e.y=t.y,e.x=t.x,e.height=t.height,e.width=2*i}},leftFieldBlock:Object.assign({},n),rightFieldBlock:Object.assign(Object.assign({},n),{init:(t,e)=>({zIndex:-1,content:"^",style:{fill:e.fieldColor,textFill:e.rightFieldEmpty?"#000":"rgba(0, 0, 0, 0)"}}),draw:(t,e)=>{let i=t.width/8;e.y=t.y,e.x=t.x+3*i,e.width=t.width/4,e.height=t.height}})})}defaultStyle(t){return Object.assign(Object.assign({},t),{fieldColor:"#eee",leftFieldEmpty:!0,rightFieldEmpty:!0})}defaultAnchors(t,e){return Object.assign(Object.assign({},t),{1:[e*(3/8),0],3:[3/8*-e,0]})}}e.DualNode=a}])}));