You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
8 lines
240 KiB
8 lines
240 KiB
1 year ago
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("G6",[],e):"object"==typeof exports?exports.G6=e():t.G6=e()}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var i={},r=n(32);i.Color=n(105),i.Layout=n(18),i.Math=n(8),i.Matrix=n(2),i.Tween=n(33),i.Canvas=n(10),i.Graph=n(11),i.Net=n(152),i.Tree=n(81),i.Mind=n(148),i.Global=i.Graph.Global,i.Handler=i.Graph.Handler,i.Shape=i.Graph.Shape,i.Util=i.Graph.Util,i.registNode=i.Graph.registNode,i.registEdge=i.Graph.registEdge,i.registBehaviour=i.Handler.registBehaviour,r.tracking=!0,i.track=function(t){r.tracking=t},n(156),t.exports=i},function(t,e,n){var i=n(101);t.exports=i},function(t,e,n){var i={Matrix3:n(82),Vector2:n(83),Vector3:n(84)};t.exports=i},function(t,e,n){"use strict";function i(t){for(var e=t.superclass.constructor;e.Mode;)t.Mode=r.mix({},e.Mode,t.Mode),e=e.superclass.constructor}var r=n(1),a={resetMode:function(t,e){var n;e._off();for(var i=0;i<t.length;i++)n=a[t[i]],n&&n(e)},registMode:function(t){i(t),r.each(t.Mode,function(t){r.each(t,function(t){try{n(157)("./"+t)}catch(e){throw new Error("there is no such "+t+" behaviour! \u6ca1\u6709"+t+"\u884c\u4e3a\uff01")}})})},registBehaviour:function(t,e){a[t]=e}};t.exports=a},function(t,e,n){"use strict";var i=n(1),r=n(30),a=n(17),o=n(29),s=n(146),u=n(61),c=n(144),h={};i.mix(h,i,o,r,a,s,u,c),t.exports=h},function(t,e,n){var i=n(1),r=n(39),a=n(6),o=n(2).Vector3,s=function(t){s.superclass.constructor.call(this,t)};s.ATTRS={},i.extend(s,r),i.augment(s,{isShape:!0,createPath:function(){},drawInner:function(t){var e=this,n=e.__attrs;e.createPath(t);var r=t.globalAlpha;if(e.hasFill()){var a=n.fillOpacity;i.isNull(a)||1===a?t.fill():(t.globalAlpha=a,t.fill(),t.globalAlpha=r)}if(e.hasStroke()){var o=e.__attrs.lineWidth;if(o>0){var s=n.strokeOpacity;i.isNull(s)||1===s||(t.globalAlpha=s),t.stroke()}}},isPointInPath:function(){return!1},isHitBox:function(){return!0},isHit:function(t,e){var n=this,i=new o(t,e,1);if(n.invert(i),n.isHitBox()){var r=n.getBBox();if(r&&!a.box(r.minX,r.maxX,r.minY,r.maxY,i.x,i.y))return!1}var s=n.__attrs.clip;return s?!!s.inside(t,e)&&n.isPointInPath(i.x,i.y):n.isPointInPath(i.x,i.y)},calculateBox:function(){return null},clearTotalMatrix:function(){this.__cfg.totalMatrix=null,this.__cfg.region=null},clearBBox:function(){this.__cfg.box=null,this.__cfg.region=null},getBBox:function(){var t=this.__cfg.box;return t||(t=this.calculateBox(),t&&(t.x=t.minX,t.y=t.minY,t.width=t.maxX-t.minX,t.height=t.maxY-t.minY),this.__cfg.box=t),t}}),t.exports=s},function(t,e,n){var i=n(21),r=n(22),a=n(16),o=n(20);t.exports={line:function(t,e,n,r,a,o,s){var u=i.box(t,e,n,r,a);if(!this.box(u.minX,u.maxX,u.minY,u.maxY,o,s))return!1;var c=i.pointDistance(t,e,n,r,o,s);return!isNaN(c)&&c<=a/2},polyline:function(t,e,n,i){var r=t.length-1;if(r<1)return!1;for(var a=0;a<r;a++){var o=t[a][0],s=t[a][1],u=t[a+1][0],c=t[a+1][1];if(this.line(o,s,u,c,e,n,i))return!0}return!1},cubicline:function(t,e,n,i,r,o,s,u,c,h,l){return a.pointDistance(t,e,n,i,r,o,s,u,h,l)<=c/2},quadraticline:function(t,e,n,i,a,o,s,u,c){return r.pointDistance(t,e,n,i,a,o,u,c)<=s/2},arcline:function(t,e,n,i,r,a,s,u,c){return o.pointDistance(t,e,n,i,r,a,u,c)<=s/2},rect:function(t,e,n,i,r,a){return t<=r&&r<=t+n&&e<=a&&a<=e+i},circle:function(t,e,n,i,r){return Math.pow(i-t,2)+Math.pow(r-e,2)<=Math.pow(n,2)},box:function(t,e,n,i,r,a){return t<=r&&r<=e&&n<=a&&a<=i}}},function(t,e){"use strict";t.exports={colors:["#4E7CCC","#36B3C3","#4ECDA5","#94E08A","#E2F194","#EDCC72","#F8AB60","#F9815C","#EB4456","#C82B3D"],guide:{},grid:{line:{stroke:"#F5F5F5",lineWidth:1},forceAlign:!0,cell:10},nodeStyle:{stroke:"#666",fill:"#fff",lineWidth:1,radius:4,fillOpacity:.1},delegationStyle:{stroke:"#108EE9",lineDash:[3,3]},nodePadding:[8,16],nodeLabelStyle:{fill:"#666",textAlign:"center",textBaseline:"middle",fontSi
|
||
|
var i=this.nodeSet[e[1]];if(void 0==i)throw new TypeError("invalid node name: "+e[1]);var r=e[2];this.newEdge(n,i,r)}},e.prototype.newNode=function(t){var e=new n(this.nextNodeId++,t);return this.addNode(e),e},e.prototype.newEdge=function(t,e,n){var r=new i(this.nextEdgeId++,t,e,n);return this.addEdge(r),r},e.prototype.loadJSON=function(t){("string"==typeof t||t instanceof String)&&(t=JSON.parse(t)),("nodes"in t||"edges"in t)&&(this.addNodes.apply(this,t.nodes),this.addEdges.apply(this,t.edges))},e.prototype.getEdges=function(t,e){return t.id in this.adjacency&&e.id in this.adjacency[t.id]?this.adjacency[t.id][e.id]:[]},e.prototype.removeNode=function(t){t.id in this.nodeSet&&delete this.nodeSet[t.id];for(var e=this.nodes.length-1;e>=0;e--)this.nodes[e].id===t.id&&this.nodes.splice(e,1);this.detachNode(t)},e.prototype.detachNode=function(t){var e=this.edges.slice();e.forEach(function(e){e.source.id!==t.id&&e.target.id!==t.id||this.removeEdge(e)},this),this.notify()},e.prototype.removeEdge=function(t){for(var e=this.edges.length-1;e>=0;e--)this.edges[e].id===t.id&&this.edges.splice(e,1);for(var n in this.adjacency){for(var i in this.adjacency[n]){for(var r=this.adjacency[n][i],a=r.length-1;a>=0;a--)this.adjacency[n][i][a].id===t.id&&this.adjacency[n][i].splice(a,1);0==this.adjacency[n][i].length&&delete this.adjacency[n][i]}u(this.adjacency[n])&&delete this.adjacency[n]}this.notify()},e.prototype.merge=function(t){var e=[];t.nodes.forEach(function(t){e.push(this.addNode(new n(t.id,t.data)))},this),t.edges.forEach(function(t){var n=e[t.from],r=e[t.to],a=t.directed?a=t.type+"-"+n.id+"-"+r.id:n.id<r.id?t.type+"-"+n.id+"-"+r.id:t.type+"-"+r.id+"-"+n.id,o=this.addEdge(new i(a,n,r,t.data));o.data.type=t.type},this)},e.prototype.filterNodes=function(t){var e=this.nodes.slice();e.forEach(function(e){t(e)||this.removeNode(e)},this)},e.prototype.filterEdges=function(t){var e=this.edges.slice();e.forEach(function(e){t(e)||this.removeEdge(e)},this)},e.prototype.addGraphListener=function(t){this.eventListeners.push(t)},e.prototype.notify=function(){this.eventListeners.forEach(function(t){t.graphChanged()})};var r=t.Layout={};r.ForceDirected=function(t,e,n,i,r){this.graph=t,this.stiffness=e,this.repulsion=n,this.damping=i,this.minEnergyThreshold=r||.01,this.nodePoints={},this.edgeSprings={}},r.ForceDirected.prototype.point=function(t){if(!(t.id in this.nodePoints)){var e=void 0!==t.data.mass?t.data.mass:1;this.nodePoints[t.id]=new r.ForceDirected.Point(o.random(),e)}return this.nodePoints[t.id]},r.ForceDirected.prototype.spring=function(t){if(!(t.id in this.edgeSprings)){var e=void 0!==t.data.length?t.data.length:1,n=!1,i=this.graph.getEdges(t.source,t.target);if(i.forEach(function(t){n===!1&&t.id in this.edgeSprings&&(n=this.edgeSprings[t.id])},this),n!==!1)return new r.ForceDirected.Spring(n.point1,n.point2,0,0);if(this.graph.getEdges(t.target,t.source),i.forEach(function(t){n===!1&&t.id in this.edgeSprings&&(n=this.edgeSprings[t.id])},this),n!==!1)return new r.ForceDirected.Spring(n.point2,n.point1,0,0);this.edgeSprings[t.id]=new r.ForceDirected.Spring(this.point(t.source),this.point(t.target),e,this.stiffness)}return this.edgeSprings[t.id]},r.ForceDirected.prototype.eachNode=function(t){var e=this;this.graph.nodes.forEach(function(n){t.call(e,n,e.point(n))})},r.ForceDirected.prototype.eachEdge=function(t){var e=this;this.graph.edges.forEach(function(n){t.call(e,n,e.spring(n))})},r.ForceDirected.prototype.eachSpring=function(t){var e=this;this.graph.edges.forEach(function(n){t.call(e,e.spring(n))})},r.ForceDirected.prototype.applyCoulombsLaw=function(){this.eachNode(function(t,e){this.eachNode(function(t,n){if(e!==n){var i=e.p.subtract(n.p),r=i.magnitude()+.1,a=i.normalise();e.applyForce(a.multiply(this.repulsion).divide(r*r*.5)),n.applyForce(a.multiply(this.repulsion).divide(r*r*-.5))}})})},r.ForceDirected.prototype.applyHookesLaw=function(){this.eachSpring(function(t){var e=t.point2.p.subtract(t.point1.p),n=t.length-e.magnitude(),i=e.normalise();t.point1.applyForce(i.multiply(t.k*n*-.5)),t.point2.applyForce(i.multiply(t.k*n*.5))}
|
||
|
i}},s={afterDraw:function(){},draw:function(){},style:function(){}};a.registGeom=function(t,e){var n=r.ucfirst(t),i=r.mix({},o,e);return a[n]=i,i.className=n,i},a.registNode=function(t,e,n){var o=a.Node,s=i(o,t,n),u=r.mix({},s,e);return o[t]=u,u},a.registEdge=function(t,e,n){var o=a.Edge,s=i(o,t,n),u=r.mix({},s,e);return o[t]=u,u},a.getShape=function(t){var e=this;return t=r.ucfirst(t),e[t]||a.ShapeBase},a.GeomShape=o,a.ShapeBase=s,t.exports=a},function(t,e,n){"use strict";var i=n(1),r={};i.mix(r,{frameDraw:function(t,e){function n(){t.animateHandler=i.requestAnimationFrame(function(){t.animateHandler=void 0,t.toDraw&&n()}),e(),t.toDraw=!1}t.animateHandler?t.toDraw=!0:n()},drawLabel:function(t,e,n){return t.addShape("text",{attrs:e,class:"label",zIndex:n,freezePoint:{x:e.x,y:e.y}})}}),t.exports=r},function(t,e,n){"use strict";var i=n(1),r=n(8),a=n(2),o=a.Vector2,s=a.Vector3,u=2,c=.001;i.mix(r,{getpointInRectQuadrant:function(t,e){var n=new o(t.maxX-t.minX,t.minY-t.maxY),i=new o(t.maxX-t.minX,t.maxY-t.minY),a=new o(t.minX-t.maxX,t.maxY-t.minY),s=new o(t.minX-t.maxX,t.minY-t.maxY),u=new o(e.x-(t.minX+t.maxX)/2,e.y-(t.minY+t.maxY)/2);return r.getVectorAngle(u,i)<r.getVectorAngle(a,i)?2:r.getVectorAngle(u,n)<r.getVectorAngle(i,n)?1:r.getVectorAngle(u,s)<r.getVectorAngle(n,s)?0:r.getVectorAngle(u,a)<r.getVectorAngle(s,a)?3:void 0},getObjectValues:function(t){var e,n=[];for(e in t)t.hasOwnProperty(e)&&n.push(t[e]);return n},getVectorAngle:function(t,e){var n=t.angleTo(e,!0);return n},isBetween:function(t,e,n){return t>=e&&t<=n},applyPoints:function(t,e,n){var a=[];return i.each(t,function(t){a.push(r.applyPoint(t,e,n))}),a},applyPoint:function(t,e,n){var i=new s(t.x,t.y,1);return e.apply(i,n),t.x=i.x,t.y=i.y,t},getBBox:function(t,e){e=e?e:t;var n,i,a,o,s,u=t.getBBox(),c=r.applyPoint({x:u.minX,y:u.minY},t,e),h=r.applyPoint({x:u.maxX,y:u.maxY},t,e);return n=c.x,i=c.y,a=h.x,o=h.y,s={minX:n,minY:i,x:n,y:i,maxX:a,maxY:o,centerX:(a+n)/2,centerY:(o+i)/2,width:a-n,height:o-i}},radixSort:function(t){var e,n,i,r,a,o,s,u=10,c=1,h=[],l=1;for(i=0;i<t.length;i++)e=parseInt(t[i].get("zIndex"),10),n=e.toString().length,e.toString().length>l&&(l=n);for(i=0;i<l;i++,c*=10,u*=10){for(r=0;r<t.length;r++)a=parseInt(t[r].get("zIndex")%u/c,10),void 0===h[a]&&(h[a]=[]),h[a].push(t[r]);for(o=0,r=0;r<h.length;r++)if(s=void 0,void 0!==h[r])for(s=h[r].shift();void 0!==s;)t[o++]=s,s=h[r].shift()}return t},scaleMatrix:function(t,e,n){e&&n.translate(-e.x,-e.y),n.scale(t,t),e&&n.translate(e.x,e.y)},invertPoint:function(t,e,n){return e=e.getInverse(),r.converPoint(t,e,n)},converPoint:function(t,e,n){void 0===n&&(n=1);var i=new s(t.x,t.y,n);return i.applyMatrix(e),{x:i.x,y:i.y}},getRectIntersect:function(t,e){var n=t.x,i=t.y,a=t.width,o=t.height,s=n+a/2,u=i+o/2,c=[],h={x:s,y:u};c.push({x:n,y:i}),c.push({x:n+a,y:i}),c.push({x:n+a,y:i+o}),c.push({x:n,y:i+o}),c.push({x:n,y:i});for(var l=null,f=1;f<c.length&&!(l=r.getLineIntersect(c[f-1],c[f],h,e));f++);return l},getLineIntersect:function(t,e,n,i){var a=r.vector(t,n),o=r.vector(t,e),s=r.vector(n,i),u=o.x*s.y-o.y*s.x,h=u*u,l=o.x*o.x+o.y*o.y,f=s.x*s.x+s.y*s.y,d=null;if(h>c*l*f){var g=(a.x*s.y-a.y*s.x)/u,p=(a.x*o.y-a.y*o.x)/u;r.isBetween(g,0,1)&&r.isBetween(p,0,1)&&(d={x:t.x+g*o.x,y:t.y+g*o.y})}return d},getSnapPoint:function(t,e){for(var n=r.distance(t[0],e,!1),i=t[0],a=1;a<t.length;a++){var o=t[a],s=r.distance(o,e,!1);s<n&&(i=o,n=s)}return i},distance:function(t,e,n){var i=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y);return n===!1?i:Math.sqrt(i)},isInRect:function(t,e,n,i,r){return t.x<i&&t.x>e&&t.y<r&&t.y>n},isInSegment:function(t,e,n){if(!t||!e||!n)return!1;var i=r.segmentDistance(t,e,n);return i!==1/0&&i<u},segmentDistance:function(t,e,n){var i=r.vector(t,n),a=r.vector(e,n),o=r.vector(t,e),s=i.angle(o),u=a.angle(o);if(s=s-Math.PI/2>0?1:0,u=u-Math.PI/2>0?1:0,s===u)return 1/0;var c=o.angle(i),h=o.length();return Math.abs(h*Math.sin(c))},vector:function(t,e){return new o(e.x-t.x,e.y-t.y)},guid:function(){return"xxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0,n="x"===t?e:3&e|8;return n.toString(16)})}}),t.
|
||
|
i.each(n,function(t){var e=t[0],n=t[1];e<a&&(a=e),e>s&&(s=e),n<o&&(o=n),n>u&&(u=n)});var c=r/2;return{minX:a-c,minY:o-c,maxX:s+c,maxY:u+c}},isPointInPath:function(t,e){var n=this,i=n.hasFill(),r=n.hasStroke();return i&&r?n.__isPointInFill(t,e)||n.__isPointInStroke(t,e):i?n.__isPointInFill(t,e):!!r&&n.__isPointInStroke(t,e)},__isPointInFill:function(t,e){var n=this,i=n.get("context");return n.createPath(),i.isPointInPath(t,e)},__isPointInStroke:function(t,e){var n=this,i=n.__attrs,r=i.points;if(r.length<2)return!1;var o=i.lineWidth,s=r.slice(0);return r.length>=3&&s.push(r[0]),a.polyline(s,o,t,e)},createPath:function(t){var e=this,n=e.__attrs,r=n.points;r.length<2||(t=t||e.get("context"),t.beginPath(),i.each(r,function(e,n){0===n?t.moveTo(e[0],e[1]):t.lineTo(e[0],e[1])}),t.closePath())}}),t.exports=o},function(t,e,n){var i=n(1),r=n(5),a=n(6),o=n(13),s=n(21),u=n(2),c=u.Vector2,h=function(t){h.superclass.constructor.call(this,t)};h.ATTRS={points:null,lineWidth:1,arrow:!1,tCache:null},i.extend(h,r),i.augment(h,{canStroke:!0,type:"polyline",tCache:null,getDefaultAttrs:function(){return{lineWidth:1,arrow:!1}},calculateBox:function(){var t=this,e=t.__attrs,n=e.lineWidth,r=e.points;if(!r||0===r.length)return null;var a=1/0,o=1/0,s=-(1/0),u=-(1/0);i.each(r,function(t){var e=t[0],n=t[1];e<a&&(a=e),e>s&&(s=e),n<o&&(o=n),n>u&&(u=n)});var c=n/2;return{minX:a-c,minY:o-c,maxX:s+c,maxY:u+c}},__setTcache:function(){var t,e,n=this,r=n.__attrs,a=r.points,o=0,u=0,c=[];a&&0!==a.length&&(i.each(a,function(t,e){a[e+1]&&(o+=s.len(t[0],t[1],a[e+1][0],a[e+1][1]))}),o<=0||(i.each(a,function(n,i){a[i+1]&&(t=[],t[0]=u/o,e=s.len(n[0],n[1],a[i+1][0],a[i+1][1]),u+=e,t[1]=u/o,c.push(t))}),this.tCache=c))},isPointInPath:function(t,e){var n=this,i=n.__attrs;if(n.hasStroke()){var r=i.points;if(r.length<2)return!1;var o=i.lineWidth;return a.polyline(r,o,t,e)}return!1},createPath:function(t){var e,n,i=this,r=i.__attrs,a=r.points,s=r.arrow,u=r.lineWidth;if(!(a.length<2)){for(t=t||i.get("context"),t.beginPath(),t.moveTo(a[0][0],a[0][1]),n=1,e=a.length-1;n<e;n++)t.lineTo(a[n][0],a[n][1]);if(s){var h=new c(a[e][0]-a[e-1][0],a[e][1]-a[e-1][1]),l=o.getEndPoint(h,new c(a[e][0],a[e][1]),u);t.lineTo(l.x,l.y),o.makeArrow(t,h,l,u)}else t.lineTo(a[e][0],a[e][1])}},getPoint:function(t){var e,n,r=this.__attrs,a=r.points,o=this.tCache;return o||(this.__setTcache(),o=this.tCache),i.each(o,function(i,r){t>=i[0]&&t<=i[1]&&(e=(t-i[0])/(i[1]-i[0]),n=r)}),{x:s.at(a[n][0],a[n+1][0],e),y:s.at(a[n][1],a[n+1][1],e)}}}),t.exports=h},function(t,e,n){var i=n(1),r=n(5),a=n(6),o=n(13),s=n(22),u=n(2).Vector2,c=function(t){c.superclass.constructor.call(this,t)};c.ATTRS={p1:null,p2:null,p3:null,lineWidth:1,arrow:!1},i.extend(c,r),i.augment(c,{canStroke:!0,type:"quadratic",getDefaultAttrs:function(){return{lineWidth:1,arrow:!1}},calculateBox:function(){var t,e,n=this,r=n.__attrs,a=r.p1,o=r.p2,u=r.p3;if(i.isNull(a)||i.isNull(o)||i.isNull(u))return null;var c=r.lineWidth/2,h=s.extrema(a[0],o[0],u[0]);for(t=0,e=h.length;t<e;t++)h[t]=s.at(a[0],o[0],u[0],h[t]);h.push(a[0],u[0]);var l=s.extrema(a[1],o[1],u[1]);for(t=0,e=l.length;t<e;t++)l[t]=s.at(a[1],o[1],u[1],l[t]);return l.push(a[1],u[1]),{minX:Math.min.apply(Math,h)-c,maxX:Math.max.apply(Math,h)+c,minY:Math.min.apply(Math,l)-c,maxY:Math.max.apply(Math,l)+c}},isPointInPath:function(t,e){var n=this,i=n.__attrs,r=i.p1,o=i.p2,s=i.p3,u=i.lineWidth;return a.quadraticline(r[0],r[1],o[0],o[1],s[0],s[1],u,t,e)},createPath:function(t){var e=this,n=e.__attrs,r=n.p1,a=n.p2,s=n.p3,c=n.lineWidth,h=n.arrow;if(!(i.isNull(r)||i.isNull(a)||i.isNull(s)))if(t=t||e.get("context"),t.beginPath(),t.moveTo(r[0],r[1]),h){var l=new u(s[0]-a[0],s[1]-a[1]),f=o.getEndPoint(l,new u(s[0],s[1]),c);t.quadraticCurveTo(a[0],a[1],f.x,f.y),o.makeArrow(t,l,f,c)}else t.quadraticCurveTo(a[0],a[1],s[0],s[1])},getPoint:function(t){var e=this.__attrs;return{x:s.at(e.p1[0],e.p2[0],e.p3[0],t),y:s.at(e.p1[1],e.p2[1],e.p3[1],t)}}}),t.exports=c},function(t,e,n){var i=n(1),r=n(5),a=n(6),o=function(t){o.superclass.constructor.call(this,t)};o.ATTRS={x:0,y:0,width:0,height:0,radius:0,lineWidth:
|
||
|
function(t){if(t=new c(t),!t.getType())return 0;var e=t.getR(),l=t.getG(),f=t.getB(),d=t.getA();d=d||1;var g=0,p=0;return 0!==o&&(g+=(e-n)/o,p++),0!==s&&(g+=(l-i)/s,p++),0!==u&&(g+=(f-r)/u,p++),0!==h&&h&&(g+=(d-a)/h,p++),0===p?0:g/p}}function s(t,e){var n=t.getH(),i=t.getS(),r=t.getL(),a=t.getA(),o=e.getH()-n,s=e.getS()-i,u=e.getL()-r,h=e.getA();return void 0===a&&void 0===h||(a=a||1,h=(void 0===h?1:h)-a),function(t){var e=new c;return e.setHSL(n+o*t,i+s*t,r+u*t,void 0!==a&&void 0!==h?a+h*t:void 0),e.getHSLStyle()}}function u(t,e){var n=t.getH(),i=t.getS(),r=t.getL(),a=t.getA(),o=e.getH()-n,s=e.getS()-i,u=e.getL()-r,h=e.getA();return void 0===a&&void 0===h||(a=a||1,h=(void 0===h?1:h)-a),function(t){if(t=new c(t),!t.getType())return 0;var e=t.getH(),l=t.getS(),f=t.getL(),d=t.getA();d=d||1;var g=0,p=0;return 0!==o&&(g+=(e-n)/o,p++),0!==s&&(g+=(l-i)/s,p++),0!==u&&(g+=(f-r)/u,p++),0!==h&&h&&(g+=(d-a)/h,p++),0===p?0:g/p}}var c=n(15);t.exports={color:i,unColor:r}},function(t,e,n){"use strict";function i(t,e){return a.isObject(t)&&a.isObject(e)?"matrix3"===t.type&&"matrix3"===e.type?h.matrix(t,e):"path"===t.type&&"path"===e.type?o.path(t,e):u.object(t,e):a.isArray(t)&&a.isArray(e)?s.array(t,e):c.singular(t,e)}function r(t,e){return"matrix3"===t.type&&"matrix3"===e.type?h.unMatrix(t,e):a.isArray(t)&&a.isArray(e)?s.unArray(t,e):a.isObject(t)&&a.isObject(e)?u.unObject(t,e):c.unSingular(t,e)}var a=n(1),o=n(94),s=n(88),u=n(93),c=n(14),h=n(91),l=n(2);l.Matrix3;t.exports={interpolation:i,unInterpolation:r}},function(t,e,n){"use strict";function i(t,e){for(var n=[],i=t.elements,r=e.elements,o=0;o<u;o++)n[o]=a.singular(i[o],r[o]);return function(t){for(var e=new s,i=e.elements,r=0;r<u;r++)i[r]=n[r](t);return e}}function r(t,e){for(var n=[],i=t.elements,r=e.elements,o=0;o<u;o++)n[o]=a.unSingular(i[o],r[o]);return function(t){for(var e=t.elements,i=0,r=0,a=0;a<u;a++){var o=n[a](e[a]);0!==o&&(i+=o,r++)}return i/r}}var a=n(14),o=n(2),s=o.Matrix3,u=9;t.exports={matrix:i,unMatrix:r}},function(t,e){"use strict";function n(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function i(t,e){return e-=t,function(n){return 0===e?0:(n-t)/e}}t.exports={number:n,unNumber:i}},function(t,e,n){"use strict";function i(t,e){var n={};for(var i in t)i in e&&(n[i]=a.singular(t[i],e[i]));return function(t){var e={};for(var i in n)e[i]=n[i](t);return e}}function r(t,e){var n={};for(var i in t)i in e&&(n[i]=a.unSingular(t[i],e[i]));return function(t){var e=0,i=0;for(var r in n)r in t&&(e+=n[r](t[r]),i++);return 0===i?0:e/i}}var a=n(14);t.exports={object:i,unObject:r}},function(t,e,n){"use strict";function i(t,e){var n=r.toCurve(t.path,e.path),i=n[0],a=n[1];return function(n){var r=[];if(n>=1)return e.path;if(n<=0)return t.path;for(var o=0;o<i.length;o++){r[o]=[i[o][0]];for(var s=1;s<i[o].length;s++)r[o][s]=(a[o][s]-i[o][s])*n+i[o][s]}return r}}var r=n(19);t.exports={path:i}},function(t,e,n){"use strict";function i(t){this.space={},r.isString(t)?this.setStyle(t):t instanceof i&&this.copy(t)}var r=n(1),a=(n(8),n(97)),o=n(98),s=n(96),u={hex:/^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6})$/,space:/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)$/,rgbNum:/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/,rgbaNum:/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([0-9]*\.?[0-9]+)\s*$/,rgbPre:/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*$/,rgbaPre:/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*([0-9]*\.?[0-9]+)\s*$/,hsl:/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*$/,hsla:/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*([0-9]*\.?[0-9]+)\s*$/};r.augment(i,{getType:function(){return this.space.type},toRGB:function(){var t=this.space;if("rgb"!==t.type){var e=t.toRGB();this.setRGB(e.r,e.g,e.b,e.a)}},toHSL:function(){var t=this.space;if("hsl"!==t.type){var e=t.toHSL();this.setHSL(e.h,e.s,e.l,e.a)}},getR:function(){return this.toRGB(),this.space.r},getG:function(){return this.toRGB(),this.space.g},getB:function(){return this.toRGB(),this.space.b},getH:function(){return this.toHSL(),this.space.h},getS:function(){return this.toHSL(),this.space.s},getL:function(){return this.toHSL(),this.space.l},getA:function(){return this.
|
||
|
return{x:p,y:v,m:{x:x,y:y},n:{x:m,y:w},start:{x:b,y:_},end:{x:M,y:S},alpha:A}},T=function(t,e,n){var i=P(t),r=P(e);if(!A(i,r))return n?0:[];for(var a=w.apply(0,t),o=w.apply(0,e),s=~~(a/8),u=~~(o/8),c=[],h=[],l={},f=n?0:[],d=0;d<s+1;d++){var g=E.apply(0,t.concat(d/s));c.push({x:g.x,y:g.y,t:d/s})}for(d=0;d<u+1;d++)g=E.apply(0,e.concat(d/u)),h.push({x:g.x,y:g.y,t:d/u});for(d=0;d<s;d++)for(var p=0;p<u;p++){var v=c[d],x=c[d+1],y=h[p],m=h[p+1],b=Math.abs(x.x-v.x)<.001?"y":"x",M=Math.abs(m.x-y.x)<.001?"y":"x",S=_(v.x,v.y,x.x,x.y,y.x,y.y,m.x,m.y);if(S){if(l[S.x.toFixed(4)]==S.y.toFixed(4))continue;l[S.x.toFixed(4)]=S.y.toFixed(4);var T=v.t+Math.abs((S[b]-v[b])/(x[b]-v[b]))*(x.t-v.t),C=y.t+Math.abs((S[M]-y[M])/(m[M]-y[M]))*(m.t-y.t);T>=0&&T<=1&&C>=0&&C<=1&&(n?f++:f.push({x:S.x,y:S.y,t1:T,t2:C}))}}return f},C=function(t,e,n){t=p(t),e=p(e);for(var i,r,a,o,s,u,c,h,l,f,d=n?0:[],g=0,v=t.length;g<v;g++){var x=t[g];if("M"==x[0])i=s=x[1],r=u=x[2];else{"C"==x[0]?(l=[i,r].concat(x.slice(1)),i=l[6],r=l[7]):(l=[i,r,i,r,s,u,s,u],i=s,r=u);for(var y=0,m=e.length;y<m;y++){var w=e[y];if("M"==w[0])a=c=w[1],o=h=w[2];else{"C"==w[0]?(f=[a,o].concat(w.slice(1)),a=f[6],o=f[7]):(f=[a,o,a,o,c,h,c,h],a=c,o=h);var b=T(l,f,n);if(n)d+=b;else{for(var _=0,M=b.length;_<M;_++)b[_].segment1=g,b[_].segment2=y,b[_].bez1=l,b[_].bez2=f;d=d.concat(b)}}}}}return d},I=function(t,e){return C(t,e)},k={toArray:u,toString:y,toCurve:p,toAbsolute:l,catmullRomToBezier:c,rectPath:S,intersection:I};t.exports=k},function(t,e,n){"use strict";var i=n(57),r=n(112),a=n(41),o=function(t){o.superclass.constructor.call(this,t)};o.CFG={eventEnable:!0,width:null,height:null,widthCanvas:null,heightCanvas:null,widthStyle:null,heightStyle:null,containerDOM:null,canvasDOM:null,pixelRatio:null},i.extend(o,a.Group),i.augment(o,{init:function(){o.superclass.init.call(this),this._setGlobalParam(),this._setDOM(),this._setInitSize(),this._setCanvas(),this._scale(),this.get("eventEnable")&&this._registEvents()},_registEvents:function(){var t=this,e=t.get("el"),n=new r(t);e.addEventListener("mouseout",function(t){n.mouseout(t)},!1),e.addEventListener("mouseover",function(t){n.mouseover(t)},!1),e.addEventListener("mousemove",function(t){n.mousemove(t)},!1),e.addEventListener("mousedown",function(t){n.mousedown(t)},!1),e.addEventListener("mouseup",function(t){n.mouseup(t)},!1),e.addEventListener("click",function(t){n.click(t)},!1),e.addEventListener("dblclick",function(t){n.dblclick(t)},!1)},_scale:function(){var t=this.get("pixelRatio");this.scale(t,t)},_setCanvas:function(){var t=this.get("canvasDOM");this.set("el",t),this.set("context",t.getContext("2d")),this.set("canvas",this)},_setGlobalParam:function(){var t=this.get("pixelRatio");t||this.set("pixelRatio",i.getRatio())},_setDOM:function(){this._setContainer(),this._setLayer()},_setContainer:function(){var t=this.get("containerId"),e=this.get("containerDOM");e||(e=document.getElementById(t),this.set("containerDOM",e)),i.modiCSS(e,{position:"relative"})},_setLayer:function(){var t=this.get("containerDOM"),e=i.guid("canvas_");if(t){var n=i.createDom('<canvas id="'+e+'"></canvas>');t.appendChild(n),this.set("canvasDOM",n)}},_setInitSize:function(){this.get("widthStyle")?this.changeSizeByCss(this.get("widthStyle"),this.get("heightStyle")):this.get("width")&&this.changeSize(this.get("width"),this.get("height"))},_getPx:function(t,e){var n=this.get("canvasDOM");n.style[t]=e;var r=i.getBoundingClientRect(n);return"width"===t?r.right-r.left:"height"===t?r.bottom-r.top:void 0},_reSize:function(){var t=this.get("canvasDOM"),e=this.get("widthCanvas"),n=this.get("heightCanvas"),i=this.get("widthStyle"),r=this.get("heightStyle");t.style.width=i,t.style.height=r,t.setAttribute("width",e),t.setAttribute("height",n)},getWidth:function(){var t=this.get("pixelRatio"),e=this.get("width");return e*t},getHeight:function(){var t=this.get("pixelRatio"),e=this.get("height");return e*t},changeSizeByCss:function(t,e){var n=this.get("pixelRatio");t=this._getPx("width",t),e=this._getPx("height",e);var i=t*n,r=e*n;this.set("widthStyle",t),this.set("heightStyle",e),this.set(
|
||
|
},onMouseWheel:function(t){this._processEventObj(t);var e=this.currentEventObj;this.graph.fire("mousewheel",this.getEventObj(e))},onMouseDown:function(t){t.preventDefault(),this._processEventObj(t);var e=this.currentEventObj;this.pressing=!0,this.dragging=!0,this.pressingPoint={x:e.x,y:e.y},0===t.button&&this.graph.fire("mousedown",this.getEventObj(e))},onMouseUp:function(t){t.preventDefault(),this._processEventObj(t);var e=this.currentEventObj;0===t.button&&(this.pressing&&(this.graph.fire("click",this.getEventObj(e)),e.item&&this.graph.fire("itemclick",this.getEventObj(e)),this.pressing=!1),this.dragging&&(this.dragStartPoint&&this.graph.fire("dragend",this.getEventObj(e)),this.dragging=!1),this.graph.fire("mouseup",this.getEventObj(e)),this.dragStartPoint=null,this.dragItem=null)},onMouseMove:function(t){t.preventDefault(),this._processEventObj(t);var e=this.graph,n=this.currentEventObj,i=this.lastEventObj;this.pressing!==!0||n.x===i.x&&n.y===i.y||(this.pressing=!1),i&&n&&(i.toEvObj=n,n.fromEvObj=i,this.isSame(i,n,"shape")||((i.shape||i.frontEvObj.shape)&&e.fire("mouseleave",this.getEventObj(i)),(n.shape||n.frontEvObj.shape)&&e.fire("mouseenter",this.getEventObj(n))),this.isSame(i,n,"item")||((i.item||i.frontEvObj.item)&&e.fire("itemmouseleave",this.getEventObj(i)),(n.item||n.frontEvObj.item)&&e.fire("itemmouseenter",this.getEventObj(n)))),this.dragging&&(this.dragStartPoint?e.fire("dragmove",this.getEventObj(n)):(this.dragStartPoint={x:n.x,y:n.y},this.dragItem=n.item,e.fire("dragstart",this.getEventObj(n)))),n.item&&e.fire("itemhover",this.getEventObj(n)),e.fire("mousemove",this.getEventObj(n))},isSame:function(t,e,n){var i=t[n],r=e[n],a=t.frontEvObj[n],o=e.frontEvObj[n];return i===r&&a===o},destroy:function(){var t=this.domMouseUp,e=this.domMouseDown,n=this.domMouseMove,i=this.domDblClick,r=this.domMouseWheel,a=this.domContextMenu,o=this.domKeyDown,s=this.domKeyUp;a&&a.remove(),s&&s.remove(),r&&r.remove(),o&&o.remove(),i&&i.remove(),t&&t.remove(),e&&e.remove(),n&&n.remove()}}),t.exports=a},function(t,e,n){"use strict";var i=n(1),r=function(t){i.mix(this,t),this.init()};i.augment(r,{group:null,visible:!0,gridEl:null,minX:0,minY:0,cell:10,maxX:1e3,maxY:1e3,line:null,init:function(){var t=this,e=t.group,n=t._getPath(),r=i.mix({},t.line);r.path=n;var a=e.addShape("path",{attrs:r,capture:!1});a.set("visible",t.visible),this.gridEl=a},_getPath:function(){for(var t=this,e=t.minX,n=t.minY,i=t.maxX,r=t.maxY,a=t._getCell(),o=Math.ceil(e/a)*a,s=Math.ceil(n/a)*a,u=[],c=0;c<=i-e;c+=a){var h=o+c;u.push(["M",h,n]),u.push(["L",h,r])}for(var l=0;l<=r-n;l+=a){var f=s+l;u.push(["M",e,f]),u.push(["L",i,f])}return u},_getCell:function(){var t=this.cell?this.cell:10;return t},update:function(t){i.mix(this,t);var e=this._getPath(),n=this.gridEl;n.attr("path",e),n.set("visible",this.visible)},destroy:function(){var t=this,e=t.gridEl;e&&e.remove()}}),t.exports=r},function(t,e,n){"use strict";var i=n(4),r=n(25),a=function(t){i.mix(this,t),this.init()};i.augment(a,{graph:null,guides:[],frontGuideGroup:null,backGuideGroup:null,init:function(){var t=this.graph,e=t.get("frontGroup").addGroup(),n=t.get("backGroup").addGroup();this.frontGuideGroup=e,this.backGuideGroup=n},link:function(t){this.guides.push({type:"link",cfg:t})},_link:function(t){var e=this.guides,n=this.graph,a=n.find(t.source),o=n.find(t.target);if(!a||!o)return!1;var s=t.id?t.id:"guide-link-"+e.length,u=this.frontGuideGroup,c=u.addGroup(r,{data:{type:"link",cfg:t},id:s}),h=a.getCenter(),l=o.getCenter(),f=a.getIntersectionByPoint(l),d=o.getIntersectionByPoint(h),g=i.mix({},t,{source:a,target:o,points:[f,d]}),p=t.shape?t.shape:"line";return i.drawEdge(p,g,c),c},draw:function(){var t=this,e=this.guides;i.each(e,function(e){t["_"+e.type](e.cfg)})},save:function(){return this.guides},clear:function(t){this.frontGuideGroup.clear(t),this.backGuideGroup.clear(t)},destroy:function(){this.frontGuideGroup.clear(),this.backGuideGroup.clear()}}),t.exports=a},function(t,e,n){"use strict";var i=n(4),r=function(t){i.mix(this,t),this.init()};i.augment(r,{graph:null,tooltipDOM:null,titleDOM:null,
|
||
|
n.translate(-e.minX+r-e.width-a,-e.minY+i-e.height-a),this.updateMatrix(n)},bc:function(){var t=this.get("itemGroup"),e=t.getBBox(),n=t.getMatrix().clone(),i=this.get("height"),r=this.get("width"),a=this.get("fitViewPadding");n.translate(-e.minX+(r-e.width)/2,-e.minY+i-e.height-a),this.updateMatrix(n)},focusPoint:function(t,e){this._zoom(1,void 0,t),e!==!1&&this.draw()}}),t.exports=s},function(t,e,n){"use strict";function i(t,e){var n,i;for(n=0;n<t.length;n++)for(i=0;i<e.length;i++)t[n]===e[i]&&t.splice(n,1);for(n=0;n<e.length;n++)t.push(e[n]);return t}function r(t,e){for(var n=0;n<t.length;n++)if(t[n]===e){t.splice(n,1);break}}var a=n(1),o=n(3),s=function(){};s.ATTRS={modes:null,mode:"default",behaviourFilter:null,behaviours:null},a.augment(s,{_initMode:function(){var t=this.get("modes"),e=this.get("mode");t||(t=this.constructor.Mode,this.set("modes",t)),this.changeMode(e)},_filterBehaviour:function(t){var e=this.get("behaviourFilter"),n={};return a.each(t,function(t,i){n[i]=a.filter(t,function(t){return e.indexOf(t)===-1})}),n},_mapCursor:function(t){var e={add:"pointer",drag:"move",default:"default",edit:"default"},n=e[t];n&&this.css({cursor:e[t]})},filterBehaviour:function(t){this.set("behaviourFilter",t),this.resetMode()},addBehaviour:function(t,e){var n=this.get("modes");return a.isArray(t)?a.each(n,function(e,r){n[r]=i(e,t)}):n[t]?n[t]=i(n[t],e):n[t]=e,this.resetMode(),this},removeBehaviour:function(t,e){var n=this.get("modes");return a.isArray(t)?a.each(n,function(e){a.each(t,function(t){r(e,t)})}):n[t]&&a.each(e,function(e){r(n[t],e)}),this.resetMode(),this},resetMode:function(){var t=this.get("mode");this.changeMode(t)},changeMode:function(t){var e=this.get("modes"),n=this.get("behaviourFilter");e&&"none"!==e&&(n&&(e=this._filterBehaviour(e)),e[t]&&(o.resetMode(e[t],this),this.set("mode",t),this._mapCursor(t)))}}),t.exports=s},function(t,e,n){"use strict";var i=n(4),r=n(28);r.registGeom("edge",{defaultShapeType:"line",getPath:function(t,e){var n=this.getShape(t);return!!i.isFunction(n.getPath)&&n.getPath(e)}}),r.registEdge("line",{getPath:function(t){return i.getEdgePath("line",t,"line")},draw:function(t,e){return i.drawEdge("line",t,e,!1,"line")}}),r.registEdge("arrow",{getPath:function(t){return i.getEdgePath("line",t,"line")},draw:function(t,e){return i.drawEdge("line",t,e,!0,"line")}}),r.registEdge("HV",{getPath:function(t){return i.getEdgePath("HV",t,"line")},draw:function(t,e){return i.drawEdge("HV",t,e,!1,"line",!1)}}),r.registEdge("VH",{getPath:function(t){return i.getEdgePath("VH",t,"line")},draw:function(t,e){return i.drawEdge("VH",t,e,!1,"line",!1)}}),r.registEdge("HVH",{getPath:function(t){return i.getEdgePath("HVH",t,"line")},draw:function(t,e){return i.drawEdge("HVH",t,e,!1,"line",!1)}}),r.registEdge("VHV",{getPath:function(t){return i.getEdgePath("VHV",t,"line")},draw:function(t,e){return i.drawEdge("VHV",t,e,!1,"line",!1)}}),r.registEdge("smooth",{getPath:function(t){return i.getEdgePath("bezierAuto",t,"curve")},draw:function(t,e){return i.drawEdge("bezierAuto",t,e,!1,"curve")}}),r.registEdge("smoothArrow",{getPath:function(t){return i.getEdgePath("bezierAuto",t,"curve")},draw:function(t,e){return i.drawEdge("bezierAuto",t,e,!0,"curve")}}),r.registEdge("bezierHorizontal",{getPath:function(t){return i.getEdgePath("bezierHorizontal",t,"curve")},draw:function(t,e){return i.drawEdge("bezierHorizontal",t,e,!1,"curve")}}),r.registEdge("bezierVertical",{getPath:function(t){return i.getEdgePath("bezierVertical",t,"curve")},draw:function(t,e){return i.drawEdge("bezierVertical",t,e,!1,"curve")}}),r.registEdge("bezierQuadratic",{getPath:function(t){return i.getEdgePath("bezierQuadratic",t,"curve")},draw:function(t,e){return i.drawEdge("bezierQuadratic",t,e,!1,"curve",!1)}})},function(t,e,n){"use strict";function i(){return[[.5,0],[1,.5],[.5,1],[0,.5]]}var r=n(4),a=n(28),o=.5/Math.sqrt(2);a.registGeom("node",{defaultShapeType:"rect",getAnchorPoints:function(t,e,n){var i=this.getShape(t);return!!r.isFunction(i.getAnchorPoints)&&i.getAnchorPoints(e,n)}}),a.registNode("rect",{draw:function(t,e){return r.drawN
|