jmgraph 3.2.19 → 3.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +311 -6
- package/dist/jmgraph.core.min.js +1 -1
- package/dist/jmgraph.core.min.js.map +1 -1
- package/dist/jmgraph.js +2022 -368
- package/dist/jmgraph.min.js +1 -1
- package/index.js +23 -25
- package/package.json +1 -1
- package/src/core/jmControl.js +199 -30
- package/src/core/jmFilter.js +150 -0
- package/src/core/jmGraph.js +207 -7
- package/src/core/jmLayer.js +142 -0
- package/src/core/jmPath.js +55 -0
- package/src/core/jmUtils.js +46 -37
- package/src/lib/webgl/base.js +10 -36
- package/src/lib/webgl/gradient.js +16 -3
- package/src/lib/webgl/index.js +5 -4
- package/src/lib/webgl/path.js +156 -33
- package/src/shapes/jmEllipse.js +91 -0
- package/src/shapes/jmLabel.js +126 -75
- package/src/shapes/jmPolygon.js +129 -0
- package/src/shapes/jmRect.js +107 -29
- package/src/shapes/jmStar.js +160 -0
- package/example/ball.html +0 -217
- package/example/base.html +0 -112
- package/example/canvas.html +0 -54
- package/example/cell.html +0 -284
- package/example/controls/arc.html +0 -129
- package/example/controls/arrowline.html +0 -78
- package/example/controls/bezier.html +0 -299
- package/example/controls/img.html +0 -97
- package/example/controls/label.html +0 -87
- package/example/controls/line.html +0 -173
- package/example/controls/prismatic.html +0 -63
- package/example/controls/rect.html +0 -64
- package/example/controls/resize.html +0 -112
- package/example/controls/test.html +0 -360
- package/example/es.html +0 -70
- package/example/es5module.html +0 -63
- package/example/heartarc.html +0 -116
- package/example/index.html +0 -47
- package/example/js/require.js +0 -5
- package/example/love/img/bling/bling.tps +0 -265
- package/example/love/img/bling.json +0 -87
- package/example/love/img/bling.tps +0 -295
- package/example/love/img/doc/bling.gif +0 -0
- package/example/love/img/love.json +0 -95
- package/example/love/img/love.tps +0 -315
- package/example/love/img/qq/qq.tps +0 -399
- package/example/love/img/qq.json +0 -242
- package/example/love/index.html +0 -40
- package/example/love/js/game.js +0 -558
- package/example/music.html +0 -211
- package/example/node/test.js +0 -138
- package/example/pdf.html +0 -187
- package/example/progress.html +0 -173
- package/example/pso.html +0 -148
- package/example/sort.html +0 -805
- package/example/tweenjs.html +0 -84
- package/example/webgl.html +0 -278
- package/example/xfj/img/dr_die.gif +0 -0
- package/example/xfj/index.html +0 -332
- package/example/xfj/shake.js +0 -49
- package/example/xfj/testori.html +0 -76
package/dist/jmgraph.core.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jmGraph={})}(this,function(t){"use strict";function e(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)),i}function a(i){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?e(Object(r),!0).forEach(function(t){var e,n;e=i,t=r[n=t],n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(r,t))})}return i}function c(t){return(c="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 h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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)}}function u(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function l(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&&o(t,e)}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function f(t,e,n){return(f=s()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);i=new(Function.bind.apply(t,i));return n&&o(i,n.prototype),i}).apply(null,arguments)}function n(t){var n="function"==typeof Map?new Map:void 0;return function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return f(t,arguments,r(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),o(e,t)}(t)}function v(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?v(t):e}function p(n){var i=s();return function(){var t,e=r(n);return d(this,i?(t=r(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function y(t,e,n){return(y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){t=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}(t,e);if(t){e=Object.getOwnPropertyDescriptor(t,e);return e.get?e.get.call(n):e.value}})(t,e,n||t)}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}}(t,e)||x(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||x(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){if(t){if("string"==typeof t)return b(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(n="Object"===n&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(t,e):void 0}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function w(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=x(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,e=function(){};return{s:e,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,r=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw r}}}}var _=function(){l(a,n(Array));var s=p(a);function a(){var t;h(this,a);for(var e=[],n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];if(i&&i.length&&Array.isArray(i[0])){for(var o=0;o<i[0].length;o++)e.push(i[0][o]);t=s.call.apply(s,[this].concat(e))}else t=s.call(this);return t.option={},t.type="jmList",d(t)}return u(a,[{key:"add",value:function(t){if(t&&Array.isArray(t)){for(var e=0;e<t.length;e++)this.includes(t[e])||this.push(t[e]);return t}return"object"==c(t)&&this.includes(t)||this.push(t),t}},{key:"remove",value:function(t){for(var e=this.length-1;0<=e;e--)this[e]==t&&this.removeAt(e)}},{key:"removeAt",value:function(t){var e;this.length>t&&(e=this[t],this.splice(t,1),this.option.removeHandler&&this.option.removeHandler.call(this,e,t))}},{key:"contain",value:function(t){return this.includes(t)}},{key:"get",value:function(t){return"function"==typeof t?this.find(t):this[t]}},{key:"each",value:function(t,e){if(t&&"function"==typeof t)if(e){for(var n=this.length-1;0<=n;n--)if(!1===t.call(this,n,this[n]))break}else for(var i=this.length,r=0;r<i;r++)if(!1===t.call(this,r,this[r]))break}},{key:"count",value:function(t){if(t&&"function"==typeof t){for(var e=0,n=this.length,i=0;i<n;i++)t(this[i])&&e++;return e}return this.length}},{key:"clear",value:function(){this.splice(0,this.length)}}]),a}(),k={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",transparent:"rgba(0,0,0,0)"},A=function(){function t(){h(this,t)}return u(t,null,[{key:"clone",value:function(t,e){var n,i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0;if("function"==typeof r){var s=r(t,i,o);if(s)return s}if("boolean"==typeof e&&(i=e,e=void 0),100<++o)return e;if(t&&"object"===c(t)){if(e=e||{},this.isType(t,_))return new _(t);if(Array.isArray(t)){if(i){for(var a=[],h=0;h<t.length;h++)a.push(this.clone(t[h],e[h],i,r,o));return a}return t.slice(0)}for(var u in t.__proto__&&(e.__proto__=t.__proto__),t)"constructor"!==u&&((n=t[u])&&(n.tagName||n.getContext)?e[u]=n:"object"!==c(e[u])&&void 0!==e[u]||(e[u]=this.clone(n,e[u],i,r,o)));return e}return void 0!==e?e:t}},{key:"bindEvent",value:function(t,e,n,i){if(e&&e.indexOf&&-1!=e.indexOf(" "))for(var r=e.split(" "),o=0;o<r.length;o++)this.bindEvent(t,r[o],n,i);return t.attachEvent?t.attachEvent("on"+e,n,i):t.addEventListener&&t.addEventListener(e,n,i),{name:e,target:t,fun:n}}},{key:"removeEvent",value:function(t,e,n){return t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent?(t.detachEvent("on"+e,n),!0):void(t["on"+e]=null)}},{key:"getElementPosition",value:function(t){var e={top:0,left:0};if(!t)return e;if(t.offsetParent)for(;t.offsetParent;)e.top+=t.offsetTop,e.left+=t.offsetLeft,t=t.offsetParent;else t.x?e.left+=t.x:t.x&&(e.top+=t.y);return e}},{key:"getEventPosition",value:function(t,e){var n=(t=t||event).isWXMiniApp,i=!1,r=t.changedTouches||t.targetTouches||t.touches,o=t.target||t.srcElement;r&&r.length&&((t=r[0]).target||(t.target=o),i=!0);var s=t.pageX||t.x;void 0===s&&(s=t.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var a=t.pageY||t.y;void 0===a&&(a=t.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var h=t.offsetX,u=t.offsetY;return void 0===h&&void 0===u&&(u=n?(h=t.x,t.y):(h=s-(o=this.getElementPosition(o)).left,a-o.top)),e&&(e.x&&(h/=e.x),e.y&&(u/=e.y)),{pageX:s,pageY:a,clientX:t.clientX,clientY:t.clientY,offsetX:h,offsetY:u,layerX:t.layerX,layerY:t.layerY,screenX:t.screenX,screenY:t.screenY,x:h,y:u,isTouch:i,touches:r,isWXMiniApp:n}}},{key:"isType",value:function(t,e){return!(!t||"object"!==c(t))&&t.constructor===e}},{key:"pointInPolygon",value:function(t,e,n){n=n||1,n/=2;var i=e.length;if(!e||0==i)return 0;if(1==i)return Math.abs(e[0].x-t.x)<=n&&Math.abs(e[0].y-t.y)<=n?1:0;if(2==i)return this.pointOnLine(t,e[0],e[1],n);for(var r=0;r<i;r++)if(Math.abs(e[r].x-t.x)<=n&&Math.abs(e[r].y-t.y)<=n)return 1;return this.rayCasting(t,e,n)}},{key:"pointOnLine",value:function(t,e,n,i){var r=Math.min(e.x,n.x),o=Math.max(e.x,n.x),s=Math.min(e.y,n.y),a=Math.max(e.y,n.y);if(r-t.x>i||t.x-o>i)return 0;if(s-t.y>i||t.y-a>i)return 0;if(e.x==n.x)return Math.abs(e.x-t.x)<=i&&(t.y-e.y)*(t.y-n.y)<=0?1:0;if(e.y==n.y)return Math.abs(e.y-t.y)<=i&&(t.x-e.x)*(t.x-n.x)<=0?1:0;if(Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i)return 1;if(Math.abs(n.x-t.x)<i&&Math.abs(n.y-t.y)<i)return 1;if(t.y==e.y||t.y==n.y)return 0;n=(n.x-e.x)/(n.y-e.y)*(t.y-e.y),n=(t.y-e.y)/Math.sqrt(n*n+(t.y-e.y)*(t.y-e.y))*(t.x-e.x-n);return Math.abs(n)<=i?1:0}},{key:"rayCasting",value:function(t,e,n){for(var i=e.length,r=!1,o=t.y,s=t.x,a=0,h=i-1;a<i;h=a++){var u=e[a].y,l=e[h].y,c=e[a].x,f=e[h].x;o<u!=o<l&&s<(f-c)*(o-u)/(l-u)+c&&(r=!r)}return r?2:0}},{key:"checkOutSide",value:function(t,e,n){var i={left:0,right:0,top:0,bottom:0};return n.x<0?i.left=e.left+n.x-t.left:0<n.x&&(i.right=e.right+n.x-t.right),n.y<0?i.top=e.top+n.y-t.top:0<n.y&&(i.bottom=e.bottom+n.y-t.bottom),i}},{key:"rotatePoints",value:function(t,e,n){if(!n||!t)return t;var i=Math.cos(n),r=Math.sin(n);if(Array.isArray(t))for(var o,s,a=0;a<t.length;a++)t[a]&&(o=t[a].x-e.x,s=t[a].y-e.y,t[a].x=o*i-s*r+e.x,t[a].y=o*r+s*i+e.y);else{var h=t.x-e.x,n=t.y-e.y;t.x=h*i-n*r+e.x,t.y=h*r+n*i+e.y}return t}},{key:"trimStart",value:function(t,e){if(e=e||" ",t&&0<t.length){var n=t[0];if(n===e||0<=e.indexOf(n))return t=t.substring(1),this.trimStart(t,e)}return t}},{key:"trimEnd",value:function(t,e){if(e=e||" ",t&&0<t.length){var n=t[t.length-1];if(n===e||0<=e.indexOf(n))return t=t.substring(0,t.length-1),this.trimStart(t,e)}return t}},{key:"trim",value:function(t,e){return this.trimEnd(this.trimStart(t,e),e)}},{key:"checkPercent",value:function(t){if("string"==typeof t&&"%"==(t=this.trim(t))[t.length-1])return t}},{key:"percentToNumber",value:function(t){var e;return"string"!=typeof t||(e=this.checkPercent(t))&&(t=this.trim(e,"% "),t/=100),t}},{key:"hexToNumber",value:function(t){if("string"!=typeof t)return t;for(var e=0,n=(t=t.toLowerCase()).length,i=0;i<n;i++){var r="0123456789abcdef".indexOf(t[i]);if(0!=r){for(var o=1;o<n-i;o++)r*=16;e+=r}}return e}},{key:"numberToHex",value:function(t){for(var e="";0<t;){e="0123456789abcdef"[t%16]+e;t=Math.floor(t/16)}return e}},{key:"hexToRGBA",value:function(t){if("string"!=typeof t)return t;if(t=this.trim(t),this.__hexToRGBA_Cache=this.__hexToRGBA_Cache||{},this.__hexToRGBA_Cache[t])return this.__hexToRGBA_Cache[t];var e,n=t;return"#"==(n=k[n]?k[n]:n)[0]&&(e={a:1},8<=n.length?(e.a=n.substr(1,2),e.g=n.substr(5,2),e.b=n.substr(7,2),e.r=n.substr(3,2),e.a=Number((this.hexToNumber(e.a)/255).toFixed(4)),e.r=this.hexToNumber(e.r||0),e.g=this.hexToNumber(e.g||0),e.b=this.hexToNumber(e.b||0),n=e):7===n.length||4===n.length?(4===n.length?(e.g=n.substr(2,1),e.g=e.g+e.g,e.b=n.substr(3,1),e.b=e.b+e.b,e.r=n.substr(1,1),e.r=e.r+e.r):(e.g=n.substr(3,2),e.b=n.substr(5,2),e.r=n.substr(1,2)),e.r=this.hexToNumber(e.r||0),e.g=this.hexToNumber(e.g||0),e.b=this.hexToNumber(e.b||0),n=e):5===n.length&&(e.a=n.substr(1,1),e.g=n.substr(3,1),e.b=n.substr(4,1),e.r=n.substr(2,1),e.r=this.hexToNumber(e.r||0),e.g=this.hexToNumber(e.g||0),e.b=this.hexToNumber(e.b||0),e.a=Number((this.hexToNumber(e.a)/255).toFixed(4)),n=e)),"string"!=typeof n||(e=n.match(/rgb(a)?\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)\s*,\s*([\d\.]+)\s*(,\s*[\d\.]+)?\s*\)/i))&&6===e.length&&(n={r:Number(e[2]),g:Number(e[3]),b:Number(e[4]),a:Number(this.trimStart(e[5]||"1",","))}),this.__hexToRGBA_Cache[t]=n}},{key:"rgbToDecimal",value:function(t){return(t=this.clone(t)).r=this.byteToDecimal(t.r),t.g=this.byteToDecimal(t.g),t.b=this.byteToDecimal(t.b),t}},{key:"byteToDecimal",value:function(t){return t/255}},{key:"toColor",value:function(t,e,n,i){if("string"==typeof t&&t){if("#"===(t=this.trim(t))[0]&&(4===t.length||7===t.length))return t;var r=this.hexToRGBA(t);if("string"==typeof r)return r;t=void 0!==r.r?r.r:t,e=void 0!==r.g?r.g:e,n=void 0!==r.b?r.b:n,i=void 0!==r.a?r.a:i}return t&&"object"===c(t)&&(e=t.g,n=t.b,i=t.a||1,t=t.r),void 0!==t&&void 0!==e&&void 0!==n?void 0!==i?"rgba("+t+","+e+","+n+","+i+")":"rgb("+t+","+e+","+n+")":t}},{key:"requestAnimationFrame",value:function(t,e){return(e&&e.requestAnimationFrame?e.requestAnimationFrame:"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:setTimeout)(t,20)}},{key:"cancelAnimationFrame",value:function(t,e){return(e&&e.cancelAnimationFrame?e.cancelAnimationFrame:"undefined"!=typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame:clearTimeout)(t)}}]),t}(),T=0,E=function(){function e(t){h(this,e),t&&"jmGraph"==t.type&&(this.graph=t),this.id=++T}return u(e,[{key:"is",value:function(t){return"string"==typeof t?this.type==t:this instanceof t}},{key:"animate",value:function(){if(this.is("jmGraph")){if(1<arguments.length){this.animateHandles||(this.animateHandles=new _);var t=[];if(2<arguments.length)for(var e=2;e<arguments.length;e++)t.push(e<0||arguments.length<=e?void 0:arguments[e]);this.animateHandles.add({millisec:(arguments.length<=1?void 0:arguments[1])||20,handle:arguments.length<=0?void 0:arguments[0],params:t})}var o;this.animateHandles&&0<this.animateHandles.count()&&((o=this).dispatcher=setTimeout(function(n){n=n||o;var t,i=[],r=Date.now();for(t in n.animateHandles.each(function(t,e){try{e&&e.handle&&(!e.times||r-e.times>=e.millisec)&&(!1===e.handle.apply(n,e.params)&&i.push(e),e.times=r)}catch(t){e&&i.push(e)}}),i)n.animateHandles.remove(i[t]);n.animate()},10,this))}else{var n=this.graph;n&&n.animate.apply(n,arguments)}}}]),e}(),P=Symbol("properties"),C=function(){l(i,E);var n=p(i);function i(t){var e;return h(this,i),(e=n.call(this))[P]={},t&&t.mode&&(e.mode=t.mode),e}return u(i,[{key:"property",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(e){var i=this[P],r=e[0];if(1<e.length){var o=e[1],o={oldValue:i[r],newValue:o};return i[r]=e[1],this.emit&&this.emit("propertyChange",r,o),e[1]}if(r)return i[r]}}},{key:"needUpdate",get:function(){return this.property("needUpdate")},set:function(t){this.property("needUpdate",t),t&&!this.is("jmGraph")&&this.graph&&(this.graph.needUpdate=!0)}},{key:"graph",get:function(){return this.property("graph")||this.property("graph",this.findParent("jmGraph"))},set:function(t){return this.property("graph",t)}},{key:"mode",get:function(){var t=this.property("mode");return t||(this.is("jmGraph")?this.property("mode"):this.graph.mode)},set:function(t){return this.property("mode",t)}},{key:"requestAnimationFrame",value:function(t){return A.requestAnimationFrame(t,this.graph?this.graph.canvas:null)}},{key:"cancelAnimationFrame",value:function(t){return A.cancelAnimationFrame(t,this.graph?this.graph.canvas:null)}}]),i}(),S=function(){function r(t,e,n,i){h(this,r),"string"!=typeof t||e||n||i?(this.x=t,this.y=e,this.blur=n,this.color=i):this.fromString(t)}return u(r,[{key:"fromString",value:function(t){if(t){t=t.match(/\s*([^,]+)\s*,\s*([^,]+)\s*(,[^,]+)?\s*(,[\s\S]+)?\s*/i);return t&&(this.x=t[1]||0,this.y=t[2]||0,t[3]&&(t[3]=A.trim(t[3],", "),0===t[3].indexOf("#")||/^rgb/i.test(t[3])?this.color=t[3]:this.blur=A.trim(t[3],", ")),t[4]&&(this.color=A.trim(t[4],", "))),this}}},{key:"toString",value:function(){var t=this.x+","+this.y;return this.blur&&(t+=","+this.blur),this.color&&(t+=","+this.color),t}}]),r}(),M=function(){function i(t){if(h(this,i),this.stops=new _,t&&"object"==c(t)){for(var e in t)"stops"!==e&&(this[e]=t[e]);var n;t.stops&&Array.isArray(t.stops)&&(n=this.stops).push.apply(n,m(t.stops))}else"string"==typeof t&&this.fromString(t)}return u(i,[{key:"addStop",value:function(t,e){this.stops.add({offset:Number(t),color:e})}},{key:"toGradient",value:function(t){var i,e=t.context||t,n=t.absoluteBounds||t.getAbsoluteBounds(),r=this.x1||0,o=this.y1||0,s=this.x2,a=this.y2,h=t.getLocation(),u=0,u=(u=h.radius?2*h.radius:u)||Math.min(h.width,h.height);A.checkPercent(r)&&(r=A.percentToNumber(r)*(n.width||u)),A.checkPercent(s)&&(s=A.percentToNumber(s)*(n.width||u)),A.checkPercent(o)&&(o=A.percentToNumber(o)*(n.height||u)),A.checkPercent(a)&&(a=A.percentToNumber(a)*(n.height||u));var l=Number(r)+n.left,c=Number(o)+n.top,f=Number(s)+n.left,v=Number(a)+n.top;if("linear"===this.type?"webgl"===t.mode&&t.webglControl?(i=t.webglControl.createLinearGradient(r,o,s,a,n)).key=this.toString():e.createLinearGradient&&(i=e.createLinearGradient(l,c,f,v)):"radial"===this.type&&(h=this.r1||0,d=this.r2,A.checkPercent(h)&&(h=A.percentToNumber(h),h*=u),A.checkPercent(d)&&(d=A.percentToNumber(d),d*=u),"webgl"===t.mode&&t.webglControl?(i=t.webglControl.createRadialGradient(r,o,h,s,a,d,n)).key=this.toString():e.createRadialGradient?i=e.createRadialGradient(l,c,h,f,v,d):e.createCircularGradient&&(i=e.createCircularGradient(l,c,d))),i)return this.stops.each(function(t,e){var n=A.toColor(e.color);i&&i.addColorStop(e.offset,n)}),i;var d=this.stops.get(0);return d&&d.color||"#000"}},{key:"fromString",value:function(t){if(t){var e=t.match(/(linear|radial)-gradient\s*\(\s*([^,]+)\s*,\s*((.|\s)+)\)/i);if(e&&!(e.length<3)){this.type=e[1].toLowerCase();t=A.trim(e[2]).split(/\s+/);"linear"==this.type?t.length<=2?(this.x2=t[0],this.y2=t[1]||0):(this.x1=t[0],this.y1=t[1],this.x2=t[2],this.y2=t[3]):t.length<=3?(this.x2=t[0],this.y2=t[1]||0,this.r2=t[2]||0):(this.x1=t[0],this.y1=t[1],this.r1=t[2],this.x2=t[3],this.y2=t[3],this.r2=t[3]);var n=e[3].match(/((rgb(a)?\s*\([\d,\.\s]+\))|(#[a-zA-Z\d]+))\s+([\d\.]+)/gi);if(n&&n.length)for(var i=0;i<n.length;i++){var r,o=A.trim(n[i]),s=o.lastIndexOf(" ");-1<s&&(r=Number(o.substr(s+1)),s=A.trim(o.substr(0,s)),!isNaN(r)&&s&&this.addStop(r,s))}}}}},{key:"toString",value:function(){var n=this.type+"-gradient(";return"linear"==this.type?n+=this.x1+" "+this.y1+" "+this.x2+" "+this.y2:n+=this.x1+" "+this.y1+" "+this.r1+" "+this.x2+" "+this.y2+" "+this.r2,this.stops.each(function(t,e){n+=","+e.color+" "+e.offset}),n+")"}}]),i}(),R=function(){function n(t,e){h(this,n),this.container=t,this.target=e||t,this.mouseHandler=new N(this,t,e),this.keyHandler=new B(this,t,e)}return u(n,[{key:"touchStart",value:function(t){if((t=t||window.event).eventName="touchstart",this.container.raiseEvent("touchstart",t),(t.target||t.srcElement)==this.target)return!1}},{key:"touchMove",value:function(t){if((t=t||window.event).eventName="touchmove",this.container.raiseEvent("touchmove",t),(t.target||t.srcElement)==this.target)return!1}},{key:"touchEnd",value:function(t){if((t=t||window.event).eventName="touchend",this.container.raiseEvent("touchend",t),(t.target||t.srcElement)==this.target)return!1}},{key:"touchCancel",value:function(t){if((t=t||window.event).eventName="touchcancel",this.container.raiseEvent("touchcancel",t),(t.target||t.srcElement)==this.target)return!1}},{key:"tap",value:function(t){if((t=t||window.event).eventName="tap",this.container.raiseEvent("tap",t),(t.target||t.srcElement)==this.target)return!1}},{key:"destroy",value:function(){this.mouseHandler.destroy(),this.keyHandler.destroy()}}]),n}(),N=function(){function i(t,e,n){h(this,i),this.instance=t,this.container=e,this.target=n||e,this.eventEvents={},this.init(t,e,n)}return u(i,[{key:"init",value:function(e,n,t){var i=this.target,r="undefined"!=typeof document?document:null;this.eventEvents.mousedown=A.bindEvent(this.target,"mousedown",function(t){(t=t||window.event).eventName="mousedown",n.raiseEvent("mousedown",t)}),this.eventEvents.mousemove=A.bindEvent(this.target,"mousemove",function(t){if((t=t||window.event).eventName="mousemove",(t.target||t.srcElement)==i)return n.raiseEvent("mousemove",t),t.preventDefault&&t.preventDefault(),!1}),this.eventEvents.mouseover=A.bindEvent(this.target,"mouseover",function(t){(t=t||window.event).eventName="mouseover",n.raiseEvent("mouseover",t)}),this.eventEvents.mouseleave=A.bindEvent(this.target,"mouseleave",function(t){(t=t||window.event).eventName="mouseleave",n.raiseEvent("mouseleave",t)}),this.eventEvents.mouseout=A.bindEvent(this.target,"mouseout",function(t){(t=t||window.event).eventName="mouseout",n.raiseEvent("mouseout",t)}),r&&(this.eventEvents.mouseup=A.bindEvent(r,"mouseup",function(t){if(!((t=t||window.event).eventName="mouseup")===n.raiseEvent("mouseup",t))return t.preventDefault&&t.preventDefault(),!1})),this.eventEvents.dblclick=A.bindEvent(this.target,"dblclick",function(t){(t=t||window.event).eventName="dblclick",n.raiseEvent("dblclick",t)}),this.eventEvents.click=A.bindEvent(this.target,"click",function(t){(t=t||window.event).eventName="click",n.raiseEvent("click",t)}),r&&(this.eventEvents.resize=A.bindEvent(r,"resize",function(t){return(t=t||window.event).eventName="resize",n.raiseEvent("resize",t)})),this.eventEvents.touchstart=A.bindEvent(this.target,"touchstart",function(t){return t.eventName="touchstart",e.touchStart(t)},{passive:!1}),this.eventEvents.touchmove=A.bindEvent(this.target,"touchmove",function(t){return t.eventName="touchmove",e.touchMove(t)},{passive:!1}),r&&(this.eventEvents.touchend=A.bindEvent(r,"touchend",function(t){return t.eventName="touchend",e.touchEnd(t)},{passive:!1})),r&&(this.eventEvents.touchcancel=A.bindEvent(r,"touchcancel",function(t){return t.eventName="touchcancel",e.touchCancel(t)},{passive:!1}))}},{key:"destroy",value:function(){for(var t in this.eventEvents){var e=this.eventEvents[t];e&&e.fun&&A.removeEvent(e.target,t,e.fun)}}}]),i}(),B=function(){function i(t,e,n){h(this,i),this.instance=t,this.container=e,this.target=n||e,this.eventEvents={},this.init(e,n)}return u(i,[{key:"init",value:function(n,t){function i(t){return!(t=t.srcElement||t.target)||"INPUT"!=t.tagName&&"TEXTAREA"!=t.tagName&&"ANCHOR"!=t.tagName&&"FORM"!=t.tagName&&"FILE"!=t.tagName&&"IMG"!=t.tagName&&"HIDDEN"!=t.tagName&&"RADIO"!=t.tagName&&"TEXT"!=t.tagName}var e="undefined"!=typeof document?document:null;e&&(this.eventEvents.keypress=A.bindEvent(e,"keypress",function(t){if(t=t||window.event,i(t)){var e=n.raiseEvent("keypress",t);return!1===e&&t.preventDefault&&t.preventDefault(),e}})),e&&(this.eventEvents.keydown=A.bindEvent(e,"keydown",function(t){if(t=t||window.event,i(t)){var e=n.raiseEvent("keydown",t);return!1===e&&t.preventDefault&&t.preventDefault(),e}})),e&&(this.eventEvents.keyup=A.bindEvent(e,"keyup",function(t){if(t=t||window.event,i(t)){var e=n.raiseEvent("keyup",t);return!1===e&&t.preventDefault&&t.preventDefault(),e}}))}},{key:"destroy",value:function(){for(var t in this.eventEvents){var e=this.eventEvents[t];e&&e.fun&&A.removeEvent(e.target,t,e.fun)}}}]),i}();function O(t,e,n){n=n||2;var i,r,o,s,a,h=e&&e.length,u=h?e[0]*n:t.length,l=D(t,0,u,n,!0),c=[];if(!l||l.next===l.prev)return c;if(h&&(l=function(t,e,n,i){var r,o,s,a,h=[];for(r=0,o=e.length;r<o;r++)s=e[r]*i,a=r<o-1?e[r+1]*i:t.length,(a=D(t,s,a,i,!1))===a.next&&(a.steiner=!0),h.push(function(t){var e=t,n=t;for(;(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next,e!==t;);return n}(a));for(h.sort(z),r=0;r<h.length;r++)n=function(t,e){var n=function(t,e){var n,i=e,r=t.x,o=t.y,s=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var a=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=r&&s<a&&(s=a,n=i.x<i.next.x?i:i.next,a===r))return n}}while(i=i.next,i!==e);if(!n)return null;var h,u=n,l=n.x,c=n.y,f=1/0;i=n;for(;r>=i.x&&i.x>=l&&r!==i.x&&j(o<c?r:s,o,l,c,o<c?s:r,o,i.x,i.y)&&(h=Math.abs(o-i.y)/(r-i.x),Y(i,t)&&(h<f||h===f&&(i.x>n.x||i.x===n.x&&function(t,e){return U(t.prev,t,e.prev)<0&&U(e.next,t,t.next)<0}(n,i)))&&(n=i,f=h)),i=i.next,i!==u;);return n}(t,e);if(!n)return e;t=W(n,t);return I(t,t.next),I(n,n.next)}(h[r],n);return n}(t,e,l,n)),t.length>80*n){for(var f=i=t[0],v=r=t[1],d=n;d<u;d+=n)(o=t[d])<f&&(f=o),(s=t[d+1])<v&&(v=s),i<o&&(i=o),r<s&&(r=s);a=0!==(a=Math.max(i-f,r-v))?32767/a:0}return L(l,c,n,f,v,a,0),c}function D(t,e,n,i,r){var o,s;if(r===0<K(t,e,n,i))for(o=e;o<n;o+=i)s=Z(o,t[o],t[o+1],s);else for(o=n-i;e<=o;o-=i)s=Z(o,t[o],t[o+1],s);return s&&G(s,s.next)&&(V(s),s=s.next),s}function I(t,e){if(!t)return t;e=e||t;var n,i=t;do{if(n=!1,i.steiner||!G(i,i.next)&&0!==U(i.prev,i,i.next))i=i.next;else{if(V(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function L(t,e,n,i,r,o,s){if(t){!s&&o&&function(t,e,n,i){var r=t;for(;0===r.z&&(r.z=F(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next,r!==t;);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,s,a,h,u=1;do{for(n=t,o=t=null,s=0;n;){for(s++,i=n,e=a=0;e<u&&(a++,i=i.nextZ);e++);for(h=u;0<a||0<h&&i;)0!==a&&(0===h||!i||n.z<=i.z)?(n=(r=n).nextZ,a--):(i=(r=i).nextZ,h--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}}while(o.nextZ=null,u*=2,1<s)}(r)}(t,i,r,o);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,o?function(t,e,n,i){var r=t.prev,o=t,s=t.next;if(0<=U(r,o,s))return!1;var a=r.x,h=o.x,u=s.x,l=r.y,c=o.y,f=s.y,v=a<h?a<u?a:u:h<u?h:u,d=l<c?l<f?l:f:c<f?c:f,p=h<a?u<a?a:u:u<h?h:u,y=c<l?f<l?l:f:f<c?c:f,g=F(v,d,e,n,i),m=F(p,y,e,n,i),x=t.prevZ,b=t.nextZ;for(;x&&x.z>=g&&b&&b.z<=m;){if(x.x>=v&&x.x<=p&&x.y>=d&&x.y<=y&&x!==r&&x!==s&&j(a,l,h,c,u,f,x.x,x.y)&&0<=U(x.prev,x,x.next))return!1;if(x=x.prevZ,b.x>=v&&b.x<=p&&b.y>=d&&b.y<=y&&b!==r&&b!==s&&j(a,l,h,c,u,f,b.x,b.y)&&0<=U(b.prev,b,b.next))return!1;b=b.nextZ}for(;x&&x.z>=g;){if(x.x>=v&&x.x<=p&&x.y>=d&&x.y<=y&&x!==r&&x!==s&&j(a,l,h,c,u,f,x.x,x.y)&&0<=U(x.prev,x,x.next))return!1;x=x.prevZ}for(;b&&b.z<=m;){if(b.x>=v&&b.x<=p&&b.y>=d&&b.y<=y&&b!==r&&b!==s&&j(a,l,h,c,u,f,b.x,b.y)&&0<=U(b.prev,b,b.next))return!1;b=b.nextZ}return!0}(t,i,r,o):function(t){var e=t.prev,n=t,t=t.next;if(0<=U(e,n,t))return!1;var i=e.x,r=n.x,o=t.x,s=e.y,a=n.y,h=t.y,u=i<r?i<o?i:o:r<o?r:o,l=s<a?s<h?s:h:a<h?a:h,c=r<i?o<i?i:o:o<r?r:o,f=a<s?h<s?s:h:h<a?a:h,v=t.next;for(;v!==e;){if(v.x>=u&&v.x<=c&&v.y>=l&&v.y<=f&&j(i,s,r,a,o,h,v.x,v.y)&&0<=U(v.prev,v,v.next))return!1;v=v.next}return!0}(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(h.i/n|0),V(t),t=h.next,u=h.next;else if((t=h)===u){s?1===s?L(t=function(t,e,n){var i=t;do{var r=i.prev,o=i.next.next}while(!G(r,o)&&X(r,i,i.next,o)&&Y(r,o)&&Y(o,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(o.i/n|0),V(i),V(i.next),i=t=o),i=i.next,i!==t);return I(i)}(I(t),e,n),e,n,i,r,o,2):2===s&&function(t,e,n,i,r,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&X(n,n.next,t,e))return!0}while(n=n.next,n!==t);return!1}(t,e)&&(Y(t,e)&&Y(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;for(;n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next,n!==t;);return i}(t,e)&&(U(t.prev,t,e.prev)||U(t,e.prev,e))||G(t,e)&&0<U(t.prev,t,t.next)&&0<U(e.prev,e,e.next))}(s,a)){var h=W(s,a);return s=I(s,s.next),h=I(h,h.next),L(s,e,n,i,r,o,0),L(h,e,n,i,r,o,0)}a=a.next}}while(s=s.next,s!==t)}(t,e,n,i,r,o):L(I(t),e,n,i,r,o,1);break}}}function z(t,e){return t.x-e.x}function F(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function j(t,e,n,i,r,o,s,a){return(t-s)*(o-a)<=(r-s)*(e-a)&&(n-s)*(e-a)<=(t-s)*(i-a)&&(r-s)*(i-a)<=(n-s)*(o-a)}function U(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function G(t,e){return t.x===e.x&&t.y===e.y}function X(t,e,n,i){var r=H(U(t,e,n)),o=H(U(t,e,i)),s=H(U(n,i,t)),a=H(U(n,i,e));return r!==o&&s!==a||(0===r&&q(t,n,e)||(0===o&&q(t,i,e)||(0===s&&q(n,t,i)||!(0!==a||!q(n,e,i)))))}function q(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function H(t){return 0<t?1:t<0?-1:0}function Y(t,e){return U(t.prev,t,t.next)<0?0<=U(t,e,t.next)&&0<=U(t,t.prev,e):U(t,e,t.prev)<0||U(t,t.next,e)<0}function W(t,e){var n=new J(t.i,t.x,t.y),i=new J(e.i,e.x,e.y),r=t.next,o=e.prev;return(t.next=e).prev=t,(n.next=r).prev=n,(i.next=n).prev=i,(o.next=i).prev=o,i}function Z(t,e,n,i){n=new J(t,e,n);return i?(n.next=i.next,(n.prev=i).next.prev=n,i.next=n):(n.prev=n).next=n,n}function V(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function J(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function K(t,e,n,i){for(var r=0,o=e,s=n-i;o<n;o+=i)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}O.deviation=function(t,e,n,i){var r=e&&e.length,o=r?e[0]*n:t.length,s=Math.abs(K(t,0,o,n));if(r)for(var a=0,h=e.length;a<h;a++){var u=e[a]*n,l=a<h-1?e[a+1]*n:t.length;s-=Math.abs(K(t,u,l,n))}for(var c=0,a=0;a<i.length;a+=3){var f=i[a]*n,v=i[a+1]*n,d=i[a+2]*n;c+=Math.abs((t[f]-t[d])*(t[1+v]-t[1+f])-(t[f]-t[v])*(t[1+d]-t[1+f]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},O.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},i=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[r][o][s]);0<r&&(i+=t[r-1].length,n.holes.push(i))}return n};var Q=function(){function n(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"linear",e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};h(this,n),this.type=t||"linear",this.x1=e.x1||0,this.y1=e.y1||0,this.r1=e.r1||0,this.x2=e.x2||0,this.y2=e.y2||0,this.r2=e.r2||0,this.bounds=e.bounds||{left:0,top:0,width:0,height:0},this.control=e.control,this.stops=[],this.init()}return u(n,[{key:"init",value:function(){var t=this.x2-this.x1,e=this.y2-this.y1;"radial"===this.type?this.length=this.r2-this.r1:0==t&&0==e?this.length=0:(this.length=Math.sqrt(Math.pow(t,2),Math.pow(e,2)),this.sin=e/this.length,this.cos=t/this.length)}},{key:"addColorStop",value:function(t,e){this.stops.push({offset:t,color:e})}},{key:"toImageData",value:function(i,t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!i.textureContext)return null;var r=null,r="linear"===this.type?i.textureContext.createLinearGradient(this.x1,this.y1,this.x2,this.y2):i.textureContext.createRadialGradient(this.x1,this.y1,this.r1,this.x2,this.y2,this.r2);return this.stops.forEach(function(t,e){var n=i.graph.utils.toColor(t.color);r&&r.addColorStop(t.offset,n)}),i.toFillTexture(r,t,e)}},{key:"toString",value:function(){var e=this.type+"-gradient(";return"linear"==this.type?e+=this.x1+" "+this.y1+" "+this.x2+" "+this.y2:e+=this.x1+" "+this.y1+" "+this.r1+" "+this.x2+" "+this.y2+" "+this.r2,this.stops.forEach(function(t){e+=","+t.color+" "+t.offset}),e+")"}}]),n}();function $(t,e,n){e=t.createShader(e);return t.shaderSource(e,n),t.compileShader(e),e}var tt={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1},et=function(t){return tt[t]},nt=null,it={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D"},rt=function(t,e){if(!nt){var n=Object.keys(it);nt={};for(var i=0;i<n.length;++i){var r=n[i];nt[t[r]]=it[r]}}return nt[e]};function ot(t,e,n){var i=$(t,t.VERTEX_SHADER,e),e=$(t,t.FRAGMENT_SHADER,n),n=t.createProgram();return t.attachShader(n,i),t.attachShader(n,e),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||(console.error("PError: Could not initialize shader."),console.error("gl.VALIDATE_STATUS",t.getProgramParameter(n,t.VALIDATE_STATUS)),console.error("gl.getError()",t.getError()),""!==t.getProgramInfoLog(n)&&console.warn("Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(n)),t.deleteProgram(n)),st(t,n),t.deleteShader(i),t.deleteShader(e),{program:n,attrs:function(t,e){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),r=0;r<i;r++){var o=t.getActiveAttrib(e,r),s=rt(t,o.type);n[o.name]={attribData:o,size:et(s),type:s,location:t.getAttribLocation(e,o.name)}}return n}(t,n),uniforms:function(t,e){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r<i;r++){var o=t.getActiveUniform(e,r),s=o.name.replace(/\[.*?\]/,""),a=rt(t,o.type);n[s]={uniformData:o,type:a,size:o.size,location:t.getUniformLocation(e,s)}}return n}(t,n)}}function st(t,e){return t.useProgram(e)}function at(t,e,n,i){var r=2<arguments.length&&void 0!==n?n:t.ARRAY_BUFFER,n=3<arguments.length&&void 0!==i?i:t.STATIC_DRAW,i=t.createBuffer();if(!i)throw Error("创建缓冲区对象失败");return t.bindBuffer(r,i),t.bufferData(r,e.buffer||e,n),{type:r,drawType:n,buffer:i,unitSize:e.BYTES_PER_ELEMENT}}function ht(t){var e=t.createTexture();return t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,e),t.texParameterf(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameterf(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameterf(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameterf(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}var ut="\n attribute vec4 a_position;\n attribute vec4 a_color;\n attribute vec2 a_text_coord;\n uniform vec2 a_center_point; // 当前canvas的中心位置\n uniform float a_point_size; // 点的大小\n uniform int a_type;\n varying vec4 v_color;\n varying vec2 v_text_coord;\n varying float v_type;\n\n ".concat("\n vec4 translatePosition(vec4 point, float x, float y) {\n point.x = (point.x-x)/x;\n point.y = (y-point.y)/y;\n return point;\n }","\n\n void main() {\n gl_PointSize = a_point_size == 0.0? 1.0 : a_point_size;\n v_type = float(a_type);\n vec4 pos = translatePosition(a_position, a_center_point.x, a_center_point.y);\n gl_Position = pos;\n v_color = a_color;\n if(a_type == 2) {\n v_text_coord = a_text_coord;\n }\n }\n"),lt="\n precision mediump float;\n uniform sampler2D u_sample;\n uniform vec4 v_texture_bounds; // 纹理的左上坐标和大小 x,y,z,w\n uniform vec4 v_single_color;\n varying float v_type;\n varying vec4 v_color;\n varying vec2 v_text_coord;\n\n ".concat("\n vec2 translateTexturePosition(in vec2 point, vec4 bounds) {\n point.x = (point.x-bounds.x)/bounds.z; // 离左上角位置的X长比上纹理宽 0-1\n point.y = 1.0-(point.y-bounds.y)/bounds.w; // 离左上角位置的Y长比上高,因为纹理坐标是左下角起,所以要用1-\n return point;\n }","\n\n void main() {\n // 如果是fill,则直接填充颜色\n if(v_type == 1.0) {\n gl_FragColor = v_single_color;\n }\n // 渐变色\n else if(v_type == 3.0) {\n gl_FragColor = v_color;\n }\n else if(v_type == 2.0) {\n vec2 pos = translateTexturePosition(v_text_coord, v_texture_bounds);\n gl_FragColor = texture2D(u_sample, pos);\n }\n else {\n float r = distance(gl_PointCoord, vec2(0.5, 0.5));\n //根据距离设置片元\n if(r <= 0.5){\n // 方形区域片元距离几何中心半径小于0.5,像素颜色设置红色\n gl_FragColor = v_single_color;\n }else {\n // 方形区域距离几何中心半径不小于0.5的片元剪裁舍弃掉:\n discard;\n }\n }\n }\n"),ct=function(){function n(t,e){h(this,n),this.graph=t,this.option=e||{},this.style={globalAlpha:1},this.stateStack=[],this.transformMatrix=[1,0,0,1,0,0]}return u(n,[{key:"context",get:function(){if(this.graph)return this.graph.context}},{key:"save",value:function(){this.stateStack.push({transformMatrix:m(this.transformMatrix),style:a({},this.style)})}},{key:"restore",value:function(){var t;0<this.stateStack.length&&(t=this.stateStack.pop(),this.transformMatrix=t.transformMatrix,this.style=t.style)}},{key:"translate",value:function(t,e){this.transformMatrix[4]+=t*this.transformMatrix[0]+e*this.transformMatrix[2],this.transformMatrix[5]+=t*this.transformMatrix[1]+e*this.transformMatrix[3]}},{key:"scale",value:function(t,e){this.transformMatrix[0]*=t,this.transformMatrix[1]*=t,this.transformMatrix[2]*=e,this.transformMatrix[3]*=e}},{key:"rotate",value:function(t){var e=Math.cos(t),n=Math.sin(t),i=g(this.transformMatrix,6),r=i[0],o=i[1],s=i[2],t=i[3];i[4],i[5],this.transformMatrix[0]=r*e-o*n,this.transformMatrix[1]=r*n+o*e,this.transformMatrix[2]=s*e-t*n,this.transformMatrix[3]=s*n+t*e}},{key:"transform",value:function(t,e,n,i,r,o){var s=g(this.transformMatrix,6),a=s[0],h=s[1],u=s[2],l=s[3],c=s[4],s=s[5];this.transformMatrix[0]=t*a+e*u,this.transformMatrix[1]=t*h+e*l,this.transformMatrix[2]=n*a+i*u,this.transformMatrix[3]=n*h+i*l,this.transformMatrix[4]=r*a+o*u+c,this.transformMatrix[5]=r*h+o*l+s}},{key:"applyTransform",value:function(t){var e=g(this.transformMatrix,6),n=e[0],i=e[1],r=e[2],o=e[3],s=e[4],e=e[5];return{x:n*t.x+r*t.y+s,y:i*t.x+o*t.y+e}}},{key:"textureCanvas",get:function(){var t=this.graph.textureCanvas;if(!t){if("undefined"==typeof document)return null;t=this.graph.textureCanvas=document.createElement("canvas")}return t}},{key:"textureContext",get:function(){return this.textureCanvas.ctx||(this.textureCanvas.ctx=this.textureCanvas.getContext("2d",{willReadFrequently:!0}))}},{key:"program",get:function(){return this.graph.context.pathProgram||(this.graph.context.pathProgram=this.createProgram(ut,lt))}},{key:"setStyle",value:function(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.style;"string"==typeof e&&((t={})[e]=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",e=t),this.style=a(a({},this.style),e)}},{key:"convertColor",value:function(t){return this.isGradient(t)?t:("string"==typeof t&&(t=this.graph.utils.hexToRGBA(t)),this.graph.utils.rgbToDecimal(t))}},{key:"setTextureStyle",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof t)-1<["fillStyle","strokeStyle","shadowColor"].indexOf(t)&&(e=this.graph.utils.toColor(e)),this.textureContext[t]=e;else for(var n in t)"constructor"!==n&&this.setTextureStyle(n,t[n])}},{key:"createProgram",value:function(t,e){return this.context.lineWidth(1),ot(this.context,t,e)}},{key:"useProgram",value:function(){var t=(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.program).program||t;return this.context.__curent_program===t?t:(st(this.context,t.program||t),this.context.__curent_program=t)}},{key:"getAttribLocation",value:function(t){return this.context.getAttribLocation(this.program.program,t)}},{key:"getUniformLocation",value:function(t){return this.context.getUniformLocation(this.program.program,t)}},{key:"writeVertexAttrib",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:2,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:this.context.FLOAT;return t.attr=e,function(t,e,n,i,r,o,s){return i=3<arguments.length&&void 0!==i?i:2,r=4<arguments.length&&void 0!==r?r:0,o=5<arguments.length&&void 0!==o?o:0,s=6<arguments.length&&void 0!==s?s:t.FLOAT,t.bindBuffer(e.type,e.buffer),t.vertexAttribPointer(n.location,i,s,!1,r*e.unitSize,o),t.enableVertexAttribArray(n.location),e}(this.context,t,e,n,i,r,o)}},{key:"disableVertexAttribArray",value:function(t){try{return t?this.context.disableVertexAttribArray(t.location):t}catch(t){console.error(t)}return t}},{key:"createFloat32Buffer",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.context.ARRAY_BUFFER,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.context.STATIC_DRAW;return a({data:t},function(t,e,n,i){return n=2<arguments.length&&void 0!==n?n:t.ARRAY_BUFFER,i=3<arguments.length&&void 0!==i?i:t.STATIC_DRAW,at(t,new Float32Array(e),n,i)}(this.context,t,e,n))}},{key:"createUint16Buffer",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.context.ARRAY_BUFFER,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.context.STATIC_DRAW;return a({data:t},function(t,e,n,i){return n=2<arguments.length&&void 0!==n?n:t.ARRAY_BUFFER,i=3<arguments.length&&void 0!==i?i:t.STATIC_DRAW,at(t,new Uint16Array(e),n,i)}(this.context,t,e,n))}},{key:"deleteBuffer",value:function(e){try{if(!e)return;var t=e.buffer||e;if(t)return n=this.context,i=t,void n.deleteBuffer(i.buffer||i)}catch(t){console.log(e),console.error(t)}var n,i;return e}},{key:"create2DTexture",value:function(){return ht(this.context)}},{key:"createImgTexture",value:function(t){return e=this.context,n=t,t=ht(e),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n),{texture:t};var e,n}},{key:"createDataTexture",value:function(t){return e=this.context,n=t,i=new Uint8Array(n.data||n),t=ht(e),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width||1,n.height||1,0,e.RGBA,e.UNSIGNED_BYTE,i),{texture:t};var e,n,i}},{key:"deleteTexture",value:function(t){try{return e=this.context,n=t.texture||t,e.deleteTexture(n)}catch(t){console.error(t)}var e,n;return t}},{key:"earCutPoints",value:function(t){return O(this.pointsToArray(t))}},{key:"earCutPointsToTriangles",value:function(t){this.earCutCache=this.earCutCache||(this.earCutCache={});var e=JSON.stringify(t);if(this.earCutCache[e])return this.earCutCache[e];for(var n=this.earCutPoints(t),i=[],r=0;r<n.length;r+=3){var o=t[n[r]],s=t[n[r+1]],a=t[n[r+2]];i.push([o,s,a])}return this.earCutCache[e]=i}},{key:"pointsToArray",value:function(t){var e;return(e=[]).concat.apply(e,m(t.map(function(t){return[t.x,t.y]})))}},{key:"arrayToPoints",value:function(t){for(var e=[],n=0;n<t.length;n+=2)e.push({x:t[n],y:t[n+1]});return e}},{key:"createLinearGradient",value:function(t,e,n,i,r){return new Q("linear",{x1:t,y1:e,x2:n,y2:i,bounds:r,control:this})}},{key:"createRadialGradient",value:function(t,e,n,i,r,o,s){return new Q("radial",{x1:t,y1:e,r1:n,x2:i,y2:r,r2:o,bounds:s,control:this})}},{key:"isGradient",value:function(t){return t&&t instanceof Q}},{key:"testSize",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.style;this.textureContext.save&&this.textureContext.save(),(e.font||e.fontSize)&&(this.textureContext.font=e.font||e.fontSize+"px "+e.fontFamily);t=this.textureContext.measureText?this.textureContext.measureText(t):{width:15};return this.textureContext.restore&&this.textureContext.restore(),t.height=this.style.fontSize||15,t}},{key:"toFillTexture",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=this.textureCanvas;if(!i)return t;if(i.width=e.width,i.height=e.height,!i.width||!i.height)return t;if(this.textureContext.clearRect(0,0,i.width,i.height),this.textureContext.fillStyle=t,this.textureContext.beginPath(),n&&n.length||((n=[]).push({x:e.left,y:e.top}),n.push({x:e.left+e.width,y:e.top}),n.push({x:e.left+e.width,y:e.top+e.height}),n.push({x:e.left,y:e.top+e.height}),n.push({x:e.left,y:e.top})),n&&n.length){var r,o=w(n);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.m?this.textureContext.moveTo(s.x-e.left,s.y-e.top):this.textureContext.lineTo(s.x-e.left,s.y-e.top)}}catch(t){o.e(t)}finally{o.f()}}else this.textureContext.moveTo(0,0),this.textureContext.lineTo(e.width,0),this.textureContext.lineTo(e.width,e.height),this.textureContext.lineTo(0,e.height),this.textureContext.lineTo(0,0);return this.textureContext.closePath(),this.textureContext.fill(),{data:this.textureContext.getImageData(0,0,i.width,i.height),points:n}}}]),n}(),ft=function(){l(i,ct);var n=p(i);function i(t,e){return h(this,i),(t=n.call(this,t,e)).isRegular=e.isRegular||!1,t.needCut=e.needCut||!1,t.control=e.control,t.points=[],t}return u(i,[{key:"applyTransform",value:function(t){return y(r(i.prototype),"applyTransform",this).call(this,t)}},{key:"setParentBounds",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.parentAbsoluteBounds;t&&(this.parentAbsoluteBounds=t),this.context.uniform2f(this.program.uniforms.a_center_point.location,this.graph.width/2,this.graph.height/2)}},{key:"setFragColor",value:function(t){if(!Array.isArray(t))return void 0===(t=this.convertColor(t)).a&&(t.a=1),this.context.uniform4f(this.program.uniforms.v_single_color.location,t.r,t.g,t.b,t.a*this.style.globalAlpha),null;var e,n=[],i=w(t);try{for(i.s();!(e=i.n()).done;){var r=e.value;void 0===(r=this.convertColor(r)).a&&(r.a=1),n.push(r.r,r.g,r.b,r.a*this.style.globalAlpha)}}catch(t){i.e(t)}finally{i.f()}t=this.createFloat32Buffer(n);return this.writeVertexAttrib(t,this.program.attrs.a_color,4,0,0),t.attr=this.program.attrs.a_color,t}},{key:"beginDraw",value:function(){this.useProgram()}},{key:"draw",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.parentAbsoluteBounds;this.setParentBounds(e),this.points=t}},{key:"endDraw",value:function(){this.points&&delete this.points,this.pathPoints&&delete this.pathPoints}},{key:"closePath",value:function(){var t,e;this.points&&2<this.points.length&&this.points[0]!==this.points[this.points.length-1]&&((t=this.points[0])==(e=this.points[this.points.length-1])||t.x===e.x&&t.y===e.y||this.points.push(t))}},{key:"writePoints",value:function(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.program.attrs.a_position,i=[],r=w(t);try{for(r.s();!(e=r.n()).done;){var o=e.value,s=this.applyTransform(o);i.push(s.x+this.parentAbsoluteBounds.left,s.y+this.parentAbsoluteBounds.top)}}catch(t){r.e(t)}finally{r.f()}t=this.createFloat32Buffer(i);return this.writeVertexAttrib(t,n,2,0,0),t.attr=n,t}},{key:"genLinePoints",value:function(t,e){var n=[t],i=e.x-t.x,r=e.y-t.y;if(0!=i||0!=r)for(var o=Math.sqrt(Math.pow(i,2)+Math.pow(r,2)),s=i/o,a=r/o,h=.5;h<o;h+=.5){var u=t.x+s*h,l=t.y+a*h;n.push({x:u,y:l})}return n.push(e),n}},{key:"pathToPoints",value:function(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.points,e=null,n=[],i=0;i<t.length;i++){var r,o=t[i];e&&!o.m?(r=this.genLinePoints(e,o),n.push.apply(n,m(r))):e&&!n.includes(e)&&n.push(e),e=o}return n.includes(e)||n.push(e),n}},{key:"equalPoint",value:function(t,e){return t.x===e.x&&t.y===e.y}},{key:"pathToLines",value:function(t){for(var e=null,n=[],i=0;i<t.length;i++){var r=t[i];!e||r.m||e.x==r.x&&e.y==r.y||n.push({start:e,end:r}),e=r}return n}},{key:"cutLines",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(t&&t.length<3)return t;for(n=Math.max(e+1,n);e<t.length;){for(var i=t[e];n<t.length;){var r=t[n];if(this.equalPoint(i.start,r.start)||this.equalPoint(i.end,r.end)||this.equalPoint(i.start,r.end)||this.equalPoint(i.end,r.start))n++;else{var o,s,a=!1,h=this.getIntersection(i,r);if(h&&(this.equalPoint(i.start,h)||this.equalPoint(i.end,h)||(o={start:i.start,end:h},s={start:h,end:i.end},t.splice(e,1,o,s),a=!0,n++),this.equalPoint(r.start,h)||this.equalPoint(r.end,h)||(s={start:r.start,end:h},r={start:h,end:r.end},t.splice(n,1,s,r),n++)),n++,a)return this.cutLines(t,e,n)}}n=++e+1}return t}},{key:"getIntersection",value:function(t,e){if(this.equalPoint(t.start,e.start)||this.equalPoint(t.start,e.end))return t.start;if(this.equalPoint(t.end,e.start)||this.equalPoint(t.end,e.end))return t.end;var n=(t.start.x-e.start.x)*(t.end.y-e.start.y)-(t.start.y-e.start.y)*(t.end.x-e.start.x),i=(t.start.x-e.end.x)*(t.end.y-e.end.y)-(t.start.y-e.end.y)*(t.end.x-e.end.x);if(0<n*i)return null;e=(e.start.x-t.start.x)*(e.end.y-t.start.y)-(e.start.y-t.start.y)*(e.end.x-t.start.x);if(0<e*(e+n-i))return null;if(i==n)return null;i=e/(i-n),n=i*(t.end.x-t.start.x),i*=t.end.y-t.start.y;return{x:t.start.x+n,y:t.start.y+i}}},{key:"getIntersectionLines",value:function(t,e,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:t.end,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:[],o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:null,s={line:t,polygons:[]};if(r.push(i),o&&this.equalPoint(o.line.start,i))return r.unshift(o.line.start),o.polygons.push(r),s;for(;n<e.length;n++){var a=e[n];this.equalPoint(i,a.start)?r.includes(a.end)||this.getIntersectionLines(a,e,n+1,a.end,m(r),o||s):this.equalPoint(i,a.end)&&(r.includes(a.start)||this.getIntersectionLines(a,e,n+1,a.start,m(r),o||s))}return s}},{key:"getPolygon",value:function(t){var e=[];if((n=this.pathToLines(t))&&2<n.length)for(var n=this.cutLines(n),i=0;i<n.length-1;i++){var r=n[i],r=this.getIntersectionLines(r,n,i+1);r.polygons.length&&e.push.apply(e,m(r.polygons))}return e}},{key:"getTriangles",value:function(t){this.trianglesCache=this.trianglesCache||(this.trianglesCache={});var e=JSON.stringify(t);if(this.trianglesCache[e])return this.trianglesCache[e];var n=[],t=this.getPolygon(t);if(t.length){var i,r=w(t);try{for(r.s();!(i=r.n()).done;){var o=i.value,s=this.earCutPointsToTriangles(o);n.push.apply(n,m(s))}}catch(t){r.e(t)}finally{r.f()}}return this.trianglesCache[e]=n}},{key:"stroke",value:function(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.points,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.style.strokeStyle,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.style.lineWidth;e&&e.length&&(t=null,n&&(t=this.setFragColor(n)),i&&this.context.uniform1f(this.program.uniforms.a_point_size.location,i),this.program.uniforms.a_type&&this.context.uniform1i(this.program.uniforms.a_type.location,1===e.length?4:1),e&&e.length&&(e=(n=i<=1.2)?e:this.pathToPoints(e),i=this.writePoints(e),this.context.drawArrays(n?this.context.LINE_LOOP:this.context.POINTS,0,e.length),this.deleteBuffer(i)),t&&this.deleteBuffer(t),t&&this.disableVertexAttribArray(t.attr))}},{key:"fill",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{left:0,top:0,width:0,height:0},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;this.points&&this.points.length&&(this.style.fillStyle&&this.fillColor(this.style.fillStyle,this.points,t,e),this.style.fillImage&&this.fillImage(this.style.fillImage,this.points,t,e))}},{key:"fillColor",value:function(t,e,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;if(this.isGradient(t)){var r=t.toImageData(this,n,e);return this.fillImage(r.data,r.points,n)}this.context.uniform1i(this.program.uniforms.a_type.location,i);t=this.setFragColor(t);this.fillPolygons(e),t&&this.deleteBuffer(t),t&&this.disableVertexAttribArray(t.attr)}},{key:"fillImage",value:function(t,e,n){t&&(t=t instanceof ImageData?this.createDataTexture(t):this.createImgTexture(t),this.context.uniform1i(this.program.uniforms.u_sample.location,0),this.context.uniform4f(this.program.uniforms.v_texture_bounds.location,n.left+this.parentAbsoluteBounds.left,n.top+this.parentAbsoluteBounds.top,n.width,n.height),this.fillTexture(e),this.deleteTexture(t))}},{key:"fillTexture",value:function(t){t&&t.length&&(this.context.uniform1i(this.program.uniforms.a_type.location,2),this.fillPolygons(t,!0),this.disableVertexAttribArray(this.program.attrs.a_text_coord))}},{key:"fillPolygons",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(3<t.length){var n=this.needCut?this.earCutPointsToTriangles(t):this.getTriangles(t);if(n.length){var i,r=w(n);try{for(r.s();!(i=r.n()).done;){var o=i.value;this.fillPolygons(o,e)}}catch(t){r.e(t)}finally{r.f()}}}else{var s=this.writePoints(t),n=e?this.writePoints(t,this.program.attrs.a_text_coord):null;this.context.drawArrays(this.context.TRIANGLE_FAN,0,t.length),this.deleteBuffer(s),n&&this.deleteBuffer(n)}}},{key:"drawImage",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:t.width,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:t.height,i=i||t.width,r=r||t.height;this.fillImage(t,this.points,{left:e,top:n,width:i,height:r})}},{key:"drawText",value:function(t,e,n,i){var r=this.textureCanvas;if(!r)return null;if(r.width=i.width,r.height=i.height,!r.width||!r.height)return null;this.textureContext.clearRect(0,0,r.width,r.height),this.textureContext.font=this.style.font||this.style.fontSize+"px "+this.style.fontFamily,e-=i.left,n-=i.top,this.setTextureStyle(this.style),this.style.fillStyle&&this.textureContext.fillText&&(this.style.maxWidth?this.textureContext.fillText(t,e,n,this.style.maxWidth):this.textureContext.fillText(t,e,n)),this.textureContext.strokeText&&(this.style.maxWidth?this.textureContext.strokeText(t,e,n,this.style.maxWidth):this.textureContext.strokeText(t,e,n));r=this.textureContext.getImageData(0,0,r.width,r.height);this.fillImage(r,this.points,i)}}]),i}(),vt={fill:"fillStyle",fillImage:"fillImage",stroke:"strokeStyle","shadow.blur":"shadowBlur","shadow.x":"shadowOffsetX","shadow.y":"shadowOffsetY","shadow.color":"shadowColor",lineWidth:"lineWidth",miterLimit:"miterLimit",fillStyle:"fillStyle",strokeStyle:"strokeStyle",font:"font",opacity:"globalAlpha",textAlign:"textAlign",textBaseline:"textBaseline",shadowBlur:"shadowBlur",shadowOffsetX:"shadowOffsetX",shadowOffsetY:"shadowOffsetY",shadowColor:"shadowColor",lineJoin:"lineJoin",lineCap:"lineCap"},dt=function(){l(r,C);var i=p(r);function r(t,e){var n;return h(this,r),(n=i.call(this,t=t||{})).property("type",e||(this instanceof r?this.constructor:void 0).name),n.style=t&&t.style?t.style:{},n.width=t.width||0,n.height=t.height||0,n.hitArea=t.hitArea||null,t.position&&(n.position=t.position),n.graph=t.graph||null,n.zIndex=t.zIndex||0,n.interactive=void 0!==t.interactive&&t.interactive,"webgl"===n.mode&&(n.webglControl=new ft(n.graph,{style:n.style,control:v(n),isRegular:t.isRegular,needCut:t.needCut})),n.initializing(),n.on=n.bind,n.option=t,n}return u(r,[{key:"type",get:function(){return this.property("type")}},{key:"context",get:function(){var t=this.property("context");if(t)return t;if(this.is("jmGraph")&&this.canvas&&this.canvas.getContext)return this.context=this.canvas.getContext(this.mode||"2d");t=this.graph;return t?t.context:t.canvas.getContext(this.mode||"2d")},set:function(t){return this.property("context",t)}},{key:"style",get:function(){return this.property("style")||this.property("style",{})},set:function(t){return this.needUpdate=!0,this.property("style",t)}},{key:"visible",get:function(){var t=this.property("visible");return t=void 0===t?this.property("visible",!0):t},set:function(t){return this.needUpdate=!0,this.property("visible",t)}},{key:"interactive",get:function(){return this.property("interactive")},set:function(t){return this.property("interactive",t)}},{key:"hitArea",get:function(){return this.property("hitArea")},set:function(t){return this.property("hitArea",t)}},{key:"children",get:function(){return this.property("children")||this.property("children",new _)},set:function(t){return this.needUpdate=!0,this.property("children",t)}},{key:"width",get:function(){var t=this.property("width");return t=void 0===t?this.property("width",0):t},set:function(t){return this.needUpdate=!0,this.property("width",t)}},{key:"height",get:function(){var t=this.property("height");return t=void 0===t?this.property("height",0):t},set:function(t){return this.needUpdate=!0,this.property("height",t)}},{key:"zIndex",get:function(){return this.property("zIndex")||this.property("zIndex",0)},set:function(t){return this.property("zIndex",t),this.children.sort(),this.needUpdate=!0,t}},{key:"cursor",get:function(){var t=this.graph;if(t)return t.css("cursor")},set:function(t){var e=this.graph;e&&e.css("cursor",t)}},{key:"initializing",value:function(){var e=this;this.children=this.children||new _;var n=this.children.add;this.children.add=function(t){if("object"===c(t))return t.parent&&t.parent!=e&&t.parent.children&&t.parent.children.remove(t),t.parent=e,this.contain(t)&&this.oremove(t),n.call(this,t),t.emit("add",t),e.needUpdate=!0,e.graph&&(t.graph=e.graph),this.sort(),t},this.children.oremove=this.children.remove,this.children.remove=function(t){"object"===c(t)&&(t.parent=null,t.graph=null,t.remove(!0),this.oremove(t),e.needUpdate=!0)},this.children.sort=function(){var t,i={};for(t in this.each(function(t,e){var n;e&&(!(n=e.zIndex)&&e.style&&e.style.zIndex&&(n=Number(e.style.zIndex),isNaN(n)&&(n=e.style.zIndex||0)),(i[n]||(i[n]=[])).push(e))}),this.splice(0,this.length),i)n.call(this,i[t])},this.children.clear=function(){this.each(function(t,e){this.remove(e)},!0)},this.needUpdate=!0}},{key:"setStyle",value:function(t){var a=this;if(t=t||A.clone(this.style,!0)){var e,n,i=function t(e,n,i){if(e){var r=e;if("function"==typeof r)try{r=r.call(a)}catch(t){return void console.warn(t)}var o=c(r),i=vt[i||n];if(r instanceof M||"string"==o&&-1<r.indexOf("-gradient"))t((r="string"==o&&-1<r.indexOf("-gradient")?new M(r):r).toGradient(a),i||n);else if(i)a.webglControl?a.webglControl.setStyle(i,r):("string"==o&&-1<["fillStyle","strokeStyle","shadowColor"].indexOf(i)&&(r=A.toColor(r)),a.context[i]=r);else switch(n){case"shadow":if("string"==o){t(new S(r),n);break}for(var s in r)t(r[s],s,n+"."+s);break;case"translate":break;case"rotation":if(void 0===r.angle||isNaN(r.angle))break;r=a.getRotation(r),a.__translateAbsolutePosition=a.toAbsolutePoint({x:r.x,y:r.y}),a.context.translate&&a.context.translate(a.__translateAbsolutePosition.x,a.__translateAbsolutePosition.y),a.context.rotate&&a.context.rotate(r.angle),a.context.translate&&a.context.translate(-a.__translateAbsolutePosition.x,-a.__translateAbsolutePosition.y);break;case"transform":if(!a.context.transform)break;Array.isArray(r)?a.context.transform.apply(a.context,r):"object"==c(r)&&a.context.transform(r.scaleX||1,r.skewX||0,r.skewY||0,r.scaleY||1,r.offsetX||0,r.offsetY||0);break;case"cursor":a.cursor=r}}};for(e in this.translate&&i(this.translate,"translate"),this.transform&&i(this.transform,"transform"),t)"constructor"!==e&&("string"==(n=c(t[e]))&&-1<t[e].indexOf("-gradient")?t[e]=new M(t[e]):"string"==n&&"shadow"==e&&(t[e]=new S(t[e])),i(t[e],e))}}},{key:"getBounds",value:function(t){if(this.bounds&&!t)return this.bounds;var e={};if("jmGraph"==this.type&&this.canvas)"function"==typeof this.canvas.width?e.right=this.canvas.width():this.width&&(e.right=this.width),"function"==typeof this.canvas.height?e.bottom=this.canvas.height():this.height&&(e.bottom=this.height);else if(this.points&&0<this.points.length){var n,i=w(this.points);try{for(i.s();!(n=i.n()).done;){var r=n.value;(void 0===e.left||e.left>r.x)&&(e.left=r.x),(void 0===e.top||e.top>r.y)&&(e.top=r.y),(void 0===e.right||e.right<r.x)&&(e.right=r.x),(void 0===e.bottom||e.bottom<r.y)&&(e.bottom=r.y)}}catch(t){i.e(t)}finally{i.f()}}else!this.getLocation||(t=this.getLocation())&&(e.left=t.left,e.top=t.top,e.right=t.left+t.width,e.bottom=t.top+t.height);return e.left||(e.left=0),e.top||(e.top=0),e.right||(e.right=0),e.bottom||(e.bottom=0),e.width=e.right-e.left,e.height=e.bottom-e.top,this.bounds=e}},{key:"getRotationBounds",value:function(){var t=(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null)||this.getRotation(),e=this.getBounds();if(!t||!t.angle)return e;var n,i={width:0,height:0,oldBounds:e},r=[];this.points&&0<this.points.length?r=A.clone(this.points,!0):!this.getLocation||(n=this.getLocation())&&r.push({x:n.left,y:n.top},{x:n.left+n.width,y:n.top},{x:n.left+n.width,y:n.top+n.height},{x:n.left,y:n.top+n.height});var o,s=w(r=A.rotatePoints(r,{x:t.x+e.left,y:t.y+e.top},t.angle));try{for(s.s();!(o=s.n()).done;){var a=o.value;(void 0===i.left||i.left>a.x)&&(i.left=a.x),(void 0===i.top||i.top>a.y)&&(i.top=a.y),(void 0===i.right||i.right<a.x)&&(i.right=a.x),(void 0===i.bottom||i.bottom<a.y)&&(i.bottom=a.y)}}catch(t){s.e(t)}finally{s.f()}return i.left||(i.left=0),i.top||(i.top=0),i.right||(i.right=0),i.bottom||(i.bottom=0),i.width=i.right-i.left,i.height=i.bottom-i.top,i}},{key:"getLocation",value:function(){var t=this.location={left:0,top:0,width:0,height:0};t.position="function"==typeof this.position?this.position():A.clone(this.position),t.center=this.center&&"function"==typeof this.center?this.center():A.clone(this.center),t.start=this.start&&"function"==typeof this.start?this.start():A.clone(this.start),t.end=this.end&&"function"==typeof this.end?this.end():A.clone(this.end),t.radius=this.radius,t.width=this.width,t.height=this.height;var e=A.clone(this.style.margin,{});return e.left=e.left||0,e.top=e.top||0,e.right=e.right||0,e.bottom=e.bottom||0,t.position?(t.left=t.position.x,t.top=t.position.y):(t.left=e.left,t.top=e.top),this.parent&&(e=this.parent.getBounds(),A.checkPercent(t.left)&&(t.left=A.percentToNumber(t.left)*e.width),A.checkPercent(t.top)&&(t.top=A.percentToNumber(t.top)*e.height),A.checkPercent(t.width)&&(t.width=A.percentToNumber(t.width)*e.width),A.checkPercent(t.height)&&(t.height=A.percentToNumber(t.height)*e.height),t.center&&(A.checkPercent(t.center.x)&&(t.center.x=A.percentToNumber(t.center.x)*e.width),A.checkPercent(t.center.y)&&(t.center.y=A.percentToNumber(t.center.y)*e.height)),t.radius&&A.checkPercent(t.radius)&&(t.radius=A.percentToNumber(t.radius)*Math.min(e.width,e.height))),t}},{key:"getRotation",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return(t=t||A.clone(this.style.rotation))?(e=e||this.getBounds(),void 0===t.x&&(t.x="50%"),void 0===t.y&&(t.y="50%"),A.checkPercent(t.x)&&(t.x=A.percentToNumber(t.x)*e.width),A.checkPercent(t.y)&&(t.y=A.percentToNumber(t.y)*e.height)):(t=this.parent&&this.parent.getRotation?this.parent.getRotation():null)&&(e=e||this.getBounds(),t.x-=e.left,t.y-=e.top),a(a({},t),{},{bounds:e})}},{key:"getTranslate",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(!(t=t||this.style.translate))return{x:0,y:0};t={x:t.x||0,y:t.y||0};return A.checkPercent(t.x)&&(!e&&this.parent&&(e=this.parent.getBounds()),t.x=A.percentToNumber(t.x)*e.width),A.checkPercent(t.y)&&(!e&&this.parent&&(e=this.parent.getBounds()),t.y=A.percentToNumber(t.y)*e.height),t}},{key:"remove",value:function(){this.parent&&this.parent.children.remove(this)}},{key:"offset",value:function(t,e,n,i){n=!1!==n;var r=this.getLocation(!0),o=!1;if(r.position&&(r.left+=t,r.top+=e,this.position.x=r.left,this.position.y=r.top,o=!0),r.center&&(this.center.x=r.center.x+t,this.center.y=r.center.y+e,o=!0),r.start&&"object"==c(r.start)&&(this.start.x=r.start.x+t,this.start.y=r.start.y+e,o=!0),r.end&&"object"==c(r.end)&&(this.end.x=r.end.x+t,this.end.y=r.end.y+e,o=!0),0==o&&this.cpoints){var s=(this.cpoints,this.cpoints);if(s){for(var a=s.length,h=0;h<a;h++)s[h].x+=t,s[h].y+=e;o=!0}}if(0==o&&this.points){for(var u=this.points.length,l=0;l<u;l++)this.points[l].x+=t,this.points[l].y+=e;o=!0}this.emit("move",{offsetX:t,offsetY:e,trans:n,evt:i}),this.needUpdate=!0}},{key:"getAbsoluteBounds",value:function(){var t=this.getBounds();if(this.parent&&this.parent.absoluteBounds){var e=this.parent.absoluteBounds||this.parent.getAbsoluteBounds();return{left:e.left+t.left,top:e.top+t.top,right:e.left+t.right,bottom:e.top+t.bottom,width:t.width,height:t.height}}return t}},{key:"toAbsolutePoint",value:function(t){var e;return(t.x||t.y)&&(e=this.absoluteBounds||this.getAbsoluteBounds(),t.x=(t.x||0)+e.left,t.y=(t.y||0)+e.top),t}},{key:"toLocalPosition",value:function(t){var e=this.absoluteBounds||this.getAbsoluteBounds();return!!e&&{x:t.x-e.left,y:t.y-e.top}}},{key:"beginDraw",value:function(){this.getLocation(!0),this.context.beginPath&&this.context.beginPath(),this.webglControl&&this.webglControl.beginDraw&&this.webglControl.beginDraw()}},{key:"endDraw",value:function(){this.style.close&&(this.webglControl&&this.webglControl.closePath(),this.context.closePath&&this.context.closePath());var t,e=this.style.fill||this.style.fillStyle;e&&(this.webglControl&&(t=this.getBounds(),this.webglControl.fill(t)),this.context.fill&&this.context.fill()),!this.style.stroke&&(e||this.is("jmGraph"))||(this.webglControl&&this.webglControl.stroke(),this.context.stroke&&this.context.stroke()),this.webglControl&&this.webglControl.endDraw&&this.webglControl.endDraw(),this.needUpdate=!1}},{key:"draw",value:function(){if(this.points&&0<this.points.length){var t=(this.parent&&this.parent.absoluteBounds?this.parent:this).absoluteBounds;if(this.webglControl)this.webglControl.setParentBounds(t),this.webglControl.draw(m(this.points));else if(this.context&&this.context.moveTo){this.context.moveTo(this.points[0].x+t.left,this.points[0].y+t.top);for(var e=this.points.length,n=1;n<e;n++){var i=this.points[n];i.m?this.context.moveTo(i.x+t.left,i.y+t.top):this.context.lineTo(i.x+t.left,i.y+t.top)}}}}},{key:"paint",value:function(t){!1!==t&&!1!==this.visible&&(this.initPoints&&this.initPoints(),this.bounds=null,this.absoluteBounds=this.getAbsoluteBounds(),t=!0,!this.is("jmGraph")&&this.graph&&(this.absoluteBounds.left>=this.graph.width||this.absoluteBounds.top>=this.graph.height||this.absoluteBounds.right<=0||this.absoluteBounds.bottom<=0)&&(t=!1),this.context.save&&this.context.save(),this.emit("beginDraw",this),this.setStyle(),t&&this.beginDraw&&this.beginDraw(),t&&this.draw&&this.draw(),t&&this.endDraw&&this.endDraw(),this.children&&this.children.each(function(t,e){e&&e.paint&&e.paint()}),this.emit("endDraw",this),this.context.restore&&this.context.restore(),this.needUpdate=!1)}},{key:"getEvent",value:function(t){return this.__events?this.__events[t]:null}},{key:"bind",value:function(t,e){if(t&&-1<t.indexOf(" ")){var n,i=w(t=t.split(" "));try{for(i.s();!(n=i.n()).done;){var r=n.value;r&&this.bind(r,e)}}catch(t){i.e(t)}finally{i.f()}}else{t=this.getEvent(t)||function(t,e){return this.__events||(this.__events={}),this.__events[t]=e}.call(this,t,new _);t.contain(e)||t.add(e)}}},{key:"unbind",value:function(t,e){if(t&&-1<t.indexOf(" ")){var n,i=w(t=t.split(" "));try{for(i.s();!(n=i.n()).done;){var r=n.value;r&&this.unbind(r,e)}}catch(t){i.e(t)}finally{i.f()}}else{t=this.getEvent(t);t&&(e?t.remove(e):t.clear())}}},{key:"emit",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.runEventHandle(e[0],e.slice(1)),this}},{key:"runEventHandle",value:function(t,n){var i,t=this.getEvent(t);return t&&(i=this,Array.isArray(n)||(n=[n]),t.each(function(t,e){!1===e.apply(i,n)&&(n.cancel=!0)})),n.cancel}},{key:"checkPoint",value:function(t,e){if("jmGraph"==this.type){var n=this.getPosition(),i=n.left+this.width,r=n.top+this.height;return t.x>i||t.x<n.left?!1:!(t.y>r||t.y<n.top)}var o=this.getBounds();if(this.hitArea){var i=this.hitArea.x+o.left,s=this.hitArea.y+o.top,r=this.hitArea.width+o.left,n=this.hitArea.height+o.top;return t.x>r||t.x<i?!1:!(t.y>n||t.y<s)}var a=this.points;if(a&&a.length||((a=[]).push({x:o.left,y:o.top}),a.push({x:o.right,y:o.top}),a.push({x:o.right,y:o.bottom}),a.push({x:o.left,y:o.bottom}),a.push({x:o.left,y:o.top})),e=Number(e||this.style.touchPadding||this.style.lineWidth||1),a&&a.length){s=this.getRotation(null,o);if(s&&s.angle&&(a=A.clone(a,!0),a=A.rotatePoints(a,{x:s.x+o.left,y:s.y+o.top},s.angle||0)),2<a.length&&(!this.style.fill||this.style.stroke)){for(var h=0,u=a.length,l=h+1;l<=u;l=++h+1)if(l==u){if(this.style.close)if(A.pointInPolygon(t,[a[h],a[0]],e))return!0}else if(A.pointInPolygon(t,[a[h],a[l]],e))return!0;if(!this.style.fill)return!1}return A.pointInPolygon(t,a,e)}return!(t.x>o.right||t.x<o.left)&&!(t.y>o.bottom||t.y<o.top)}},{key:"raiseEvent",value:function(n,i){if(!1!==this.visible){var t,e;i.position||(o=this.graph,i.isWXMiniApp=o.isWXMiniApp,t=i.srcElement||i.target,e=A.getEventPosition(i),i={position:e,button:0==i.button||e.isTouch?1:i.button,keyCode:i.keyCode||i.charCode||i.which,ctrlKey:i.ctrlKey,cancel:!1,event:i,srcElement:t,isWXMiniApp:o.isWXMiniApp}),i.path=i.path||[];var r=!1;if(this.children&&this.children.each(function(t,e){if(!0!==i.cancel&&(r=!1===e.raiseEvent(n,i)||r))return!1},!0),r)return!1;var o=(this.parent&&this.parent.absoluteBounds?this.parent:this).absoluteBounds;if(!o)return!1;i.position.x=i.position.offsetX-o.left,i.position.y=i.position.offsetY-o.top;o=!1!==this.interactive&&this.checkPoint(i.position);return o?(i.target||(i.target=this),this.runEventAndPopEvent(n,i),this.focused||"mousemove"!==n&&"touchmove"!==n||(this.focused=!0,this.raiseEvent("mousemove"===n?"mouseover":"touchover",i))):!1===this.interactive||o||!this.focused||"mousemove"!==n&&"touchmove"!==n||(this.focused=!1,this.runEventHandle("mousemove"===n?"mouseleave":"touchleave",i)),!1===i.cancel}}},{key:"runEventAndPopEvent",value:function(t,e){!0!==e.cancel&&(e.path.push(this),this.runEventHandle(t,e))}},{key:"clearEvents",value:function(t){t=this.getEvent(t);t&&t.clear}},{key:"findParent",value:function(t){if("string"==typeof t){if(this.type==t)return this}else if(this.is(t))return this;return this.parent?this.parent.findParent(t):null}},{key:"canMove",value:function(t,e){var o;return this.__mvMonitor||(this.__mvMonitor={},this.__mvMonitor.mouseDown=!1,this.__mvMonitor.curposition={x:0,y:0},(o=this).__mvMonitor.mv=function(t){var e=o;if(e.__mvMonitor.mouseDown){e.parent.bounds=null;var n,i=t.position.offsetX-e.__mvMonitor.curposition.x,r=t.position.offsetY-e.__mvMonitor.curposition.y;return e.option.lockSide&&(n=e.bounds||e.getAbsoluteBounds(),((n=A.checkOutSide(e.option.lockSide,n,{x:i,y:r})).left<0&&i<0||0<n.right&&0<i)&&(i=0),(n.top<0&&r<0||0<n.bottom&&0<r)&&(r=0)),(i||r)&&(e.offset(i,r,!0,t),i&&(e.__mvMonitor.curposition.x=t.position.offsetX),r&&(e.__mvMonitor.curposition.y=t.position.offsetY)),!1}},this.__mvMonitor.mu=function(t){var e=o;e.__mvMonitor.mouseDown&&(e.__mvMonitor.mouseDown=!1,e.emit("moveend",{position:e.__mvMonitor.curposition}))},this.__mvMonitor.ml=function(){var t=o;if(t.__mvMonitor.mouseDown)return t.__mvMonitor.mouseDown=!1,t.emit("moveend",{position:t.__mvMonitor.curposition}),!1},this.__mvMonitor.md=function(t){if(!this.__mvMonitor.mouseDown)return 0==t.button||1==t.button?(this.__mvMonitor.mouseDown=!0,this.__mvMonitor.curposition.x=t.position.offsetX,this.__mvMonitor.curposition.y=t.position.offsetY,this.emit("movestart",{position:this.__mvMonitor.curposition}),!(t.cancel=!0)):void 0}),e=e||this.graph,!1!==t?(e.bind("mousemove",this.__mvMonitor.mv),e.bind("mouseup",this.__mvMonitor.mu),e.bind("mouseleave",this.__mvMonitor.ml),this.bind("mousedown",this.__mvMonitor.md),e.bind("touchmove",this.__mvMonitor.mv),e.bind("touchend",this.__mvMonitor.mu),this.bind("touchstart",this.__mvMonitor.md)):(e.unbind("mousemove",this.__mvMonitor.mv),e.unbind("mouseup",this.__mvMonitor.mu),e.unbind("mouseleave",this.__mvMonitor.ml),this.unbind("mousedown",this.__mvMonitor.md),e.unbind("touchmove",this.__mvMonitor.mv),e.unbind("touchend",this.__mvMonitor.mu),this.unbind("touchstart",this.__mvMonitor.md)),this.interactive=!0,this}}]),r}(),pt=function(){l(i,dt);var n=p(i);function i(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"jmPath";return h(this,i),(e=n.call(this,t,e)).points=t&&t.points?t.points:[],e}return u(i,[{key:"points",get:function(){return this.property("points")},set:function(t){return this.needUpdate=!0,this.property("points",t)}}]),i}(),yt=function(){l(s,dt);var o=p(s);function s(t,e,n){var i,r;return h(this,s),"function"==typeof e&&(n=e,e={}),(e=e||{}).interactive=!0,e.isRegular=!0,(i=o.call(this,e,"jmGraph")).option=e||{},i.devicePixelRatio=1,i.util=i.utils=A,i.mode=e.mode||"2d","undefined"!=typeof wx&&wx.canIUse&&wx.canIUse("canvas")?("string"==typeof t&&(t=wx.createSelectorQuery().select("#"+t)),i.isWXMiniApp=!0,i.container=t):("string"==typeof t&&"undefined"!=typeof document?t=document.getElementById(t):t.length&&(t=t[0]),t.getContext||"undefined"==typeof document?i.container=t.parentElement:(i.container=t,r=document.createElement("canvas"),t.appendChild(r),r.width=t.offsetWidth||t.clientWidth,r.height=t.offsetHeight||t.clientHeight,t=r)),i.canvas=t,"webgl"===i.mode?i.context=t.getContext(i.mode,{preserveDrawingBuffer:!0}):i.context=t.getContext(i.mode),i.textureCanvas=e.textureCanvas||null,"webgl"===i.mode&&(i.context.enable(i.context.BLEND),i.context.blendFunc(i.context.SRC_ALPHA,i.context.ONE_MINUS_SRC_ALPHA),A.bindEvent(t,"webglcontextlost",function(t){console.log("canvas webglcontextlost",t),i.emit("webglcontextlost",t)}),A.bindEvent(t,"webglcontextrestored",function(t){console.log("canvas webglcontextrestored",t),i.emit("webglcontextrestored",t)})),i.__init(n),i}return u(s,[{key:"__init",value:function(t){this.shapes=Object.assign({path:pt},this.option.shapes),this.on("beginDraw",function(){this.context.translate&&this.context.translate(.5,.5)}),this.on("endDraw",function(){this.context.translate&&this.context.translate(-.5,-.5)});var e="undefined"!=typeof window&&1<window.devicePixelRatio?window.devicePixelRatio:1;this.isWXMiniApp&&(e=wx.getWindowInfo().pixelRatio||1),this.devicePixelRatio=e,this.dprScaleSize=1<this.devicePixelRatio?this.devicePixelRatio:2,0<this.option.width&&(this.width=this.option.width),0<this.option.height&&(this.height=this.option.height),this.resize(),this.eventHandler=new R(this,this.canvas.canvas||this.canvas),this.option.autoRefresh&&this.autoRefresh(),t&&t(this)}},{key:"resize",value:function(t,e){this.canvas&&(this.__normalSize=this.__normalSize||{width:0,height:0},t=t||this.__normalSize.width||this.width,e=e||this.__normalSize.height||this.height,t&&(this.__normalSize.width=t),e&&(this.__normalSize.height=e),this.css("width",t+"px"),this.css("height",e+"px"),"2d"===this.mode?(this.canvas.height=e*this.dprScaleSize,this.canvas.width=t*this.dprScaleSize,1!==this.dprScaleSize&&this.context.scale&&this.context.scale(this.dprScaleSize,this.dprScaleSize)):(this.canvas.width=t,this.canvas.height=e),this.context.viewport&&this.context.viewport(0,0,t,e),this.needUpdate=!0)}},{key:"width",get:function(){return this.__normalSize&&this.__normalSize.width?this.__normalSize.width:this.canvas?this.canvas.width:0},set:function(t){return this.needUpdate=!0,this.canvas&&this.resize(t),t}},{key:"height",get:function(){return this.__normalSize&&this.__normalSize.height?this.__normalSize.height:this.canvas?this.canvas.height:0},set:function(t){return this.needUpdate=!0,this.canvas&&this.resize(0,t),t}},{key:"getPosition",value:function(){var t=this.isWXMiniApp?{left:0,top:0}:A.getElementPosition(this.canvas.canvas||this.canvas);return t.width=this.width,t.height=this.height,t.right=t.left+t.width,t.bottom=t.top+t.height,t}},{key:"registerShape",value:function(t,e){this.shapes[t]=e}},{key:"createShape",value:function(t,e){if(t="string"==typeof t?this.shapes[t]:t)return(e=e||{}).graph=this,new t(e)}},{key:"createShadow",value:function(t,e,n,i){return new S(t,e,n,i)}},{key:"createLinearGradient",value:function(t,e,n,i){return new M({type:"linear",x1:t,y1:e,x2:n,y2:i,stops:4<arguments.length&&void 0!==arguments[4]?arguments[4]:[]})}},{key:"createRadialGradient",value:function(t,e,n,i,r,o){return new M({type:"radial",x1:t,y1:e,r1:n,x2:i,y2:r,r2:o,stops:6<arguments.length&&void 0!==arguments[6]?arguments[6]:[]})}},{key:"refresh",value:function(){this.redraw()}},{key:"redraw",value:function(t,e){this.clear(t||this.width,e||this.height),this.paint()}},{key:"clear",value:function(t,e){t&&e||(t=this.width,e=this.height),this.context.clearRect?(this.style&&this.style.fill&&(this.points=[{x:0,y:0},{x:t,y:0},{x:t,y:e},{x:0,y:e}],this.style.close=!0),this.context.clearRect(0,0,t,e)):"webgl"===this.mode&&this.context.clear&&(e=this.style&&this.style.fill?this.utils.hexToRGBA(this.style.fill):{r:0,g:0,b:0,a:0},this.context.clearColor(e.r,e.g,e.b,e.a),this.context.clear(this.context.COLOR_BUFFER_BIT))}},{key:"css",value:function(t,e){if(this.canvas&&this.canvas.style)return void 0!==e&&(this.canvas.style[t]=e),this.canvas.style[t]}},{key:"createPath",value:function(t,e){return this.createShape("path",a({points:t,style:e},2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}))}},{key:"createLine",value:function(t,e,n){return this.createShape("line",{start:t,end:e,style:n})}},{key:"zoomOut",value:function(){this.scale(.9,.9)}},{key:"zoomIn",value:function(){this.scale(1.1,1.1)}},{key:"zoomActual",value:function(){this.scaleSize?this.scale(1/this.scaleSize.x,1/this.scaleSize.y):this.scale(1,1)}},{key:"scale",value:function(t,e){this.normalSize||(this.normalSize={width:this.canvas.width,height:this.canvas.height}),this.scaleSize?this.scaleSize={x:t*this.scaleSize.x,y:e*this.scaleSize.y}:this.scaleSize={x:1,y:1},this.canvas.style&&(this.canvas.style.transform="scale(".concat(this.scaleSize.x,", ").concat(this.scaleSize.y,")"))}},{key:"toDataURL",value:function(){return this.canvas.toDataURL?this.canvas.toDataURL():""}},{key:"autoRefresh",value:function(n){if(!this.___isAutoRefreshing){var i=this;this.___isAutoRefreshing=!0;var r=Date.now();return i.__requestAnimationFrameFunHandler&&this.cancelAnimationFrame(i.__requestAnimationFrameFunHandler),i.__requestAnimationFrameFunHandler=this.requestAnimationFrame(function t(){var e;i.destroyed?i.___isAutoRefreshing=!1:(i.needUpdate&&i.redraw(),e=Date.now()-r,i.emit("update",e),i.__requestAnimationFrameFunHandler&&i.cancelAnimationFrame(i.__requestAnimationFrameFunHandler),i.__requestAnimationFrameFunHandler=i.requestAnimationFrame(t),n&&n())}),this}}},{key:"destroy",value:function(){this.eventHandler.destroy(),this.destroyed=!0}}],[{key:"create",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return f(s,e)}}]),s}();t.default=yt,t.jmControl=dt,t.jmEvents=R,t.jmGradient=M,t.jmGraph=yt,t.jmList=_,t.jmPath=pt,t.jmProperty=C,t.jmShadow=S,t.jmUtils=A,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jmGraph={})}(this,function(t){"use strict";function e(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)),i}function a(i){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?e(Object(r),!0).forEach(function(t){var e,n;e=i,t=r[n=t],n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(r,t))})}return i}function v(t){return(v="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 h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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)}}function l(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function u(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&&o(t,e)}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function c(t,e,n){return(c=s()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);i=new(Function.bind.apply(t,i));return n&&o(i,n.prototype),i}).apply(null,arguments)}function n(t){var n="function"==typeof Map?new Map:void 0;return function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return c(t,arguments,r(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),o(e,t)}(t)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?f(t):e}function p(n){var i=s();return function(){var t,e=r(n);return d(this,i?(t=r(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function y(t,e,n){return(y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){t=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}(t,e);if(t){e=Object.getOwnPropertyDescriptor(t,e);return e.get?e.get.call(n):e.value}})(t,e,n||t)}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}}(t,e)||m(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){if(t){if("string"==typeof t)return b(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(n="Object"===n&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(t,e):void 0}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function _(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=m(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,e=function(){};return{s:e,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,r=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw r}}}}var w=function(){u(a,n(Array));var s=p(a);function a(){var t;h(this,a);for(var e=[],n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];if(i&&i.length&&Array.isArray(i[0])){for(var o=0;o<i[0].length;o++)e.push(i[0][o]);t=s.call.apply(s,[this].concat(e))}else t=s.call(this);return t.option={},t.type="jmList",d(t)}return l(a,[{key:"add",value:function(t){if(t&&Array.isArray(t)){for(var e=0;e<t.length;e++)this.includes(t[e])||this.push(t[e]);return t}return"object"==v(t)&&this.includes(t)||this.push(t),t}},{key:"remove",value:function(t){for(var e=this.length-1;0<=e;e--)this[e]==t&&this.removeAt(e)}},{key:"removeAt",value:function(t){var e;this.length>t&&(e=this[t],this.splice(t,1),this.option.removeHandler&&this.option.removeHandler.call(this,e,t))}},{key:"contain",value:function(t){return this.includes(t)}},{key:"get",value:function(t){return"function"==typeof t?this.find(t):this[t]}},{key:"each",value:function(t,e){if(t&&"function"==typeof t)if(e){for(var n=this.length-1;0<=n;n--)if(!1===t.call(this,n,this[n]))break}else for(var i=this.length,r=0;r<i;r++)if(!1===t.call(this,r,this[r]))break}},{key:"count",value:function(t){if(t&&"function"==typeof t){for(var e=0,n=this.length,i=0;i<n;i++)t(this[i])&&e++;return e}return this.length}},{key:"clear",value:function(){this.splice(0,this.length)}}]),a}(),k={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",transparent:"rgba(0,0,0,0)"},A=function(){function t(){h(this,t)}return l(t,null,[{key:"clone",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:null;if("function"==typeof i){var s=i(t,n,r);if(s)return s}if(o=o||new WeakMap,"boolean"==typeof e&&(n=e,e=void 0),!t||"object"!==v(t))return void 0!==e?e:t;if(o.has(t))return o.get(t);if(Array.isArray(t)){if(this.isType(t,w))return new w(t);if(n){var a=[];o.set(t,a);for(var h=0;h<t.length;h++)a.push(this.clone(t[h],void 0,n,i,r+1,o));return a}return t.slice(0)}if(t.tagName||t.getContext||t.emit)return t;o.set(t,e=e||{}),t.__proto__&&(e.__proto__=t.__proto__);var l,u=_(Object.keys(t).concat(Object.getOwnPropertySymbols(t)));try{for(u.s();!(l=u.n()).done;){var c,f=l.value;"constructor"!==f&&((c=t[f])&&(c.tagName||c.getContext||c.emit)?e[f]=c:"object"!==v(e[f])&&void 0!==e[f]||(e[f]=this.clone(c,e[f],n,i,r+1,o)))}}catch(t){u.e(t)}finally{u.f()}return e}},{key:"bindEvent",value:function(t,e,n,i){if(e&&e.indexOf&&-1!=e.indexOf(" "))for(var r=e.split(" "),o=0;o<r.length;o++)this.bindEvent(t,r[o],n,i);return t.attachEvent?t.attachEvent("on"+e,n,i):t.addEventListener&&t.addEventListener(e,n,i),{name:e,target:t,fun:n}}},{key:"removeEvent",value:function(t,e,n){return t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent?(t.detachEvent("on"+e,n),!0):void(t["on"+e]=null)}},{key:"getElementPosition",value:function(t){var e={top:0,left:0};if(!t)return e;if(t.offsetParent)for(;t.offsetParent;)e.top+=t.offsetTop,e.left+=t.offsetLeft,t=t.offsetParent;else t.x?e.left+=t.x:t.x&&(e.top+=t.y);return e}},{key:"getEventPosition",value:function(t,e){var n=(t=t||event).isWXMiniApp,i=!1,r=t.changedTouches||t.targetTouches||t.touches,o=t.target||t.srcElement;r&&r.length&&((t=r[0]).target||(t.target=o),i=!0);var s=t.pageX||t.x;void 0===s&&(s=t.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var a=t.pageY||t.y;void 0===a&&(a=t.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var h=t.offsetX,l=t.offsetY;return void 0===h&&void 0===l&&(l=n?(h=t.x,t.y):(h=s-(o=this.getElementPosition(o)).left,a-o.top)),e&&(e.x&&(h/=e.x),e.y&&(l/=e.y)),{pageX:s,pageY:a,clientX:t.clientX,clientY:t.clientY,offsetX:h,offsetY:l,layerX:t.layerX,layerY:t.layerY,screenX:t.screenX,screenY:t.screenY,x:h,y:l,isTouch:i,touches:r,isWXMiniApp:n}}},{key:"isType",value:function(t,e){return!(!t||"object"!==v(t))&&t.constructor===e}},{key:"pointInPolygon",value:function(t,e,n){n=n||1,n/=2;var i=e.length;if(!e||0==i)return 0;if(1==i)return Math.abs(e[0].x-t.x)<=n&&Math.abs(e[0].y-t.y)<=n?1:0;if(2==i)return this.pointOnLine(t,e[0],e[1],n);for(var r=0;r<i;r++)if(Math.abs(e[r].x-t.x)<=n&&Math.abs(e[r].y-t.y)<=n)return 1;return this.rayCasting(t,e,n)}},{key:"pointOnLine",value:function(t,e,n,i){var r=Math.min(e.x,n.x),o=Math.max(e.x,n.x),s=Math.min(e.y,n.y),a=Math.max(e.y,n.y);if(r-t.x>i||t.x-o>i)return 0;if(s-t.y>i||t.y-a>i)return 0;if(e.x==n.x)return Math.abs(e.x-t.x)<=i&&(t.y-e.y)*(t.y-n.y)<=0?1:0;if(e.y==n.y)return Math.abs(e.y-t.y)<=i&&(t.x-e.x)*(t.x-n.x)<=0?1:0;if(Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i)return 1;if(Math.abs(n.x-t.x)<i&&Math.abs(n.y-t.y)<i)return 1;if(t.y==e.y||t.y==n.y)return 0;n=(n.x-e.x)/(n.y-e.y)*(t.y-e.y),n=(t.y-e.y)/Math.sqrt(n*n+(t.y-e.y)*(t.y-e.y))*(t.x-e.x-n);return Math.abs(n)<=i?1:0}},{key:"rayCasting",value:function(t,e,n){for(var i=e.length,r=!1,o=t.y,s=t.x,a=0,h=i-1;a<i;h=a++){var l=e[a].y,u=e[h].y,c=e[a].x,f=e[h].x;o<l!=o<u&&s<(f-c)*(o-l)/(u-l)+c&&(r=!r)}return r?2:0}},{key:"checkOutSide",value:function(t,e,n){var i={left:0,right:0,top:0,bottom:0};return n.x<0?i.left=e.left+n.x-t.left:0<n.x&&(i.right=e.right+n.x-t.right),n.y<0?i.top=e.top+n.y-t.top:0<n.y&&(i.bottom=e.bottom+n.y-t.bottom),i}},{key:"rotatePoints",value:function(t,e,n){if(!n||!t)return t;var i=Math.cos(n),r=Math.sin(n);if(Array.isArray(t))for(var o,s,a=0;a<t.length;a++)t[a]&&(o=t[a].x-e.x,s=t[a].y-e.y,t[a].x=o*i-s*r+e.x,t[a].y=o*r+s*i+e.y);else{var h=t.x-e.x,n=t.y-e.y;t.x=h*i-n*r+e.x,t.y=h*r+n*i+e.y}return t}},{key:"trimStart",value:function(t,e){if(e=e||" ",t&&0<t.length){var n=t[0];if(n===e||0<=e.indexOf(n))return t=t.substring(1),this.trimStart(t,e)}return t}},{key:"trimEnd",value:function(t,e){if(e=e||" ",t&&0<t.length){var n=t[t.length-1];if(n===e||0<=e.indexOf(n))return t=t.substring(0,t.length-1),this.trimStart(t,e)}return t}},{key:"trim",value:function(t,e){return this.trimEnd(this.trimStart(t,e),e)}},{key:"checkPercent",value:function(t){if("string"==typeof t&&"%"==(t=this.trim(t))[t.length-1])return t}},{key:"percentToNumber",value:function(t){var e;return"string"!=typeof t||(e=this.checkPercent(t))&&(t=this.trim(e,"% "),t/=100),t}},{key:"hexToNumber",value:function(t){if("string"!=typeof t)return t;for(var e=0,n=(t=t.toLowerCase()).length,i=0;i<n;i++){var r="0123456789abcdef".indexOf(t[i]);if(0!=r){for(var o=1;o<n-i;o++)r*=16;e+=r}}return e}},{key:"numberToHex",value:function(t){for(var e="";0<t;){e="0123456789abcdef"[t%16]+e;t=Math.floor(t/16)}return e}},{key:"hexToRGBA",value:function(t){if("string"!=typeof t)return t;if(t=this.trim(t),this.__hexToRGBA_Cache=this.__hexToRGBA_Cache||{},this.__hexToRGBA_Cache[t])return this.__hexToRGBA_Cache[t];var e,n=t;return"#"==(n=k[n]?k[n]:n)[0]&&(e={a:1},8<=n.length?(e.a=n.substr(1,2),e.g=n.substr(5,2),e.b=n.substr(7,2),e.r=n.substr(3,2),e.a=Number((this.hexToNumber(e.a)/255).toFixed(4)),e.r=this.hexToNumber(e.r||0),e.g=this.hexToNumber(e.g||0),e.b=this.hexToNumber(e.b||0),n=e):7===n.length||4===n.length?(4===n.length?(e.g=n.substr(2,1),e.g=e.g+e.g,e.b=n.substr(3,1),e.b=e.b+e.b,e.r=n.substr(1,1),e.r=e.r+e.r):(e.g=n.substr(3,2),e.b=n.substr(5,2),e.r=n.substr(1,2)),e.r=this.hexToNumber(e.r||0),e.g=this.hexToNumber(e.g||0),e.b=this.hexToNumber(e.b||0),n=e):5===n.length&&(e.a=n.substr(1,1),e.g=n.substr(3,1),e.b=n.substr(4,1),e.r=n.substr(2,1),e.r=this.hexToNumber(e.r||0),e.g=this.hexToNumber(e.g||0),e.b=this.hexToNumber(e.b||0),e.a=Number((this.hexToNumber(e.a)/255).toFixed(4)),n=e)),"string"!=typeof n||(e=n.match(/rgb(a)?\s*\(\s*([\d\.]+)\s*,\s*([\d\.]+)\s*,\s*([\d\.]+)\s*(,\s*[\d\.]+)?\s*\)/i))&&6===e.length&&(n={r:Number(e[2]),g:Number(e[3]),b:Number(e[4]),a:Number(this.trimStart(e[5]||"1",","))}),this.__hexToRGBA_Cache[t]=n}},{key:"rgbToDecimal",value:function(t){return(t=this.clone(t)).r=this.byteToDecimal(t.r),t.g=this.byteToDecimal(t.g),t.b=this.byteToDecimal(t.b),t}},{key:"byteToDecimal",value:function(t){return t/255}},{key:"toColor",value:function(t,e,n,i){if("string"==typeof t&&t){if("#"===(t=this.trim(t))[0]&&(4===t.length||7===t.length))return t;var r=this.hexToRGBA(t);if("string"==typeof r)return r;t=void 0!==r.r?r.r:t,e=void 0!==r.g?r.g:e,n=void 0!==r.b?r.b:n,i=void 0!==r.a?r.a:i}return t&&"object"===v(t)&&(e=t.g,n=t.b,i=t.a||1,t=t.r),void 0!==t&&void 0!==e&&void 0!==n?void 0!==i?"rgba("+t+","+e+","+n+","+i+")":"rgb("+t+","+e+","+n+")":t}},{key:"requestAnimationFrame",value:function(t,e){return(e&&e.requestAnimationFrame?e.requestAnimationFrame:"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:setTimeout)(t,20)}},{key:"cancelAnimationFrame",value:function(t,e){return(e&&e.cancelAnimationFrame?e.cancelAnimationFrame:"undefined"!=typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame:clearTimeout)(t)}}]),t}(),T=0,E=function(){function e(t){h(this,e),t&&"jmGraph"==t.type&&(this.graph=t),this.id=++T}return l(e,[{key:"is",value:function(t){return"string"==typeof t?this.type==t:this instanceof t}},{key:"animate",value:function(){if(this.is("jmGraph")){if(1<arguments.length){this.animateHandles||(this.animateHandles=new w);var t=[];if(2<arguments.length)for(var e=2;e<arguments.length;e++)t.push(e<0||arguments.length<=e?void 0:arguments[e]);this.animateHandles.add({millisec:(arguments.length<=1?void 0:arguments[1])||20,handle:arguments.length<=0?void 0:arguments[0],params:t})}var o;this.animateHandles&&0<this.animateHandles.count()&&((o=this).dispatcher=setTimeout(function(n){n=n||o;var t,i=[],r=Date.now();for(t in n.animateHandles.each(function(t,e){try{e&&e.handle&&(!e.times||r-e.times>=e.millisec)&&(!1===e.handle.apply(n,e.params)&&i.push(e),e.times=r)}catch(t){e&&i.push(e)}}),i)n.animateHandles.remove(i[t]);n.animate()},10,this))}else{var n=this.graph;n&&n.animate.apply(n,arguments)}}}]),e}(),C=Symbol("properties"),P=function(){u(i,E);var n=p(i);function i(t){var e;return h(this,i),(e=n.call(this))[C]={},t&&t.mode&&(e.mode=t.mode),e}return l(i,[{key:"property",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(e){var i=this[C],r=e[0];if(1<e.length){var o=e[1],o={oldValue:i[r],newValue:o};return i[r]=e[1],this.emit&&this.emit("propertyChange",r,o),e[1]}if(r)return i[r]}}},{key:"needUpdate",get:function(){return this.property("needUpdate")},set:function(t){this.property("needUpdate",t),t&&!this.is("jmGraph")&&this.graph&&(this.graph.needUpdate=!0)}},{key:"graph",get:function(){return this.property("graph")||this.property("graph",this.findParent("jmGraph"))},set:function(t){return this.property("graph",t)}},{key:"mode",get:function(){var t=this.property("mode");return t||(this.is("jmGraph")?this.property("mode"):this.graph.mode)},set:function(t){return this.property("mode",t)}},{key:"requestAnimationFrame",value:function(t){return A.requestAnimationFrame(t,this.graph?this.graph.canvas:null)}},{key:"cancelAnimationFrame",value:function(t){return A.cancelAnimationFrame(t,this.graph?this.graph.canvas:null)}}]),i}(),S=function(){function r(t,e,n,i){h(this,r),"string"!=typeof t||e||n||i?(this.x=t,this.y=e,this.blur=n,this.color=i):this.fromString(t)}return l(r,[{key:"fromString",value:function(t){if(t){t=t.match(/\s*([^,]+)\s*,\s*([^,]+)\s*(,[^,]+)?\s*(,[\s\S]+)?\s*/i);return t&&(this.x=t[1]||0,this.y=t[2]||0,t[3]&&(t[3]=A.trim(t[3],", "),0===t[3].indexOf("#")||/^rgb/i.test(t[3])?this.color=t[3]:this.blur=A.trim(t[3],", ")),t[4]&&(this.color=A.trim(t[4],", "))),this}}},{key:"toString",value:function(){var t=this.x+","+this.y;return this.blur&&(t+=","+this.blur),this.color&&(t+=","+this.color),t}}]),r}(),R=function(){function i(t){if(h(this,i),this.stops=new w,t&&"object"==v(t)){for(var e in t)"stops"!==e&&(this[e]=t[e]);var n;t.stops&&Array.isArray(t.stops)&&(n=this.stops).push.apply(n,x(t.stops))}else"string"==typeof t&&this.fromString(t)}return l(i,[{key:"addStop",value:function(t,e){this.stops.add({offset:Number(t),color:e})}},{key:"toGradient",value:function(t){var i,e=t.context||t,n=t.absoluteBounds||t.getAbsoluteBounds(),r=this.x1||0,o=this.y1||0,s=this.x2,a=this.y2,h=t.getLocation(),l=0,l=(l=h.radius?2*h.radius:l)||Math.min(h.width,h.height);A.checkPercent(r)&&(r=A.percentToNumber(r)*(n.width||l)),A.checkPercent(s)&&(s=A.percentToNumber(s)*(n.width||l)),A.checkPercent(o)&&(o=A.percentToNumber(o)*(n.height||l)),A.checkPercent(a)&&(a=A.percentToNumber(a)*(n.height||l));var u=Number(r)+n.left,c=Number(o)+n.top,f=Number(s)+n.left,v=Number(a)+n.top;if("linear"===this.type?"webgl"===t.mode&&t.webglControl?(i=t.webglControl.createLinearGradient(r,o,s,a,n)).key=this.toString():e.createLinearGradient&&(i=e.createLinearGradient(u,c,f,v)):"radial"===this.type&&(h=this.r1||0,d=this.r2,A.checkPercent(h)&&(h=A.percentToNumber(h),h*=l),A.checkPercent(d)&&(d=A.percentToNumber(d),d*=l),"webgl"===t.mode&&t.webglControl?(i=t.webglControl.createRadialGradient(r,o,h,s,a,d,n)).key=this.toString():e.createRadialGradient?i=e.createRadialGradient(u,c,h,f,v,d):e.createCircularGradient&&(i=e.createCircularGradient(u,c,d))),i)return this.stops.each(function(t,e){var n=A.toColor(e.color);i&&i.addColorStop(e.offset,n)}),i;var d=this.stops.get(0);return d&&d.color||"#000"}},{key:"fromString",value:function(t){if(t){var e=t.match(/(linear|radial)-gradient\s*\(\s*([^,]+)\s*,\s*((.|\s)+)\)/i);if(e&&!(e.length<3)){this.type=e[1].toLowerCase();t=A.trim(e[2]).split(/\s+/);"linear"==this.type?t.length<=2?(this.x2=t[0],this.y2=t[1]||0):(this.x1=t[0],this.y1=t[1],this.x2=t[2],this.y2=t[3]):t.length<=3?(this.x2=t[0],this.y2=t[1]||0,this.r2=t[2]||0):(this.x1=t[0],this.y1=t[1],this.r1=t[2],this.x2=t[3],this.y2=t[3],this.r2=t[3]);var n=e[3].match(/((rgb(a)?\s*\([\d,\.\s]+\))|(#[a-zA-Z\d]+))\s+([\d\.]+)/gi);if(n&&n.length)for(var i=0;i<n.length;i++){var r,o=A.trim(n[i]),s=o.lastIndexOf(" ");-1<s&&(r=Number(o.substr(s+1)),s=A.trim(o.substr(0,s)),!isNaN(r)&&s&&this.addStop(r,s))}}}}},{key:"toString",value:function(){var n=this.type+"-gradient(";return"linear"==this.type?n+=this.x1+" "+this.y1+" "+this.x2+" "+this.y2:n+=this.x1+" "+this.y1+" "+this.r1+" "+this.x2+" "+this.y2+" "+this.r2,this.stops.each(function(t,e){n+=","+e.color+" "+e.offset}),n+")"}}]),i}(),M=function(){function n(t){if(h(this,n),this.filters=[],"string"==typeof t)this.fromString(t);else if(t&&"object"===v(t))for(var e in t)"constructor"!==e&&"filters"!==e&&this.addFilter(e,t[e])}return l(n,[{key:"addFilter",value:function(t,e){var n;t=t.toLowerCase().trim(),"string"==typeof e&&(e=parseFloat(e)),isNaN(e)||(n={blur:"blur",grayscale:"grayscale",greyscale:"grayscale",sepia:"sepia",brightness:"brightness",contrast:"contrast",saturate:"saturate","hue-rotate":"hueRotate",hueRotate:"hueRotate",invert:"invert",opacity:"opacity"}[t])&&((t=this.filters.find(function(t){return t.name===n}))?t.value=e:this.filters.push({name:n,value:e}))}},{key:"fromString",value:function(t){if(t&&"string"==typeof t)for(var e=/([a-zA-Z-]+)\s*\(\s*([^)]+)\s*\)/g;null!==(i=e.exec(t));){var n=i[1],i=i[2].replace(/[a-z%]+$/i,"").trim(),i=parseFloat(i);isNaN(i)||this.addFilter(n,i)}}},{key:"toString",value:function(){return this.filters.map(function(t){switch(t.name){case"blur":return"blur(".concat(t.value,"px)");case"hueRotate":return"hue-rotate(".concat(t.value,"deg)");default:return"".concat(t.name,"(").concat(t.value,")")}}).join(" ")}},{key:"toCanvasFilter",value:function(){return 0===this.filters.length?"none":this.toString()}},{key:"has",value:function(e){return this.filters.some(function(t){return t.name===e})}},{key:"get",value:function(e){var t=this.filters.find(function(t){return t.name===e});return t?t.value:void 0}},{key:"remove",value:function(e){var t=this.filters.findIndex(function(t){return t.name===e});-1<t&&this.filters.splice(t,1)}},{key:"clear",value:function(){this.filters=[]}}]),n}(),N=function(){function n(t,e){h(this,n),this.container=t,this.target=e||t,this.mouseHandler=new D(this,t,e),this.keyHandler=new B(this,t,e)}return l(n,[{key:"touchStart",value:function(t){if((t=t||window.event).eventName="touchstart",this.container.raiseEvent("touchstart",t),(t.target||t.srcElement)==this.target)return!1}},{key:"touchMove",value:function(t){if((t=t||window.event).eventName="touchmove",this.container.raiseEvent("touchmove",t),(t.target||t.srcElement)==this.target)return!1}},{key:"touchEnd",value:function(t){if((t=t||window.event).eventName="touchend",this.container.raiseEvent("touchend",t),(t.target||t.srcElement)==this.target)return!1}},{key:"touchCancel",value:function(t){if((t=t||window.event).eventName="touchcancel",this.container.raiseEvent("touchcancel",t),(t.target||t.srcElement)==this.target)return!1}},{key:"tap",value:function(t){if((t=t||window.event).eventName="tap",this.container.raiseEvent("tap",t),(t.target||t.srcElement)==this.target)return!1}},{key:"destroy",value:function(){this.mouseHandler.destroy(),this.keyHandler.destroy()}}]),n}(),D=function(){function i(t,e,n){h(this,i),this.instance=t,this.container=e,this.target=n||e,this.eventEvents={},this.init(t,e,n)}return l(i,[{key:"init",value:function(e,n,t){var i=this.target,r="undefined"!=typeof document?document:null;this.eventEvents.mousedown=A.bindEvent(this.target,"mousedown",function(t){(t=t||window.event).eventName="mousedown",n.raiseEvent("mousedown",t)}),this.eventEvents.mousemove=A.bindEvent(this.target,"mousemove",function(t){if((t=t||window.event).eventName="mousemove",(t.target||t.srcElement)==i)return n.raiseEvent("mousemove",t),t.preventDefault&&t.preventDefault(),!1}),this.eventEvents.mouseover=A.bindEvent(this.target,"mouseover",function(t){(t=t||window.event).eventName="mouseover",n.raiseEvent("mouseover",t)}),this.eventEvents.mouseleave=A.bindEvent(this.target,"mouseleave",function(t){(t=t||window.event).eventName="mouseleave",n.raiseEvent("mouseleave",t)}),this.eventEvents.mouseout=A.bindEvent(this.target,"mouseout",function(t){(t=t||window.event).eventName="mouseout",n.raiseEvent("mouseout",t)}),r&&(this.eventEvents.mouseup=A.bindEvent(r,"mouseup",function(t){if(!((t=t||window.event).eventName="mouseup")===n.raiseEvent("mouseup",t))return t.preventDefault&&t.preventDefault(),!1})),this.eventEvents.dblclick=A.bindEvent(this.target,"dblclick",function(t){(t=t||window.event).eventName="dblclick",n.raiseEvent("dblclick",t)}),this.eventEvents.click=A.bindEvent(this.target,"click",function(t){(t=t||window.event).eventName="click",n.raiseEvent("click",t)}),r&&(this.eventEvents.resize=A.bindEvent(r,"resize",function(t){return(t=t||window.event).eventName="resize",n.raiseEvent("resize",t)})),this.eventEvents.touchstart=A.bindEvent(this.target,"touchstart",function(t){return t.eventName="touchstart",e.touchStart(t)},{passive:!1}),this.eventEvents.touchmove=A.bindEvent(this.target,"touchmove",function(t){return t.eventName="touchmove",e.touchMove(t)},{passive:!1}),r&&(this.eventEvents.touchend=A.bindEvent(r,"touchend",function(t){return t.eventName="touchend",e.touchEnd(t)},{passive:!1})),r&&(this.eventEvents.touchcancel=A.bindEvent(r,"touchcancel",function(t){return t.eventName="touchcancel",e.touchCancel(t)},{passive:!1}))}},{key:"destroy",value:function(){for(var t in this.eventEvents){var e=this.eventEvents[t];e&&e.fun&&A.removeEvent(e.target,t,e.fun)}}}]),i}(),B=function(){function i(t,e,n){h(this,i),this.instance=t,this.container=e,this.target=n||e,this.eventEvents={},this.init(e,n)}return l(i,[{key:"init",value:function(n,t){function i(t){return!(t=t.srcElement||t.target)||"INPUT"!=t.tagName&&"TEXTAREA"!=t.tagName&&"ANCHOR"!=t.tagName&&"FORM"!=t.tagName&&"FILE"!=t.tagName&&"IMG"!=t.tagName&&"HIDDEN"!=t.tagName&&"RADIO"!=t.tagName&&"TEXT"!=t.tagName}var e="undefined"!=typeof document?document:null;e&&(this.eventEvents.keypress=A.bindEvent(e,"keypress",function(t){if(t=t||window.event,i(t)){var e=n.raiseEvent("keypress",t);return!1===e&&t.preventDefault&&t.preventDefault(),e}})),e&&(this.eventEvents.keydown=A.bindEvent(e,"keydown",function(t){if(t=t||window.event,i(t)){var e=n.raiseEvent("keydown",t);return!1===e&&t.preventDefault&&t.preventDefault(),e}})),e&&(this.eventEvents.keyup=A.bindEvent(e,"keyup",function(t){if(t=t||window.event,i(t)){var e=n.raiseEvent("keyup",t);return!1===e&&t.preventDefault&&t.preventDefault(),e}}))}},{key:"destroy",value:function(){for(var t in this.eventEvents){var e=this.eventEvents[t];e&&e.fun&&A.removeEvent(e.target,t,e.fun)}}}]),i}();function F(t,e,n){n=n||2;var i,r,o,s,a,h=e&&e.length,l=h?e[0]*n:t.length,u=O(t,0,l,n,!0),c=[];if(!u||u.next===u.prev)return c;if(h&&(u=function(t,e,n,i){var r,o,s,a,h=[];for(r=0,o=e.length;r<o;r++)s=e[r]*i,a=r<o-1?e[r+1]*i:t.length,(a=O(t,s,a,i,!1))===a.next&&(a.steiner=!0),h.push(function(t){var e=t,n=t;for(;(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next,e!==t;);return n}(a));for(h.sort(z),r=0;r<h.length;r++)n=function(t,e){var n=function(t,e){var n,i=e,r=t.x,o=t.y,s=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var a=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=r&&s<a&&(s=a,n=i.x<i.next.x?i:i.next,a===r))return n}}while(i=i.next,i!==e);if(!n)return null;var h,l=n,u=n.x,c=n.y,f=1/0;i=n;for(;r>=i.x&&i.x>=u&&r!==i.x&&U(o<c?r:s,o,u,c,o<c?s:r,o,i.x,i.y)&&(h=Math.abs(o-i.y)/(r-i.x),V(i,t)&&(h<f||h===f&&(i.x>n.x||i.x===n.x&&function(t,e){return G(t.prev,t,e.prev)<0&&G(e.next,t,t.next)<0}(n,i)))&&(n=i,f=h)),i=i.next,i!==l;);return n}(t,e);if(!n)return e;t=H(n,t);return L(t,t.next),L(n,n.next)}(h[r],n);return n}(t,e,u,n)),t.length>80*n){for(var f=i=t[0],v=r=t[1],d=n;d<l;d+=n)(o=t[d])<f&&(f=o),(s=t[d+1])<v&&(v=s),i<o&&(i=o),r<s&&(r=s);a=0!==(a=Math.max(i-f,r-v))?32767/a:0}return I(u,c,n,f,v,a,0),c}function O(t,e,n,i,r){var o,s;if(r===0<$(t,e,n,i))for(o=e;o<n;o+=i)s=Z(o,t[o],t[o+1],s);else for(o=n-i;e<=o;o-=i)s=Z(o,t[o],t[o+1],s);return s&&Y(s,s.next)&&(K(s),s=s.next),s}function L(t,e){if(!t)return t;e=e||t;var n,i=t;do{if(n=!1,i.steiner||!Y(i,i.next)&&0!==G(i.prev,i,i.next))i=i.next;else{if(K(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function I(t,e,n,i,r,o,s){if(t){!s&&o&&function(t,e,n,i){var r=t;for(;0===r.z&&(r.z=j(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next,r!==t;);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,s,a,h,l=1;do{for(n=t,o=t=null,s=0;n;){for(s++,i=n,e=a=0;e<l&&(a++,i=i.nextZ);e++);for(h=l;0<a||0<h&&i;)0!==a&&(0===h||!i||n.z<=i.z)?(n=(r=n).nextZ,a--):(i=(r=i).nextZ,h--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}}while(o.nextZ=null,l*=2,1<s)}(r)}(t,i,r,o);for(var a,h,l=t;t.prev!==t.next;)if(a=t.prev,h=t.next,o?function(t,e,n,i){var r=t.prev,o=t,s=t.next;if(0<=G(r,o,s))return!1;var a=r.x,h=o.x,l=s.x,u=r.y,c=o.y,f=s.y,v=a<h?a<l?a:l:h<l?h:l,d=u<c?u<f?u:f:c<f?c:f,p=h<a?l<a?a:l:l<h?h:l,y=c<u?f<u?u:f:f<c?c:f,g=j(v,d,e,n,i),x=j(p,y,e,n,i),m=t.prevZ,b=t.nextZ;for(;m&&m.z>=g&&b&&b.z<=x;){if(m.x>=v&&m.x<=p&&m.y>=d&&m.y<=y&&m!==r&&m!==s&&U(a,u,h,c,l,f,m.x,m.y)&&0<=G(m.prev,m,m.next))return!1;if(m=m.prevZ,b.x>=v&&b.x<=p&&b.y>=d&&b.y<=y&&b!==r&&b!==s&&U(a,u,h,c,l,f,b.x,b.y)&&0<=G(b.prev,b,b.next))return!1;b=b.nextZ}for(;m&&m.z>=g;){if(m.x>=v&&m.x<=p&&m.y>=d&&m.y<=y&&m!==r&&m!==s&&U(a,u,h,c,l,f,m.x,m.y)&&0<=G(m.prev,m,m.next))return!1;m=m.prevZ}for(;b&&b.z<=x;){if(b.x>=v&&b.x<=p&&b.y>=d&&b.y<=y&&b!==r&&b!==s&&U(a,u,h,c,l,f,b.x,b.y)&&0<=G(b.prev,b,b.next))return!1;b=b.nextZ}return!0}(t,i,r,o):function(t){var e=t.prev,n=t,t=t.next;if(0<=G(e,n,t))return!1;var i=e.x,r=n.x,o=t.x,s=e.y,a=n.y,h=t.y,l=i<r?i<o?i:o:r<o?r:o,u=s<a?s<h?s:h:a<h?a:h,c=r<i?o<i?i:o:o<r?r:o,f=a<s?h<s?s:h:h<a?a:h,v=t.next;for(;v!==e;){if(v.x>=l&&v.x<=c&&v.y>=u&&v.y<=f&&U(i,s,r,a,o,h,v.x,v.y)&&0<=G(v.prev,v,v.next))return!1;v=v.next}return!0}(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(h.i/n|0),K(t),t=h.next,l=h.next;else if((t=h)===l){s?1===s?I(t=function(t,e,n){var i=t;do{var r=i.prev,o=i.next.next}while(!Y(r,o)&&X(r,i,i.next,o)&&V(r,o)&&V(o,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(o.i/n|0),K(i),K(i.next),i=t=o),i=i.next,i!==t);return L(i)}(L(t),e,n),e,n,i,r,o,2):2===s&&function(t,e,n,i,r,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&X(n,n.next,t,e))return!0}while(n=n.next,n!==t);return!1}(t,e)&&(V(t,e)&&V(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;for(;n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next,n!==t;);return i}(t,e)&&(G(t.prev,t,e.prev)||G(t,e.prev,e))||Y(t,e)&&0<G(t.prev,t,t.next)&&0<G(e.prev,e,e.next))}(s,a)){var h=H(s,a);return s=L(s,s.next),h=L(h,h.next),I(s,e,n,i,r,o,0),I(h,e,n,i,r,o,0)}a=a.next}}while(s=s.next,s!==t)}(t,e,n,i,r,o):I(L(t),e,n,i,r,o,1);break}}}function z(t,e){return t.x-e.x}function j(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function U(t,e,n,i,r,o,s,a){return(t-s)*(o-a)<=(r-s)*(e-a)&&(n-s)*(e-a)<=(t-s)*(i-a)&&(r-s)*(i-a)<=(n-s)*(o-a)}function G(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Y(t,e){return t.x===e.x&&t.y===e.y}function X(t,e,n,i){var r=W(G(t,e,n)),o=W(G(t,e,i)),s=W(G(n,i,t)),a=W(G(n,i,e));return r!==o&&s!==a||(0===r&&q(t,n,e)||(0===o&&q(t,i,e)||(0===s&&q(n,t,i)||!(0!==a||!q(n,e,i)))))}function q(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function W(t){return 0<t?1:t<0?-1:0}function V(t,e){return G(t.prev,t,t.next)<0?0<=G(t,e,t.next)&&0<=G(t,t.prev,e):G(t,e,t.prev)<0||G(t,t.next,e)<0}function H(t,e){var n=new J(t.i,t.x,t.y),i=new J(e.i,e.x,e.y),r=t.next,o=e.prev;return(t.next=e).prev=t,(n.next=r).prev=n,(i.next=n).prev=i,(o.next=i).prev=o,i}function Z(t,e,n,i){n=new J(t,e,n);return i?(n.next=i.next,(n.prev=i).next.prev=n,i.next=n):(n.prev=n).next=n,n}function K(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function J(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function $(t,e,n,i){for(var r=0,o=e,s=n-i;o<n;o+=i)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}F.deviation=function(t,e,n,i){var r=e&&e.length,o=r?e[0]*n:t.length,s=Math.abs($(t,0,o,n));if(r)for(var a=0,h=e.length;a<h;a++){var l=e[a]*n,u=a<h-1?e[a+1]*n:t.length;s-=Math.abs($(t,l,u,n))}for(var c=0,a=0;a<i.length;a+=3){var f=i[a]*n,v=i[a+1]*n,d=i[a+2]*n;c+=Math.abs((t[f]-t[d])*(t[1+v]-t[1+f])-(t[f]-t[v])*(t[1+d]-t[1+f]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},F.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},i=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[r][o][s]);0<r&&(i+=t[r-1].length,n.holes.push(i))}return n};var Q=function(){function n(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"linear",e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};h(this,n),this.type=t||"linear",this.x1=e.x1||0,this.y1=e.y1||0,this.r1=e.r1||0,this.x2=e.x2||0,this.y2=e.y2||0,this.r2=e.r2||0,this.bounds=e.bounds||{left:0,top:0,width:0,height:0},this.control=e.control,this.stops=[],this.init()}return l(n,[{key:"init",value:function(){var t=this.x2-this.x1,e=this.y2-this.y1;"radial"===this.type?this.length=this.r2-this.r1:0==t&&0==e?this.length=0:(this.length=Math.sqrt(Math.pow(t,2),Math.pow(e,2)),this.sin=e/this.length,this.cos=t/this.length)}},{key:"addColorStop",value:function(t,e){this.stops.push({offset:t,color:e})}},{key:"toImageData",value:function(i,t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=this.toString();if(this.__cachedData&&this.__cacheKey===n&&this.__cachedData.data&&this.__cachedData.data.width===Math.ceil(t.width)&&this.__cachedData.data.data&&this.__cachedData.data.data.height===Math.ceil(t.height))return this.__cachedData;if(!i.textureContext)return null;var r=null,r="linear"===this.type?i.textureContext.createLinearGradient(this.x1,this.y1,this.x2,this.y2):i.textureContext.createRadialGradient(this.x1,this.y1,this.r1,this.x2,this.y2,this.r2);this.stops.forEach(function(t,e){var n=i.graph.utils.toColor(t.color);r&&r.addColorStop(t.offset,n)});e=i.toFillTexture(r,t,e);return this.__cachedData=e,this.__cacheKey=n,e}},{key:"invalidateCache",value:function(){this.__cachedData=null,this.__cacheKey=null}},{key:"toString",value:function(){var e=this.type+"-gradient(";return"linear"==this.type?e+=this.x1+" "+this.y1+" "+this.x2+" "+this.y2:e+=this.x1+" "+this.y1+" "+this.r1+" "+this.x2+" "+this.y2+" "+this.r2,this.stops.forEach(function(t){e+=","+t.color+" "+t.offset}),e+")"}}]),n}();function tt(t,e,n){e=t.createShader(e);return t.shaderSource(e,n),t.compileShader(e),e}var et={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1},nt=function(t){return et[t]},it=null,rt={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D"},ot=function(t,e){if(!it){var n=Object.keys(rt);it={};for(var i=0;i<n.length;++i){var r=n[i];it[t[r]]=rt[r]}}return it[e]};function st(t,e,n){var i=tt(t,t.VERTEX_SHADER,e),e=tt(t,t.FRAGMENT_SHADER,n),n=t.createProgram();return t.attachShader(n,i),t.attachShader(n,e),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||(console.error("PError: Could not initialize shader."),console.error("gl.VALIDATE_STATUS",t.getProgramParameter(n,t.VALIDATE_STATUS)),console.error("gl.getError()",t.getError()),""!==t.getProgramInfoLog(n)&&console.warn("Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(n)),t.deleteProgram(n)),at(t,n),t.deleteShader(i),t.deleteShader(e),{program:n,attrs:function(t,e){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),r=0;r<i;r++){var o=t.getActiveAttrib(e,r),s=ot(t,o.type);n[o.name]={attribData:o,size:nt(s),type:s,location:t.getAttribLocation(e,o.name)}}return n}(t,n),uniforms:function(t,e){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r<i;r++){var o=t.getActiveUniform(e,r),s=o.name.replace(/\[.*?\]/,""),a=ot(t,o.type);n[s]={uniformData:o,type:a,size:o.size,location:t.getUniformLocation(e,s)}}return n}(t,n)}}function at(t,e){return t.useProgram(e)}function ht(t,e,n,i){var r=2<arguments.length&&void 0!==n?n:t.ARRAY_BUFFER,n=3<arguments.length&&void 0!==i?i:t.STATIC_DRAW,i=t.createBuffer();if(!i)throw Error("创建缓冲区对象失败");return t.bindBuffer(r,i),t.bufferData(r,e.buffer||e,n),{type:r,drawType:n,buffer:i,unitSize:e.BYTES_PER_ELEMENT}}function lt(t){var e=t.createTexture();return t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,e),t.texParameterf(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameterf(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameterf(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameterf(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}var ut="\n attribute vec4 a_position;\n attribute vec4 a_color;\n attribute vec2 a_text_coord;\n uniform vec2 a_center_point; // 当前canvas的中心位置\n uniform float a_point_size; // 点的大小\n uniform int a_type;\n varying vec4 v_color;\n varying vec2 v_text_coord;\n varying float v_type;\n\n ".concat("\n vec4 translatePosition(vec4 point, float x, float y) {\n point.x = (point.x-x)/x;\n point.y = (y-point.y)/y;\n return point;\n }","\n\n void main() {\n gl_PointSize = a_point_size == 0.0? 1.0 : a_point_size;\n v_type = float(a_type);\n vec4 pos = translatePosition(a_position, a_center_point.x, a_center_point.y);\n gl_Position = pos;\n v_color = a_color;\n if(a_type == 2) {\n v_text_coord = a_text_coord;\n }\n }\n"),ct="\n precision mediump float;\n uniform sampler2D u_sample;\n uniform vec4 v_texture_bounds; // 纹理的左上坐标和大小 x,y,z,w\n uniform vec4 v_single_color;\n varying float v_type;\n varying vec4 v_color;\n varying vec2 v_text_coord;\n\n ".concat("\n vec2 translateTexturePosition(in vec2 point, vec4 bounds) {\n point.x = (point.x-bounds.x)/bounds.z; // 离左上角位置的X长比上纹理宽 0-1\n point.y = 1.0-(point.y-bounds.y)/bounds.w; // 离左上角位置的Y长比上高,因为纹理坐标是左下角起,所以要用1-\n return point;\n }","\n\n void main() {\n // 如果是fill,则直接填充颜色\n if(v_type == 1.0) {\n gl_FragColor = v_single_color;\n }\n // 渐变色\n else if(v_type == 3.0) {\n gl_FragColor = v_color;\n }\n else if(v_type == 2.0) {\n vec2 pos = translateTexturePosition(v_text_coord, v_texture_bounds);\n gl_FragColor = texture2D(u_sample, pos);\n }\n else {\n float r = distance(gl_PointCoord, vec2(0.5, 0.5));\n //根据距离设置片元\n if(r <= 0.5){\n // 方形区域片元距离几何中心半径小于0.5,像素颜色设置红色\n gl_FragColor = v_single_color;\n }else {\n // 方形区域距离几何中心半径不小于0.5的片元剪裁舍弃掉:\n discard;\n }\n }\n }\n"),ft=function(){function n(t,e){h(this,n),this.graph=t,this.option=e||{},this.style={globalAlpha:1},this.stateStack=[],this.transformMatrix=[1,0,0,1,0,0]}return l(n,[{key:"context",get:function(){if(this.graph)return this.graph.context}},{key:"save",value:function(){this.stateStack.push({transformMatrix:x(this.transformMatrix),style:a({},this.style)})}},{key:"restore",value:function(){var t;0<this.stateStack.length&&(t=this.stateStack.pop(),this.transformMatrix=t.transformMatrix,this.style=t.style)}},{key:"translate",value:function(t,e){this.transformMatrix[4]+=t*this.transformMatrix[0]+e*this.transformMatrix[2],this.transformMatrix[5]+=t*this.transformMatrix[1]+e*this.transformMatrix[3]}},{key:"scale",value:function(t,e){this.transformMatrix[0]*=t,this.transformMatrix[1]*=t,this.transformMatrix[2]*=e,this.transformMatrix[3]*=e}},{key:"rotate",value:function(t){var e=Math.cos(t),n=Math.sin(t),i=g(this.transformMatrix,6),r=i[0],o=i[1],s=i[2],t=i[3];i[4],i[5],this.transformMatrix[0]=r*e-o*n,this.transformMatrix[1]=r*n+o*e,this.transformMatrix[2]=s*e-t*n,this.transformMatrix[3]=s*n+t*e}},{key:"transform",value:function(t,e,n,i,r,o){var s=g(this.transformMatrix,6),a=s[0],h=s[1],l=s[2],u=s[3],c=s[4],s=s[5];this.transformMatrix[0]=t*a+e*l,this.transformMatrix[1]=t*h+e*u,this.transformMatrix[2]=n*a+i*l,this.transformMatrix[3]=n*h+i*u,this.transformMatrix[4]=r*a+o*l+c,this.transformMatrix[5]=r*h+o*u+s}},{key:"applyTransform",value:function(t){var e=g(this.transformMatrix,6),n=e[0],i=e[1],r=e[2],o=e[3],s=e[4],e=e[5];return{x:n*t.x+r*t.y+s,y:i*t.x+o*t.y+e}}},{key:"textureCanvas",get:function(){var t=this.graph.textureCanvas;if(!t){if("undefined"==typeof document)return null;t=this.graph.textureCanvas=document.createElement("canvas")}return t}},{key:"textureContext",get:function(){return this.textureCanvas.ctx||(this.textureCanvas.ctx=this.textureCanvas.getContext("2d",{willReadFrequently:!0}))}},{key:"program",get:function(){return this.graph.context.pathProgram||(this.graph.context.pathProgram=this.createProgram(ut,ct))}},{key:"setStyle",value:function(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.style;"string"==typeof e&&((t={})[e]=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",e=t),this.style=a(a({},this.style),e)}},{key:"convertColor",value:function(t){return this.isGradient(t)?t:("string"==typeof t&&(t=this.graph.utils.hexToRGBA(t)),this.graph.utils.rgbToDecimal(t))}},{key:"setTextureStyle",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof t)-1<["fillStyle","strokeStyle","shadowColor"].indexOf(t)&&(e=this.graph.utils.toColor(e)),this.textureContext[t]=e;else for(var n in t)"constructor"!==n&&this.setTextureStyle(n,t[n])}},{key:"createProgram",value:function(t,e){return st(this.context,t,e)}},{key:"useProgram",value:function(){var t=(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.program).program||t;return this.context.__curent_program===t?t:(at(this.context,t.program||t),this.context.__curent_program=t)}},{key:"getAttribLocation",value:function(t){return this.context.getAttribLocation(this.program.program,t)}},{key:"getUniformLocation",value:function(t){return this.context.getUniformLocation(this.program.program,t)}},{key:"writeVertexAttrib",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:2,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:this.context.FLOAT;return t.attr=e,function(t,e,n,i,r,o,s){return i=3<arguments.length&&void 0!==i?i:2,r=4<arguments.length&&void 0!==r?r:0,o=5<arguments.length&&void 0!==o?o:0,s=6<arguments.length&&void 0!==s?s:t.FLOAT,t.bindBuffer(e.type,e.buffer),t.vertexAttribPointer(n.location,i,s,!1,r*e.unitSize,o),t.enableVertexAttribArray(n.location),e}(this.context,t,e,n,i,r,o)}},{key:"disableVertexAttribArray",value:function(t){try{return t?this.context.disableVertexAttribArray(t.location):t}catch(t){console.error(t)}return t}},{key:"createFloat32Buffer",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.context.ARRAY_BUFFER,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.context.STATIC_DRAW;return a({data:t},function(t,e,n,i){return n=2<arguments.length&&void 0!==n?n:t.ARRAY_BUFFER,i=3<arguments.length&&void 0!==i?i:t.STATIC_DRAW,ht(t,new Float32Array(e),n,i)}(this.context,t,e,n))}},{key:"createUint16Buffer",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.context.ARRAY_BUFFER,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.context.STATIC_DRAW;return a({data:t},function(t,e,n,i){return n=2<arguments.length&&void 0!==n?n:t.ARRAY_BUFFER,i=3<arguments.length&&void 0!==i?i:t.STATIC_DRAW,ht(t,new Uint16Array(e),n,i)}(this.context,t,e,n))}},{key:"deleteBuffer",value:function(e){try{if(!e)return;var t=e.buffer||e;if(t)return n=this.context,i=t,void n.deleteBuffer(i.buffer||i)}catch(t){console.log(e),console.error(t)}var n,i;return e}},{key:"create2DTexture",value:function(){return lt(this.context)}},{key:"createImgTexture",value:function(t){return e=this.context,n=t,t=lt(e),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n),{texture:t};var e,n}},{key:"createDataTexture",value:function(t){return e=this.context,n=t,i=new Uint8Array(n.data||n),t=lt(e),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width||1,n.height||1,0,e.RGBA,e.UNSIGNED_BYTE,i),{texture:t};var e,n,i}},{key:"deleteTexture",value:function(t){try{return e=this.context,n=t.texture||t,e.deleteTexture(n)}catch(t){console.error(t)}var e,n;return t}},{key:"earCutPoints",value:function(t){return F(this.pointsToArray(t))}},{key:"earCutPointsToTriangles",value:function(t){this.earCutCache=this.earCutCache||(this.earCutCache={});var e=t.length,e=e+"_"+t[0].x+"_"+t[0].y+"_"+t[e-1].x+"_"+t[e-1].y;if(this.earCutCache[e])return this.earCutCache[e];for(var n=this.earCutPoints(t),i=[],r=0;r<n.length;r+=3){var o=t[n[r]],s=t[n[r+1]],a=t[n[r+2]];i.push([o,s,a])}return this.earCutCache[e]=i}},{key:"pointsToArray",value:function(t){var e;return(e=[]).concat.apply(e,x(t.map(function(t){return[t.x,t.y]})))}},{key:"arrayToPoints",value:function(t){for(var e=[],n=0;n<t.length;n+=2)e.push({x:t[n],y:t[n+1]});return e}},{key:"createLinearGradient",value:function(t,e,n,i,r){return new Q("linear",{x1:t,y1:e,x2:n,y2:i,bounds:r,control:this})}},{key:"createRadialGradient",value:function(t,e,n,i,r,o,s){return new Q("radial",{x1:t,y1:e,r1:n,x2:i,y2:r,r2:o,bounds:s,control:this})}},{key:"isGradient",value:function(t){return t&&t instanceof Q}},{key:"testSize",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.style;this.textureContext.save&&this.textureContext.save(),(e.font||e.fontSize)&&(this.textureContext.font=e.font||e.fontSize+"px "+e.fontFamily);t=this.textureContext.measureText?this.textureContext.measureText(t):{width:15};return this.textureContext.restore&&this.textureContext.restore(),t.height=this.style.fontSize||15,t}},{key:"toFillTexture",value:function(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=this.textureCanvas;if(!i)return t;if(i.width=e.width,i.height=e.height,!i.width||!i.height)return t;if(this.textureContext.clearRect(0,0,i.width,i.height),this.textureContext.fillStyle=t,n&&n.length){this.textureContext.beginPath();var r,o=_(n);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.m?this.textureContext.moveTo(s.x-e.left,s.y-e.top):this.textureContext.lineTo(s.x-e.left,s.y-e.top)}}catch(t){o.e(t)}finally{o.f()}this.textureContext.closePath(),this.textureContext.fill()}else this.textureContext.fillRect(0,0,e.width,e.height);return{data:this.textureContext.getImageData(0,0,i.width,i.height),points:n}}}]),n}(),vt=function(){u(i,ft);var n=p(i);function i(t,e){return h(this,i),(t=n.call(this,t,e)).isRegular=e.isRegular||!1,t.needCut=e.needCut||!1,t.control=e.control,t.points=[],t.__cachedBuffers=[],t.__cachedTexture=null,t.__cachedTextureKey=null,t}return l(i,[{key:"dispose",value:function(){var t,e=_(this.__cachedBuffers);try{for(e.s();!(t=e.n()).done;){var n=t.value;this.deleteBuffer(n)}}catch(t){e.e(t)}finally{e.f()}this.__cachedBuffers=[],this.__cachedTexture&&(this.deleteTexture(this.__cachedTexture),this.__cachedTexture=null,this.__cachedTextureKey=null)}},{key:"getOrCreateBuffer",value:function(t,e){var n=this.__cachedBuffers.find(function(t){return t.attr===e});if(n){var i=this.context,r=new Float32Array(t);return i.bindBuffer(i.ARRAY_BUFFER,n.buffer),i.bufferData(i.ARRAY_BUFFER,r,i.DYNAMIC_DRAW),n.data=t,n}return(n=this.createFloat32Buffer(t)).attr=e,this.__cachedBuffers.push(n),n}},{key:"applyTransform",value:function(t){return y(r(i.prototype),"applyTransform",this).call(this,t)}},{key:"setParentBounds",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.parentAbsoluteBounds;t&&(this.parentAbsoluteBounds=t),this.context.uniform2f(this.program.uniforms.a_center_point.location,this.graph.width/2,this.graph.height/2)}},{key:"setFragColor",value:function(t){if(!Array.isArray(t))return void 0===(t=this.convertColor(t)).a&&(t.a=1),this.context.uniform4f(this.program.uniforms.v_single_color.location,t.r,t.g,t.b,t.a*this.style.globalAlpha),null;var e,n=[],i=_(t);try{for(i.s();!(e=i.n()).done;){var r=e.value;void 0===(r=this.convertColor(r)).a&&(r.a=1),n.push(r.r,r.g,r.b,r.a*this.style.globalAlpha)}}catch(t){i.e(t)}finally{i.f()}t=this.createFloat32Buffer(n);return this.writeVertexAttrib(t,this.program.attrs.a_color,4,0,0),t.attr=this.program.attrs.a_color,t}},{key:"beginDraw",value:function(){this.useProgram()}},{key:"draw",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.parentAbsoluteBounds;this.setParentBounds(e),this.points=t}},{key:"endDraw",value:function(){this.points&&delete this.points,this.pathPoints&&delete this.pathPoints}},{key:"closePath",value:function(){var t,e;this.points&&2<this.points.length&&this.points[0]!==this.points[this.points.length-1]&&((t=this.points[0])==(e=this.points[this.points.length-1])||t.x===e.x&&t.y===e.y||this.points.push(t))}},{key:"writePoints",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.program.attrs.a_position,n=[],i=g(this.transformMatrix,6),r=i[0],o=i[1],s=i[2],a=i[3],h=i[4],i=i[5],l=this.parentAbsoluteBounds.left,u=this.parentAbsoluteBounds.top;if(1===r&&0===o&&0===s&&1===a&&0===h&&0===i)for(var c=0;c<t.length;c++)n.push(t[c].x+l,t[c].y+u);else{var f,v=_(t);try{for(v.s();!(f=v.n()).done;){var d=f.value,p=this.applyTransform(d);n.push(p.x+l,p.y+u)}}catch(t){v.e(t)}finally{v.f()}}a=new Float32Array(n),h=this.context;if(0<this.__cachedBuffers.length){i=this.__cachedBuffers.find(function(t){return t.attr===e});if(i)return h.bindBuffer(h.ARRAY_BUFFER,i.buffer),h.bufferData(h.ARRAY_BUFFER,a,h.DYNAMIC_DRAW),i.data=n,this.writeVertexAttrib(i,e,2,0,0),i}h=this.createFloat32Buffer(a,h.ARRAY_BUFFER,h.DYNAMIC_DRAW);return this.writeVertexAttrib(h,e,2,0,0),h.attr=e,this.__cachedBuffers.push(h),h}},{key:"genLinePoints",value:function(t,e){var n=[t],i=e.x-t.x,r=e.y-t.y;if(0!=i||0!=r)for(var o=Math.sqrt(Math.pow(i,2)+Math.pow(r,2)),s=i/o,a=r/o,h=.5;h<o;h+=.5){var l=t.x+s*h,u=t.y+a*h;n.push({x:l,y:u})}return n.push(e),n}},{key:"pathToPoints",value:function(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.points,e=null,n=[],i=0;i<t.length;i++){var r,o=t[i];e&&!o.m?(r=this.genLinePoints(e,o),n.push.apply(n,x(r))):e&&!n.includes(e)&&n.push(e),e=o}return n.includes(e)||n.push(e),n}},{key:"equalPoint",value:function(t,e){return t.x===e.x&&t.y===e.y}},{key:"pathToLines",value:function(t){for(var e=null,n=[],i=0;i<t.length;i++){var r=t[i];!e||r.m||e.x==r.x&&e.y==r.y||n.push({start:e,end:r}),e=r}return n}},{key:"cutLines",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(t&&t.length<3)return t;for(n=Math.max(e+1,n);e<t.length;){for(var i=t[e];n<t.length;){var r=t[n];if(this.equalPoint(i.start,r.start)||this.equalPoint(i.end,r.end)||this.equalPoint(i.start,r.end)||this.equalPoint(i.end,r.start))n++;else{var o,s,a=!1,h=this.getIntersection(i,r);if(h&&(this.equalPoint(i.start,h)||this.equalPoint(i.end,h)||(o={start:i.start,end:h},s={start:h,end:i.end},t.splice(e,1,o,s),a=!0,n++),this.equalPoint(r.start,h)||this.equalPoint(r.end,h)||(s={start:r.start,end:h},r={start:h,end:r.end},t.splice(n,1,s,r),n++)),n++,a)return this.cutLines(t,e,n)}}n=++e+1}return t}},{key:"getIntersection",value:function(t,e){if(this.equalPoint(t.start,e.start)||this.equalPoint(t.start,e.end))return t.start;if(this.equalPoint(t.end,e.start)||this.equalPoint(t.end,e.end))return t.end;var n=(t.start.x-e.start.x)*(t.end.y-e.start.y)-(t.start.y-e.start.y)*(t.end.x-e.start.x),i=(t.start.x-e.end.x)*(t.end.y-e.end.y)-(t.start.y-e.end.y)*(t.end.x-e.end.x);if(0<n*i)return null;e=(e.start.x-t.start.x)*(e.end.y-t.start.y)-(e.start.y-t.start.y)*(e.end.x-t.start.x);if(0<e*(e+n-i))return null;if(i==n)return null;i=e/(i-n),n=i*(t.end.x-t.start.x),i*=t.end.y-t.start.y;return{x:t.start.x+n,y:t.start.y+i}}},{key:"getIntersectionLines",value:function(t,e,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:t.end,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:[],o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:null,s={line:t,polygons:[]};if(r.push(i),o&&this.equalPoint(o.line.start,i))return r.unshift(o.line.start),o.polygons.push(r),s;for(;n<e.length;n++){var a=e[n];this.equalPoint(i,a.start)?r.includes(a.end)||this.getIntersectionLines(a,e,n+1,a.end,x(r),o||s):this.equalPoint(i,a.end)&&(r.includes(a.start)||this.getIntersectionLines(a,e,n+1,a.start,x(r),o||s))}return s}},{key:"getPolygon",value:function(t){var e=[];if((n=this.pathToLines(t))&&2<n.length)for(var n=this.cutLines(n),i=0;i<n.length-1;i++){var r=n[i],r=this.getIntersectionLines(r,n,i+1);r.polygons.length&&e.push.apply(e,x(r.polygons))}return e}},{key:"getTriangles",value:function(t){this.trianglesCache=this.trianglesCache||(this.trianglesCache={});var e=t.length,e=e+"_"+t[0].x+"_"+t[0].y+"_"+t[e-1].x+"_"+t[e-1].y;if(this.trianglesCache[e])return this.trianglesCache[e];var n=[],t=this.getPolygon(t);if(t.length){var i,r=_(t);try{for(r.s();!(i=r.n()).done;){var o=i.value,s=this.earCutPointsToTriangles(o);n.push.apply(n,x(s))}}catch(t){r.e(t)}finally{r.f()}}return this.trianglesCache[e]=n}},{key:"stroke",value:function(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.points,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.style.strokeStyle,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.style.lineWidth;e&&e.length&&(t=null,n&&(t=this.setFragColor(n)),i&&this.context.uniform1f(this.program.uniforms.a_point_size.location,i),this.program.uniforms.a_type&&this.context.uniform1i(this.program.uniforms.a_type.location,1===e.length?4:1),e&&e.length&&(e=(i=i<=1.2)?e:this.pathToPoints(e),this.writePoints(e),this.context.drawArrays(i?this.context.LINE_LOOP:this.context.POINTS,0,e.length)),t&&this.disableVertexAttribArray(t&&t.attr))}},{key:"fill",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{left:0,top:0,width:0,height:0},e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;this.points&&this.points.length&&(this.style.fillStyle&&this.fillColor(this.style.fillStyle,this.points,t,e),this.style.fillImage&&this.fillImage(this.style.fillImage,this.points,t,e))}},{key:"fillColor",value:function(t,e,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;if(this.isGradient(t)){var r=t.toImageData(this,n,e);return this.fillImage(r.data,r.points,n)}this.context.uniform1i(this.program.uniforms.a_type.location,i);t=this.setFragColor(t);this.fillPolygons(e),t&&this.disableVertexAttribArray(t&&t.attr)}},{key:"fillImage",value:function(t,e,n){var i,r;t&&(i=null,t instanceof ImageData?(r="".concat(t.width,"_").concat(t.height,"_").concat(n.width,"_").concat(n.height,"_").concat(n.left,"_").concat(n.top),this.__cachedTexture&&this.__cachedTextureKey===r?i=this.__cachedTexture:(i=this.createDataTexture(t),this.__cachedTexture&&this.deleteTexture(this.__cachedTexture),this.__cachedTexture=i,this.__cachedTextureKey=r)):i=this.createImgTexture(t),this.context.uniform1i(this.program.uniforms.u_sample.location,0),this.context.uniform4f(this.program.uniforms.v_texture_bounds.location,n.left+this.parentAbsoluteBounds.left,n.top+this.parentAbsoluteBounds.top,n.width,n.height),this.fillTexture(e),t instanceof ImageData||this.deleteTexture(i))}},{key:"fillTexture",value:function(t){t&&t.length&&(this.context.uniform1i(this.program.uniforms.a_type.location,2),this.fillPolygons(t,!0),this.disableVertexAttribArray(this.program.attrs.a_text_coord))}},{key:"fillPolygons",value:function(t){var e=this,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(t.length<=3)return this.writePoints(t),n&&this.writePoints(t,this.program.attrs.a_text_coord),void this.context.drawArrays(this.context.TRIANGLE_FAN,0,t.length);if(this.isRegular)return this.writePoints(t),n&&this.writePoints(t,this.program.attrs.a_text_coord),void this.context.drawArrays(this.context.TRIANGLE_FAN,0,t.length);var i=this.needCut?this.earCutPointsToTriangles(t):this.getTriangles(t);if(i.length){var r,o=[],s=[],a=_(i);try{for(a.s();!(r=a.n()).done;){var h,l=_(r.value);try{for(l.s();!(h=l.n()).done;){var u=h.value;o.push(u.x,u.y),n&&s.push(u.x,u.y)}}catch(t){l.e(t)}finally{l.f()}}}catch(t){a.e(t)}finally{a.f()}var c=new Float32Array(o),t=this.context,i=this.__cachedBuffers.find(function(t){return t.attr===e.program.attrs.a_position});i?(t.bindBuffer(t.ARRAY_BUFFER,i.buffer),t.bufferData(t.ARRAY_BUFFER,c,t.DYNAMIC_DRAW)):((i=this.createFloat32Buffer(c,t.ARRAY_BUFFER,t.DYNAMIC_DRAW)).attr=this.program.attrs.a_position,this.__cachedBuffers.push(i)),this.writeVertexAttrib(i,this.program.attrs.a_position,2,0,0),n&&s.length&&(c=new Float32Array(s),(i=this.__cachedBuffers.find(function(t){return t.attr===e.program.attrs.a_text_coord}))?(t.bindBuffer(t.ARRAY_BUFFER,i.buffer),t.bufferData(t.ARRAY_BUFFER,c,t.DYNAMIC_DRAW)):((i=this.createFloat32Buffer(c,t.ARRAY_BUFFER,t.DYNAMIC_DRAW)).attr=this.program.attrs.a_text_coord,this.__cachedBuffers.push(i)),this.writeVertexAttrib(i,this.program.attrs.a_text_coord,2,0,0)),t.drawArrays(t.TRIANGLES,0,o.length/2)}}},{key:"drawImage",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:t.width,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:t.height,i=i||t.width,r=r||t.height;this.fillImage(t,this.points,{left:e,top:n,width:i,height:r})}},{key:"drawText",value:function(t,e,n,i){var r=this.textureCanvas;if(!r)return null;if(r.width=i.width,r.height=i.height,!r.width||!r.height)return null;this.textureContext.clearRect(0,0,r.width,r.height),this.textureContext.font=this.style.font||this.style.fontSize+"px "+this.style.fontFamily,e-=i.left,n-=i.top,this.setTextureStyle(this.style),this.style.fillStyle&&this.textureContext.fillText&&(this.style.maxWidth?this.textureContext.fillText(t,e,n,this.style.maxWidth):this.textureContext.fillText(t,e,n)),this.textureContext.strokeText&&(this.style.maxWidth?this.textureContext.strokeText(t,e,n,this.style.maxWidth):this.textureContext.strokeText(t,e,n));r=this.textureContext.getImageData(0,0,r.width,r.height);this.fillImage(r,this.points,i)}}]),i}(),dt={fill:"fillStyle",fillImage:"fillImage",stroke:"strokeStyle","shadow.blur":"shadowBlur","shadow.x":"shadowOffsetX","shadow.y":"shadowOffsetY","shadow.color":"shadowColor",lineWidth:"lineWidth",miterLimit:"miterLimit",fillStyle:"fillStyle",strokeStyle:"strokeStyle",font:"font",opacity:"globalAlpha",textAlign:"textAlign",textBaseline:"textBaseline",shadowBlur:"shadowBlur",shadowOffsetX:"shadowOffsetX",shadowOffsetY:"shadowOffsetY",shadowColor:"shadowColor",lineJoin:"lineJoin",lineCap:"lineCap",lineDashOffset:"lineDashOffset",globalCompositeOperation:"globalCompositeOperation"},pt=function(){u(r,P);var i=p(r);function r(t,e){var n;return h(this,r),(n=i.call(this,t=t||{})).property("type",e||(this instanceof r?this.constructor:void 0).name),n.style=t&&t.style?t.style:{},n.width=t.width||0,n.height=t.height||0,n.hitArea=t.hitArea||null,t.position&&(n.position=t.position),n.graph=t.graph||null,n.zIndex=t.zIndex||0,n.interactive=void 0!==t.interactive&&t.interactive,"webgl"===n.mode&&(n.webglControl=new vt(n.graph,{style:n.style,control:f(n),isRegular:t.isRegular,needCut:t.needCut})),n.initializing(),n.on=n.bind,n.option=t,n}return l(r,[{key:"type",get:function(){return this.property("type")}},{key:"context",get:function(){var t=this.property("context");if(t)return t;if(this.is("jmGraph")&&this.canvas&&this.canvas.getContext)return this.context=this.canvas.getContext(this.mode||"2d");t=this.graph;return t?t.context:t.canvas.getContext(this.mode||"2d")},set:function(t){return this.property("context",t)}},{key:"style",get:function(){return this.property("style")||this.property("style",{})},set:function(t){return this.needUpdate=!0,this.property("style",t)}},{key:"visible",get:function(){var t=this.property("visible");return t=void 0===t?this.property("visible",!0):t},set:function(t){return this.needUpdate=!0,this.property("visible",t)}},{key:"interactive",get:function(){return this.property("interactive")},set:function(t){return this.property("interactive",t)}},{key:"hitArea",get:function(){return this.property("hitArea")},set:function(t){return this.property("hitArea",t)}},{key:"children",get:function(){return this.property("children")||this.property("children",new w)},set:function(t){return this.needUpdate=!0,this.property("children",t)}},{key:"width",get:function(){var t=this.property("width");return t=void 0===t?this.property("width",0):t},set:function(t){return this.needUpdate=!0,this.property("width",t)}},{key:"height",get:function(){var t=this.property("height");return t=void 0===t?this.property("height",0):t},set:function(t){return this.needUpdate=!0,this.property("height",t)}},{key:"zIndex",get:function(){return this.property("zIndex")||this.property("zIndex",0)},set:function(t){return this.property("zIndex",t),this.children.sort(),this.needUpdate=!0,t}},{key:"cursor",get:function(){var t=this.graph;if(t)return t.css("cursor")},set:function(t){var e=this.graph;e&&e.css("cursor",t)}},{key:"initializing",value:function(){var e=this;this.children=this.children||new w;var n=this.children.add;this.children.add=function(t){if("object"===v(t))return t.parent&&t.parent!=e&&t.parent.children&&t.parent.children.remove(t),t.parent=e,this.contain(t)&&this.oremove(t),n.call(this,t),t.emit("add",t),e.needUpdate=!0,e.graph&&(t.graph=e.graph),this.sort(),t},this.children.oremove=this.children.remove,this.children.remove=function(t){"object"===v(t)&&(t.parent=null,t.graph=null,t.remove(!0),this.oremove(t),e.needUpdate=!0)},this.children.sort=function(){var t,i={};for(t in this.each(function(t,e){var n;e&&(!(n=e.zIndex)&&e.style&&e.style.zIndex&&(n=Number(e.style.zIndex),isNaN(n)&&(n=e.style.zIndex||0)),(i[n]||(i[n]=[])).push(e))}),this.splice(0,this.length),i)n.call(this,i[t])},this.children.clear=function(){this.each(function(t,e){this.remove(e)},!0)},this.needUpdate=!0}},{key:"setStyle",value:function(t){var u=this;if(t=t||this.style){var e,n,i=function t(e,n,i){if(e){var r=e;if("function"==typeof r)try{r=r.call(u)}catch(t){return void console.warn(t)}var o,s=v(r),i=dt[i||n];if(r instanceof R||"string"==s&&-1<r.indexOf("-gradient"))t((r="string"==s&&-1<r.indexOf("-gradient")?new R(r):r).toGradient(u),i||n);else if(i)u.webglControl?u.webglControl.setStyle(i,r):("string"==s&&-1<["fillStyle","strokeStyle","shadowColor"].indexOf(i)&&(r=A.toColor(r)),u.context[i]=r);else switch(n){case"shadow":if("string"==s){t(new S(r),n);break}for(var a in r)t(r[a],a,n+"."+a);break;case"translate":break;case"rotation":if(void 0===r.angle||isNaN(r.angle))break;r=u.getRotation(r),u.__translateAbsolutePosition=u.toAbsolutePoint({x:r.x,y:r.y}),u.context.translate&&u.context.translate(u.__translateAbsolutePosition.x,u.__translateAbsolutePosition.y),u.context.rotate&&u.context.rotate(r.angle),u.context.translate&&u.context.translate(-u.__translateAbsolutePosition.x,-u.__translateAbsolutePosition.y);break;case"transform":if(!u.context.transform)break;Array.isArray(r)?u.context.transform.apply(u.context,r):"object"==v(r)&&u.context.transform(r.scaleX||1,r.skewX||0,r.skewY||0,r.scaleY||1,r.offsetX||0,r.offsetY||0);break;case"cursor":u.cursor=r;break;case"lineDash":if(!u.context.setLineDash)break;"string"==typeof r?o=r.split(",").map(function(t){return parseFloat(t.trim())}).filter(function(t){return!isNaN(t)}):Array.isArray(r)&&(o=r.map(function(t){return parseFloat(t)}).filter(function(t){return!isNaN(t)})),o&&o.length?u.context.setLineDash(o):u.context.setLineDash([]);break;case"lineDashOffset":if(!u.context.setLineDash)break;u.context.lineDashOffset=Number(r)||0;break;case"filter":if(void 0===u.context.filter)break;r instanceof M?u.context.filter=r.toCanvasFilter():"string"==typeof r?u.context.filter=r||"none":"object"===v(r)&&(u.context.filter=new M(r).toCanvasFilter());break;case"globalCompositeOperation":if(!u.context.globalCompositeOperation)break;u.context.globalCompositeOperation=r;break;case"clipPath":if(!u.context.clip)break;if(r&&r.points&&0<r.points.length){var h=(u.parent&&u.parent.absoluteBounds?u.parent:u).absoluteBounds;u.context.beginPath(),u.context.moveTo(r.points[0].x+(h?h.left:0),r.points[0].y+(h?h.top:0));for(var l=1;l<r.points.length;l++)r.points[l].m?u.context.moveTo(r.points[l].x+(h?h.left:0),r.points[l].y+(h?h.top:0)):u.context.lineTo(r.points[l].x+(h?h.left:0),r.points[l].y+(h?h.top:0));r.style&&r.style.close&&u.context.closePath(),u.context.clip()}break;case"mask":if(!u.context.globalCompositeOperation)break;u.__mask=r;break;case"shadowColor":u.webglControl?u.webglControl.setStyle("shadowColor",r):u.context.shadowColor=A.toColor(r);break;case"shadowBlur":u.webglControl?u.webglControl.setStyle("shadowBlur",r):u.context.shadowBlur=Number(r)||0;break;case"shadowOffsetX":u.webglControl?u.webglControl.setStyle("shadowOffsetX",r):u.context.shadowOffsetX=Number(r)||0;break;case"shadowOffsetY":u.webglControl?u.webglControl.setStyle("shadowOffsetY",r):u.context.shadowOffsetY=Number(r)||0}}};for(e in this.translate&&i(this.translate,"translate"),this.transform&&i(this.transform,"transform"),t)"constructor"!==e&&("string"==(n=v(t[e]))&&-1<t[e].indexOf("-gradient")?t[e]=new R(t[e]):"string"==n&&"shadow"==e?t[e]=new S(t[e]):"string"==n&&"filter"==e&&(t[e]=new M(t[e])),i(t[e],e))}}},{key:"getBounds",value:function(t){if(this.bounds&&!t)return this.bounds;var e={};if("jmGraph"==this.type&&this.canvas)"function"==typeof this.canvas.width?e.right=this.canvas.width():this.width&&(e.right=this.width),"function"==typeof this.canvas.height?e.bottom=this.canvas.height():this.height&&(e.bottom=this.height);else if(this.points&&0<this.points.length){var n,i=_(this.points);try{for(i.s();!(n=i.n()).done;){var r=n.value;(void 0===e.left||e.left>r.x)&&(e.left=r.x),(void 0===e.top||e.top>r.y)&&(e.top=r.y),(void 0===e.right||e.right<r.x)&&(e.right=r.x),(void 0===e.bottom||e.bottom<r.y)&&(e.bottom=r.y)}}catch(t){i.e(t)}finally{i.f()}}else!this.getLocation||(t=this.getLocation())&&(e.left=t.left,e.top=t.top,e.right=t.left+t.width,e.bottom=t.top+t.height);return e.left||(e.left=0),e.top||(e.top=0),e.right||(e.right=0),e.bottom||(e.bottom=0),e.width=e.right-e.left,e.height=e.bottom-e.top,this.bounds=e}},{key:"getRotationBounds",value:function(){var t=(t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null)||this.getRotation(),e=this.getBounds();if(!t||!t.angle)return e;var n,i={width:0,height:0,oldBounds:e},r=[];this.points&&0<this.points.length?r=A.clone(this.points,!0):!this.getLocation||(n=this.getLocation())&&r.push({x:n.left,y:n.top},{x:n.left+n.width,y:n.top},{x:n.left+n.width,y:n.top+n.height},{x:n.left,y:n.top+n.height});var o,s=_(r=A.rotatePoints(r,{x:t.x+e.left,y:t.y+e.top},t.angle));try{for(s.s();!(o=s.n()).done;){var a=o.value;(void 0===i.left||i.left>a.x)&&(i.left=a.x),(void 0===i.top||i.top>a.y)&&(i.top=a.y),(void 0===i.right||i.right<a.x)&&(i.right=a.x),(void 0===i.bottom||i.bottom<a.y)&&(i.bottom=a.y)}}catch(t){s.e(t)}finally{s.f()}return i.left||(i.left=0),i.top||(i.top=0),i.right||(i.right=0),i.bottom||(i.bottom=0),i.width=i.right-i.left,i.height=i.bottom-i.top,i}},{key:"getLocation",value:function(){var t=this.location={left:0,top:0,width:0,height:0},e=this.parent&&(A.checkPercent(this.width)||A.checkPercent(this.height)||this.position&&A.checkPercent(this.position.x)||this.position&&A.checkPercent(this.position.y));t.position="function"==typeof this.position?this.position():e?A.clone(this.position):this.position,t.center=this.center&&"function"==typeof this.center?this.center():e?A.clone(this.center):this.center,t.start=this.start&&"function"==typeof this.start?this.start():e?A.clone(this.start):this.start,t.end=this.end&&"function"==typeof this.end?this.end():e?A.clone(this.end):this.end,t.radius=this.radius,t.width=this.width,t.height=this.height;var n=this.style.margin,n=e&&n?A.clone(n,{}):n||{};return n.left=n.left||0,n.top=n.top||0,n.right=n.right||0,n.bottom=n.bottom||0,t.position?(t.left=t.position.x,t.top=t.position.y):(t.left=n.left,t.top=n.top),this.parent&&(n=this.parent.getBounds(),A.checkPercent(t.left)&&(t.left=A.percentToNumber(t.left)*n.width),A.checkPercent(t.top)&&(t.top=A.percentToNumber(t.top)*n.height),A.checkPercent(t.width)&&(t.width=A.percentToNumber(t.width)*n.width),A.checkPercent(t.height)&&(t.height=A.percentToNumber(t.height)*n.height),t.center&&(A.checkPercent(t.center.x)&&(t.center.x=A.percentToNumber(t.center.x)*n.width),A.checkPercent(t.center.y)&&(t.center.y=A.percentToNumber(t.center.y)*n.height)),t.radius&&A.checkPercent(t.radius)&&(t.radius=A.percentToNumber(t.radius)*Math.min(n.width,n.height))),t}},{key:"getRotation",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return(t=t||A.clone(this.style.rotation))?(e=e||this.getBounds(),void 0===t.x&&(t.x="50%"),void 0===t.y&&(t.y="50%"),A.checkPercent(t.x)&&(t.x=A.percentToNumber(t.x)*e.width),A.checkPercent(t.y)&&(t.y=A.percentToNumber(t.y)*e.height)):(t=this.parent&&this.parent.getRotation?this.parent.getRotation():null)&&(e=e||this.getBounds(),t.x-=e.left,t.y-=e.top),a(a({},t),{},{bounds:e})}},{key:"getTranslate",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(!(t=t||this.style.translate))return{x:0,y:0};t={x:t.x||0,y:t.y||0};return A.checkPercent(t.x)&&(!e&&this.parent&&(e=this.parent.getBounds()),t.x=A.percentToNumber(t.x)*e.width),A.checkPercent(t.y)&&(!e&&this.parent&&(e=this.parent.getBounds()),t.y=A.percentToNumber(t.y)*e.height),t}},{key:"remove",value:function(){this.parent&&this.parent.children.remove(this)}},{key:"offset",value:function(t,e,n,i){n=!1!==n;var r=this.getLocation(!0),o=!1;if(r.position&&(r.left+=t,r.top+=e,this.position.x=r.left,this.position.y=r.top,o=!0),r.center&&(this.center.x=r.center.x+t,this.center.y=r.center.y+e,o=!0),r.start&&"object"==v(r.start)&&(this.start.x=r.start.x+t,this.start.y=r.start.y+e,o=!0),r.end&&"object"==v(r.end)&&(this.end.x=r.end.x+t,this.end.y=r.end.y+e,o=!0),0==o&&this.cpoints){var s=(this.cpoints,this.cpoints);if(s){for(var a=s.length,h=0;h<a;h++)s[h].x+=t,s[h].y+=e;o=!0}}if(0==o&&this.points){for(var l=this.points.length,u=0;u<l;u++)this.points[u].x+=t,this.points[u].y+=e;o=!0}this.emit("move",{offsetX:t,offsetY:e,trans:n,evt:i}),this.needUpdate=!0}},{key:"getAbsoluteBounds",value:function(){var t=this.getBounds();if(this.parent&&this.parent.absoluteBounds){var e=this.parent.absoluteBounds||this.parent.getAbsoluteBounds();return{left:e.left+t.left,top:e.top+t.top,right:e.left+t.right,bottom:e.top+t.bottom,width:t.width,height:t.height}}return t}},{key:"toAbsolutePoint",value:function(t){var e;return(t.x||t.y)&&(e=this.absoluteBounds||this.getAbsoluteBounds(),t.x=(t.x||0)+e.left,t.y=(t.y||0)+e.top),t}},{key:"toLocalPosition",value:function(t){var e=this.absoluteBounds||this.getAbsoluteBounds();return!!e&&{x:t.x-e.left,y:t.y-e.top}}},{key:"beginDraw",value:function(){this.getLocation(!0),this.context.beginPath&&this.context.beginPath(),this.webglControl&&this.webglControl.beginDraw&&this.webglControl.beginDraw()}},{key:"endDraw",value:function(){var t,e;this.style.close&&(this.webglControl&&this.webglControl.closePath(),this.context.closePath&&this.context.closePath()),this.webglControl?((e=this.style.fill||this.style.fillStyle)&&(t=this.getBounds(),this.webglControl.fill(t)),!this.style.stroke&&(e||this.is("jmGraph"))||this.webglControl.stroke(),this.webglControl.endDraw&&this.webglControl.endDraw()):((e=this.style.fill||this.style.fillStyle)&&this.context.fill&&this.context.fill(),(this.style.stroke||!e&&!this.is("jmGraph"))&&this.context.stroke&&this.context.stroke()),this.needUpdate=!1}},{key:"draw",value:function(){if(this.points&&0<this.points.length){var t=(this.parent&&this.parent.absoluteBounds?this.parent:this).absoluteBounds;if(this.webglControl)this.webglControl.setParentBounds(t),this.webglControl.draw(this.points);else if(this.context&&this.context.moveTo){this.context.moveTo(this.points[0].x+t.left,this.points[0].y+t.top);for(var e=this.points.length,n=1;n<e;n++){var i=this.points[n];i.m?this.context.moveTo(i.x+t.left,i.y+t.top):this.context.lineTo(i.x+t.left,i.y+t.top)}}}}},{key:"paint",value:function(t){if(!1!==t&&!1!==this.visible){this.initPoints&&this.initPoints(),this.bounds=null,this.absoluteBounds=this.getAbsoluteBounds();t=!0;!this.is("jmGraph")&&this.graph&&(this.absoluteBounds.left>=this.graph.width||this.absoluteBounds.top>=this.graph.height||this.absoluteBounds.right<=0||this.absoluteBounds.bottom<=0)&&(t=!1),this.context.save&&this.context.save(),this.emit("beginDraw",this),this.setStyle();var e=this.style.mask||this.__mask;if(e&&e.points&&this.context.globalCompositeOperation){t&&this.beginDraw&&this.beginDraw(),t&&this.draw&&this.draw(),t&&this.endDraw&&this.endDraw(),this.context.globalCompositeOperation="destination-in",e.initPoints&&e.initPoints();var n=(e.parent&&e.parent.absoluteBounds?e.parent:this).absoluteBounds;if(this.context.beginPath(),e.points&&0<e.points.length){this.context.moveTo(e.points[0].x+(n?n.left:0),e.points[0].y+(n?n.top:0));for(var i=1;i<e.points.length;i++)e.points[i].m?this.context.moveTo(e.points[i].x+(n?n.left:0),e.points[i].y+(n?n.top:0)):this.context.lineTo(e.points[i].x+(n?n.left:0),e.points[i].y+(n?n.top:0));e.style&&e.style.close&&this.context.closePath()}this.context.fillStyle="#ffffff",this.context.fill(),this.context.globalCompositeOperation="source-over"}else t&&this.beginDraw&&this.beginDraw(),t&&this.draw&&this.draw(),t&&this.endDraw&&this.endDraw();this.children&&this.children.each(function(t,e){e&&e.paint&&e.paint()}),this.emit("endDraw",this),this.context.restore&&this.context.restore(),this.needUpdate=!1}}},{key:"getEvent",value:function(t){return this.__events?this.__events[t]:null}},{key:"bind",value:function(t,e){if(t&&-1<t.indexOf(" ")){var n,i=_(t=t.split(" "));try{for(i.s();!(n=i.n()).done;){var r=n.value;r&&this.bind(r,e)}}catch(t){i.e(t)}finally{i.f()}}else{t=this.getEvent(t)||function(t,e){return this.__events||(this.__events={}),this.__events[t]=e}.call(this,t,new w);t.contain(e)||t.add(e)}}},{key:"unbind",value:function(t,e){if(t&&-1<t.indexOf(" ")){var n,i=_(t=t.split(" "));try{for(i.s();!(n=i.n()).done;){var r=n.value;r&&this.unbind(r,e)}}catch(t){i.e(t)}finally{i.f()}}else{t=this.getEvent(t);t&&(e?t.remove(e):t.clear())}}},{key:"emit",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.runEventHandle(e[0],e.slice(1)),this}},{key:"runEventHandle",value:function(t,n){var i,t=this.getEvent(t);return t&&(i=this,Array.isArray(n)||(n=[n]),t.each(function(t,e){!1===e.apply(i,n)&&(n.cancel=!0)})),n.cancel}},{key:"checkPoint",value:function(t,e){if("jmGraph"==this.type){var n=this.getPosition(),i=n.left+this.width,r=n.top+this.height;return t.x>i||t.x<n.left?!1:!(t.y>r||t.y<n.top)}var o=this.getBounds();if(this.hitArea){var i=this.hitArea.x+o.left,s=this.hitArea.y+o.top,r=this.hitArea.width+o.left,n=this.hitArea.height+o.top;return t.x>r||t.x<i?!1:!(t.y>n||t.y<s)}var a=this.points;if(a&&a.length||((a=[]).push({x:o.left,y:o.top}),a.push({x:o.right,y:o.top}),a.push({x:o.right,y:o.bottom}),a.push({x:o.left,y:o.bottom}),a.push({x:o.left,y:o.top})),e=Number(e||this.style.touchPadding||this.style.lineWidth||1),a&&a.length){s=this.getRotation(null,o);if(s&&s.angle&&(a=A.clone(a,!0),a=A.rotatePoints(a,{x:s.x+o.left,y:s.y+o.top},s.angle||0)),2<a.length&&(!this.style.fill||this.style.stroke)){for(var h=0,l=a.length,u=h+1;u<=l;u=++h+1)if(u==l){if(this.style.close)if(A.pointInPolygon(t,[a[h],a[0]],e))return!0}else if(A.pointInPolygon(t,[a[h],a[u]],e))return!0;if(!this.style.fill)return!1}return A.pointInPolygon(t,a,e)}return!(t.x>o.right||t.x<o.left)&&!(t.y>o.bottom||t.y<o.top)}},{key:"raiseEvent",value:function(n,i){if(!1!==this.visible){var t,e;i.position||(o=this.graph,i.isWXMiniApp=o.isWXMiniApp,t=i.srcElement||i.target,e=A.getEventPosition(i),i={position:e,button:0==i.button||e.isTouch?1:i.button,keyCode:i.keyCode||i.charCode||i.which,ctrlKey:i.ctrlKey,cancel:!1,event:i,srcElement:t,isWXMiniApp:o.isWXMiniApp}),i.path=i.path||[];var r=!1;if(this.children&&this.children.each(function(t,e){if(!0!==i.cancel&&(r=!1===e.raiseEvent(n,i)||r))return!1},!0),r)return!1;var o=(this.parent&&this.parent.absoluteBounds?this.parent:this).absoluteBounds;if(!o)return!1;i.position.x=i.position.offsetX-o.left,i.position.y=i.position.offsetY-o.top;o=!1!==this.interactive&&this.checkPoint(i.position);return o?(i.target||(i.target=this),this.runEventAndPopEvent(n,i),this.focused||"mousemove"!==n&&"touchmove"!==n||(this.focused=!0,this.raiseEvent("mousemove"===n?"mouseover":"touchover",i))):!1===this.interactive||o||!this.focused||"mousemove"!==n&&"touchmove"!==n||(this.focused=!1,this.runEventHandle("mousemove"===n?"mouseleave":"touchleave",i)),!1===i.cancel}}},{key:"runEventAndPopEvent",value:function(t,e){!0!==e.cancel&&(e.path.push(this),this.runEventHandle(t,e))}},{key:"clearEvents",value:function(t){t=this.getEvent(t);t&&t.clear}},{key:"findParent",value:function(t){if("string"==typeof t){if(this.type==t)return this}else if(this.is(t))return this;return this.parent?this.parent.findParent(t):null}},{key:"canMove",value:function(t,e){var o;return this.__mvMonitor||(this.__mvMonitor={},this.__mvMonitor.mouseDown=!1,this.__mvMonitor.curposition={x:0,y:0},(o=this).__mvMonitor.mv=function(t){var e=o;if(e.__mvMonitor.mouseDown){e.parent.bounds=null;var n,i=t.position.offsetX-e.__mvMonitor.curposition.x,r=t.position.offsetY-e.__mvMonitor.curposition.y;return e.option.lockSide&&(n=e.bounds||e.getAbsoluteBounds(),((n=A.checkOutSide(e.option.lockSide,n,{x:i,y:r})).left<0&&i<0||0<n.right&&0<i)&&(i=0),(n.top<0&&r<0||0<n.bottom&&0<r)&&(r=0)),(i||r)&&(e.offset(i,r,!0,t),i&&(e.__mvMonitor.curposition.x=t.position.offsetX),r&&(e.__mvMonitor.curposition.y=t.position.offsetY)),!1}},this.__mvMonitor.mu=function(t){var e=o;e.__mvMonitor.mouseDown&&(e.__mvMonitor.mouseDown=!1,e.emit("moveend",{position:e.__mvMonitor.curposition}))},this.__mvMonitor.ml=function(){var t=o;if(t.__mvMonitor.mouseDown)return t.__mvMonitor.mouseDown=!1,t.emit("moveend",{position:t.__mvMonitor.curposition}),!1},this.__mvMonitor.md=function(t){if(!this.__mvMonitor.mouseDown)return 0==t.button||1==t.button?(this.__mvMonitor.mouseDown=!0,this.__mvMonitor.curposition.x=t.position.offsetX,this.__mvMonitor.curposition.y=t.position.offsetY,this.emit("movestart",{position:this.__mvMonitor.curposition}),!(t.cancel=!0)):void 0}),e=e||this.graph,!1!==t?(e.bind("mousemove",this.__mvMonitor.mv),e.bind("mouseup",this.__mvMonitor.mu),e.bind("mouseleave",this.__mvMonitor.ml),this.bind("mousedown",this.__mvMonitor.md),e.bind("touchmove",this.__mvMonitor.mv),e.bind("touchend",this.__mvMonitor.mu),this.bind("touchstart",this.__mvMonitor.md)):(e.unbind("mousemove",this.__mvMonitor.mv),e.unbind("mouseup",this.__mvMonitor.mu),e.unbind("mouseleave",this.__mvMonitor.ml),this.unbind("mousedown",this.__mvMonitor.md),e.unbind("touchmove",this.__mvMonitor.mv),e.unbind("touchend",this.__mvMonitor.mu),this.unbind("touchstart",this.__mvMonitor.md)),this.interactive=!0,this}}]),r}(),yt=function(){u(i,pt);var n=p(i);function i(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"jmPath";return h(this,i),(e=n.call(this,t,e)).points=t&&t.points?t.points:[],e}return l(i,[{key:"points",get:function(){return this.property("points")},set:function(t){return this.needUpdate=!0,this.property("points",t)}},{key:"toSVG",value:function(){if(!this.points||0===this.points.length)return"";var t="",e=this.points;t+="M ".concat(e[0].x," ").concat(e[0].y);for(var n=1;n<e.length;n++){var i=e[n];i.m?t+=" M ".concat(i.x," ").concat(i.y):t+=" L ".concat(i.x," ").concat(i.y)}this.style&&this.style.close&&(t+=" Z");var r='<path d="'+t+'"';return this.style&&(this.style.fill&&(r+=' fill="'+this.style.fill+'"'),this.style.stroke&&(r+=' stroke="'+this.style.stroke+'"'),this.style.lineWidth&&(r+=' stroke-width="'+this.style.lineWidth+'"'),this.style.opacity&&(r+=' opacity="'+this.style.opacity+'"')),r+="/>"}}]),i}(),gt=function(){u(s,pt);var o=p(s);function s(t,e,n){var i,r;return h(this,s),"function"==typeof e&&(n=e,e={}),(e=e||{}).interactive=!0,e.isRegular=!0,(i=o.call(this,e,"jmGraph")).option=e||{},i.devicePixelRatio=1,i.util=i.utils=A,i.mode=e.mode||"2d",i.scaleFactor=1,i.translation={x:0,y:0},"undefined"!=typeof wx&&wx.canIUse&&wx.canIUse("canvas")?("string"==typeof t&&(t=wx.createSelectorQuery().select("#"+t)),i.isWXMiniApp=!0,i.container=t):("string"==typeof t&&"undefined"!=typeof document?t=document.getElementById(t):t.length&&(t=t[0]),t.getContext||"undefined"==typeof document?i.container=t.parentElement:(i.container=t,r=document.createElement("canvas"),t.appendChild(r),r.width=t.offsetWidth||t.clientWidth,r.height=t.offsetHeight||t.clientHeight,t=r)),i.canvas=t,"webgl"===i.mode?i.context=t.getContext(i.mode,{preserveDrawingBuffer:!0}):i.context=t.getContext(i.mode),i.textureCanvas=e.textureCanvas||null,"webgl"===i.mode&&(i.context.enable(i.context.BLEND),i.context.blendFunc(i.context.SRC_ALPHA,i.context.ONE_MINUS_SRC_ALPHA),A.bindEvent(t,"webglcontextlost",function(t){console.log("canvas webglcontextlost",t),i.emit("webglcontextlost",t)}),A.bindEvent(t,"webglcontextrestored",function(t){console.log("canvas webglcontextrestored",t),i.emit("webglcontextrestored",t)})),i.__init(n),i}return l(s,[{key:"__init",value:function(t){this.shapes=Object.assign({path:yt},this.option.shapes),this.on("beginDraw",function(){this.context.translate&&this.context.translate(.5,.5),this.context.translate&&this.context.scale&&(this.context.translate(this.translation.x,this.translation.y),this.context.scale(this.scaleFactor,this.scaleFactor))}),this.on("endDraw",function(){this.context.translate&&this.context.translate(-.5,-.5),this.context.translate&&this.context.scale&&(this.context.scale(1/this.scaleFactor,1/this.scaleFactor),this.context.translate(-this.translation.x,-this.translation.y))});var e="undefined"!=typeof window&&1<window.devicePixelRatio?window.devicePixelRatio:1;this.isWXMiniApp&&(e=wx.getWindowInfo().pixelRatio||1),this.devicePixelRatio=e,this.dprScaleSize=1<this.devicePixelRatio?this.devicePixelRatio:2,0<this.option.width&&(this.width=this.option.width),0<this.option.height&&(this.height=this.option.height),this.resize(),this.eventHandler=new N(this,this.canvas.canvas||this.canvas),this.option.autoRefresh&&this.autoRefresh(),t&&t(this)}},{key:"resize",value:function(t,e){this.canvas&&(this.__normalSize=this.__normalSize||{width:0,height:0},t=t||this.__normalSize.width||this.width,e=e||this.__normalSize.height||this.height,t&&(this.__normalSize.width=t),e&&(this.__normalSize.height=e),this.css("width",t+"px"),this.css("height",e+"px"),"2d"===this.mode?(this.canvas.height=e*this.dprScaleSize,this.canvas.width=t*this.dprScaleSize,1!==this.dprScaleSize&&this.context.scale&&this.context.scale(this.dprScaleSize,this.dprScaleSize)):(this.canvas.width=t,this.canvas.height=e),this.context.viewport&&this.context.viewport(0,0,t,e),this.needUpdate=!0)}},{key:"width",get:function(){return this.__normalSize&&this.__normalSize.width?this.__normalSize.width:this.canvas?this.canvas.width:0},set:function(t){return this.needUpdate=!0,this.canvas&&this.resize(t),t}},{key:"height",get:function(){return this.__normalSize&&this.__normalSize.height?this.__normalSize.height:this.canvas?this.canvas.height:0},set:function(t){return this.needUpdate=!0,this.canvas&&this.resize(0,t),t}},{key:"getPosition",value:function(){var t=this.isWXMiniApp?{left:0,top:0}:A.getElementPosition(this.canvas.canvas||this.canvas);return t.width=this.width,t.height=this.height,t.right=t.left+t.width,t.bottom=t.top+t.height,t}},{key:"registerShape",value:function(t,e){this.shapes[t]=e}},{key:"createShape",value:function(t,e){if(t="string"==typeof t?this.shapes[t]:t)return(e=e||{}).graph=this,new t(e)}},{key:"createShadow",value:function(t,e,n,i){return new S(t,e,n,i)}},{key:"createLinearGradient",value:function(t,e,n,i){return new R({type:"linear",x1:t,y1:e,x2:n,y2:i,stops:4<arguments.length&&void 0!==arguments[4]?arguments[4]:[]})}},{key:"createRadialGradient",value:function(t,e,n,i,r,o){return new R({type:"radial",x1:t,y1:e,r1:n,x2:i,y2:r,r2:o,stops:6<arguments.length&&void 0!==arguments[6]?arguments[6]:[]})}},{key:"refresh",value:function(){this.redraw()}},{key:"redraw",value:function(t,e){this.clear(t||this.width,e||this.height),this.paint()}},{key:"clear",value:function(t,e){t&&e||(t=this.width,e=this.height),this.context.clearRect?(this.style&&this.style.fill&&(this.points=[{x:0,y:0},{x:t,y:0},{x:t,y:e},{x:0,y:e}],this.style.close=!0),this.context.clearRect(0,0,t,e)):"webgl"===this.mode&&this.context.clear&&(e=this.style&&this.style.fill?this.utils.hexToRGBA(this.style.fill):{r:0,g:0,b:0,a:0},this.context.clearColor(e.r,e.g,e.b,e.a),this.context.clear(this.context.COLOR_BUFFER_BIT))}},{key:"css",value:function(t,e){if(this.canvas&&this.canvas.style)return void 0!==e&&(this.canvas.style[t]=e),this.canvas.style[t]}},{key:"createPath",value:function(t,e){return this.createShape("path",a({points:t,style:e},2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}))}},{key:"createLine",value:function(t,e,n){return this.createShape("line",{start:t,end:e,style:n})}},{key:"zoomOut",value:function(){this.scale(.9,.9)}},{key:"zoomIn",value:function(){this.scale(1.1,1.1)}},{key:"zoomActual",value:function(){this.scaleSize?this.scale(1/this.scaleSize.x,1/this.scaleSize.y):this.scale(1,1)}},{key:"scale",value:function(t,e){this.normalSize||(this.normalSize={width:this.canvas.width,height:this.canvas.height}),this.scaleSize?this.scaleSize={x:t*this.scaleSize.x,y:e*this.scaleSize.y}:this.scaleSize={x:1,y:1},this.canvas.style&&(this.canvas.style.transform="scale(".concat(this.scaleSize.x,", ").concat(this.scaleSize.y,")"))}},{key:"setZoom",value:function(t,e,n){if("number"!=typeof t||isNaN(t))return console.warn("jmGraph: setZoom - 无效的缩放因子"),this;var i,r;return t=Math.max(.1,Math.min(10,t)),void 0!==e&&void 0!==n&&(i=this.scaleFactor,r=t,this.translation.x=e-(e-this.translation.x)*(r/i),this.translation.y=n-(n-this.translation.y)*(r/i)),this.scaleFactor=t,this.needUpdate=!0,this.redraw(),this}},{key:"pan",value:function(t,e){return"number"!=typeof t||"number"!=typeof e||isNaN(t)||isNaN(e)?console.warn("jmGraph: pan - 无效的平移参数"):(this.translation.x+=t,this.translation.y+=e,this.needUpdate=!0,this.redraw()),this}},{key:"resetTransform",value:function(){return this.scaleFactor=1,this.translation={x:0,y:0},this.needUpdate=!0,this.redraw(),this}},{key:"toDataURL",value:function(){return this.canvas.toDataURL?this.canvas.toDataURL():""}},{key:"exportToPNG",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"jmgraph-export",e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"image/png",n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.9;try{this.redraw();var i=this.canvas.toDataURL(e,n);this.downloadFile(i,t,"png")}catch(t){console.error("jmGraph: exportToPNG - 导出失败",t)}}},{key:"exportToJPEG",value:function(){this.exportToPNG(0<arguments.length&&void 0!==arguments[0]?arguments[0]:"jmgraph-export","image/jpeg",1<arguments.length&&void 0!==arguments[1]?arguments[1]:.9)}},{key:"exportToSVG",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"jmgraph-export";try{var e=this.toSVG(),n=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),i=URL.createObjectURL(n);this.downloadFile(i,t,"svg"),setTimeout(function(){return URL.revokeObjectURL(i)},100)}catch(t){console.error("jmGraph: exportToSVG - 导出失败",t)}}},{key:"toSVG",value:function(){var n='<svg width="'.concat(this.width,'" height="').concat(this.height,'" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ').concat(this.width," ").concat(this.height,'">');return this.style&&this.style.fill&&(n+='<rect width="100%" height="100%" fill="'.concat(this.style.fill,'"/>')),this.children.each(function(t,e){e.toSVG&&(n+=e.toSVG())}),n+="</svg>"}},{key:"downloadFile",value:function(t,e,n){var i=document.createElement("a");i.href=t,i.download="".concat(e,".").concat(n),document.body.appendChild(i),i.click(),document.body.removeChild(i)}},{key:"autoRefresh",value:function(n){if(!this.___isAutoRefreshing){var i=this;this.___isAutoRefreshing=!0;var r=Date.now();return i.__requestAnimationFrameFunHandler&&this.cancelAnimationFrame(i.__requestAnimationFrameFunHandler),i.__requestAnimationFrameFunHandler=this.requestAnimationFrame(function t(){var e;i.destroyed?i.___isAutoRefreshing=!1:(i.needUpdate&&i.redraw(),e=Date.now()-r,i.emit("update",e),i.__requestAnimationFrameFunHandler&&i.cancelAnimationFrame(i.__requestAnimationFrameFunHandler),i.__requestAnimationFrameFunHandler=i.requestAnimationFrame(t),n&&n())}),this}}},{key:"destroy",value:function(){this.eventHandler.destroy(),this.destroyed=!0}}],[{key:"create",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return c(s,e)}}]),s}();t.default=gt,t.jmControl=pt,t.jmEvents=N,t.jmFilter=M,t.jmGradient=R,t.jmGraph=gt,t.jmList=w,t.jmPath=yt,t.jmProperty=P,t.jmShadow=S,t.jmUtils=A,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=jmgraph.core.min.js.map
|