diff --git a/.eslintrc.json b/.eslintrc.json
index 782125e7..c561afde 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -5,7 +5,7 @@
"jquery": true
},
"globals": {
- "Raphael": "readonly",
+ "Chartist": "readonly",
"getAnchors": "readonly"
},
"rules": {
diff --git a/antispam_bee.php b/antispam_bee.php
index 06857a56..ac9a7af4 100755
--- a/antispam_bee.php
+++ b/antispam_bee.php
@@ -810,6 +810,18 @@ public static function add_dashboard_chart() {
public static function add_dashboard_style() {
$plugin = get_plugin_data( __FILE__ );
+ wp_register_style(
+ 'chartist_css',
+ plugins_url( '/css/chartist.min.css', __FILE__ ),
+ array(),
+ '1.3.0'
+ );
+ wp_register_style(
+ 'chartist_tooltip_css',
+ plugins_url( '/css/chartist-plugin-tooltip.min.css', __FILE__ ),
+ array(),
+ '1.0.0'
+ );
wp_register_style(
'ab_chart',
plugins_url( 'css/dashboard.min.css', __FILE__ ),
@@ -817,7 +829,7 @@ public static function add_dashboard_style() {
$plugin['Version']
);
- wp_print_styles( 'ab_chart' );
+ wp_print_styles( array( 'chartist_css', 'chartist_tooltip_css', 'ab_chart' ) );
}
@@ -835,25 +847,25 @@ public static function add_dashboard_script() {
$plugin = get_plugin_data( __FILE__ );
wp_enqueue_script(
- 'raphael',
- plugins_url( 'js/raphael.min.js', __FILE__ ),
+ 'chartist_js',
+ plugins_url( 'js/chartist.min.js', __FILE__ ),
array(),
- '2.1.0',
+ '1.3.0',
true
);
wp_enqueue_script(
- 'ab-raphael',
- plugins_url( 'js/raphael.helper.min.js', __FILE__ ),
- array( 'raphael' ),
- $plugin['Version'],
+ 'chartist_tooltip_js',
+ plugins_url( 'js/chartist-plugin-tooltip.min.js', __FILE__ ),
+ array( 'chartist_js' ),
+ '1.0.0',
true
);
wp_enqueue_script(
'ab_chart_js',
plugins_url( 'js/dashboard.min.js', __FILE__ ),
- array( 'jquery', 'ab-raphael' ),
+ array( 'jquery', 'chartist_js' ),
$plugin['Version'],
true
);
diff --git a/composer.json b/composer.json
index 43ea4454..9d026077 100644
--- a/composer.json
+++ b/composer.json
@@ -69,7 +69,7 @@
"npx stylelint css/dashboard.css css/styles.css"
],
"lint-js": [
- "npx eslint js/dashboard.js js/raphael.helper.js js/scripts.js"
+ "npx eslint js/dashboard.js js/scripts.js"
],
"lint-php": [
"phpcs --standard=phpcs.xml -s"
@@ -78,7 +78,6 @@
"minifycss css/dashboard.css > css/dashboard.min.css",
"minifycss css/styles.css > css/styles.min.css",
"minifyjs js/dashboard.js > js/dashboard.min.js",
- "minifyjs js/raphael.helper.js > js/raphael.helper.min.js",
"minifyjs js/scripts.js > js/scripts.min.js"
]
}
diff --git a/css/chartist-plugin-tooltip.min.css b/css/chartist-plugin-tooltip.min.css
new file mode 100644
index 00000000..20826eac
--- /dev/null
+++ b/css/chartist-plugin-tooltip.min.css
@@ -0,0 +1 @@
+.chartist-tooltip{position:absolute;display:inline-block;opacity:0;min-width:5em;padding:.5em;background:#F4C63D;color:#453D3F;font-family:Oxygen,Helvetica,Arial,sans-serif;font-weight:700;text-align:center;pointer-events:none;z-index:1;-webkit-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;-o-transition:opacity 0.2s linear;transition:opacity 0.2s linear}.chartist-tooltip:before{content:"";position:absolute;top:100%;left:50%;width:0;height:0;margin-left:-15px;border:15px solid transparent;border-top-color:#F4C63D}.chartist-tooltip.tooltip-show{opacity:1}.ct-area,.ct-line{pointer-events:none}
\ No newline at end of file
diff --git a/css/chartist.min.css b/css/chartist.min.css
new file mode 100644
index 00000000..1eb48b9d
--- /dev/null
+++ b/css/chartist.min.css
@@ -0,0 +1,2 @@
+.ct-label{fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:.75rem;line-height:1}.ct-chart-bar .ct-label,.ct-chart-line .ct-label{display:flex}.ct-chart-donut .ct-label,.ct-chart-pie .ct-label{dominant-baseline:central}.ct-label.ct-horizontal.ct-start{align-items:flex-end;justify-content:flex-start;text-align:left}.ct-label.ct-horizontal.ct-end{align-items:flex-start;justify-content:flex-start;text-align:left}.ct-label.ct-vertical.ct-start{align-items:flex-end;justify-content:flex-end;text-align:right}.ct-label.ct-vertical.ct-end{align-items:flex-end;justify-content:flex-start;text-align:left}.ct-chart-bar .ct-label.ct-horizontal.ct-start{align-items:flex-end;justify-content:center;text-align:center}.ct-chart-bar .ct-label.ct-horizontal.ct-end{align-items:flex-start;justify-content:center;text-align:center}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-horizontal.ct-start{align-items:flex-end;justify-content:flex-start;text-align:left}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-horizontal.ct-end{align-items:flex-start;justify-content:flex-start;text-align:left}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-vertical.ct-start{align-items:center;justify-content:flex-end;text-align:right}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-vertical.ct-end{align-items:center;justify-content:flex-start;text-align:left}.ct-grid{stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px}.ct-grid-background{fill:none}.ct-point{stroke-width:10px;stroke-linecap:round}.ct-line{fill:none;stroke-width:4px}.ct-area{stroke:none;fill-opacity:.1}.ct-bar{fill:none;stroke-width:10px}.ct-slice-donut{fill:none;stroke-width:60px}.ct-series-a .ct-bar,.ct-series-a .ct-line,.ct-series-a .ct-point,.ct-series-a .ct-slice-donut{stroke:#d70206}.ct-series-a .ct-area,.ct-series-a .ct-slice-pie{fill:#d70206}.ct-series-b .ct-bar,.ct-series-b .ct-line,.ct-series-b .ct-point,.ct-series-b .ct-slice-donut{stroke:#f05b4f}.ct-series-b .ct-area,.ct-series-b .ct-slice-pie{fill:#f05b4f}.ct-series-c .ct-bar,.ct-series-c .ct-line,.ct-series-c .ct-point,.ct-series-c .ct-slice-donut{stroke:#f4c63d}.ct-series-c .ct-area,.ct-series-c .ct-slice-pie{fill:#f4c63d}.ct-series-d .ct-bar,.ct-series-d .ct-line,.ct-series-d .ct-point,.ct-series-d .ct-slice-donut{stroke:#d17905}.ct-series-d .ct-area,.ct-series-d .ct-slice-pie{fill:#d17905}.ct-series-e .ct-bar,.ct-series-e .ct-line,.ct-series-e .ct-point,.ct-series-e .ct-slice-donut{stroke:#453d3f}.ct-series-e .ct-area,.ct-series-e .ct-slice-pie{fill:#453d3f}.ct-series-f .ct-bar,.ct-series-f .ct-line,.ct-series-f .ct-point,.ct-series-f .ct-slice-donut{stroke:#59922b}.ct-series-f .ct-area,.ct-series-f .ct-slice-pie{fill:#59922b}.ct-series-g .ct-bar,.ct-series-g .ct-line,.ct-series-g .ct-point,.ct-series-g .ct-slice-donut{stroke:#0544d3}.ct-series-g .ct-area,.ct-series-g .ct-slice-pie{fill:#0544d3}.ct-series-h .ct-bar,.ct-series-h .ct-line,.ct-series-h .ct-point,.ct-series-h .ct-slice-donut{stroke:#6b0392}.ct-series-h .ct-area,.ct-series-h .ct-slice-pie{fill:#6b0392}.ct-series-i .ct-bar,.ct-series-i .ct-line,.ct-series-i .ct-point,.ct-series-i .ct-slice-donut{stroke:#e6805e}.ct-series-i .ct-area,.ct-series-i .ct-slice-pie{fill:#e6805e}.ct-series-j .ct-bar,.ct-series-j .ct-line,.ct-series-j .ct-point,.ct-series-j .ct-slice-donut{stroke:#dda458}.ct-series-j .ct-area,.ct-series-j .ct-slice-pie{fill:#dda458}.ct-series-k .ct-bar,.ct-series-k .ct-line,.ct-series-k .ct-point,.ct-series-k .ct-slice-donut{stroke:#eacf7d}.ct-series-k .ct-area,.ct-series-k .ct-slice-pie{fill:#eacf7d}.ct-series-l .ct-bar,.ct-series-l .ct-line,.ct-series-l .ct-point,.ct-series-l .ct-slice-donut{stroke:#86797d}.ct-series-l .ct-area,.ct-series-l .ct-slice-pie{fill:#86797d}.ct-series-m .ct-bar,.ct-series-m .ct-line,.ct-series-m .ct-point,.ct-series-m .ct-slice-donut{stroke:#b2c326}.ct-series-m .ct-area,.ct-series-m .ct-slice-pie{fill:#b2c326}.ct-series-n .ct-bar,.ct-series-n .ct-line,.ct-series-n .ct-point,.ct-series-n .ct-slice-donut{stroke:#6188e2}.ct-series-n .ct-area,.ct-series-n .ct-slice-pie{fill:#6188e2}.ct-series-o .ct-bar,.ct-series-o .ct-line,.ct-series-o .ct-point,.ct-series-o .ct-slice-donut{stroke:#a748ca}.ct-series-o .ct-area,.ct-series-o .ct-slice-pie{fill:#a748ca}.ct-square{display:block;position:relative;width:100%}.ct-square:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:100%}.ct-square:after{content:"";display:table;clear:both}.ct-square>svg{display:block;position:absolute;top:0;left:0}.ct-minor-second{display:block;position:relative;width:100%}.ct-minor-second:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:93.75%}.ct-minor-second:after{content:"";display:table;clear:both}.ct-minor-second>svg{display:block;position:absolute;top:0;left:0}.ct-major-second{display:block;position:relative;width:100%}.ct-major-second:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:88.8888888889%}.ct-major-second:after{content:"";display:table;clear:both}.ct-major-second>svg{display:block;position:absolute;top:0;left:0}.ct-minor-third{display:block;position:relative;width:100%}.ct-minor-third:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:83.3333333333%}.ct-minor-third:after{content:"";display:table;clear:both}.ct-minor-third>svg{display:block;position:absolute;top:0;left:0}.ct-major-third{display:block;position:relative;width:100%}.ct-major-third:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:80%}.ct-major-third:after{content:"";display:table;clear:both}.ct-major-third>svg{display:block;position:absolute;top:0;left:0}.ct-perfect-fourth{display:block;position:relative;width:100%}.ct-perfect-fourth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:75%}.ct-perfect-fourth:after{content:"";display:table;clear:both}.ct-perfect-fourth>svg{display:block;position:absolute;top:0;left:0}.ct-perfect-fifth{display:block;position:relative;width:100%}.ct-perfect-fifth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:66.6666666667%}.ct-perfect-fifth:after{content:"";display:table;clear:both}.ct-perfect-fifth>svg{display:block;position:absolute;top:0;left:0}.ct-minor-sixth{display:block;position:relative;width:100%}.ct-minor-sixth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:62.5%}.ct-minor-sixth:after{content:"";display:table;clear:both}.ct-minor-sixth>svg{display:block;position:absolute;top:0;left:0}.ct-golden-section{display:block;position:relative;width:100%}.ct-golden-section:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:61.804697157%}.ct-golden-section:after{content:"";display:table;clear:both}.ct-golden-section>svg{display:block;position:absolute;top:0;left:0}.ct-major-sixth{display:block;position:relative;width:100%}.ct-major-sixth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:60%}.ct-major-sixth:after{content:"";display:table;clear:both}.ct-major-sixth>svg{display:block;position:absolute;top:0;left:0}.ct-minor-seventh{display:block;position:relative;width:100%}.ct-minor-seventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:56.25%}.ct-minor-seventh:after{content:"";display:table;clear:both}.ct-minor-seventh>svg{display:block;position:absolute;top:0;left:0}.ct-major-seventh{display:block;position:relative;width:100%}.ct-major-seventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:53.3333333333%}.ct-major-seventh:after{content:"";display:table;clear:both}.ct-major-seventh>svg{display:block;position:absolute;top:0;left:0}.ct-octave{display:block;position:relative;width:100%}.ct-octave:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:50%}.ct-octave:after{content:"";display:table;clear:both}.ct-octave>svg{display:block;position:absolute;top:0;left:0}.ct-major-tenth{display:block;position:relative;width:100%}.ct-major-tenth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:40%}.ct-major-tenth:after{content:"";display:table;clear:both}.ct-major-tenth>svg{display:block;position:absolute;top:0;left:0}.ct-major-eleventh{display:block;position:relative;width:100%}.ct-major-eleventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:37.5%}.ct-major-eleventh:after{content:"";display:table;clear:both}.ct-major-eleventh>svg{display:block;position:absolute;top:0;left:0}.ct-major-twelfth{display:block;position:relative;width:100%}.ct-major-twelfth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:33.3333333333%}.ct-major-twelfth:after{content:"";display:table;clear:both}.ct-major-twelfth>svg{display:block;position:absolute;top:0;left:0}.ct-double-octave{display:block;position:relative;width:100%}.ct-double-octave:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:25%}.ct-double-octave:after{content:"";display:table;clear:both}.ct-double-octave>svg{display:block;position:absolute;top:0;left:0}
+/*# sourceMappingURL=index.css.map */
\ No newline at end of file
diff --git a/css/dashboard.css b/css/dashboard.css
index 91a8d62e..8535052a 100644
--- a/css/dashboard.css
+++ b/css/dashboard.css
@@ -1,10 +1,50 @@
#ab_chart {
color: #a7aaad;
+ flex: 0 0 100%;
+ direction: rtl;
height: 140px;
margin: 0 -4px;
+ overflow-x: auto;
+ overflow-y: hidden;
text-align: center;
}
+#ab_chart .ct-label.ct-vertical.ct-start {
+ justify-content: flex-start;
+ text-align: left;
+ text-anchor: start;
+}
+
+#ab_chart .ct-line {
+ stroke: #3582c4;
+ stroke-width: 2px;
+}
+
+#ab_chart .ct-point {
+ fill: #fff;
+ stroke: #3582c4;
+ stroke-width: 1.5px;
+}
+
+#ab_chart .ct-area {
+ fill: #3582c4;
+}
+
+.ab-chartist-tooltip {
+ border: 1px solid #000;
+ background-color: #fff;
+ border-radius: 0.2em;
+ padding: 0.1em 0.5em;
+}
+
+.ab-chartist-tooltip::before {
+ border-top-color: #0009;
+}
+
+.ab-chartist-tooltip .chartist-tooltip-meta {
+ color: #3582c4;
+}
+
#ab_chart_data {
display: none;
}
diff --git a/js/chartist-plugin-tooltip.min.js b/js/chartist-plugin-tooltip.min.js
new file mode 100644
index 00000000..85da406e
--- /dev/null
+++ b/js/chartist-plugin-tooltip.min.js
@@ -0,0 +1,7 @@
+/* chartist-plugin-tooltip 1.0.0
+ * Copyright © 2023 Markus Padourek
+ * Free to use under the WTFPL license.
+ * http://www.wtfpl.net/
+ */
+!function(e,o){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define(["chartist"],function(t){return e["Chartist.plugins.tooltip"]=o(t)}):"object"==typeof module&&module.exports?module.exports=o(require("chartist")):e["Chartist.plugins.tooltip"]=o(e.Chartist)}(this,function(t){return function(m,h,x){"use strict";var t={currency:void 0,currencyFormatCallback:void 0,tooltipOffset:{x:0,y:-20},anchorToPoint:!1,appendToBody:!0,class:void 0,pointClass:"ct-point"};function b(t,e){return-1<(" "+t.getAttribute("class")+" ").indexOf(" "+e+" ")}function v(t){var e;return v in t?(e=t.offsetParent)||h.body.parentElement:(e=t.parentNode)?"static"!==m.getComputedStyle(e).position?e:"BODY"===e.tagName?e.parentElement:v(e):h.body.parentElement}x.plugins=x.plugins||{},x.plugins.tooltip=function(y){return y=x.extend({},t,y),function(l){var t=y.pointClass,r=(l instanceof x.BarChart?t="ct-bar":l instanceof x.PieChart&&(t=l.options.donut?l.options.donutSolid?"ct-slice-donut-solid":"ct-slice-donut":"ct-slice-pie"),l.container),p=!1,c=v(r),f=(y.appendToBody?h:r).querySelector(".chartist-tooltip"),u=(f||((f=h.createElement("div")).className=y.class?"chartist-tooltip "+y.class:"chartist-tooltip",(y.appendToBody?h.body:r).appendChild(f)),f.offsetHeight),d=f.offsetWidth;function e(t,e,o){r.addEventListener(t,function(t){e&&!b(t.target,e)||o(t)})}function g(t){u=u||f.offsetHeight;var e,o,n,a,i=-(d=d||f.offsetWidth)/2+y.tooltipOffset.x,s=-u+y.tooltipOffset.y,l=!0===y.anchorToPoint&&t.target.x2&&t.target.y2;!0===y.appendToBody?l?(o=r.getBoundingClientRect(),n=t.target.x2.baseVal.value+o.left+m.pageXOffset,a=t.target.y2.baseVal.value+o.top+m.pageYOffset,f.style.left=n+i+"px",f.style.top=a+s+"px"):(f.style.left=t.pageX+i+"px",f.style.top=t.pageY+s+"px"):(i=-(e=c.getBoundingClientRect()).left-m.pageXOffset+i,e=-e.top-m.pageYOffset+s,l?(o=r.getBoundingClientRect(),n=t.target.x2.baseVal.value+o.left+m.pageXOffset,a=t.target.y2.baseVal.value+o.top+m.pageYOffset,f.style.left=n+i+"px",f.style.top=a+e+"px"):(f.style.left=t.pageX+i+"px",f.style.top=t.pageY+e+"px"))}function o(t){p=!1;var e=new RegExp("tooltip-show\\s*","gi");t.className=t.className.replace(e,"").trim()}o(f),e("mouseover",t,function(t){var e,o=t.target,n="",a=(l instanceof x.PieChart?o:o.parentNode)?o.parentNode.getAttribute("ct:meta")||o.parentNode.getAttribute("ct:series-name"):"",a=o.getAttribute("ct:meta")||a||"",i=!!a,s=o.getAttribute("ct:value");y.transformTooltipTextFnc&&"function"==typeof y.transformTooltipTextFnc&&(s=y.transformTooltipTextFnc(s)),y.tooltipFnc&&"function"==typeof y.tooltipFnc?n=y.tooltipFnc(a,s):(y.metaIsHTML&&((e=h.createElement("textarea")).innerHTML=a,a=e.value),a=''+a+"",i?n+=a+"
":l instanceof x.PieChart&&(e=function(t,e){for(;t=t.nextSibling,t&&!b(t,e););return t}(o,"ct-label"))&&(n+=((i=e).innerText||i.textContent)+"
"),s&&(n+=s=''+(s=y.currency?null!=y.currencyFormatCallback?y.currencyFormatCallback(s,y):y.currency+s.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g,"$1,"):s)+"")),n&&(f.innerHTML=n,u=f.offsetHeight,d=f.offsetWidth,!0!==y.appendToBody&&(c=v(r)),"absolute"!==f.style.display&&(f.style.display="absolute"),g(t),p=!0,b(a=f,"tooltip-show")||(a.className=a.className+" tooltip-show"),u=f.offsetHeight,d=f.offsetWidth)}),e("mouseout",t,function(){o(f)}),e("mousemove",null,function(t){!1===y.anchorToPoint&&p&&g(t)})}}}(window,document,t),t.plugins.tooltip});
+//# sourceMappingURL=chartist-plugin-tooltip.min.js.map
\ No newline at end of file
diff --git a/js/chartist.min.js b/js/chartist.min.js
new file mode 100644
index 00000000..54a929a9
--- /dev/null
+++ b/js/chartist.min.js
@@ -0,0 +1,2 @@
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Chartist={})}(this,(function(e){"use strict";const t={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},s={"&":"&","<":"<",">":">",'"':""","'":"'"};function i(e,t){return"number"==typeof e?e+t:e}function n(e){if("string"==typeof e){const t=/^(\d+)\s*(.*)$/g.exec(e);return{value:t?+t[1]:0,unit:(null==t?void 0:t[2])||void 0}}return{value:Number(e)}}function r(e){return String.fromCharCode(97+e%26)}const a=2221e-19;function o(e){return Math.floor(Math.log(Math.abs(e))/Math.LN10)}function l(e,t,s){return t/s.range*e}function h(e,t){const s=Math.pow(10,t||8);return Math.round(e*s)/s}function c(e){if(1===e)return e;function t(e,s){return e%s==0?s:t(s,e%s)}function s(e){return e*e+1}let i,n=2,r=2;if(e%2==0)return 2;do{n=s(n)%e,r=s(s(r))%e,i=t(Math.abs(n-r),e)}while(1===i);return i}function u(e,t,s,i){const n=(i-90)*Math.PI/180;return{x:e+s*Math.cos(n),y:t+s*Math.sin(n)}}function d(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n={high:t.high,low:t.low,valueRange:0,oom:0,step:0,min:0,max:0,range:0,numberOfSteps:0,values:[]};n.valueRange=n.high-n.low,n.oom=o(n.valueRange),n.step=Math.pow(10,n.oom),n.min=Math.floor(n.low/n.step)*n.step,n.max=Math.ceil(n.high/n.step)*n.step,n.range=n.max-n.min,n.numberOfSteps=Math.round(n.range/n.step);const r=l(e,n.step,n),u=r=s)n.step=1;else if(i&&d=s)n.step=d;else{let t=0;for(;;){if(u&&l(e,n.step,n)<=s)n.step*=2;else{if(u||!(l(e,n.step/2,n)>=s))break;if(n.step/=2,i&&n.step%1!=0){n.step*=2;break}}if(t++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}}function m(e,t){return e===(e+=t)&&(e*=1+(t>0?a:-a)),e}n.step=Math.max(n.step,a);let p=n.min,f=n.max;for(;p+n.step<=n.low;)p=m(p,n.step);for(;f-n.step>=n.high;)f=m(f,-n.step);n.min=p,n.max=f,n.range=n.max-n.min;const g=[];for(let e=n.min;e<=n.max;e=m(e,n.step)){const t=h(e);t!==g[g.length-1]&&g.push(t)}return n.values=g,n}function m(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;ie;function f(e,t){return Array.from({length:e},t?(e,s)=>t(s):()=>{})}const g=(e,t)=>e+(t||0),x=(e,t)=>f(Math.max(...e.map((e=>e.length))),(s=>t(...e.map((e=>e[s])))));function v(e,t){return null!==e&&"object"==typeof e&&Reflect.has(e,t)}function y(e){return null!==e&&isFinite(e)}function w(e){return!e&&0!==e}function b(e){return y(e)?Number(e):void 0}function E(e){return!!Array.isArray(e)&&e.every(Array.isArray)}function A(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=0;e[s?"reduceRight":"reduce"](((e,s,n)=>t(s,i++,n)),void 0)}function M(e,t){const s=Array.isArray(e)?e[t]:v(e,"data")?e.data[t]:null;return v(s,"meta")?s.meta:void 0}function N(e){return null==e||"number"==typeof e&&isNaN(e)}function C(e){return Array.isArray(e)&&e.every((e=>Array.isArray(e)||v(e,"data")))}function O(e){return"object"==typeof e&&null!==e&&(Reflect.has(e,"x")||Reflect.has(e,"y"))}function L(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y";return O(e)&&v(e,t)?b(e[t]):b(e)}function S(e,t,s){const i={high:void 0===(t={...t,...s?"x"===s?t.axisX:t.axisY:{}}).high?-Number.MAX_VALUE:+t.high,low:void 0===t.low?Number.MAX_VALUE:+t.low},n=void 0===t.high,r=void 0===t.low;return(n||r)&&function e(t){if(!N(t))if(Array.isArray(t))for(let s=0;si.high&&(i.high=e),r&&e0||(i.high=1),i.low=0)),i}function B(e){let t,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;const r={labels:(e.labels||[]).slice(),series:z(e.series,i,n)},a=r.labels.length;return E(r.series)?(t=Math.max(a,...r.series.map((e=>e.length))),r.series.forEach((e=>{e.push(...f(Math.max(0,t-e.length)))}))):t=r.series.length,r.labels.push(...f(Math.max(0,t-a),(()=>""))),s&&k(r),r}function k(e){var t;null===(t=e.labels)||void 0===t||t.reverse(),e.series.reverse();for(const t of e.series)v(t,"data")?t.data.reverse():Array.isArray(t)&&t.reverse()}function _(e,t){if(!N(e))return t?function(e,t){let s,i;if("object"!=typeof e){const n=b(e);"x"===t?s=n:i=n}else v(e,"x")&&(s=b(e.x)),v(e,"y")&&(i=b(e.y));if(void 0!==s||void 0!==i)return{x:s,y:i}}(e,t):b(e)}function j(e,t){return Array.isArray(e)?e.map((e=>v(e,"value")?_(e.value,t):_(e,t))):j(e.data,t)}function z(e,t,s){if(C(e))return e.map((e=>j(e,t)));const i=j(e,t);return s?i.map((e=>[e])):i}function I(e,t,s){const i={increasingX:!1,fillHoles:!1,...s},n=[];let r=!0;for(let s=0;s=2&&e[s]<=e[s-2]&&(r=!0),r&&(n.push({pathCoordinates:[],valueData:[]}),r=!1),n[n.length-1].pathCoordinates.push(e[s],e[s+1]),n[n.length-1].valueData.push(t[s/2]));return n}function X(e){let t="";return null==e?e:(t="number"==typeof e?""+e:"object"==typeof e?JSON.stringify({data:e}):String(e),Object.keys(s).reduce(((e,t)=>e.replaceAll(t,s[t])),t))}class P{call(e,t){return this.svgElements.forEach((s=>Reflect.apply(s[e],s,t))),this}attr(){for(var e=arguments.length,t=new Array(e),s=0;s3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4?arguments[4]:void 0;const{easing:o,...l}=s,h={};let c,u;o&&(c=Array.isArray(o)?o:V[o]),l.begin=i(l.begin,"ms"),l.dur=i(l.dur,"ms"),c&&(l.calcMode="spline",l.keySplines=c.join(" "),l.keyTimes="0;1"),r&&(l.fill="freeze",h[t]=l.from,e.attr(h),u=n(l.begin||0).value,l.begin="indefinite");const d=e.elem("animate",{attributeName:t,...l});r&&setTimeout((()=>{try{d._node.beginElement()}catch(s){h[t]=l.to,e.attr(h),d.remove()}}),u);const m=d.getNode();a&&m.addEventListener("beginEvent",(()=>a.emit("animationBegin",{element:e,animate:m,params:s}))),m.addEventListener("endEvent",(()=>{a&&a.emit("animationEnd",{element:e,animate:m,params:s}),r&&(h[t]=l.to,e.attr(h),d.remove())}))}class R{attr(e,s){return"string"==typeof e?s?this._node.getAttributeNS(s,e):this._node.getAttribute(e):(Object.keys(e).forEach((s=>{if(void 0!==e[s])if(-1!==s.indexOf(":")){const i=s.split(":");this._node.setAttributeNS(t[i[0]],s,String(e[s]))}else this._node.setAttribute(s,String(e[s]))})),this)}elem(e,t,s){return new R(e,t,s,this,arguments.length>3&&void 0!==arguments[3]&&arguments[3])}parent(){return this._node.parentNode instanceof SVGElement?new R(this._node.parentNode):null}root(){let e=this._node;for(;"svg"!==e.nodeName&&e.parentElement;)e=e.parentElement;return new R(e)}querySelector(e){const t=this._node.querySelector(e);return t?new R(t):null}querySelectorAll(e){const t=this._node.querySelectorAll(e);return new P(t)}getNode(){return this._node}foreignObject(e,s,i){let n,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("string"==typeof e){const t=document.createElement("div");t.innerHTML=e,n=t.firstChild}else n=e;n instanceof Element&&n.setAttribute("xmlns",t.xmlns);const a=this.elem("foreignObject",s,i,r);return a._node.appendChild(n),a}text(e){return this._node.appendChild(document.createTextNode(e)),this}empty(){for(;this._node.firstChild;)this._node.removeChild(this._node.firstChild);return this}remove(){var e;return null===(e=this._node.parentNode)||void 0===e||e.removeChild(this._node),this.parent()}replace(e){var t;return null===(t=this._node.parentNode)||void 0===t||t.replaceChild(e._node,this._node),e}append(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&this._node.firstChild?this._node.insertBefore(e._node,this._node.firstChild):this._node.appendChild(e._node),this}classes(){const e=this._node.getAttribute("class");return e?e.trim().split(/\s+/):[]}addClass(e){return this._node.setAttribute("class",this.classes().concat(e.trim().split(/\s+/)).filter((function(e,t,s){return s.indexOf(e)===t})).join(" ")),this}removeClass(e){const t=e.trim().split(/\s+/);return this._node.setAttribute("class",this.classes().filter((e=>-1===t.indexOf(e))).join(" ")),this}removeAllClasses(){return this._node.setAttribute("class",""),this}height(){return this._node.getBoundingClientRect().height}width(){return this._node.getBoundingClientRect().width}animate(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=arguments.length>2?arguments[2]:void 0;return Object.keys(e).forEach((i=>{const n=e[i];Array.isArray(n)?n.forEach((e=>Y(this,i,e,!1,s))):Y(this,i,n,t,s)})),this}constructor(e,s,i,n,r=!1){e instanceof Element?this._node=e:(this._node=document.createElementNS(t.svg,e),"svg"===e&&this.attr({"xmlns:ct":t.ct})),s&&this.attr(s),i&&this.addClass(i),n&&(r&&n._node.firstChild?n._node.insertBefore(this._node,n._node.firstChild):n._node.appendChild(this._node))}}function G(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"100%",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"100%",n=arguments.length>3?arguments[3]:void 0;Array.from(e.querySelectorAll("svg")).filter((e=>e.getAttributeNS(t.xmlns,"ct"))).forEach((t=>e.removeChild(t)));const r=new R("svg").attr({width:s,height:i}).attr({style:"width: ".concat(s,"; height: ").concat(i,";")});return n&&r.addClass(n),e.appendChild(r.getNode()),r}function D(e){return"number"==typeof e?{top:e,right:e,bottom:e,left:e}:void 0===e?{top:0,right:0,bottom:0,left:0}:{top:"number"==typeof e.top?e.top:0,right:"number"==typeof e.right?e.right:0,bottom:"number"==typeof e.bottom?e.bottom:0,left:"number"==typeof e.left?e.left:0}}function U(e,t){var s,i,r,a;const o=Boolean(t.axisX||t.axisY),l=(null===(s=t.axisY)||void 0===s?void 0:s.offset)||0,h=(null===(i=t.axisX)||void 0===i?void 0:i.offset)||0,c=null===(r=t.axisY)||void 0===r?void 0:r.position,u=null===(a=t.axisX)||void 0===a?void 0:a.position;let d=e.width()||n(t.width).value||0,m=e.height()||n(t.height).value||0;const p=D(t.chartPadding);d=Math.max(d,l+p.left+p.right),m=Math.max(m,h+p.top+p.bottom);const f={x1:0,x2:0,y1:0,y2:0,padding:p,width(){return this.x2-this.x1},height(){return this.y1-this.y2}};return o?("start"===u?(f.y2=p.top+h,f.y1=Math.max(m-p.bottom,f.y2+1)):(f.y2=p.top,f.y1=Math.max(m-p.bottom-h,f.y2+1)),"start"===c?(f.x1=p.left+l,f.x2=Math.max(d-p.right,f.x1+1)):(f.x1=p.left,f.x2=Math.max(d-p.right-l,f.x1+1))):(f.x1=p.left,f.x2=Math.max(d-p.right,f.x1+1),f.y2=p.top,f.y1=Math.max(m-p.bottom,f.y2+1)),f}function H(e,t,s,i,n,r,a,o){const l={["".concat(s.units.pos,"1")]:e,["".concat(s.units.pos,"2")]:e,["".concat(s.counterUnits.pos,"1")]:i,["".concat(s.counterUnits.pos,"2")]:i+n},h=r.elem("line",l,a.join(" "));o.emit("draw",{type:"grid",axis:s,index:t,group:r,element:h,...l})}function T(e,t,s,i){const n=e.elem("rect",{x:t.x1,y:t.y2,width:t.width(),height:t.height()},s,!0);i.emit("draw",{type:"gridBackground",group:e,element:n})}function Q(e,t,s,i,n,r,a,o,l,h){const c={[n.units.pos]:e+a[n.units.pos],[n.counterUnits.pos]:a[n.counterUnits.pos],[n.units.len]:t,[n.counterUnits.len]:Math.max(0,r-10)},u=Math.round(c[n.units.len]),d=Math.round(c[n.counterUnits.len]),m=document.createElement("span");m.className=l.join(" "),m.style[n.units.len]=u+"px",m.style[n.counterUnits.len]=d+"px",m.textContent=String(i);const p=o.foreignObject(m,{style:"overflow: visible;",...c});h.emit("draw",{type:"label",axis:n,index:s,group:o,element:p,text:i,...c})}function F(e,t,s){let i;const n=[];function r(n){const r=i;i=m({},e),t&&t.forEach((e=>{window.matchMedia(e[0]).matches&&(i=m(i,e[1]))})),s&&n&&s.emit("optionsChanged",{previousOptions:r,currentOptions:i})}if(!window.matchMedia)throw new Error("window.matchMedia not found! Make sure you're using a polyfill.");return t&&t.forEach((e=>{const t=window.matchMedia(e[0]);t.addEventListener("change",r),n.push(t)})),r(),{removeMediaQueryListeners:function(){n.forEach((e=>e.removeEventListener("change",r)))},getCurrentOptions:()=>i}}R.Easing=V;const q={m:["x","y"],l:["x","y"],c:["x1","y1","x2","y2","x","y"],a:["rx","ry","xAr","lAf","sf","x","y"]},W={accuracy:3};function Z(e,t,s,i,n,r){const a={command:n?e.toLowerCase():e.toUpperCase(),...t,...r?{data:r}:{}};s.splice(i,0,a)}function $(e,t){e.forEach(((s,i)=>{q[s.command.toLowerCase()].forEach(((n,r)=>{t(s,n,i,r,e)}))}))}class J{static join(e){const t=new J(arguments.length>1&&void 0!==arguments[1]&&arguments[1],arguments.length>2?arguments[2]:void 0);for(let s=0;s2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;return Z("M",{x:+e,y:+t},this.pathElements,this.pos++,s,i),this}line(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;return Z("L",{x:+e,y:+t},this.pathElements,this.pos++,s,i),this}curve(e,t,s,i,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0;return Z("C",{x1:+e,y1:+t,x2:+s,y2:+i,x:+n,y:+r},this.pathElements,this.pos++,a,o),this}arc(e,t,s,i,n,r,a){let o=arguments.length>7&&void 0!==arguments[7]&&arguments[7],l=arguments.length>8?arguments[8]:void 0;return Z("A",{rx:e,ry:t,xAr:s,lAf:i,sf:n,x:r,y:a},this.pathElements,this.pos++,o,l),this}parse(e){const t=e.replace(/([A-Za-z])(-?[0-9])/g,"$1 $2").replace(/([0-9])([A-Za-z])/g,"$1 $2").split(/[\s,]+/).reduce(((e,t)=>(t.match(/[A-Za-z]/)&&e.push([]),e[e.length-1].push(t),e)),[]);"Z"===t[t.length-1][0].toUpperCase()&&t.pop();const s=t.map((e=>{const t=e.shift(),s=q[t.toLowerCase()];return{command:t,...s.reduce(((t,s,i)=>(t[s]=+e[i],t)),{})}}));return this.pathElements.splice(this.pos,0,...s),this.pos+=s.length,this}stringify(){const e=Math.pow(10,this.options.accuracy);return this.pathElements.reduce(((t,s)=>{const i=q[s.command.toLowerCase()].map((t=>{const i=s[t];return this.options.accuracy?Math.round(i*e)/e:i}));return t+s.command+i.join(",")}),"")+(this.close?"Z":"")}scale(e,t){return $(this.pathElements,((s,i)=>{s[i]*="x"===i[0]?e:t})),this}translate(e,t){return $(this.pathElements,((s,i)=>{s[i]+="x"===i[0]?e:t})),this}transform(e){return $(this.pathElements,((t,s,i,n,r)=>{const a=e(t,s,i,n,r);(a||0===a)&&(t[s]=a)})),this}clone(){const e=new J(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||this.close);return e.pos=this.pos,e.pathElements=this.pathElements.slice().map((e=>({...e}))),e.options={...this.options},e}splitByCommand(e){const t=[new J];return this.pathElements.forEach((s=>{s.command===e.toUpperCase()&&0!==t[t.length-1].pathElements.length&&t.push(new J),t[t.length-1].pathElements.push(s)})),t}constructor(e=!1,t){this.close=e,this.pathElements=[],this.pos=0,this.options={...W,...t}}}function K(e){const t={fillHoles:!1,...e};return function(e,s){const i=new J;let n=!0;for(let r=0;r1)return J.join(n.map((t=>e(t.pathCoordinates,t.valueData))));{if(s=n[0].pathCoordinates,i=n[0].valueData,s.length<=4)return K()(s,i);const e=[],t=[],r=s.length/2,a=[],o=[],l=[],h=[];for(let i=0;i0!=o[e]>0?a[e]=0:(a[e]=3*(h[e-1]+h[e])/((2*h[e]+h[e-1])/o[e-1]+(h[e]+2*h[e-1])/o[e]),isFinite(a[e])||(a[e]=0));const c=(new J).move(e[0],t[0],!1,i[0]);for(let s=0;s1)return J.join(a.map((t=>e(t.pathCoordinates,t.valueData))));{if(n=a[0].pathCoordinates,r=a[0].valueData,n.length<=4)return K()(n,r);const e=(new J).move(n[0],n[1],!1,r[0]),t=!1;for(let a=0,o=n.length;o-2*Number(!t)>a;a+=2){const t=[{x:+n[a-2],y:+n[a-1]},{x:+n[a],y:+n[a+1]},{x:+n[a+2],y:+n[a+3]},{x:+n[a+4],y:+n[a+5]}];o-4===a?t[3]=t[2]:a||(t[0]={x:+n[a],y:+n[a+1]}),e.curve(s*(-t[0].x+6*t[1].x+t[2].x)/6+i*t[2].x,s*(-t[0].y+6*t[1].y+t[2].y)/6+i*t[2].y,s*(t[1].x+6*t[2].x-t[3].x)/6+i*t[2].x,s*(t[1].y+6*t[2].y-t[3].y)/6+i*t[2].y,t[2].x,t[2].y,!1,r[(a+2)/2])}return e}}return K()([],[])}},monotoneCubic:ee});class se{on(e,t){const{allListeners:s,listeners:i}=this;"*"===e?s.add(t):(i.has(e)||i.set(e,new Set),i.get(e).add(t))}off(e,t){const{allListeners:s,listeners:i}=this;if("*"===e)t?s.delete(t):s.clear();else if(i.has(e)){const s=i.get(e);t?s.delete(t):s.clear(),s.size||i.delete(e)}}emit(e,t){const{allListeners:s,listeners:i}=this;i.has(e)&&i.get(e).forEach((e=>e(t))),s.forEach((s=>s(e,t)))}constructor(){this.listeners=new Map,this.allListeners=new Set}}const ie=new WeakMap;class ne{update(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var i;(e&&(this.data=e||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.eventEmitter.emit("data",{type:"update",data:this.data})),t)&&(this.options=m({},s?this.options:this.defaultOptions,t),this.initializeTimeoutId||(null===(i=this.optionsProvider)||void 0===i||i.removeMediaQueryListeners(),this.optionsProvider=F(this.options,this.responsiveOptions,this.eventEmitter)));return!this.initializeTimeoutId&&this.optionsProvider&&this.createChart(this.optionsProvider.getCurrentOptions()),this}detach(){var e;this.initializeTimeoutId?window.clearTimeout(this.initializeTimeoutId):(window.removeEventListener("resize",this.resizeListener),null===(e=this.optionsProvider)||void 0===e||e.removeMediaQueryListeners());return ie.delete(this.container),this}on(e,t){return this.eventEmitter.on(e,t),this}off(e,t){return this.eventEmitter.off(e,t),this}initialize(){window.addEventListener("resize",this.resizeListener),this.optionsProvider=F(this.options,this.responsiveOptions,this.eventEmitter),this.eventEmitter.on("optionsChanged",(()=>this.update())),this.options.plugins&&this.options.plugins.forEach((e=>{Array.isArray(e)?e[0](this,e[1]):e(this)})),this.eventEmitter.emit("data",{type:"initial",data:this.data}),this.createChart(this.optionsProvider.getCurrentOptions()),this.initializeTimeoutId=null}constructor(e,t,s,i,n){this.data=t,this.defaultOptions=s,this.options=i,this.responsiveOptions=n,this.eventEmitter=new se,this.resizeListener=()=>this.update(),this.initializeTimeoutId=setTimeout((()=>this.initialize()),0);const r="string"==typeof e?document.querySelector(e):e;if(!r)throw new Error("Target element is not found");this.container=r;const a=ie.get(r);a&&a.detach(),ie.set(r,this)}}const re={x:{pos:"x",len:"width",dir:"horizontal",rectStart:"x1",rectEnd:"x2",rectOffset:"y2"},y:{pos:"y",len:"height",dir:"vertical",rectStart:"y2",rectEnd:"y1",rectOffset:"x1"}};class ae{createGridAndLabels(e,t,s,i){const n="x"===this.units.pos?s.axisX:s.axisY,r=this.ticks.map(((e,t)=>this.projectValue(e,t))),a=this.ticks.map(n.labelInterpolationFnc);r.forEach(((o,l)=>{const h=a[l],c={x:0,y:0};let u;u=r[l+1]?r[l+1]-o:Math.max(this.axisLength-o,this.axisLength/this.ticks.length),""!==h&&w(h)||("x"===this.units.pos?(o=this.chartRect.x1+o,c.x=s.axisX.labelOffset.x,"start"===s.axisX.position?c.y=this.chartRect.padding.top+s.axisX.labelOffset.y+5:c.y=this.chartRect.y1+s.axisX.labelOffset.y+5):(o=this.chartRect.y1-o,c.y=s.axisY.labelOffset.y-u,"start"===s.axisY.position?c.x=this.chartRect.padding.left+s.axisY.labelOffset.x:c.x=this.chartRect.x2+s.axisY.labelOffset.x+10),n.showGrid&&H(o,l,this,this.gridOffset,this.chartRect[this.counterUnits.len](),e,[s.classNames.grid,s.classNames[this.units.dir]],i),n.showLabel&&Q(o,u,l,h,this,n.offset,c,t,[s.classNames.label,s.classNames[this.units.dir],"start"===n.position?s.classNames[n.position]:s.classNames.end],i))}))}constructor(e,t,s){this.units=e,this.chartRect=t,this.ticks=s,this.counterUnits=e===re.x?re.y:re.x,this.axisLength=t[this.units.rectEnd]-t[this.units.rectStart],this.gridOffset=t[this.units.rectOffset]}}class oe extends ae{projectValue(e){const t=Number(L(e,this.units.pos));return this.axisLength*(t-this.bounds.min)/this.bounds.range}constructor(e,t,s,i){const n=i.highLow||S(t,i,e.pos),r=d(s[e.rectEnd]-s[e.rectStart],n,i.scaleMinSpace||20,i.onlyInteger),a={min:r.min,max:r.max};super(e,s,r.values),this.bounds=r,this.range=a}}class le extends ae{projectValue(e,t){return this.stepLength*t}constructor(e,t,s,i){const n=i.ticks||[];super(e,s,n);const r=Math.max(1,n.length-(i.stretch?1:0));this.stepLength=this.axisLength/r,this.stretch=Boolean(i.stretch)}}function he(e,t,s){var i;if(v(e,"name")&&e.name&&(null===(i=t.series)||void 0===i?void 0:i[e.name])){const i=(null==t?void 0:t.series[e.name])[s];return void 0===i?t[s]:i}return t[s]}const ce={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:p,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:p,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,showGridBackground:!1,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};const ue={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:p,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:p,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,high:void 0,low:void 0,referenceValue:0,chartPadding:{top:15,right:15,bottom:5,left:10},seriesBarDistance:15,stackBars:!1,stackMode:"accumulate",horizontalBars:!1,distributeSeries:!1,reverseData:!1,showGridBackground:!1,classNames:{chart:"ct-chart-bar",horizontalBars:"ct-horizontal-bars",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",bar:"ct-bar",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};const de={width:void 0,height:void 0,chartPadding:5,classNames:{chartPie:"ct-chart-pie",chartDonut:"ct-chart-donut",series:"ct-series",slicePie:"ct-slice-pie",sliceDonut:"ct-slice-donut",label:"ct-label"},startAngle:0,total:void 0,donut:!1,donutWidth:60,showLabel:!0,labelOffset:0,labelPosition:"inside",labelInterpolationFnc:p,labelDirection:"neutral",ignoreEmptyValues:!1};function me(e,t,s){const i=t.x>e.x;return i&&"explode"===s||!i&&"implode"===s?"start":i&&"implode"===s||!i&&"explode"===s?"end":"middle"}e.AutoScaleAxis=oe,e.Axis=ae,e.BarChart=class extends ne{createChart(e){const{data:t}=this,s=B(t,e.reverseData,e.horizontalBars?"x":"y",!0),i=G(this.container,e.width,e.height,e.classNames.chart+(e.horizontalBars?" "+e.classNames.horizontalBars:"")),n=e.stackBars&&!0!==e.stackMode&&s.series.length?S([(a=s.series,x(a,(function(){for(var e=arguments.length,t=new Array(e),s=0;s({x:e.x+(v(t,"x")?t.x:0),y:e.y+(v(t,"y")?t.y:0)})),{x:0,y:0})})))],e,e.horizontalBars?"x":"y"):S(s.series,e,e.horizontalBars?"x":"y");var a;this.svg=i;const o=i.elem("g").addClass(e.classNames.gridGroup),l=i.elem("g"),h=i.elem("g").addClass(e.classNames.labelGroup);"number"==typeof e.high&&(n.high=e.high),"number"==typeof e.low&&(n.low=e.low);const c=U(i,e);let u;const d=e.distributeSeries&&e.stackBars?s.labels.slice(0,1):s.labels;let m,p,f;e.horizontalBars?(u=p=void 0===e.axisX.type?new oe(re.x,s.series,c,{...e.axisX,highLow:n,referenceValue:0}):new e.axisX.type(re.x,s.series,c,{...e.axisX,highLow:n,referenceValue:0}),m=f=void 0===e.axisY.type?new le(re.y,s.series,c,{ticks:d}):new e.axisY.type(re.y,s.series,c,e.axisY)):(m=p=void 0===e.axisX.type?new le(re.x,s.series,c,{ticks:d}):new e.axisX.type(re.x,s.series,c,e.axisX),u=f=void 0===e.axisY.type?new oe(re.y,s.series,c,{...e.axisY,highLow:n,referenceValue:0}):new e.axisY.type(re.y,s.series,c,{...e.axisY,highLow:n,referenceValue:0}));const g=e.horizontalBars?c.x1+u.projectValue(0):c.y1-u.projectValue(0),w="accumulate"===e.stackMode,b="accumulate-relative"===e.stackMode,E=[],N=[];let C=E;m.createGridAndLabels(o,h,e,this.eventEmitter),u.createGridAndLabels(o,h,e,this.eventEmitter),e.showGridBackground&&T(o,c,e.classNames.gridBackground,this.eventEmitter),A(t.series,((i,n)=>{const a=n-(t.series.length-1)/2;let o;o=e.distributeSeries&&!e.stackBars?m.axisLength/s.series.length/2:e.distributeSeries&&e.stackBars?m.axisLength/2:m.axisLength/s.series[n].length/2;const h=l.elem("g"),d=v(i,"name")&&i.name,x=v(i,"className")&&i.className,A=v(i,"meta")?i.meta:void 0;d&&h.attr({"ct:series-name":d}),A&&h.attr({"ct:meta":X(A)}),h.addClass([e.classNames.series,x||"".concat(e.classNames.series,"-").concat(r(n))].join(" ")),s.series[n].forEach(((t,r)=>{const l=v(t,"x")&&t.x,d=v(t,"y")&&t.y;let x,A;x=e.distributeSeries&&!e.stackBars?n:e.distributeSeries&&e.stackBars?0:r,A=e.horizontalBars?{x:c.x1+u.projectValue(l||0,r,s.series[n]),y:c.y1-m.projectValue(d||0,x,s.series[n])}:{x:c.x1+m.projectValue(l||0,x,s.series[n]),y:c.y1-u.projectValue(d||0,r,s.series[n])},m instanceof le&&(m.stretch||(A[m.units.pos]+=o*(e.horizontalBars?-1:1)),A[m.units.pos]+=e.stackBars||e.distributeSeries?0:a*e.seriesBarDistance*(e.horizontalBars?-1:1)),b&&(C=d>=0||l>=0?E:N);const O=C[r]||g;if(C[r]=O-(g-A[m.counterUnits.pos]),void 0===t)return;const L={["".concat(m.units.pos,"1")]:A[m.units.pos],["".concat(m.units.pos,"2")]:A[m.units.pos]};e.stackBars&&(w||b||!e.stackMode)?(L["".concat(m.counterUnits.pos,"1")]=O,L["".concat(m.counterUnits.pos,"2")]=C[r]):(L["".concat(m.counterUnits.pos,"1")]=g,L["".concat(m.counterUnits.pos,"2")]=A[m.counterUnits.pos]),L.x1=Math.min(Math.max(L.x1,c.x1),c.x2),L.x2=Math.min(Math.max(L.x2,c.x1),c.x2),L.y1=Math.min(Math.max(L.y1,c.y2),c.y1),L.y2=Math.min(Math.max(L.y2,c.y2),c.y1);const S=M(i,r),B=h.elem("line",L,e.classNames.bar).attr({"ct:value":[l,d].filter(y).join(","),"ct:meta":X(S)});this.eventEmitter.emit("draw",{type:"bar",value:t,index:r,meta:S,series:i,seriesIndex:n,axisX:p,axisY:f,chartRect:c,group:h,element:B,...L})}))}),e.reverseData),this.eventEmitter.emit("created",{chartRect:c,axisX:p,axisY:f,svg:i,options:e})}constructor(e,t,s,i){super(e,t,ue,m({},ue,s),i),this.data=t}},e.BaseChart=ne,e.EPSILON=a,e.EventEmitter=se,e.FixedScaleAxis=class extends ae{projectValue(e){const t=Number(L(e,this.units.pos));return this.axisLength*(t-this.range.min)/(this.range.max-this.range.min)}constructor(e,t,s,i){const n=i.highLow||S(t,i,e.pos),r=i.divisor||1,a=(i.ticks||f(r,(e=>n.low+(n.high-n.low)/r*e))).sort(((e,t)=>Number(e)-Number(t))),o={min:n.low,max:n.high};super(e,s,a),this.range=o}},e.Interpolation=te,e.LineChart=class extends ne{createChart(e){const{data:t}=this,s=B(t,e.reverseData,!0),i=G(this.container,e.width,e.height,e.classNames.chart);this.svg=i;const n=i.elem("g").addClass(e.classNames.gridGroup),a=i.elem("g"),o=i.elem("g").addClass(e.classNames.labelGroup),l=U(i,e);let h,c;h=void 0===e.axisX.type?new le(re.x,s.series,l,{...e.axisX,ticks:s.labels,stretch:e.fullWidth}):new e.axisX.type(re.x,s.series,l,e.axisX),c=void 0===e.axisY.type?new oe(re.y,s.series,l,{...e.axisY,high:y(e.high)?e.high:e.axisY.high,low:y(e.low)?e.low:e.axisY.low}):new e.axisY.type(re.y,s.series,l,e.axisY),h.createGridAndLabels(n,o,e,this.eventEmitter),c.createGridAndLabels(n,o,e,this.eventEmitter),e.showGridBackground&&T(n,l,e.classNames.gridBackground,this.eventEmitter),A(t.series,((t,i)=>{const n=a.elem("g"),o=v(t,"name")&&t.name,u=v(t,"className")&&t.className,d=v(t,"meta")?t.meta:void 0;o&&n.attr({"ct:series-name":o}),d&&n.attr({"ct:meta":X(d)}),n.addClass([e.classNames.series,u||"".concat(e.classNames.series,"-").concat(r(i))].join(" "));const m=[],p=[];s.series[i].forEach(((e,n)=>{const r={x:l.x1+h.projectValue(e,n,s.series[i]),y:l.y1-c.projectValue(e,n,s.series[i])};m.push(r.x,r.y),p.push({value:e,valueIndex:n,meta:M(t,n)})}));const f={lineSmooth:he(t,e,"lineSmooth"),showPoint:he(t,e,"showPoint"),showLine:he(t,e,"showLine"),showArea:he(t,e,"showArea"),areaBase:he(t,e,"areaBase")};let g;g="function"==typeof f.lineSmooth?f.lineSmooth:f.lineSmooth?ee():K();const x=g(m,p);if(f.showPoint&&x.pathElements.forEach((s=>{const{data:r}=s,a=n.elem("line",{x1:s.x,y1:s.y,x2:s.x+.01,y2:s.y},e.classNames.point);if(r){let e,t;v(r.value,"x")&&(e=r.value.x),v(r.value,"y")&&(t=r.value.y),a.attr({"ct:value":[e,t].filter(y).join(","),"ct:meta":X(r.meta)})}this.eventEmitter.emit("draw",{type:"point",value:null==r?void 0:r.value,index:(null==r?void 0:r.valueIndex)||0,meta:null==r?void 0:r.meta,series:t,seriesIndex:i,axisX:h,axisY:c,group:n,element:a,x:s.x,y:s.y,chartRect:l})})),f.showLine){const r=n.elem("path",{d:x.stringify()},e.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:s.series[i],path:x.clone(),chartRect:l,index:i,series:t,seriesIndex:i,meta:d,axisX:h,axisY:c,group:n,element:r})}if(f.showArea&&c.range){const r=Math.max(Math.min(f.areaBase,c.range.max),c.range.min),a=l.y1-c.projectValue(r);x.splitByCommand("M").filter((e=>e.pathElements.length>1)).map((e=>{const t=e.pathElements[0],s=e.pathElements[e.pathElements.length-1];return e.clone(!0).position(0).remove(1).move(t.x,a).line(t.x,t.y).position(e.pathElements.length+1).line(s.x,a)})).forEach((r=>{const a=n.elem("path",{d:r.stringify()},e.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:s.series[i],path:r.clone(),series:t,seriesIndex:i,axisX:h,axisY:c,chartRect:l,index:i,group:n,element:a,meta:d})}))}}),e.reverseData),this.eventEmitter.emit("created",{chartRect:l,axisX:h,axisY:c,svg:i,options:e})}constructor(e,t,s,i){super(e,t,ce,m({},ce,s),i),this.data=t}},e.PieChart=class extends ne{createChart(e){const{data:t}=this,s=B(t),i=[];let a,o,l=e.startAngle;const h=G(this.container,e.width,e.height,e.donut?e.classNames.chartDonut:e.classNames.chartPie);this.svg=h;const c=U(h,e);let d=Math.min(c.width()/2,c.height()/2);const m=e.total||s.series.reduce(g,0),p=n(e.donutWidth);"%"===p.unit&&(p.value*=d/100),d-=e.donut?p.value/2:0,o="outside"===e.labelPosition||e.donut?d:"center"===e.labelPosition?0:d/2,e.labelOffset&&(o+=e.labelOffset);const f={x:c.x1+c.width()/2,y:c.y2+c.height()/2},x=1===t.series.filter((e=>v(e,"value")?0!==e.value:0!==e)).length;t.series.forEach(((e,t)=>i[t]=h.elem("g"))),e.showLabel&&(a=h.elem("g")),t.series.forEach(((n,h)=>{var g,y;if(0===s.series[h]&&e.ignoreEmptyValues)return;const b=v(n,"name")&&n.name,E=v(n,"className")&&n.className,A=v(n,"meta")?n.meta:void 0;b&&i[h].attr({"ct:series-name":b}),i[h].addClass([null===(g=e.classNames)||void 0===g?void 0:g.series,E||"".concat(null===(y=e.classNames)||void 0===y?void 0:y.series,"-").concat(r(h))].join(" "));let M=m>0?l+s.series[h]/m*360:0;const N=Math.max(0,l-(0===h||x?0:.2));M-N>=359.99&&(M=N+359.99);const C=u(f.x,f.y,d,N),O=u(f.x,f.y,d,M),L=new J(!e.donut).move(O.x,O.y).arc(d,d,0,Number(M-l>180),0,C.x,C.y);e.donut||L.line(f.x,f.y);const S=i[h].elem("path",{d:L.stringify()},e.donut?e.classNames.sliceDonut:e.classNames.slicePie);if(S.attr({"ct:value":s.series[h],"ct:meta":X(A)}),e.donut&&S.attr({style:"stroke-width: "+p.value+"px"}),this.eventEmitter.emit("draw",{type:"slice",value:s.series[h],totalDataSum:m,index:h,meta:A,series:n,group:i[h],element:S,path:L.clone(),center:f,radius:d,startAngle:l,endAngle:M,chartRect:c}),e.showLabel){let i,r;i=1===t.series.length?{x:f.x,y:f.y}:u(f.x,f.y,o,l+(M-l)/2),r=s.labels&&!w(s.labels[h])?s.labels[h]:s.series[h];const d=e.labelInterpolationFnc(r,h);if(d||0===d){const t=a.elem("text",{dx:i.x,dy:i.y,"text-anchor":me(f,i,e.labelDirection)},e.classNames.label).text(String(d));this.eventEmitter.emit("draw",{type:"label",index:h,group:a,element:t,text:""+d,chartRect:c,series:n,meta:A,...i})}}l=M})),this.eventEmitter.emit("created",{chartRect:c,svg:h,options:e})}constructor(e,t,s,i){super(e,t,de,m({},de,s),i),this.data=t}},e.StepAxis=le,e.Svg=R,e.SvgList=P,e.SvgPath=J,e.alphaNumerate=r,e.axisUnits=re,e.createChartRect=U,e.createGrid=H,e.createGridBackground=T,e.createLabel=Q,e.createSvg=G,e.deserialize=function(e){if("string"!=typeof e)return e;if("NaN"===e)return NaN;let t=e=Object.keys(s).reduce(((e,t)=>e.replaceAll(s[t],t)),e);if("string"==typeof e)try{t=JSON.parse(e),t=void 0!==t.data?t.data:t}catch(e){}return t},e.determineAnchorPosition=me,e.each=A,e.easings=V,e.ensureUnit=i,e.escapingMap=s,e.extend=m,e.getBounds=d,e.getHighLow=S,e.getMetaData=M,e.getMultiValue=L,e.getNumberOrUndefined=b,e.getSeriesOption=he,e.isArrayOfArrays=E,e.isArrayOfSeries=C,e.isDataHoleValue=N,e.isFalseyButZero=w,e.isMultiValue=O,e.isNumeric=y,e.namespaces=t,e.noop=p,e.normalizeData=B,e.normalizePadding=D,e.optionsProvider=F,e.orderOfMagnitude=o,e.polarToCartesian=u,e.precision=8,e.projectLength=l,e.quantity=n,e.rho=c,e.roundWithPrecision=h,e.safeHasProperty=v,e.serialMap=x,e.serialize=X,e.splitIntoSegments=I,e.sum=g,e.times=f,Object.defineProperty(e,"__esModule",{value:!0})}));
+//# sourceMappingURL=index.umd.js.map
diff --git a/js/dashboard.js b/js/dashboard.js
index 94d1783e..2caa3166 100644
--- a/js/dashboard.js
+++ b/js/dashboard.js
@@ -1,112 +1,91 @@
( function() {
+ var labels = [];
+ var data = [];
+ var dataTable = jQuery( '#ab_chart_data' );
+ var maxValue;
+ var chartWidth;
+ var fullWidth = true;
+ var pointRadius = 4;
+ var chart;
+
+ // Abort if no data is present.
+ if ( ! dataTable.length ) {
+ return;
+ }
+
// Grab the data
- var labels = [],
- data = [];
- jQuery( '#ab_chart_data tfoot th' ).each( function() {
+ jQuery( 'tfoot th', dataTable ).each( function() {
labels.push( jQuery( this ).text() );
} );
- jQuery( '#ab_chart_data tbody td' ).each( function() {
+ jQuery( 'tbody td', dataTable ).each( function() {
data.push( jQuery( this ).text() );
} );
- // Draw
- var width = jQuery( '#ab_chart' ).parent().width() + 8,
- height = 140,
- leftgutter = 0,
- bottomgutter = 22,
- topgutter = 22,
- color = '#135e96',
- r = Raphael( 'ab_chart', width, height ),
- txt = { font: 'bold 12px "Open Sans", sans-serif', fill: '#1d2327' },
- X = ( width - leftgutter * 2 ) / labels.length,
- max = Math.max.apply( Math, data ),
- Y = ( height - bottomgutter - topgutter ) / max;
+ // Determine maximum value for scaling.
+ maxValue = Math.max.apply( Math, data );
- // Max value
- r
- .text( 16, 16, max )
- .attr(
- {
- font: 'normal 10px "Open Sans", sans-serif',
- fill: '#a7aaad',
- }
- );
+ // Adjust display according if there are too many values to display readable.
+ chartWidth = jQuery( '#statify_chart' ).width();
+ if ( chartWidth < data.length * 4 ) {
+ // Make chart scrollable, if 2px points are overlapping.
+ fullWidth = false;
+ pointRadius = 3;
+ } else if ( chartWidth < data.length * 8 ) {
+ // Shrink datapoints if 4px is overlapping, but 2 is not.
+ pointRadius = 2;
+ }
- var path = r.path().attr( { stroke: color, 'stroke-width': 2, 'stroke-linejoin': 'round' } ),
- bgp = r.path().attr( { stroke: 'none', opacity: .3, fill: color } ),
- label = r.set(),
- lx = 0,
- ly = 0,
- is_label_visible = false,
- leave_timer,
- blanket = r.set();
- label.push( r.text( 60, 12, '' ).attr( txt ) );
- label.push( r.text( 60, 27, '' ).attr( txt ).attr( { fill: color } ) );
- label.hide();
- var frame = r.popup( 100, 100, label, 'right' ).attr( { fill: '#fff', stroke: '#444', 'stroke-width': 1 } ).hide();
+ // Draw chart.
+ chart = new Chartist.LineChart( '#ab_chart', {
+ labels: labels,
+ series: [
+ data,
+ ],
+ }, {
+ low: 0,
+ showArea: true,
+ fullWidth: fullWidth,
+ width: ( fullWidth ? undefined : 5 * data.length ),
+ axisX: {
+ showGrid: false,
+ showLabel: false,
+ offset: 0,
+ },
+ axisY: {
+ showGrid: true,
+ showLabel: true,
+ type: Chartist.FixedScaleAxis,
+ low: 0,
+ high: maxValue + 1,
+ ticks: [
+ 0,
+ Math.round( maxValue * 1 / 4 ),
+ Math.round( maxValue * 2 / 4 ),
+ Math.round( maxValue * 3 / 4 ),
+ maxValue,
+ ],
+ offset: 30,
+ },
+ plugins: [
+ Chartist.plugins.tooltip( {
+ appendToBody: true,
+ class: 'ab-chartist-tooltip',
+ } ),
+ ],
+ } );
- var p, bgpp;
- for ( var i = 0, ii = labels.length; i < ii; i++ ) {
- var y = Math.round( height - bottomgutter - Y * data[i] ),
- x = Math.round( leftgutter + X * ( i + .5 ) );
- if ( ! i ) {
- p = [ 'M', x, y, 'C', x, y ];
- bgpp = [ 'M', leftgutter + X * .5, height - bottomgutter, 'L', x, y, 'C', x, y ];
+ // Replace default points with hollow circles, add "× Spam" to value and append date (label) as meta data.
+ chart.on( 'draw', function( d ) {
+ var circle;
+ if ( 'point' === d.type ) {
+ circle = new Chartist.Svg( 'circle', {
+ cx: [ d.x ],
+ cy: [ d.y ],
+ r: [ pointRadius ],
+ 'ct:value': d.value.y + '× Spam',
+ 'ct:meta': labels[d.index],
+ }, 'ct-point' );
+ d.element.replace( circle );
}
- if ( i && i < ii - 1 ) {
- var Y0 = Math.round( height - bottomgutter - Y * data[i - 1] ),
- X0 = Math.round( leftgutter + X * ( i - .5 ) ),
- Y2 = Math.round( height - bottomgutter - Y * data[i + 1] ),
- X2 = Math.round( leftgutter + X * ( i + 1.5 ) );
- var a = getAnchors( X0, Y0, x, y, X2, Y2 );
- p = p.concat( [ a.x1, a.y1, x, y, a.x2, a.y2 ] );
- bgpp = bgpp.concat( [ a.x1, a.y1, x, y, a.x2, a.y2 ] );
- }
- var dot = r.circle( x, y, 4 ).attr( { fill: '#fff', stroke: color, 'stroke-width': 1 } );
- blanket.push( r.rect( leftgutter + X * i, 0, X, height - bottomgutter ).attr( { stroke: 'none', fill: '#fff', opacity: .2 } ) );
- var rect = blanket[blanket.length - 1];
- ( function( x, y, data, date, dot ) {
- var timer,
- i = 0;
- rect.hover( function() {
- clearTimeout( leave_timer );
- var side = 'right';
- if ( x + frame.getBBox().width > width ) {
- side = 'left';
- }
- // set label content to determine correct dimensions
- label[0].attr( { text: date } );
- label[1].attr( { text: data + '× Spam' } );
- var ppp = r.popup( x, y, label, side, 1 ),
- anim = Raphael.animation( {
- path: ppp.path,
- transform: [ 't', ppp.dx, ppp.dy ],
- }, 200 * is_label_visible );
- lx = label[0].transform()[0][1] + ppp.dx;
- ly = label[0].transform()[0][2] + ppp.dy;
- frame.show().stop().animate( anim );
-
- label[0].show().stop().animateWith( frame, anim, { transform: [ 't', lx, ly ] }, 200 * is_label_visible );
- label[1].show().stop().animateWith( frame, anim, { transform: [ 't', lx, ly ] }, 200 * is_label_visible );
- dot.attr( 'r', 6 );
- is_label_visible = true;
- }, function() {
- dot.attr( 'r', 4 );
- leave_timer = setTimeout( function() {
- frame.hide();
- label[0].hide();
- label[1].hide();
- is_label_visible = false;
- }, 1 );
- } );
- }( x, y, data[i], labels[i], dot ) );
- }
- p = p.concat( [ x, y, x, y ] );
- bgpp = bgpp.concat( [ x, y, x, y, 'L', x, height - bottomgutter, 'z' ] );
- path.attr( { path: p } );
- bgp.attr( { path: bgpp } );
- frame.toFront();
- label[0].toFront();
- label[1].toFront();
- blanket.toFront();
+ } );
}() );
diff --git a/js/raphael.helper.js b/js/raphael.helper.js
deleted file mode 100644
index b7a066d3..00000000
--- a/js/raphael.helper.js
+++ /dev/null
@@ -1,140 +0,0 @@
-var tokenRegex = /\{([^\}]+)\}/g,
- objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,
- replacer = function( all, key, obj ) {
- var res = obj;
- key.replace( objNotationRegex, function( all, name, quote, quotedName, isFunc ) {
- name = name || quotedName;
- if ( res ) {
- if ( name in res ) {
- res = res[name];
- }
- typeof res === 'function' && isFunc && ( res = res() );
- }
- } );
- res = ( res == null || res == obj ? all : res ) + '';
- return res;
- },
- fill = function( str, obj ) {
- return String( str ).replace( tokenRegex, function( all, key ) {
- return replacer( all, key, obj );
- } );
- };
-
-Raphael.fn.popup = function( X, Y, set, pos, ret ) {
- pos = String( pos || 'top-middle' ).split( '-' );
- pos[1] = pos[1] || 'middle';
- var r = 5,
- bb = set.getBBox(),
- w = Math.round( bb.width ),
- h = Math.round( bb.height ),
- x = Math.round( bb.x ) - r,
- y = Math.round( bb.y ) - r,
- gap = Math.min( h / 2, w / 2, 10 ),
- shapes = {
- top: 'M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}l-{right},0-{gap},{gap}-{gap}-{gap}-{left},0a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z',
- bottom: 'M{x},{y}l{left},0,{gap}-{gap},{gap},{gap},{right},0a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z',
- right: 'M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}l0-{bottom}-{gap}-{gap},{gap}-{gap},0-{top}a{r},{r},0,0,1,{r}-{r}z',
- left: 'M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}l0,{top},{gap},{gap}-{gap},{gap},0,{bottom}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z',
- },
- offset = {
- hx0: X - ( x + r + w - gap * 2 ),
- hx1: X - ( x + r + w / 2 - gap ),
- hx2: X - ( x + r + gap ),
- vhy: Y - ( y + r + h + r + gap ),
- '^hy': Y - ( y - gap ),
-
- },
- mask = [ {
- x: x + r,
- y: y,
- w: w,
- w4: w / 4,
- h4: h / 4,
- right: 0,
- left: w - gap * 2,
- bottom: 0,
- top: h - gap * 2,
- r: r,
- h: h,
- gap: gap,
- }, {
- x: x + r,
- y: y,
- w: w,
- w4: w / 4,
- h4: h / 4,
- left: w / 2 - gap,
- right: w / 2 - gap,
- top: h / 2 - gap,
- bottom: h / 2 - gap,
- r: r,
- h: h,
- gap: gap,
- }, {
- x: x + r,
- y: y,
- w: w,
- w4: w / 4,
- h4: h / 4,
- left: 0,
- right: w - gap * 2,
- top: 0,
- bottom: h - gap * 2,
- r: r,
- h: h,
- gap: gap,
- } ][pos[1] == 'middle' ? 1 : ( pos[1] == 'top' || pos[1] == 'left' ) * 2];
- var dx = 0,
- dy = 0,
- out = this.path( fill( shapes[pos[0]], mask ) ).insertBefore( set );
- switch ( pos[0] ) {
- case 'top':
- dx = X - ( x + r + mask.left + gap );
- dy = Y - ( y + r + h + r + gap );
- break;
- case 'bottom':
- dx = X - ( x + r + mask.left + gap );
- dy = Y - ( y - gap );
- break;
- case 'left':
- dx = X - ( x + r + w + r + gap );
- dy = Y - ( y + r + mask.top + gap );
- break;
- case 'right':
- dx = X - ( x - gap );
- dy = Y - ( y + r + mask.top + gap );
- break;
- }
- out.translate( dx, dy );
- if ( ret ) {
- ret = out.attr( 'path' );
- out.remove();
- return {
- path: ret,
- dx: dx,
- dy: dy,
- };
- }
- set.translate( dx, dy );
- return out;
-};
-
-function getAnchors( p1x, p1y, p2x, p2y, p3x, p3y ) {
- var l1 = ( p2x - p1x ) / 2,
- l2 = ( p3x - p2x ) / 2,
- a = Math.atan( ( p2x - p1x ) / Math.abs( p2y - p1y ) ),
- b = Math.atan( ( p3x - p2x ) / Math.abs( p2y - p3y ) );
- a = p1y < p2y ? Math.PI - a : a;
- b = p3y < p2y ? Math.PI - b : b;
- var alpha = Math.PI / 2 - ( ( a + b ) % ( Math.PI * 2 ) ) / 2,
- dx1 = l1 * Math.sin( alpha + a ),
- dy1 = l1 * Math.cos( alpha + a ),
- dx2 = l2 * Math.sin( alpha + b ),
- dy2 = l2 * Math.cos( alpha + b );
- return {
- x1: p2x - dx1,
- y1: p2y + dy1,
- x2: p2x + dx2,
- y2: p2y + dy2,
- };
-}
diff --git a/js/raphael.min.js b/js/raphael.min.js
deleted file mode 100644
index 2fb91046..00000000
--- a/js/raphael.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-!function t(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Raphael=r():e.Raphael=r()}(this,function(){return function(t){function e(i){if(r[i])return r[i].exports;var n=r[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var i,n;i=[r(1),r(3),r(4)],n=function(t){return t}.apply(e,i),!(void 0!==n&&(t.exports=n))},function(t,e,r){var i,n;i=[r(2)],n=function(t){function e(r){if(e.is(r,"function"))return w?r():t.on("raphael.DOMload",r);if(e.is(r,Q))return e._engine.create[z](e,r.splice(0,3+e.is(r[0],$))).add(r);var i=Array.prototype.slice.call(arguments,0);if(e.is(i[i.length-1],"function")){var n=i.pop();return w?n.call(e._engine.create[z](e,i)):t.on("raphael.DOMload",function(){n.call(e._engine.create[z](e,i))})}return e._engine.create[z](e,arguments)}function r(t){if("function"==typeof t||Object(t)!==t)return t;var e=new t.constructor;for(var i in t)t[A](i)&&(e[i]=r(t[i]));return e}function i(t,e){for(var r=0,i=t.length;r=1e3&&delete o[l.shift()],l.push(s),o[s]=t[z](e,a),r?r(o[s]):o[s])}return n}function a(){return this.hex}function s(t,e){for(var r=[],i=0,n=t.length;n-2*!e>i;i+=2){var a=[{x:+t[i-2],y:+t[i-1]},{x:+t[i],y:+t[i+1]},{x:+t[i+2],y:+t[i+3]},{x:+t[i+4],y:+t[i+5]}];e?i?n-4==i?a[3]={x:+t[0],y:+t[1]}:n-2==i&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[n-2],y:+t[n-1]}:n-4==i?a[3]=a[2]:i||(a[0]={x:+t[i],y:+t[i+1]}),r.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return r}function o(t,e,r,i,n){var a=-3*e+9*r-9*i+3*n,s=t*a+6*e-12*r+6*i;return t*s-3*e+3*r}function l(t,e,r,i,n,a,s,l,h){null==h&&(h=1),h=h>1?1:h<0?0:h;for(var u=h/2,c=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;gd;)c/=2,f+=(pW(n,s)||W(e,i)W(a,o))){var l=(t*i-e*r)*(n-s)-(t-r)*(n*o-a*s),h=(t*i-e*r)*(a-o)-(e-i)*(n*o-a*s),u=(t-r)*(a-o)-(e-i)*(n-s);if(u){var c=l/u,f=h/u,p=+c.toFixed(2),d=+f.toFixed(2);if(!(p<+G(t,r).toFixed(2)||p>+W(t,r).toFixed(2)||p<+G(n,s).toFixed(2)||p>+W(n,s).toFixed(2)||d<+G(e,i).toFixed(2)||d>+W(e,i).toFixed(2)||d<+G(a,o).toFixed(2)||d>+W(a,o).toFixed(2)))return{x:c,y:f}}}}function c(t,e){return p(t,e)}function f(t,e){return p(t,e,1)}function p(t,r,i){var n=e.bezierBBox(t),a=e.bezierBBox(r);if(!e.isBBoxIntersect(n,a))return i?0:[];for(var s=l.apply(0,t),o=l.apply(0,r),h=W(~~(s/5),1),c=W(~~(o/5),1),f=[],p=[],d={},g=i?0:[],v=0;v=0&&S<=1.001&&A>=0&&A<=1.001&&(i?g++:g.push({x:C.x,y:C.y,t1:G(S,1),t2:G(A,1)}))}}return g}function d(t,r,i){t=e._path2curve(t),r=e._path2curve(r);for(var n,a,s,o,l,h,u,c,f,d,g=i?0:[],v=0,x=t.length;vi)return i;for(;ra?r=n:i=n,n=(i-r)/2+r}return n}var h=3*e,u=3*(i-e)-h,c=1-h-u,f=3*r,p=3*(n-r)-f,d=1-f-p;return o(t,1/(200*a))}function m(t,e){var r=[],i={};if(this.ms=e,this.times=1,t){for(var n in t)t[A](n)&&(i[ht(n)]=t[n],r.push(ht(n)));r.sort(Bt)}this.anim=i,this.top=r[r.length-1],this.percents=r}function b(r,i,n,a,s,o){n=ht(n);var l,h,u,c=[],f,p,d,v=r.ms,x={},m={},b={};if(a)for(w=0,B=Ee.length;wa*r.top){n=r.percents[w],p=r.percents[w-1]||0,v=v/r.top*(n-p),f=r.percents[w+1],l=r.anim[n];break}a&&i.attr(r.anim[r.percents[w]])}if(l){if(h)h.initstatus=a,h.start=new Date-h.ms*a;else{for(var C in l)if(l[A](C)&&(pt[A](C)||i.paper.customAttributes[A](C)))switch(x[C]=i.attr(C),null==x[C]&&(x[C]=ft[C]),m[C]=l[C],pt[C]){case $:b[C]=(m[C]-x[C])/v;break;case"colour":x[C]=e.getRGB(x[C]);var S=e.getRGB(m[C]);b[C]={r:(S.r-x[C].r)/v,g:(S.g-x[C].g)/v,b:(S.b-x[C].b)/v};break;case"path":var T=Qt(x[C],m[C]),E=T[1];for(x[C]=T[0],b[C]=[],w=0,B=x[C].length;w',Lt=Nt.firstChild,Lt.style.behavior="url(#default#VML)",!Lt||"object"!=typeof Lt.adj)return e.type=R;Nt=null}e.svg=!(e.vml="VML"==e.type),e._Paper=M,e.fn=N=M.prototype=e.prototype,e._id=0,e.is=function(t,e){return e=O.call(e),"finite"==e?!at[A](+t):"array"==e?t instanceof Array:"null"==e&&null===t||e==typeof t&&null!==t||"object"==e&&t===Object(t)||"array"==e&&Array.isArray&&Array.isArray(t)||tt.call(t).slice(8,-1).toLowerCase()==e},e.angle=function(t,r,i,n,a,s){if(null==a){var o=t-i,l=r-n;return o||l?(180+180*Y.atan2(-l,-o)/U+360)%360:0}return e.angle(t,r,a,s)-e.angle(i,n,a,s)},e.rad=function(t){return t%360*U/180},e.deg=function(t){return Math.round(180*t/U%360*1e3)/1e3},e.snapTo=function(t,r,i){if(i=e.is(i,"finite")?i:10,e.is(t,Q)){for(var n=t.length;n--;)if(H(t[n]-r)<=i)return t[n]}else{t=+t;var a=r%t;if(at-i)return r-a+t}return r};var zt=e.createUUID=function(t,e){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(t,e).toUpperCase()}}(/[xy]/g,function(t){var e=16*Y.random()|0,r="x"==t?e:3&e|8;return r.toString(16)});e.setWindow=function(r){t("raphael.setWindow",e,T.win,r),T.win=r,T.doc=T.win.document,e._engine.initWin&&e._engine.initWin(T.win)};var Pt=function(t){if(e.vml){var r=/^\s+|\s+$/g,i;try{var a=new ActiveXObject("htmlfile");a.write(""),a.close(),i=a.body}catch(s){i=createPopup().document.body}var o=i.createTextRange();Pt=n(function(t){try{i.style.color=I(t).replace(r,R);var e=o.queryCommandValue("ForeColor");return e=(255&e)<<16|65280&e|(16711680&e)>>>16,"#"+("000000"+e.toString(16)).slice(-6)}catch(n){return"none"}})}else{var l=T.doc.createElement("i");l.title="Raphaël Colour Picker",l.style.display="none",T.doc.body.appendChild(l),Pt=n(function(t){return l.style.color=t,T.doc.defaultView.getComputedStyle(l,R).getPropertyValue("color")})}return Pt(t)},Ft=function(){return"hsb("+[this.h,this.s,this.b]+")"},Rt=function(){return"hsl("+[this.h,this.s,this.l]+")"},jt=function(){return this.hex},It=function(t,r,i){if(null==r&&e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(i=t.b,r=t.g,t=t.r),null==r&&e.is(t,Z)){var n=e.getRGB(t);t=n.r,r=n.g,i=n.b}return(t>1||r>1||i>1)&&(t/=255,r/=255,i/=255),[t,r,i]},qt=function(t,r,i,n){t*=255,r*=255,i*=255;var a={r:t,g:r,b:i,hex:e.rgb(t,r,i),toString:jt};return e.is(n,"finite")&&(a.opacity=n),a};e.color=function(t){var r;return e.is(t,"object")&&"h"in t&&"s"in t&&"b"in t?(r=e.hsb2rgb(t),t.r=r.r,t.g=r.g,t.b=r.b,t.hex=r.hex):e.is(t,"object")&&"h"in t&&"s"in t&&"l"in t?(r=e.hsl2rgb(t),t.r=r.r,t.g=r.g,t.b=r.b,t.hex=r.hex):(e.is(t,"string")&&(t=e.getRGB(t)),e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t?(r=e.rgb2hsl(t),t.h=r.h,t.s=r.s,t.l=r.l,r=e.rgb2hsb(t),t.v=r.b):(t={hex:"none"},t.r=t.g=t.b=t.h=t.s=t.v=t.l=-1)),t.toString=jt,t},e.hsb2rgb=function(t,e,r,i){this.is(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(r=t.b,e=t.s,i=t.o,t=t.h),t*=360;var n,a,s,o,l;return t=t%360/60,l=r*e,o=l*(1-H(t%2-1)),n=a=s=r-l,t=~~t,n+=[l,o,0,0,o,l][t],a+=[o,l,l,o,0,0][t],s+=[0,0,o,l,l,o][t],qt(n,a,s,i)},e.hsl2rgb=function(t,e,r,i){this.is(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(r=t.l,e=t.s,t=t.h),(t>1||e>1||r>1)&&(t/=360,e/=100,r/=100),t*=360;var n,a,s,o,l;return t=t%360/60,l=2*e*(r<.5?r:1-r),o=l*(1-H(t%2-1)),n=a=s=r-l/2,t=~~t,n+=[l,o,0,0,o,l][t],a+=[o,l,l,o,0,0][t],s+=[0,0,o,l,l,o][t],qt(n,a,s,i)},e.rgb2hsb=function(t,e,r){r=It(t,e,r),t=r[0],e=r[1],r=r[2];var i,n,a,s;return a=W(t,e,r),s=a-G(t,e,r),i=0==s?null:a==t?(e-r)/s:a==e?(r-t)/s+2:(t-e)/s+4,i=(i+360)%6*60/360,n=0==s?0:s/a,{h:i,s:n,b:a,toString:Ft}},e.rgb2hsl=function(t,e,r){r=It(t,e,r),t=r[0],e=r[1],r=r[2];var i,n,a,s,o,l;return s=W(t,e,r),o=G(t,e,r),l=s-o,i=0==l?null:s==t?(e-r)/l:s==e?(r-t)/l+2:(t-e)/l+4,i=(i+360)%6*60/360,a=(s+o)/2,n=0==l?0:a<.5?l/(2*a):l/(2-2*a),{h:i,s:n,l:a,toString:Rt}},e._path2string=function(){return this.join(",").replace(xt,"$1")};var Dt=e._preload=function(t,e){var r=T.doc.createElement("img");r.style.cssText="position:absolute;left:-9999em;top:-9999em",r.onload=function(){e.call(this),this.onload=null,T.doc.body.removeChild(this)},r.onerror=function(){T.doc.body.removeChild(this)},T.doc.body.appendChild(r),r.src=t};e.getRGB=n(function(t){if(!t||(t=I(t)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:a};if("none"==t)return{r:-1,g:-1,b:-1,hex:"none",toString:a};!(vt[A](t.toLowerCase().substring(0,2))||"#"==t.charAt())&&(t=Pt(t));var r,i,n,s,o,l,h,u=t.match(nt);return u?(u[2]&&(s=ut(u[2].substring(5),16),n=ut(u[2].substring(3,5),16),i=ut(u[2].substring(1,3),16)),u[3]&&(s=ut((l=u[3].charAt(3))+l,16),n=ut((l=u[3].charAt(2))+l,16),i=ut((l=u[3].charAt(1))+l,16)),u[4]&&(h=u[4][q](gt),i=ht(h[0]),"%"==h[0].slice(-1)&&(i*=2.55),n=ht(h[1]),"%"==h[1].slice(-1)&&(n*=2.55),s=ht(h[2]),"%"==h[2].slice(-1)&&(s*=2.55),"rgba"==u[1].toLowerCase().slice(0,4)&&(o=ht(h[3])),h[3]&&"%"==h[3].slice(-1)&&(o/=100)),u[5]?(h=u[5][q](gt),i=ht(h[0]),"%"==h[0].slice(-1)&&(i*=2.55),n=ht(h[1]),"%"==h[1].slice(-1)&&(n*=2.55),s=ht(h[2]),"%"==h[2].slice(-1)&&(s*=2.55),("deg"==h[0].slice(-3)||"°"==h[0].slice(-1))&&(i/=360),"hsba"==u[1].toLowerCase().slice(0,4)&&(o=ht(h[3])),h[3]&&"%"==h[3].slice(-1)&&(o/=100),e.hsb2rgb(i,n,s,o)):u[6]?(h=u[6][q](gt),i=ht(h[0]),"%"==h[0].slice(-1)&&(i*=2.55),n=ht(h[1]),"%"==h[1].slice(-1)&&(n*=2.55),s=ht(h[2]),"%"==h[2].slice(-1)&&(s*=2.55),("deg"==h[0].slice(-3)||"°"==h[0].slice(-1))&&(i/=360),"hsla"==u[1].toLowerCase().slice(0,4)&&(o=ht(h[3])),h[3]&&"%"==h[3].slice(-1)&&(o/=100),e.hsl2rgb(i,n,s,o)):(u={r:i,g:n,b:s,toString:a},u.hex="#"+(16777216|s|n<<8|i<<16).toString(16).slice(1),e.is(o,"finite")&&(u.opacity=o),u)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:a}},e),e.hsb=n(function(t,r,i){return e.hsb2rgb(t,r,i).hex}),e.hsl=n(function(t,r,i){return e.hsl2rgb(t,r,i).hex}),e.rgb=n(function(t,e,r){function i(t){return t+.5|0}return"#"+(16777216|i(r)|i(e)<<8|i(t)<<16).toString(16).slice(1)}),e.getColor=function(t){var e=this.getColor.start=this.getColor.start||{h:0,s:1,b:t||.75},r=this.hsb2rgb(e.h,e.s,e.b);return e.h+=.075,e.h>1&&(e.h=0,e.s-=.2,e.s<=0&&(this.getColor.start={h:0,s:1,b:e.b})),r.hex},e.getColor.reset=function(){delete this.start},e.parsePathString=function(t){if(!t)return null;var r=Vt(t);if(r.arr)return Yt(r.arr);var i={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},n=[];return e.is(t,Q)&&e.is(t[0],Q)&&(n=Yt(t)),n.length||I(t).replace(yt,function(t,e,r){var a=[],s=e.toLowerCase();if(r.replace(bt,function(t,e){e&&a.push(+e)}),"m"==s&&a.length>2&&(n.push([e][P](a.splice(0,2))),s="l",e="m"==e?"l":"L"),"r"==s)n.push([e][P](a));else for(;a.length>=i[s]&&(n.push([e][P](a.splice(0,i[s]))),i[s]););}),n.toString=e._path2string,r.arr=Yt(n),n},e.parseTransformString=n(function(t){if(!t)return null;var r={r:3,s:4,t:2,m:6},i=[];return e.is(t,Q)&&e.is(t[0],Q)&&(i=Yt(t)),i.length||I(t).replace(mt,function(t,e,r){var n=[],a=O.call(e);r.replace(bt,function(t,e){e&&n.push(+e)}),i.push([e][P](n))}),i.toString=e._path2string,i});var Vt=function(t){var e=Vt.ps=Vt.ps||{};return e[t]?e[t].sleep=100:e[t]={sleep:100},setTimeout(function(){for(var r in e)e[A](r)&&r!=t&&(e[r].sleep--,!e[r].sleep&&delete e[r])}),e[t]};e.findDotsAtSegment=function(t,e,r,i,n,a,s,o,l){var h=1-l,u=X(h,3),c=X(h,2),f=l*l,p=f*l,d=u*t+3*c*l*r+3*h*l*l*n+p*s,g=u*e+3*c*l*i+3*h*l*l*a+p*o,v=t+2*l*(r-t)+f*(n-2*r+t),x=e+2*l*(i-e)+f*(a-2*i+e),y=r+2*l*(n-r)+f*(s-2*n+r),m=i+2*l*(a-i)+f*(o-2*a+i),b=h*t+l*r,_=h*e+l*i,w=h*n+l*s,k=h*a+l*o,B=90-180*Y.atan2(v-y,x-m)/U;return(v>y||x=t.x&&e<=t.x2&&r>=t.y&&r<=t.y2},e.isBBoxIntersect=function(t,r){var i=e.isPointInsideBBox;return i(r,t.x,t.y)||i(r,t.x2,t.y)||i(r,t.x,t.y2)||i(r,t.x2,t.y2)||i(t,r.x,r.y)||i(t,r.x2,r.y)||i(t,r.x,r.y2)||i(t,r.x2,r.y2)||(t.xr.x||r.xt.x)&&(t.yr.y||r.yt.y)},e.pathIntersection=function(t,e){return d(t,e)},e.pathIntersectionNumber=function(t,e){return d(t,e,1)},e.isPointInsidePath=function(t,r,i){var n=e.pathBBox(t);return e.isPointInsideBBox(n,r,i)&&d(t,[["M",r,i],["H",n.x2+10]],1)%2==1},e._removedFactory=function(e){return function(){t("raphael.log",null,"Raphaël: you are calling to method “"+e+"” of removed object",e)}};var Ot=e.pathBBox=function(t){var e=Vt(t);if(e.bbox)return r(e.bbox);if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0};t=Qt(t);for(var i=0,n=0,a=[],s=[],o,l=0,h=t.length;l1&&(b=Y.sqrt(b),r=b*r,i=b*i);var _=r*r,w=i*i,k=(s==o?-1:1)*Y.sqrt(H((_*w-_*m*m-w*y*y)/(_*m*m+w*y*y))),B=k*r*m/i+(t+l)/2,C=k*-i*y/r+(e+h)/2,S=Y.asin(((e-C)/i).toFixed(9)),A=Y.asin(((h-C)/i).toFixed(9));S=tA&&(S-=2*U),!o&&A>S&&(A-=2*U)}var T=A-S;if(H(T)>c){var E=A,M=l,N=h;A=S+c*(o&&A>S?1:-1),l=B+r*Y.cos(A),h=C+i*Y.sin(A),p=Ut(l,h,r,i,a,0,o,M,N,[A,E,B,C])}T=A-S;var L=Y.cos(S),z=Y.sin(S),F=Y.cos(A),R=Y.sin(A),j=Y.tan(T/4),I=4/3*r*j,D=4/3*i*j,V=[t,e],O=[t+I*z,e-D*L],W=[l+I*R,h-D*F],G=[l,h];if(O[0]=2*V[0]-O[0],O[1]=2*V[1]-O[1],u)return[O,W,G][P](p);p=[O,W,G][P](p).join()[q](",");for(var X=[],$=0,Z=p.length;$"1e12"&&(c=.5),H(f)>"1e12"&&(f=.5),c>0&&c<1&&(g=$t(t,e,r,i,n,a,s,o,c),d.push(g.x),p.push(g.y)),f>0&&f<1&&(g=$t(t,e,r,i,n,a,s,o,f),d.push(g.x),p.push(g.y)),l=a-2*i+e-(o-2*a+i),h=2*(i-e)-2*(a-i),u=e-i,c=(-h+Y.sqrt(h*h-4*l*u))/2/l,f=(-h-Y.sqrt(h*h-4*l*u))/2/l,H(c)>"1e12"&&(c=.5),H(f)>"1e12"&&(f=.5),c>0&&c<1&&(g=$t(t,e,r,i,n,a,s,o,c),d.push(g.x),p.push(g.y)),f>0&&f<1&&(g=$t(t,e,r,i,n,a,s,o,f),d.push(g.x),p.push(g.y)),{min:{x:G[z](0,d),y:G[z](0,p)},max:{x:W[z](0,d),y:W[z](0,p)}}}),Qt=e._path2curve=n(function(t,e){var r=!e&&Vt(t);if(!e&&r.curve)return Yt(r.curve);for(var i=Gt(t),n=e&&Gt(e),a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=(function(t,e,r){var i,n,a={T:1,Q:1};if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in a)&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"][P](Ut[z](0,[e.x,e.y][P](t.slice(1))));break;case"S":"C"==r||"S"==r?(i=2*e.x-e.bx,n=2*e.y-e.by):(i=e.x,n=e.y),t=["C",i,n][P](t.slice(1));break;case"T":"Q"==r||"T"==r?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"][P](Xt(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"][P](Xt(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"][P](Ht(e.x,e.y,t[1],t[2]));break;case"H":t=["C"][P](Ht(e.x,e.y,t[1],e.y));break;case"V":t=["C"][P](Ht(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"][P](Ht(e.x,e.y,e.X,e.Y))}return t}),l=function(t,e){if(t[e].length>7){t[e].shift();for(var r=t[e];r.length;)u[e]="A",n&&(c[e]="A"),t.splice(e++,0,["C"][P](r.splice(0,6)));t.splice(e,1),g=W(i.length,n&&n.length||0)}},h=function(t,e,r,a,s){t&&e&&"M"==t[s][0]&&"M"!=e[s][0]&&(e.splice(s,0,["M",a.x,a.y]),r.bx=0,r.by=0,r.x=t[s][1],r.y=t[s][2],g=W(i.length,n&&n.length||0))},u=[],c=[],f="",p="",d=0,g=W(i.length,n&&n.length||0);dn){if(r&&!c.start){if(f=ke(s,o,l[1],l[2],l[3],l[4],l[5],l[6],n-p),u+=["C"+f.start.x,f.start.y,f.m.x,f.m.y,f.x,f.y],a)return u;c.start=u,u=["M"+f.x,f.y+"C"+f.n.x,f.n.y,f.end.x,f.end.y,l[5],l[6]].join(),p+=h,s=+l[5],o=+l[6];continue}if(!t&&!r)return f=ke(s,o,l[1],l[2],l[3],l[4],l[5],l[6],n-p),{x:f.x,y:f.y,alpha:f.alpha}}p+=h,s=+l[5],o=+l[6]}u+=l.shift()+l}return c.end=u,f=t?p:r?c:e.findDotsAtSegment(s,o,l[0],l[1],l[2],l[3],l[4],l[5],1),f.alpha&&(f={x:f.x,y:f.y,alpha:f.alpha}),f}},Ce=Be(1),Se=Be(),Ae=Be(0,1);e.getTotalLength=Ce,e.getPointAtLength=Se,e.getSubpath=function(t,e,r){if(this.getTotalLength(t)-r<1e-6)return Ae(t,e).end;var i=Ae(t,r,1);return e?Ae(i,e).end:i},ye.getTotalLength=function(){var t=this.getPath();if(t)return this.node.getTotalLength?this.node.getTotalLength():Ce(t)},ye.getPointAtLength=function(t){var e=this.getPath();if(e)return Se(e,t)},ye.getPath=function(){var t,r=e._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return r&&(t=r(this)),t},ye.getSubpath=function(t,r){var i=this.getPath();if(i)return e.getSubpath(i,t,r)};var Te=e.easing_formulas={linear:function(t){return t},"<":function(t){return X(t,1.7)},">":function(t){return X(t,.48)},"<>":function(t){var e=.48-t/1.04,r=Y.sqrt(.1734+e*e),i=r-e,n=X(H(i),1/3)*(i<0?-1:1),a=-r-e,s=X(H(a),1/3)*(a<0?-1:1),o=n+s+.5;return 3*(1-o)*o*o+o*o*o},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){t-=1;var e=1.70158;return t*t*((e+1)*t+e)+1},elastic:function(t){return t==!!t?t:X(2,-10*t)*Y.sin((t-.075)*(2*U)/.3)+1},bounce:function(t){var e=7.5625,r=2.75,i;return t<1/r?i=e*t*t:t<2/r?(t-=1.5/r,i=e*t*t+.75):t<2.5/r?(t-=2.25/r,i=e*t*t+.9375):(t-=2.625/r,i=e*t*t+.984375),i}};Te.easeIn=Te["ease-in"]=Te["<"],Te.easeOut=Te["ease-out"]=Te[">"],Te.easeInOut=Te["ease-in-out"]=Te["<>"],Te["back-in"]=Te.backIn,Te["back-out"]=Te.backOut;var Ee=[],Me=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,16)},Ne=function(){for(var r=+new Date,i=0;i1&&!n.next){for(v in u)u[A](v)&&(g[v]=n.totalOrigin[v]);n.el.attr(g),b(n.anim,n.el,n.anim.percents[0],null,n.totalOrigin,n.repeat-1)}n.next&&!n.stop&&b(n.anim,n.el,n.next,null,n.totalOrigin,n.repeat)}}}Ee.length&&Me(Ne)},Le=function(t){return t>255?255:t<0?0:t};ye.animateWith=function(t,r,i,n,a,s){var o=this;if(o.removed)return s&&s.call(o),o;var l=i instanceof m?i:e.animation(i,n,a,s),h,u;b(l,o,l.percents[0],null,o.attr());for(var c=0,f=Ee.length;cl&&(l=u)}l+="%",!t[l].callback&&(t[l].callback=n)}return new m(t,r)},ye.animate=function(t,r,i,n){var a=this;if(a.removed)return n&&n.call(a),a;var s=t instanceof m?t:e.animation(t,r,i,n);return b(s,a,s.percents[0],null,a.attr()),a},ye.setTime=function(t,e){return t&&null!=e&&this.status(t,G(e,t.ms)/t.ms),this},ye.status=function(t,e){var r=[],i=0,n,a;if(null!=e)return b(t,this,-1,G(e,1)),this;for(n=Ee.length;i1)for(var i=0,n=r.length;i.5)-1;l(f-.5,2)+l(p-.5,2)>.25&&(p=a.sqrt(.25-l(f-.5,2))*n+.5)&&.5!=p&&(p=p.toFixed(5)-1e-5*n)}return c}),n=n.split(/\s*\-\s*/),"linear"==h){var b=n.shift();if(b=-i(b),isNaN(b))return null;var _=[0,0,a.cos(t.rad(b)),a.sin(t.rad(b))],w=1/(s(o(_[2]),o(_[3]))||1);_[2]*=w,_[3]*=w,_[2]<0&&(_[0]=-_[2],_[2]=0),_[3]<0&&(_[1]=-_[3],_[3]=0)}var k=t._parseDots(n);if(!k)return null;if(u=u.replace(/[\(\)\s,\xb0#]/g,"_"),e.gradient&&u!=e.gradient.id&&(g.defs.removeChild(e.gradient),delete e.gradient),!e.gradient){y=v(h+"Gradient",{id:u}),e.gradient=y,v(y,"radial"==h?{fx:f,fy:p}:{x1:_[0],y1:_[1],x2:_[2],y2:_[3],gradientTransform:e.matrix.invert()}),g.defs.appendChild(y);for(var B=0,C=k.length;B1?z.opacity/100:z.opacity});case"stroke":z=t.getRGB(g),l.setAttribute(d,z.hex),"stroke"==d&&z[e]("opacity")&&v(l,{"stroke-opacity":z.opacity>1?z.opacity/100:z.opacity}),"stroke"==d&&i._.arrows&&("startString"in i._.arrows&&_(i,i._.arrows.startString),"endString"in i._.arrows&&_(i,i._.arrows.endString,1));break;case"gradient":("circle"==i.type||"ellipse"==i.type||"r"!=r(g).charAt())&&x(i,g);break;case"opacity":u.gradient&&!u[e]("stroke-opacity")&&v(l,{"stroke-opacity":g>1?g/100:g});case"fill-opacity":if(u.gradient){P=t._g.doc.getElementById(l.getAttribute("fill").replace(/^url\(#|\)$/g,c)),P&&(F=P.getElementsByTagName("stop"),v(F[F.length-1],{"stop-opacity":g}));break}default:"font-size"==d&&(g=n(g,10)+"px");var R=d.replace(/(\-.)/g,function(t){return t.substring(1).toUpperCase()});l.style[R]=g,i._.dirty=1,l.setAttribute(d,g)}}S(i,a),l.style.visibility=f},C=1.2,S=function(i,a){if("text"==i.type&&(a[e]("text")||a[e]("font")||a[e]("font-size")||a[e]("x")||a[e]("y"))){var s=i.attrs,o=i.node,l=o.firstChild?n(t._g.doc.defaultView.getComputedStyle(o.firstChild,c).getPropertyValue("font-size"),10):10;if(a[e]("text")){for(s.text=a.text;o.firstChild;)o.removeChild(o.firstChild);for(var h=r(a.text).split("\n"),u=[],f,p=0,d=h.length;p"));var Z=X.getBoundingClientRect();m.W=f.w=(Z.right-Z.left)/U,m.H=f.h=(Z.bottom-Z.top)/U,m.X=f.x,m.Y=f.y+m.H/2,("x"in l||"y"in l)&&(m.path.v=t.format("m{0},{1}l{2},{1}",a(f.x*b),a(f.y*b),a(f.x*b)+1));for(var Q=["x","y","text","font","font-family","font-weight","font-style","font-size"],J=0,K=Q.length;J.25&&(r=n.sqrt(.25-l(e-.5,2))*(2*(r>.5)-1)+.5),f=e+p+r),d}),a=a.split(/\s*\-\s*/),"linear"==c){var g=a.shift();if(g=-i(g),isNaN(g))return null}var v=t._parseDots(a);if(!v)return null;if(e=e.shape||e.node,v.length){e.removeChild(s),s.on=!0,s.method="none",s.color=v[0].color,s.color2=v[v.length-1].color;for(var x=[],y=0,m=v.length;y')}}catch(r){N=function(t){return e.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},t._engine.initWin(t._g.win),t._engine.create=function(){var e=t._getContainer.apply(0,arguments),r=e.container,i=e.height,n,a=e.width,s=e.x,o=e.y;if(!r)throw new Error("VML container not found.");var l=new t._Paper,h=l.canvas=t._g.doc.createElement("div"),u=h.style;return s=s||0,o=o||0,a=a||512,i=i||342,l.width=a,l.height=i,a==+a&&(a+="px"),i==+i&&(i+="px"),l.coordsize=1e3*b+p+1e3*b,l.coordorigin="0 0",l.span=t._g.doc.createElement("span"),l.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",h.appendChild(l.span),u.cssText=t.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",a,i),1==r?(t._g.doc.body.appendChild(h),u.left=s+"px",u.top=o+"px",u.position="absolute"):r.firstChild?r.insertBefore(h,r.firstChild):r.appendChild(h),l.renderfix=function(){},l},t.prototype.clear=function(){t.eve("raphael.clear",this),this.canvas.innerHTML=d,this.span=t._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},t.prototype.remove=function(){t.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var e in this)this[e]="function"==typeof this[e]?t._removedFactory(e):null;return!0};var L=t.st;for(var z in M)M[e](z)&&!L[e](z)&&(L[z]=function(t){return function(){var e=arguments;return this.forEach(function(r){r[t].apply(r,e)})}}(z))}}.apply(e,i),!(void 0!==n&&(t.exports=n))}])});
\ No newline at end of file