UNPKG

ccnetviz

Version:

[![Build Status](https://travis-ci.org/HelikarLab/ccNetViz.svg?branch=master)](https://travis-ci.org/HelikarLab/ccNetViz) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![semantic-releas

1 lines 25.8 kB
!function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}t.exports=function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}},function(t,e,n){var i=n(7),o=n(8);t.exports=function(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?o(t):e}},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(e)}t.exports=n},function(t,e,n){var i=n(9);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}},function(t,e,n){t.exports=n(10)},function(t,e){function n(t,e,n,i,o,r,s){try{var a=t[r](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(i,o)}t.exports=function(t){return function(){var e=this,i=arguments;return new Promise((function(o,r){var s=t.apply(e,i);function a(t){n(s,o,r,a,c,"next",t)}function c(t){n(s,o,r,a,c,"throw",t)}a(void 0)}))}}},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=i=function(t){return n(t)}:t.exports=i=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},i(e)}t.exports=i},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e){function n(e,i){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(e,i)}t.exports=n},function(t,e,n){var i=function(t){"use strict";var e,n=Object.prototype,i=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},r=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(t,e,n,i){var o=e&&e.prototype instanceof p?e:p,r=Object.create(o.prototype),s=new S(i||[]);return r._invoke=function(t,e,n){var i=f;return function(o,r){if(i===l)throw new Error("Generator is already running");if(i===g){if("throw"===o)throw r;return O()}for(n.method=o,n.arg=r;;){var s=n.delegate;if(s){var a=z(s,n);if(a){if(a===d)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===f)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=l;var c=h(t,e,n);if("normal"===c.type){if(i=n.done?g:u,c.arg===d)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=g,n.method="throw",n.arg=c.arg)}}}(t,n,s),r}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f="suspendedStart",u="suspendedYield",l="executing",g="completed",d={};function p(){}function v(){}function y(){}var x={};x[r]=function(){return this};var m=Object.getPrototypeOf,b=m&&m(m(M([])));b&&b!==n&&i.call(b,r)&&(x=b);var k=y.prototype=p.prototype=Object.create(x);function w(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function P(t){var e;this._invoke=function(n,o){function r(){return new Promise((function(e,r){!function e(n,o,r,s){var a=h(t[n],t,o);if("throw"!==a.type){var c=a.arg,f=c.value;return f&&"object"==typeof f&&i.call(f,"__await")?Promise.resolve(f.__await).then((function(t){e("next",t,r,s)}),(function(t){e("throw",t,r,s)})):Promise.resolve(f).then((function(t){c.value=t,r(c)}),(function(t){return e("throw",t,r,s)}))}s(a.arg)}(n,o,e,r)}))}return e=e?e.then(r,r):r()}}function z(t,n){var i=t.iterator[n.method];if(i===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,z(t,n),"throw"===n.method))return d;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=h(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var r=o.arg;return r?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function M(t){if(t){var n=t[r];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,s=function n(){for(;++o<t.length;)if(i.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}return{next:O}}function O(){return{value:e,done:!0}}return v.prototype=k.constructor=y,y.constructor=v,y[a]=v.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(k),t},t.awrap=function(t){return{__await:t}},w(P.prototype),P.prototype[s]=function(){return this},t.AsyncIterator=P,t.async=function(e,n,i,o){var r=new P(c(e,n,i,o));return t.isGeneratorFunction(n)?r:r.next().then((function(t){return t.done?t.value:r.next()}))},w(k),k[a]="Generator",k[r]=function(){return this},k.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var i=e.pop();if(i in t)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=M,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(i,o){return a.type="throw",a.arg=t,n.next=i,o&&(n.method="next",n.arg=e),!!o}for(var r=this.tryEntries.length-1;r>=0;--r){var s=this.tryEntries[r],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var c=i.call(s,"catchLoc"),h=i.call(s,"finallyLoc");if(c&&h){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var r=o;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var s=r?r.completion:{};return s.type=t,s.arg=e,r?(this.method="next",this.next=r.finallyLoc,d):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var o=i.arg;C(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:M(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),d}},t}(t.exports);try{regeneratorRuntime=i}catch(t){Function("r","regeneratorRuntime = r")(i)}},function(t,e,n){"use strict";n.r(e);var i=n(0),o=n.n(i),r=n(1),s=n.n(r),a=n(2),c=n.n(a),h=n(3),f=n.n(h),u=n(4),l=n.n(u),g=n(5),d=n.n(g),p=n(6),v=n.n(p),y=new(function(){function t(){o()(this,t),this.config={fps:10,duration:2e3,frame:0,frameCount:0,scene:0},this.listener={},this.status=!0,this.frameBatch=[],this.config.frameCount=this.config.fps*(this.config.duration/1e3)}var e;return s()(t,[{key:"addListener",value:function(t){this.listener[t]=!0}},{key:"draw",value:(e=v()(d.a.mark((function t(e,n){return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.frameBatch.push(n),void 0===this.instance&&(this.instance=e),!(this.frameBatch.length>=Object.keys(this.listener).length)){t.next=6;break}return t.next=5,this.fps();case 5:this.frameBatch.length&&(void 0!==ccNetViz.plugin&&(void 0===ccNetViz.plugin.animationHandler&&(ccNetViz.plugin.animationHandler="node"),"node"===ccNetViz.plugin.animationHandler&&this.instance.animateTexture()),n>this.config.frameCount&&(this.status=!1),this.config.scene=n%this.config.frameCount,this.frameBatch.length=0);case 6:case"end":return t.stop()}}),t,this)}))),function(t,n){return e.apply(this,arguments)})},{key:"fps",value:function(){var t=this;return new Promise((function(e){return setTimeout(e,1e3/t.config.fps)}))}}]),t}()),x=function(){function t(e,n,i){o()(this,t),this.config=e,this.textureReady=i,void 0===this.textureReady?(this._preConf(),this._preAnimation()):this.config.animation.scene=y.config.scene,this._setAnimation(n),void 0===this.textureReady&&(this.canvas=document.createElement("canvas"),this.canvas.width=0,this.canvas.height=0,this.ready=!1,this._setCanvas(),this._setGradient(),this._preDraw(),this._draw())}var e;return s()(t,[{key:"_preConf",value:function(){this.default={stroke:{color:"#ffffff",size:1e-8,round:!1},textureColor:"#2257a4",size:20,minSize:6,maxSize:16,label:{color:"rgb(120, 120, 120)",font:{type:"Arial, Helvetica, sans-serif",size:11}}},void 0!==this.config?(void 0!==this.config.stroke?(this.config.stroke.size=this.config.stroke.size||this.default.stroke.size,this.config.stroke.color=this.config.stroke.color||this.default.stroke.color,this.config.stroke.round=this.config.stroke.round||this.default.stroke.round):this.config.stroke=this.default.stroke,void 0!==this.config.label?(this.config.label.color=this.config.label.color||this.default.label.color,this.config.label.font=this.config.label.font||this.default.label.font):this.config.label=this.default.label,this.config.size=this.config.size||this.default.size,this.config.minSize=this.config.minSize||this.default.maxSize,this.config.maxSize=this.config.maxSize||this.default.maxSize,this.config.textureColor=this.config.textureColor||this.default.textureColor):this.config=this.default}},{key:"_preAnimation",value:function(){if(void 0!==this.config.animation){var t=function(t){if(!t)return[0,0,0];if(t.indexOf("rgb")>=0)return t.replace(/([A-z]|[().])+/g,"").split(",").map((function(t){return parseInt(t)}));if(t.indexOf("#")>=0){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,i){return e+e+n+n+i+i}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:[0,0,0]}return[0,0,0]},e=function(t,e,n){for(var i=t,o=e,r=0,s=[],a=n,c=0;c<a+1;c++){var h=[];r+=1/a,h[0]=i[0]*r+(1-r)*o[0],h[1]=i[1]*r+(1-r)*o[1],h[2]=i[2]*r+(1-r)*o[2],s[c]="rgb(".concat(Math.abs(Math.floor(h[0])),",").concat(Math.abs(Math.floor(h[1])),",").concat(Math.abs(Math.floor(h[2])),")")}return s};if("color"===this.config.animation.type){if(void 0===this.config.animation.colors){var n=e(t(this.config.animation.color),t(this.config.textureColor),y.config.frameCount/2||0);this.config.animation.colors=n.concat(n.slice().reverse())}this.config.animation.scene=y.config.scene,void 0!==this.config.animation.colors&&(this.config.textureColor="".concat(this.config.animation.colors[this.config.animation.frame]||this.config.textureColor))}else if("stroke"===this.config.animation.type){if(this.config.stroke.color=this.config.animation.color||"#000",this.config.animation.scene=y.config.scene,void 0===this.config.animation.colors){var i=e(t(this.config.animation.color),t(this.config.textureColor),y.config.frameCount/2||0);this.config.animation.colors=i.concat(i.slice().reverse())}this.config.animation.scene+1<=y.config.frameCount/2?this.config.stroke.size=this.config.stroke.size+.5:this.config.stroke.size=this.config.stroke.size-.5,void 0!==this.config.animation.colors&&(this.config.stroke.color="".concat(this.config.animation.colors[this.config.animation.frame]||this.config.textureColor))}else this.config.animation.scene+1<=y.config.frameCount/2?this.config.size=this.config.size+.3:this.config.size=this.config.size-.3,this.config.animation.scene=y.config.scene}else this.config.temp=this.config.texture}},{key:"_setAnimation",value:(e=v()(d.a.mark((function t(e){return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===e||void 0===this.config.animation){t.next=10;break}if(!this.ready||!e.findArea(0,0,1,1,1,0).nodes.length){t.next=7;break}this.config.animation.status=y.status,void 0===this.config.animation.frame&&(void 0!==this.config.type&&y.addListener(this.config.type),this.config.animation.frame=0),y.draw(e,this.config.animation.frame++),t.next=10;break;case 7:return t.next=9,new Promise((function(t){return setTimeout(t,50)}));case 9:this._setAnimation(e);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"_setCanvas",value:function(){var t={x0:this.canvas.width,y0:this.canvas.height,x1:this.canvas.width+(2*this.config.stroke.size+this.config.size),y1:this.canvas.height+(2*this.config.stroke.size+this.config.size)};this.canvas.width=t.x1,this.canvas.height=t.y1,this.context=this.canvas.getContext("2d"),this.context.fillStyle=this.config.textureColor,this.context.strokeStyle=this.config.stroke.color,this.context.lineWidth=this.config.stroke.size,this.config.stroke.round&&(this.context.lineJoin="round")}},{key:"_setGradient",value:function(){var t=this;if(void 0!==this.config.textureGradient){var e=this.context.createLinearGradient(0,0,void 0!==this.config.textureGradient[0].x?this.canvas.width:0,void 0!==this.config.textureGradient[0].y?this.canvas.height:0);this.config.textureGradient.map((function(n){e.addColorStop(n.x||n.y||0,n.color||t.config.textureColor)})),this.context.fillStyle=e}}},{key:"_preDraw",value:function(){}},{key:"_draw",value:function(){}},{key:"t",value:function(t){return this.config.stroke.size+this.config.size*t}},{key:"toConfig",value:function(){var t=this;return new Promise((function(e,n){t.canvas.toBlob((function(n){e(Object.assign({texture:URL.createObjectURL(n)},t.config)),t.ready=!0}),"image/png")}))}},{key:"toTexture",value:function(){var t=this;return new Promise((function(e,n){e(t.config),t.ready=!0}))}}]),t}(),m=function(t,e,n){var i=function(t){function e(t,n,i){var r;return o()(this,e),(r=c()(this,f()(e).call(this,t,n,i))).type="Ellipse",r}return l()(e,t),s()(e,[{key:"_setCanvas",value:function(){this.config.radiusX=this.config.radiusX||16,this.config.radiusY=this.config.radiusY||16;var t={x0:this.config.radiusX,y0:this.config.radiusY,x1:this.config.radiusX+(2*this.config.stroke.size+this.config.radiusX),y1:this.config.radiusY+(2*this.config.stroke.size+this.config.radiusY)};this.config.offset={x:0,y:0},t.x1<t.y1?(this.config.offset.x=t.y1-t.x1,t.x1=t.y1):(this.config.offset.y=t.x1-t.y1,t.y1=t.x1),this.canvas.width=t.x1,this.canvas.height=t.y1,this.context=this.canvas.getContext("2d"),this.context.fillStyle=this.config.textureColor,this.context.strokeStyle=this.config.stroke.color,this.context.lineWidth=this.config.stroke.size}},{key:"_preDraw",value:function(){"ellipse"===this.config.type&&(this.config.radiusX=25,this.config.radiusY=15)}},{key:"_draw",value:function(){this.context.ellipse(this.config.radiusX+this.config.stroke.size+this.config.offset.x/2,this.config.radiusY+this.config.stroke.size+this.config.offset.y/2,this.config.radiusX,this.config.radiusY,0,0,2*Math.PI),this.context.stroke(),this.context.fill()}}]),e}(x);return new i(t,e,n)},b=function(t,e,n){var i=function(t){function e(t,n,i){var r;return o()(this,e),(r=c()(this,f()(e).call(this,t,n,i))).type="Star",r}return l()(e,t),s()(e,[{key:"_preDraw",value:function(){if("star"===this.config.type)this.config.spikes=7;else for(var t=3;t<=10;t++)this.config.type==="star-".concat(t)&&(this.config.spikes=t)}},{key:"_draw",value:function(){this.context.beginPath();for(var t=this.config.spikes||5,e=this.config.inset||2,n=this.config.size/2,i=1;i<=2*t;i++){var o=void 0,r=void 0,s=i*(2*Math.PI)/(2*t),a=n+this.config.stroke.size;i%2==0?(o=a+n*Math.cos(s),r=a+n*Math.sin(s)):(o=a+n/e*Math.cos(s),r=a+n/e*Math.sin(s)),this.context.lineTo(o,r)}this.context.closePath(),this.context.stroke(),this.context.fill()}}]),e}(x);return new i(t,e,n)},k=function(t,e,n){var i=function(t){function e(t,n,i){var r;return o()(this,e),(r=c()(this,f()(e).call(this,t,n,i))).type="Polygon",r}return l()(e,t),s()(e,[{key:"_preDraw",value:function(){switch(this.config.type){case"triangle":this.config.edges=3;break;case"quadrilateral":this.config.edges=4;break;case"pentagon":this.config.edges=5;break;case"hexagon":this.config.edges=6;break;case"heptagon":this.config.edges=7;break;case"octagon":this.config.edges=8;break;case"nonagon":case"decagon":this.config.edges=9}}},{key:"_draw",value:function(){this.context.beginPath();for(var t=this.config.edges||3,e=360/t,n=this.config.size/2,i=0;i<t;i++){var o=e*(i+1)*(Math.PI/180),r=n+this.config.stroke.size,s=r+n*Math.cos(o),a=r+n*Math.sin(o);this.context.lineTo(s,a)}this.context.closePath(),this.context.stroke(),this.context.fill()}}]),e}(x);return new i(t,e,n)},w=function(t,e,n){var i=function(t){function e(t,n,i){var r;return o()(this,e),(r=c()(this,f()(e).call(this,t,n,i))).type="Custom",r}return l()(e,t),s()(e,[{key:"_preDraw",value:function(){switch(this.config.type){case"square":this.config.lines=[{},{x:1},{x:1,y:1},{y:1}];break;case"vee":this.config.lines=[{},{x:.5,y:.4},{x:1},{x:.5,y:1},{}];break;case"tag":this.config.lines=[{},{x:.7},{x:1,y:.5},{x:.7,y:1},{y:1},{}]}}},{key:"_draw",value:function(){var t=this;this.context.beginPath(),this.config.lines.map((function(e){t.context.lineTo(t.t(e.x||0),t.t(e.y||0))})),this.context.closePath(),this.context.stroke(),this.context.fill()}}]),e}(x);return new i(t,e,n)},P=function(t,e,n){var i=function(t){function e(t,n,i){var r;return o()(this,e),(r=c()(this,f()(e).call(this,t,n,i))).type="PieChart",r}return l()(e,t),s()(e,[{key:"_draw",value:function(){var t=this.config.chart,e=this.config.size/2,n=e+this.config.stroke.size,i={end:0,start:0};this.context.beginPath(),this.context.arc(n,n,e,0,2*Math.PI,!1),this.context.stroke(),this.context.fill();for(var o=1;o<=t.length;o++){var r=t[o-1],s=r.ratio/100*2*Math.PI;i.end=s,this.context.beginPath(),this.context.moveTo(n,n),this.context.arc(n,n,e-1,i.start,i.end+i.start,!1),this.context.fillStyle=r.color||"#000000",this.context.fill(),i.start+=s}}}]),e}(x);return new i(t,e,n)},z=function(t,e,n){var i=function(t){function e(t,n,i){var r;return o()(this,e),(r=c()(this,f()(e).call(this,t,n,i))).type="GaugeChart",r}return l()(e,t),s()(e,[{key:"colorGradient",value:function(t,e,n){for(var i=t,o=e,r=0,s=[],a=n,c=0;c<a+1;c++){var h=[];r+=1/a,h[0]=i[0]*r+(1-r)*o[0],h[1]=i[1]*r+(1-r)*o[1],h[2]=i[2]*r+(1-r)*o[2],s[c]="rgb(".concat(Math.abs(Math.floor(h[0])),",").concat(Math.abs(Math.floor(h[1])),",").concat(Math.abs(Math.floor(h[2])),")")}return s}},{key:"_draw",value:function(){var t=[[0,128,0],[255,255,0],[255,0,0]];void 0!==this.config.colorSet&&(t=this.config.colorSet);var e=this.colorGradient(t[1],t[2],15).concat(this.colorGradient(t[0],t[1],15)),n=this.config.size/2,i=n+this.config.stroke.size,o={end:0,start:Math.PI};this.context.arc(i,i,n,0,2*Math.PI,!1),this.context.stroke(),this.context.fill();for(var r=1;r<=e.length;r++){var s=e[r-1],a=2*(Math.PI/2)/100*Math.PI;o.end=a,this.context.beginPath(),this.context.moveTo(i,i),this.context.arc(i,i,n-1,o.start,o.end+o.start,!1),this.context.fillStyle=s,this.context.fill(),o.start+=a}for(var c=this.config.chart,h=1;h<=c.length;h++){var f=this.config.chart[h-1],u={end:0,start:0};f.ratio=f.ratio%100,u.end=(10+10*(f.ratio+2)/100)/Math.PI,u.start=(10+10*(f.ratio-2)/100)/Math.PI,this.context.beginPath(),this.context.moveTo(i,i),this.context.arc(i,i,n,u.start,u.end,!1),this.context.fillStyle=f.color||"#000000",c.length<=1&&(this.context.font="bold ".concat(60*i/100,"px arial"),this.context.textAlign="center",this.context.fillText("".concat(f.ratio,"%"),i,2*i-i/3)),this.context.fill()}}}]),e}(x);return new i(t,e,n)},_=function(t,e,n){var i=function(t){function e(t,n,i){var r;return o()(this,e),(r=c()(this,f()(e).call(this,t,n,i))).type="DoughnutChart",r}return l()(e,t),s()(e,[{key:"_draw",value:function(){var t=this.config.chart,e=this.config.size/2,n=e+ +this.config.stroke.size,i={end:0,start:0};this.context.beginPath(),this.context.arc(n,n,e,0,2*Math.PI,!1),this.context.stroke(),this.context.fill();for(var o=1;o<=t.length;o++){var r=t[o-1],s=r.ratio/100*2*Math.PI;i.end=s,this.context.beginPath(),this.context.moveTo(n,n),this.context.arc(n,n,e-1,i.start,i.end+i.start,!1),this.context.fillStyle=r.color||"#000000",this.context.fill(),i.start+=s}this.context.beginPath(),this.context.globalCompositeOperation="destination-out",this.context.arc(n,n,e-50*e/100,0,2*Math.PI,!1),this.context.fill(),this.context.globalCompositeOperation="destination-over",this.context.fillStyle=this.config.textureColor,this.context.arc(n,n,e,0,2*Math.PI,!1),this.context.fill()}}]),e}(x);return new i(t,e,n)},C=function(t,e,n){var i=function(t){function e(t,n,i){var r;return o()(this,e),(r=c()(this,f()(e).call(this,t,n,i))).type="RadialHistogram",r}return l()(e,t),s()(e,[{key:"_draw",value:function(){for(var t=this.config.chart,e=360/t.length,n=this.config.size/2,i=n+this.config.stroke.size,o=0;o<t.length;o++){var r=t[o],s=e*(o+1)*(Math.PI/180),a=i+(r.ratio*(n/2/100)+n/2)*Math.cos(s),c=i+(r.ratio*(n/2/100)+n/2)*Math.sin(s),h=(e*(o+1)+(100/t.length>20?20:100/t.length))*(Math.PI/180),f=i+(r.ratio*(n/2/100)+n/2)*Math.cos(h),u=i+(r.ratio*(n/2/100)+n/2)*Math.sin(h);this.context.beginPath(),this.context.moveTo(i,i),this.context.lineTo(a,c),this.context.lineTo(f,u),this.context.lineTo(f,u),this.context.fillStyle=r.color||"#000000",this.context.strokeStyle=r.color||"#000000",this.context.lineWidth=2,this.context.lineJoin="round",this.context.closePath(),this.context.stroke(),this.context.fill()}this.context.beginPath(),this.context.strokeStyle=this.config.stroke.color,this.context.lineWidth=this.config.stroke.size,this.context.fillStyle=this.config.textureColor,this.context.arc(i,i,n/2,0,2*Math.PI,!1),this.context.stroke(),this.context.fill()}}]),e}(x);return new i(t,e,n)},S=function(t,e){var n=[],i=t,o=e;if(void 0===i)return{shapes:n,options:i};if(void 0===i.styles)return{shapes:n,options:i};for(var r=function(t,e,n){var r=[];for(var s in e.map((function(e){if(void 0===i.styles[e])i.styles[e]=t({type:e});else if(void 0===i.styles[e].temp){var n=i.styles[e];if(void 0!==n.animation&&!1===n.animation.status)return void(i.styles[e]=t(Object.assign({type:e},i.styles[e]),void 0,!0));i.styles[e]=t(Object.assign({type:e},i.styles[e]))}})),i.styles){var a=i.styles[s];if(a.type===n){var c=a;if(void 0!==a.config&&(c=a.config),void 0!==c.animation){if(!1===c.animation.status){c.texture=c.animation.textureFrame[c.animation.scene+1];var h=new t(c,o,!0);r.push({config:h.toTexture(),name:s});continue}void 0===c.animation.textureFrame&&(c.animation.textureFrame=[]),c.animation.textureFrame.push(c.texture),delete c.texture}var f=new t(a.config||a,o);r.push({config:f.toConfig(),name:s})}}return r},s=r(k,["triangle","quadrilateral","pentagon","hexagon","heptagon","octagon","nonagon"],"Polygon"),a=r(m,["circle","ellipse"],"Ellipse"),c=r(w,["square","vee","tag"],"Custom"),h=r(P,[],"PieChart"),f=r(_,[],"DoughnutChart"),u=r(z,[],"GaugeChart"),l=r(C,[],"RadialHistogram"),g=["star"],d=3;d<=10;d++)g.push("star-".concat(d));var p=r(b,g,"Star");return n=n.concat(s).concat(p).concat(a).concat(c).concat(h).concat(u).concat(f).concat(l),{options:i,shapes:n}};"undefined"==typeof ccNetViz?console.warn("ccNetViz node plugin could not be implemented."):(void 0===ccNetViz.plugin&&(ccNetViz.plugin={}),ccNetViz.plugin.node={Ellipse:m,Star:b,Polygon:k,Custom:w,PieChart:P,GaugeChart:z,DoughnutChart:_,Integration:S});e.default={Ellipse:m,Star:b,Polygon:k,Custom:w,PieChart:P,GaugeChart:z,DoughnutChart:_,Integration:S}}]);