jmgraph 3.2.12 → 3.2.13
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/dist/jmgraph.core.min.js +1 -1
- package/dist/jmgraph.core.min.js.map +1 -1
- package/dist/jmgraph.js +38 -5
- package/dist/jmgraph.min.js +1 -1
- package/package.json +1 -1
- package/src/core/jmControl.js +34 -2
package/dist/jmgraph.core.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
((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){function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e,n){e=o(e);var i=t,e=s()?Reflect.construct(e,n||[],o(t).constructor):e.apply(t,n);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(i)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e,n){var i;return s()?Reflect.construct.apply(null,arguments):((i=[null]).push.apply(i,e),e=new(t.bind.apply(t,i)),n&&v(e,n.prototype),e)}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,F(i.key),i)}}function e(t,e,n){return e&&I(t.prototype,e),n&&I(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e){var n,i,r,o,s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(s)return r=!(i=!0),{s:function(){s=s.call(t)},n:function(){var t=s.next();return i=t.done,t},e:function(t){r=!0,n=t},f:function(){try{i||null==s.return||s.return()}finally{if(r)throw n}}};if(Array.isArray(t)||(s=j(t))||e&&t&&"number"==typeof t.length)return s&&(t=s),o=0,{s:e=function(){},n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},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.")}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}function s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(s=function(){return!!t})()}function L(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 f(i){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach(function(t){var e,n;e=i,n=r[t=t],(t=F(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(r,t))})}return i}function z(t){throw new TypeError('"'+t+'" is read-only')}function v(t,e){return(v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function d(t){return(t=>{if(Array.isArray(t))return i(t)})(t)||(t=>{if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)})(t)||j(t)||(()=>{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 F(t){t=((t,e)=>{if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);if("object"!=typeof(n=n.call(t,e||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string");return"symbol"==typeof t?t:t+""}function y(t){return(y="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 j(t,e){var n;if(t)return"string"==typeof t?i(t,e):"Map"===(n="Object"===(n={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}function U(t){var n="function"==typeof Map?new Map:void 0;return function(t){if(null===t||!(e=>{try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}})(t))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 r(t,arguments,o(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),v(e,t)}(t)}var p=(()=>{function s(){l(this,s);for(var t,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=h(this,s,[].concat(e))}else t=h(this,s);return t.option={},t.type="jmList",a(t)}return c(s,U(Array)),e(s,[{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]);else"object"==y(t)&&this.includes(t)||this.push(t);return 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)}}])})(),G={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)"},g=(()=>e(function t(){l(this,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"===y(t)){if(e=e||{},this.isType(t,p))return new p(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 l in t.__proto__&&(e.__proto__=t.__proto__),t)"constructor"!==l&&((n=t[l])&&(n.tagName||n.getContext)?e[l]=n:"object"!==y(e[l])&&void 0!==e[l]||(e[l]=this.clone(n,e[l],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)if(t.offsetParent)for(;t.offsetParent;)e.top+=t.offsetTop,e.left+=t.offsetLeft,t=t.offsetParent;else t.x&&(e.left+=t.x);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,s=(r&&r.length&&((t=r[0]).target||(t.target=o),i=!0),t.pageX||t.x),a=(void 0===s&&(s=t.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),t.pageY||t.y),h=(void 0===a&&(a=t.clientY+(document.documentElement.scrollTop||document.body.scrollTop)),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"!==y(t))&&t.constructor===e}},{key:"pointInPolygon",value:function(t,e,n){n=n||1,n/=2;var i,r,o,s=e.length,a=!1,h=!0;if(!e||0==s)return 0;if(1==s)return Math.abs(e[0].x-t.x)<=n&&Math.abs(e[0].y-t.y)<=n;if(2==s)return Math.min(e[0].x,e[1].x)-t.x>n||t.x-Math.max(e[0].x,e[1].x)>n||Math.min(e[0].y,e[1].y)-t.y>n||t.y-Math.max(e[0].y,e[1].y)>n?0:e[0].x==e[1].x?Math.abs(e[0].x-t.x)<=n&&(t.y-e[0].y)*(t.y-e[1].y)<=0?1:0:e[0].y==e[1].y?Math.abs(e[0].y-t.y)<=n&&(t.x-e[0].x)*(t.x-e[1].x)<=0?1:0:Math.abs(e[0].x-t.x)<n&&Math.abs(e[0].y-t.y)<n||Math.abs(e[1].x-t.x)<n&&Math.abs(e[1].y-t.y)<n||t.y!=e[0].y&&t.y!=e[1].y&&(o=(e[1].x-e[0].x)/(e[1].y-e[0].y)*(t.y-e[0].y),o=(t.y-e[0].y)/Math.sqrt(o*o+(t.y-e[0].y)*(t.y-e[0].y))*(t.x-e[0].x-o),Math.abs(o)<=n)?1:0;for(i=0;i<s;++i)if(e[i].x==t.x&&e[i].y==t.y)return 1;for(;h;)for(a=h=!1,i=0,r=s-1;i<s;r=i++)if(e[i].y<t.y&&t.y<e[r].y||e[r].y<t.y&&t.y<e[i].y){if(t.x<=e[i].x||t.x<=e[r].x){var l=(t.y-e[i].y)*(e[r].x-e[i].x)/(e[r].y-e[i].y)+e[i].x;if(t.x<l)a=!a;else if(t.x==l)return 1}}else if(t.y==e[i].y){if(t.x<e[i].x){e[i].y>e[r].y?--t.y:++t.y,h=!0;break}}else if(e[i].y==e[r].y&&t.y==e[i].y&&(e[i].x<t.x&&t.x<e[r].x||e[r].x<t.x&&t.x<e[i].x)){a=!0;break}return a?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){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 n=t.x-e.x,h=t.y-e.y;t.x=n*i-h*r+e.x,t.y=n*r+h*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){var e,n;return"string"!=typeof t?t:(t=this.trim(t),this.__hexToRGBA_Cache=this.__hexToRGBA_Cache||{},this.__hexToRGBA_Cache[t]||("#"==(n=G[n=t]?G[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"===y(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)}}]))(),X=0,q=(()=>e(function t(e){l(this,t),e&&"jmGraph"==e.type&&(this.graph=e),this.id=++X},[{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 p);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=(new Date).getTime();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){window.console&&window.console.info&&window.console.info(t.toString()),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)}}}]))(),H=Symbol("properties"),Y=(()=>{function n(t){var e;return l(this,n),(e=h(this,n))[H]={},t&&t.mode&&(e.mode=t.mode),e}return c(n,q),e(n,[{key:"property",value:function(){for(var t,e,n,i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];if(r)return t=this[H],e=r[0],1<r.length?(n=r[1],n={oldValue:t[e],newValue:n},t[e]=r[1],this.emit&&this.emit("propertyChange",e,n),r[1]):e?t[e]:void 0}},{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 g.requestAnimationFrame(t,this.graph?this.graph.canvas:null)}},{key:"cancelAnimationFrame",value:function(t){return g.cancelAnimationFrame(t,this.graph?this.graph.canvas:null)}}])})(),x=(()=>e(function t(e,n,i,r){l(this,t),"string"!=typeof e||n||i||r?(this.x=e,this.y=n,this.blur=i,this.color=r):this.fromString(e)},[{key:"fromString",value:function(t){if(t)return(t=t.match(/\s*([^,]+)\s*,\s*([^,]+)\s*(,[^,]+)?\s*(,[\s\S]+)?\s*/i))&&(this.x=t[1]||0,this.y=t[2]||0,t[3]&&(t[3]=g.trim(t[3],", "),0===t[3].indexOf("#")||/^rgb/i.test(t[3])?this.color=t[3]:this.blur=g.trim(t[3],", ")),t[4])&&(this.color=g.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}}]))(),m=(()=>e(function t(e){if(l(this,t),this.stops=new p,e&&"object"==y(e)){for(var n in e)"stops"!==n&&(this[n]=e[n]);var i;e.stops&&Array.isArray(e.stops)&&(i=this.stops).push.apply(i,d(e.stops))}else"string"==typeof e&&this.fromString(e)},[{key:"addStop",value:function(t,e){this.stops.add({offset:Number(t),color:e})}},{key:"toGradient",value:function(t){var i,e,n,r=t.context||t,o=t.absoluteBounds||t.getAbsoluteBounds(),s=this.x1||0,a=this.y1||0,h=this.x2,l=this.y2,u=t.getLocation(),c=0,u=(c=(c=u.radius?2*u.radius:c)||Math.min(u.width,u.height),g.checkPercent(s)&&(s=g.percentToNumber(s)*(o.width||c)),g.checkPercent(h)&&(h=g.percentToNumber(h)*(o.width||c)),g.checkPercent(a)&&(a=g.percentToNumber(a)*(o.height||c)),g.checkPercent(l)&&(l=g.percentToNumber(l)*(o.height||c)),Number(s)+o.left),f=Number(a)+o.top,v=Number(h)+o.left,d=Number(l)+o.top;return"linear"===this.type?"webgl"===t.mode&&t.webglControl?(i=t.webglControl.createLinearGradient(s,a,h,l,o)).key=this.toString():r.createLinearGradient&&(i=r.createLinearGradient(u,f,v,d)):"radial"===this.type&&(e=this.r1||0,n=this.r2,g.checkPercent(e)&&(e=g.percentToNumber(e),e*=c),g.checkPercent(n)&&(n=g.percentToNumber(n),n*=c),"webgl"===t.mode&&t.webglControl?(i=t.webglControl.createRadialGradient(s,a,e,h,l,n,o)).key=this.toString():r.createRadialGradient?i=r.createRadialGradient(u,f,e,v,d,n):r.createCircularGradient&&(i=r.createCircularGradient(u,f,n))),i?(this.stops.each(function(t,e){var n=g.toColor(e.color);i&&i.addColorStop(e.offset,n)}),i):(c=this.stops.get(0))&&c.color||"#000"}},{key:"fromString",value:function(t){if(t){t=t.match(/(linear|radial)-gradient\s*\(\s*([^,]+)\s*,\s*((.|\s)+)\)/i);if(t&&!(t.length<3)){this.type=t[1].toLowerCase();var e=g.trim(t[2]).split(/\s+/),n=("linear"==this.type?e.length<=2?(this.x2=e[0],this.y2=e[1]||0):(this.x1=e[0],this.y1=e[1],this.x2=e[2],this.y2=e[3]):e.length<=3?(this.x2=e[0],this.y2=e[1]||0,this.r2=e[2]||0):(this.x1=e[0],this.y1=e[1],this.r1=e[2],this.x2=e[3],this.y2=e[3],this.r2=e[3]),t[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=g.trim(n[i]),s=o.lastIndexOf(" ");-1<s&&(r=Number(o.substr(s+1)),o=g.trim(o.substr(0,s)),!isNaN(r))&&o&&this.addStop(r,o)}}}}},{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+")"}}]))(),W=(()=>e(function t(e,n){l(this,t),this.container=e,this.target=n||e,this.mouseHandler=new Z(this,e,n),this.keyHandler=new V(this,e,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:"destroy",value:function(){this.mouseHandler.destroy(),this.keyHandler.destroy()}}]))(),Z=(()=>e(function t(e,n,i){l(this,t),this.instance=e,this.container=n,this.target=i||n,this.eventEvents={},this.init(e,n,i)},[{key:"init",value:function(e,n,t){var i=this.target,r="undefined"!=typeof document?document:null;this.eventEvents.mousedown=g.bindEvent(this.target,"mousedown",function(t){(t=t||window.event).eventName="mousedown",n.raiseEvent("mousedown",t)}),this.eventEvents.mousemove=g.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=g.bindEvent(this.target,"mouseover",function(t){(t=t||window.event).eventName="mouseover",n.raiseEvent("mouseover",t)}),this.eventEvents.mouseleave=g.bindEvent(this.target,"mouseleave",function(t){(t=t||window.event).eventName="mouseleave",n.raiseEvent("mouseleave",t)}),this.eventEvents.mouseout=g.bindEvent(this.target,"mouseout",function(t){(t=t||window.event).eventName="mouseout",n.raiseEvent("mouseout",t)}),r&&(this.eventEvents.mouseup=g.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=g.bindEvent(this.target,"dblclick",function(t){(t=t||window.event).eventName="dblclick",n.raiseEvent("dblclick",t)}),this.eventEvents.click=g.bindEvent(this.target,"click",function(t){(t=t||window.event).eventName="click",n.raiseEvent("click",t)}),r&&(this.eventEvents.resize=g.bindEvent(r,"resize",function(t){return(t=t||window.event).eventName="resize",n.raiseEvent("resize",t)})),this.eventEvents.touchstart=g.bindEvent(this.target,"touchstart",function(t){return t.eventName="touchstart",e.touchStart(t)},{passive:!1}),this.eventEvents.touchmove=g.bindEvent(this.target,"touchmove",function(t){return t.eventName="touchmove",e.touchMove(t)},{passive:!1}),r&&(this.eventEvents.touchend=g.bindEvent(r,"touchend",function(t){return t.eventName="touchend",e.touchEnd(t)},{passive:!1})),r&&(this.eventEvents.touchcancel=g.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&&g.removeEvent(e.target,t,e.fun)}}}]))(),V=(()=>e(function t(e,n,i){l(this,t),this.instance=e,this.container=n,this.target=i||n,this.eventEvents={},this.init(n,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=g.bindEvent(e,"keypress",function(t){var e;if(t=t||window.event,i(t))return!1===(e=n.raiseEvent("keypress",t))&&t.preventDefault&&t.preventDefault(),e})),e&&(this.eventEvents.keydown=g.bindEvent(e,"keydown",function(t){var e;if(t=t||window.event,i(t))return!1===(e=n.raiseEvent("keydown",t))&&t.preventDefault&&t.preventDefault(),e})),e&&(this.eventEvents.keyup=g.bindEvent(e,"keyup",function(t){var e;if(t=t||window.event,i(t))return!1===(e=n.raiseEvent("keyup",t))&&t.preventDefault&&t.preventDefault(),e}))}},{key:"destroy",value:function(){for(var t in this.eventEvents){var e=this.eventEvents[t];e&&e.fun&&g.removeEvent(e.target,t,e.fun)}}}]))();function n(t,e,n){n=n||2;var i,r,o,s,a,h=e&&e.length,l=h?e[0]*n:t.length,u=K(t,0,l,n,!0),c=[];if(u&&u.next!==u.prev){if(h&&(u=((t,e,n,i)=>{var r,o,s,a,h=[];for(r=0,o=e.length;r<o;r++)a=e[r]*i,s=r<o-1?e[r+1]*i:t.length,(a=K(t,a,s,i,!1))===a.next&&(a.steiner=!0),h.push((t=>{for(var e=t,n=t;(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),(e=e.next)!==t;);return n})(a));for(h.sort(J),r=0;r<h.length;r++)n=((t,e)=>{var n=((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)!==e);if(!n)return null;var h,l=n,u=n.x,c=n.y,f=1/0;for(i=n;r>=i.x&&i.x>=u&&r!==i.x&&S(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),M(i,t))&&(h<f||h===f&&(i.x>n.x||i.x===n.x&&((t,e)=>C(t.prev,t,e.prev)<0&&C(e.next,t,t.next)<0)(n,i)))&&(n=i,f=h),(i=i.next)!==l;);return n})(t,e);return n?(T(t=$(n,t),t.next),T(n,n.next)):e})(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}A(u,c,n,f,v,a,0)}return c}function K(t,e,n,i,r){var o,s;if(r===0<k(t,e,n,i))for(o=e;o<n;o+=i)s=tt(o,t[o],t[o+1],s);else for(o=n-i;e<=o;o-=i)s=tt(o,t[o],t[o+1],s);return s&&R(s,s.next)&&(N(s),s=s.next),s}function T(t,e){if(!t)return t;e=e||t;var n,i=t;do{if(n=!1,i.steiner||!R(i,i.next)&&0!==C(i.prev,i,i.next))i=i.next;else{if(N(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function A(t,e,n,i,r,o,s){if(t){if(!s&&o){for(var a=t,h=i,l=r,u=o,c=a;0===c.z&&(c.z=P(c.x,c.y,h,l,u)),c.prevZ=c.prev,c.nextZ=c.next,(c=c.next)!==a;);c.prevZ.nextZ=null,c.prevZ=null;var f,v,d,y,p,g,x,m,b=c,w=1;do{for(v=b,p=b=null,g=0;v;){for(g++,d=v,f=x=0;f<w&&(x++,d=d.nextZ);f++);for(m=w;0<x||0<m&&d;)0!==x&&(0===m||!d||v.z<=d.z)?(v=(y=v).nextZ,x--):(d=(y=d).nextZ,m--),p?p.nextZ=y:b=y,y.prevZ=p,p=y;v=d}}while(p.nextZ=null,w*=2,1<g)}for(var _,k,E=t;t.prev!==t.next;)if(_=t.prev,k=t.next,o?((t,e,n,i)=>{var r=t.prev,o=t,s=t.next;if(!(0<=C(r,o,s))){for(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,y=h<a?l<a?a:l:l<h?h:l,p=c<u?f<u?u:f:f<c?c:f,g=P(v,d,e,n,i),x=P(y,p,e,n,i),m=t.prevZ,b=t.nextZ;m&&m.z>=g&&b&&b.z<=x;){if(m.x>=v&&m.x<=y&&m.y>=d&&m.y<=p&&m!==r&&m!==s&&S(a,u,h,c,l,f,m.x,m.y)&&0<=C(m.prev,m,m.next))return;if(m=m.prevZ,b.x>=v&&b.x<=y&&b.y>=d&&b.y<=p&&b!==r&&b!==s&&S(a,u,h,c,l,f,b.x,b.y)&&0<=C(b.prev,b,b.next))return;b=b.nextZ}for(;m&&m.z>=g;){if(m.x>=v&&m.x<=y&&m.y>=d&&m.y<=p&&m!==r&&m!==s&&S(a,u,h,c,l,f,m.x,m.y)&&0<=C(m.prev,m,m.next))return;m=m.prevZ}for(;b&&b.z<=x;){if(b.x>=v&&b.x<=y&&b.y>=d&&b.y<=p&&b!==r&&b!==s&&S(a,u,h,c,l,f,b.x,b.y)&&0<=C(b.prev,b,b.next))return;b=b.nextZ}return 1}})(t,i,r,o):(t=>{var e=t.prev,n=t,t=t.next;if(!(0<=C(e,n,t))){for(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;v!==e;){if(v.x>=l&&v.x<=c&&v.y>=u&&v.y<=f&&S(i,s,r,a,o,h,v.x,v.y)&&0<=C(v.prev,v,v.next))return;v=v.next}return 1}})(t))e.push(_.i/n|0),e.push(t.i/n|0),e.push(k.i/n|0),N(t),t=k.next,E=k.next;else if((t=k)===E){s?1===s?A(t=((t,e,n)=>{var i=t;do{var r=i.prev,o=i.next.next}while(!R(r,o)&&Q(r,i,i.next,o)&&M(r,o)&&M(o,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(o.i/n|0),N(i),N(i.next),i=t=o),(i=i.next)!==t);return T(i)})(T(t),e,n),e,n,i,r,o,2):2===s&&((t,e,n,i,r,o)=>{var s=t;do{for(var a,h=s.next.next;h!==s.prev;){if(s.i!==h.i&&((t,e)=>t.next.i!==e.i&&t.prev.i!==e.i&&!((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&&Q(n,n.next,t,e))return 1}while((n=n.next)!==t)})(t,e)&&(M(t,e)&&M(e,t)&&((t,e)=>{for(var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;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)!==t;);return i})(t,e)&&(C(t.prev,t,e.prev)||C(t,e.prev,e))||R(t,e)&&0<C(t.prev,t,t.next)&&0<C(e.prev,e,e.next)))(s,h))return a=$(s,h),s=T(s,s.next),a=T(a,a.next),A(s,e,n,i,r,o,0),A(a,e,n,i,r,o,0);h=h.next}}while((s=s.next)!==t)})(t,e,n,i,r,o):A(T(t),e,n,i,r,o,1);break}}}function J(t,e){return t.x-e.x}function P(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 S(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 C(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function R(t,e){return t.x===e.x&&t.y===e.y}function Q(t,e,n,i){var r=w(C(t,e,n)),o=w(C(t,e,i)),s=w(C(n,i,t)),a=w(C(n,i,e));return r!==o&&s!==a||0===r&&b(t,n,e)||0===o&&b(t,i,e)||0===s&&b(n,t,i)||!(0!==a||!b(n,e,i))}function b(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 M(t,e){return C(t.prev,t,t.next)<0?0<=C(t,e,t.next)&&0<=C(t,t.prev,e):C(t,e,t.prev)<0||C(t,t.next,e)<0}function $(t,e){var n=new _(t.i,t.x,t.y),i=new _(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,(o.next=n.prev=i).prev=o,i}function tt(t,e,n,i){t=new _(t,e,n);return i?(t.next=i.next,(t.prev=i).next.prev=t,i.next=t):(t.prev=t).next=t,t}function N(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 _(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}n.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 l=e[a]*n,u=a<h-1?e[a+1]*n:t.length;s-=Math.abs(k(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)},n.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 E=(()=>e(function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"linear",n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};l(this,t),this.type=e||"linear",this.x1=n.x1||0,this.y1=n.y1||0,this.r1=n.r1||0,this.x2=n.x2||0,this.y2=n.y2||0,this.r2=n.r2||0,this.bounds=n.bounds||{left:0,top:0,width:0,height:0},this.control=n.control,this.stops=[],this.init()},[{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 r,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return i.textureContext?(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)}),i.toFillTexture(r,t,e)):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+")"}}]))();function et(t,e,n){e=t.createShader(e);return t.shaderSource(e,n),t.compileShader(e),e}var nt={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},it=function(t){return nt[t]},B=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(!B){var n=Object.keys(rt);B={};for(var i=0;i<n.length;++i){var r=n[i];B[t[r]]=rt[r]}}return B[e]};function st(t,e,n){var e=et(t,t.VERTEX_SHADER,e),n=et(t,t.FRAGMENT_SHADER,n),i=t.createProgram();return t.attachShader(i,e),t.attachShader(i,n),t.linkProgram(i),t.getProgramParameter(i,t.LINK_STATUS)||(console.error("PError: Could not initialize shader."),console.error("gl.VALIDATE_STATUS",t.getProgramParameter(i,t.VALIDATE_STATUS)),console.error("gl.getError()",t.getError()),""!==t.getProgramInfoLog(i)&&console.warn("Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(i)),t.deleteProgram(i)),at(t,i),t.deleteShader(e),t.deleteShader(n),{program:i,attrs:((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:it(s),type:s,location:t.getAttribLocation(e,o.name)}}return n})(t,i),uniforms:((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,i)}}function at(t,e){t.useProgram(e)}function ht(t,e,n,i){var n=2<arguments.length&&void 0!==n?n:t.ARRAY_BUFFER,i=3<arguments.length&&void 0!==i?i:t.STATIC_DRAW,r=t.createBuffer();if(r)return t.bindBuffer(n,r),t.bufferData(n,e.buffer||e,i),{type:n,drawType:i,buffer:r,unitSize:e.BYTES_PER_ELEMENT};throw Error("创建缓冲区对象失败")}function D(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 lt="\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"),ut="\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=(()=>e(function t(e,n){l(this,t),this.graph=e,this.option=n||{},this.style={globalAlpha:1}},[{key:"context",get:function(){if(this.graph)return this.graph.context}},{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(lt,ut))}},{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=f(f({},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),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&&(at(this.context,t.program||t),this.context.__curent_program=t),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 f({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 f({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 D(this.context)}},{key:"createImgTexture",value:function(t){return e=this.context,t=t,n=D(e),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),{texture:n};var e,n}},{key:"createDataTexture",value:function(t){return e=this.context,t=t,n=new Uint8Array(t.data||t),i=D(e),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.width||1,t.height||1,0,e.RGBA,e.UNSIGNED_BYTE,n),{texture:i};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 n(this.pointsToArray(t))}},{key:"earCutPointsToTriangles",value:function(t){for(var e=this.earCutPoints(t),n=[],i=0;i<e.length;i+=3){var r=t[e[i]],o=t[e[i+1]],s=t[e[i+2]];n.push([r,o,s])}return n}},{key:"pointsToArray",value:function(t){var e;return(e=[]).concat.apply(e,d(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 E("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 E("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 E}},{key:"testSize",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.style,e=(this.textureContext.save&&this.textureContext.save(),(e.font||e.fontSize)&&(this.textureContext.font=e.font||e.fontSize+"px "+e.fontFamily),this.textureContext.measureText?this.textureContext.measureText(t):{width:15});return this.textureContext.restore&&this.textureContext.restore(),e.height=this.style.fontSize||15,e}},{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=u(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}}}]))(),ft=(()=>{function n(t,e){return l(this,n),(t=h(this,n,[t,e])).isRegular=e.isRegular||!1,t.needCut=e.needCut||!1,t.control=e.control,t.points=[],t}return c(n,ct),e(n,[{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=u(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=u(t);try{for(r.s();!(e=r.n()).done;){var o=e.value;i.push(o.x+this.parentAbsoluteBounds.left,o.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 l=t.x+s*h;n.push({x:l,y:t.y+a*h})}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,d(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))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)||(o={start:r.start,end:h},s={start:h,end:r.end},t.splice(n,1,o,s),n++)),n++,a)return this.cutLines(t,e,n)}}n=++e+1}return t}},{key:"getIntersection",value:function(t,e){var n,i;return this.equalPoint(t.start,e.start)||this.equalPoint(t.start,e.end)?t.start:this.equalPoint(t.end,e.start)||this.equalPoint(t.end,e.end)?t.end:0<(i=(t.start.x-e.start.x)*(t.end.y-e.start.y)-(t.start.y-e.start.y)*(t.end.x-e.start.x))*(n=(t.start.x-e.end.x)*(t.end.y-e.end.y)-(t.start.y-e.end.y)*(t.end.x-e.end.x))||0<(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))*(e+i-n)||n==i?null:(n=(e=e/(n-i))*(t.end.x-t.start.x),i=e*(t.end.y-t.start.y),{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))r.unshift(o.line.start),o.polygons.push(r);else 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,d(r),o||s):this.equalPoint(i,a.end)&&!r.includes(a.start)&&this.getIntersectionLines(a,e,n+1,a.start,d(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,d(r.polygons))}return e}},{key:"getTriangles",value:function(t){var e=[],t=this.getPolygon(t);if(t.length){var n,i=u(t);try{for(i.s();!(n=i.n()).done;){var r=n.value,o=this.earCutPointsToTriangles(r);e.push.apply(e,d(o))}}catch(t){i.e(t)}finally{i.f()}}return e}},{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))return r=t.toImageData(this,n,e),this.fillImage(r.data,r.points,n);this.context.uniform1i(this.program.uniforms.a_type.location,i);var r=this.setFragColor(t);this.fillPolygons(e),r&&this.deleteBuffer(r),r&&this.disableVertexAttribArray(r.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],n=this.writePoints(t),e=e?this.writePoints(t,this.program.attrs.a_text_coord):null;this.context.drawArrays(this.context.TRIANGLE_FAN,0,t.length),this.deleteBuffer(n),e&&this.deleteBuffer(e)}},{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));t=this.textureContext.getImageData(0,0,r.width,r.height);this.fillImage(t,this.points,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"},O=(()=>{function i(t,e){var n;return l(this,i),(n=h(this,i,[t=t||{}])).property("type",e||(this instanceof i?this.constructor:void 0).name),n.style=t&&t.style?t.style:{},n.width=t.width||0,n.height=t.height||0,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:n,isRegular:t.isRegular,needCut:t.needCut})),n.initializing(),n.on=n.bind,n.option=t,n}return c(i,Y),e(i,[{key:"type",get:function(){return this.property("type")}},{key:"context",get:function(){var t=this.property("context");return t||(this.is("jmGraph")&&this.canvas&&this.canvas.getContext?this.context=this.canvas.getContext(this.mode||"2d"):(t=this.graph)?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:"children",get:function(){return this.property("children")||this.property("children",new p)},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,n=(this.children=this.children||new p,this.children.add);this.children.add=function(t){if("object"===y(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"===y(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 s=this;if(t=t||g.clone(this.style,!0)){var e,n,a=function(t,e,n){if(t){var i=t;if("function"==typeof i)try{i=i.call(s)}catch(t){return void console.warn(t)}var r=y(i),t=vt[n||e];if(i instanceof m||"string"==r&&-1<i.indexOf("-gradient"))"string"==r&&-1<i.indexOf("-gradient")&&(i=new m(i)),a(i.toGradient(s),t||e);else if(t)s.webglControl?s.webglControl.setStyle(t,i):("string"==r&&-1<["fillStyle","strokeStyle","shadowColor"].indexOf(t)&&(i=g.toColor(i)),s.context[t]=i);else switch(e){case"shadow":if("string"==r)a(new x(i),e);else for(var o in i)a(i[o],o,e+"."+o);break;case"translate":break;case"rotation":void 0===i.angle||isNaN(i.angle)||(i=s.getRotation(i),s.__translateAbsolutePosition=s.toAbsolutePoint({x:i.x,y:i.y}),s.context.translate&&s.context.translate(s.__translateAbsolutePosition.x,s.__translateAbsolutePosition.y),s.context.rotate&&s.context.rotate(i.angle),s.context.translate&&s.context.translate(-s.__translateAbsolutePosition.x,-s.__translateAbsolutePosition.y));break;case"transform":s.context.transform&&(Array.isArray(i)?s.context.transform.apply(s.context,i):"object"==y(i)&&s.context.transform(i.scaleX||1,i.skewX||0,i.skewY||0,i.scaleY||1,i.offsetX||0,i.offsetY||0));break;case"cursor":s.cursor=i}}};for(e in this.translate&&a(this.translate,"translate"),this.transform&&a(this.transform,"transform"),t)"constructor"!==e&&("string"==(n=y(t[e]))&&-1<t[e].indexOf("-gradient")?t[e]=new m(t[e]):"string"==n&&"shadow"==e&&(t[e]=new x(t[e])),a(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=u(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=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:null)||this.getRotation(),e=this.getBounds();if(!t||!t.angle)return e;var n,i,r={width:0,height:0,oldBounds:e},o=[],s=(this.points&&0<this.points.length?o=g.clone(this.points,!0):this.getLocation&&(n=this.getLocation())&&o.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}),u(o=g.rotatePoints(o,{x:t.x+e.left,y:t.y+e.top},t.angle)));try{for(s.s();!(i=s.n()).done;){var a=i.value;(void 0===r.left||r.left>a.x)&&(r.left=a.x),(void 0===r.top||r.top>a.y)&&(r.top=a.y),(void 0===r.right||r.right<a.x)&&(r.right=a.x),(void 0===r.bottom||r.bottom<a.y)&&(r.bottom=a.y)}}catch(t){s.e(t)}finally{s.f()}return r.left||(r.left=0),r.top||(r.top=0),r.right||(r.right=0),r.bottom||(r.bottom=0),r.width=r.right-r.left,r.height=r.bottom-r.top,r}},{key:"getLocation",value:function(){var t=this.location={left:0,top:0,width:0,height:0},e=(t.position="function"==typeof this.position?this.position():g.clone(this.position),t.center=this.center&&"function"==typeof this.center?this.center():g.clone(this.center),t.start=this.start&&"function"==typeof this.start?this.start():g.clone(this.start),t.end=this.end&&"function"==typeof this.end?this.end():g.clone(this.end),t.radius=this.radius,t.width=this.width,t.height=this.height,g.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(),g.checkPercent(t.left)&&(t.left=g.percentToNumber(t.left)*e.width),g.checkPercent(t.top)&&(t.top=g.percentToNumber(t.top)*e.height),g.checkPercent(t.width)&&(t.width=g.percentToNumber(t.width)*e.width),g.checkPercent(t.height)&&(t.height=g.percentToNumber(t.height)*e.height),t.center&&(g.checkPercent(t.center.x)&&(t.center.x=g.percentToNumber(t.center.x)*e.width),g.checkPercent(t.center.y))&&(t.center.y=g.percentToNumber(t.center.y)*e.height),t.radius)&&g.checkPercent(t.radius)&&(t.radius=g.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||g.clone(this.style.rotation))?(e=e||this.getBounds(),void 0===t.x&&(t.x="50%"),void 0===t.y&&(t.y="50%"),g.checkPercent(t.x)&&(t.x=g.percentToNumber(t.x)*e.width),g.checkPercent(t.y)&&(t.y=g.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),f(f({},t),{},{bounds:e})}},{key:"getTranslate",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return(t=t||this.style.translate)?(t={x:t.x||0,y:t.y||0},g.checkPercent(t.x)&&(!e&&this.parent&&(e=this.parent.getBounds()),t.x=g.percentToNumber(t.x)*e.width),g.checkPercent(t.y)&&(!e&&this.parent&&(e=this.parent.getBounds()),t.y=g.percentToNumber(t.y)*e.height),t):{x:0,y:0}}},{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"==y(r.start)&&(this.start.x=r.start.x+t,this.start.y=r.start.y+e,o=!0),r.end&&"object"==y(r.end)&&(this.end.x=r.end.x+t,this.end.y=r.end.y+e,o=!0),0==o&&this.cpoints){this.cpoints;var s=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,e=this.getBounds();return this.parent&&this.parent.absoluteBounds?{left:(t=this.parent.absoluteBounds||this.parent.getAbsoluteBounds()).left+e.left,top:t.top+e.top,right:t.left+e.right,bottom:t.top+e.bottom,width:e.width,height:e.height}:e}},{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(d(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=u(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 p);t.contain(e)||t.add(e)}}},{key:"unbind",value:function(t,e){if(t&&-1<t.indexOf(" ")){var n,i=u(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){var n;if("jmGraph"==this.type)return i=(n=this.getPosition()).left+this.width,o=n.top+this.height,!(t.x>i||t.x<n.left||o<t.y||t.y<n.top);var i=this.getBounds(),r=this.points;if(r&&r.length||((r=[]).push({x:i.left,y:i.top}),r.push({x:i.right,y:i.top}),r.push({x:i.right,y:i.bottom}),r.push({x:i.left,y:i.bottom}),r.push({x:i.left,y:i.top})),e=Number(e||this.style.touchPadding||this.style.lineWidth||1),r&&r.length){var o=this.getRotation(null,i);if(o&&o.angle&&(r=g.clone(r,!0),r=g.rotatePoints(r,{x:o.x+i.left,y:o.y+i.top},o.angle||0)),2<r.length&&(!this.style.fill||this.style.stroke)){for(var s=0,a=r.length,h=s+1;h<=a;h=++s+1)if(h==a){if(this.style.close)if(g.pointInPolygon(t,[r[s],r[0]],e))return!0}else if(g.pointInPolygon(t,[r[s],r[h]],e))return!0;if(!this.style.fill)return!1}return g.pointInPolygon(t,r,e)}return!(t.x>i.right||t.x<i.left||t.y>i.bottom||t.y<i.top)}},{key:"raiseEvent",value:function(n,i){if(!1!==this.visible){i.position||(t=this.graph,i.isWXMiniApp=t.isWXMiniApp,o=i.srcElement||i.target,e=g.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:o,isWXMiniApp:t.isWXMiniApp}),i.path=i.path||[];var t,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 e=(this.parent&&this.parent.absoluteBounds?this.parent:this).absoluteBounds;if(!e)return!1;i.position.x=i.position.offsetX-e.left,i.position.y=i.position.offsetY-e.top;var 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,n,i,r=o;if(r.__mvMonitor.mouseDown)return r.parent.bounds=null,e=t.position.offsetX-r.__mvMonitor.curposition.x,n=t.position.offsetY-r.__mvMonitor.curposition.y,r.option.lockSide&&(i=r.bounds||r.getAbsoluteBounds(),((i=g.checkOutSide(r.option.lockSide,i,{x:e,y:n})).left<0||0<i.right)&&z("offsetx"),i.top<0||0<i.bottom)&&z("offsety"),(e||n)&&(r.offset(e,n,!0,t),e&&(r.__mvMonitor.curposition.x=t.position.offsetX),n)&&(r.__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){return!this.__mvMonitor.mouseDown&&(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}}])})(),dt=(()=>{function n(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"jmPath";return l(this,n),(e=h(this,n,[t,e])).points=t&&t.points?t.points:[],e}return c(n,O),e(n,[{key:"points",get:function(){return this.property("points")},set:function(t){return this.needUpdate=!0,this.property("points",t)}}])})(),yt=(()=>{function o(t,e,n){var i,r;return l(this,o),"function"==typeof e&&(n=e,e={}),(e=e||{}).interactive=!0,e.isRegular=!0,(i=h(this,o,[e,"jmGraph"])).option=e||{},i.devicePixelRatio=1,i.util=i.utils=g,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,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),g.bindEvent(t,"webglcontextlost",function(t){console.log("canvas webglcontextlost",t),i.emit("webglcontextlost",t)}),g.bindEvent(t,"webglcontextrestored",function(t){console.log("canvas webglcontextrestored",t),i.emit("webglcontextrestored",t)})),i.__init(n),i}return c(o,O),e(o,[{key:"__init",value:function(t){this.shapes=Object.assign({path:dt},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 W(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}:g.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 x(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&&(t=this.style&&this.style.fill?this.utils.hexToRGBA(this.style.fill):{r:0,g:0,b:0,a:0},this.context.clearColor(t.r,t.g,t.b,t.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",f({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){var i,r;if(!this.___isAutoRefreshing)return(i=this).___isAutoRefreshing=!0,r=Date.now(),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 r(o,e)}}])})();t.default=yt,t.jmControl=O,t.jmEvents=W,t.jmGradient=m,t.jmGraph=yt,t.jmList=p,t.jmPath=dt,t.jmProperty=Y,t.jmShadow=x,t.jmUtils=g,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
1
|
+
((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){function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e,n){e=o(e);var i=t,e=s()?Reflect.construct(e,n||[],o(t).constructor):e.apply(t,n);if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(i)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e,n){var i;return s()?Reflect.construct.apply(null,arguments):((i=[null]).push.apply(i,e),e=new(t.bind.apply(t,i)),n&&v(e,n.prototype),e)}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,z(i.key),i)}}function e(t,e,n){return e&&I(t.prototype,e),n&&I(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e){var n,i,r,o,s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(s)return r=!(i=!0),{s:function(){s=s.call(t)},n:function(){var t=s.next();return i=t.done,t},e:function(t){r=!0,n=t},f:function(){try{i||null==s.return||s.return()}finally{if(r)throw n}}};if(Array.isArray(t)||(s=F(t))||e&&t&&"number"==typeof t.length)return s&&(t=s),o=0,{s:e=function(){},n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},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.")}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}function s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(s=function(){return!!t})()}function L(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 f(i){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach(function(t){var e,n;e=i,n=r[t=t],(t=z(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(r,t))})}return i}function v(t,e){return(v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function d(t){return(t=>{if(Array.isArray(t))return i(t)})(t)||(t=>{if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)})(t)||F(t)||(()=>{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 z(t){t=((t,e)=>{if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);if("object"!=typeof(n=n.call(t,e||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string");return"symbol"==typeof t?t:t+""}function p(t){return(p="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 F(t,e){var n;if(t)return"string"==typeof t?i(t,e):"Map"===(n="Object"===(n={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}function j(t){var n="function"==typeof Map?new Map:void 0;return function(t){if(null===t||!(e=>{try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}})(t))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 r(t,arguments,o(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),v(e,t)}(t)}var y=(()=>{function s(){l(this,s);for(var t,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=h(this,s,[].concat(e))}else t=h(this,s);return t.option={},t.type="jmList",a(t)}return c(s,j(Array)),e(s,[{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]);else"object"==p(t)&&this.includes(t)||this.push(t);return 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)}}])})(),U={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)"},g=(()=>e(function t(){l(this,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"===p(t)){if(e=e||{},this.isType(t,y))return new y(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 l in t.__proto__&&(e.__proto__=t.__proto__),t)"constructor"!==l&&((n=t[l])&&(n.tagName||n.getContext)?e[l]=n:"object"!==p(e[l])&&void 0!==e[l]||(e[l]=this.clone(n,e[l],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)if(t.offsetParent)for(;t.offsetParent;)e.top+=t.offsetTop,e.left+=t.offsetLeft,t=t.offsetParent;else t.x&&(e.left+=t.x);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,s=(r&&r.length&&((t=r[0]).target||(t.target=o),i=!0),t.pageX||t.x),a=(void 0===s&&(s=t.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),t.pageY||t.y),h=(void 0===a&&(a=t.clientY+(document.documentElement.scrollTop||document.body.scrollTop)),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"!==p(t))&&t.constructor===e}},{key:"pointInPolygon",value:function(t,e,n){n=n||1,n/=2;var i,r,o,s=e.length,a=!1,h=!0;if(!e||0==s)return 0;if(1==s)return Math.abs(e[0].x-t.x)<=n&&Math.abs(e[0].y-t.y)<=n;if(2==s)return Math.min(e[0].x,e[1].x)-t.x>n||t.x-Math.max(e[0].x,e[1].x)>n||Math.min(e[0].y,e[1].y)-t.y>n||t.y-Math.max(e[0].y,e[1].y)>n?0:e[0].x==e[1].x?Math.abs(e[0].x-t.x)<=n&&(t.y-e[0].y)*(t.y-e[1].y)<=0?1:0:e[0].y==e[1].y?Math.abs(e[0].y-t.y)<=n&&(t.x-e[0].x)*(t.x-e[1].x)<=0?1:0:Math.abs(e[0].x-t.x)<n&&Math.abs(e[0].y-t.y)<n||Math.abs(e[1].x-t.x)<n&&Math.abs(e[1].y-t.y)<n||t.y!=e[0].y&&t.y!=e[1].y&&(o=(e[1].x-e[0].x)/(e[1].y-e[0].y)*(t.y-e[0].y),o=(t.y-e[0].y)/Math.sqrt(o*o+(t.y-e[0].y)*(t.y-e[0].y))*(t.x-e[0].x-o),Math.abs(o)<=n)?1:0;for(i=0;i<s;++i)if(e[i].x==t.x&&e[i].y==t.y)return 1;for(;h;)for(a=h=!1,i=0,r=s-1;i<s;r=i++)if(e[i].y<t.y&&t.y<e[r].y||e[r].y<t.y&&t.y<e[i].y){if(t.x<=e[i].x||t.x<=e[r].x){var l=(t.y-e[i].y)*(e[r].x-e[i].x)/(e[r].y-e[i].y)+e[i].x;if(t.x<l)a=!a;else if(t.x==l)return 1}}else if(t.y==e[i].y){if(t.x<e[i].x){e[i].y>e[r].y?--t.y:++t.y,h=!0;break}}else if(e[i].y==e[r].y&&t.y==e[i].y&&(e[i].x<t.x&&t.x<e[r].x||e[r].x<t.x&&t.x<e[i].x)){a=!0;break}return a?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){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 n=t.x-e.x,h=t.y-e.y;t.x=n*i-h*r+e.x,t.y=n*r+h*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){var e,n;return"string"!=typeof t?t:(t=this.trim(t),this.__hexToRGBA_Cache=this.__hexToRGBA_Cache||{},this.__hexToRGBA_Cache[t]||("#"==(n=U[n=t]?U[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"===p(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)}}]))(),G=0,X=(()=>e(function t(e){l(this,t),e&&"jmGraph"==e.type&&(this.graph=e),this.id=++G},[{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 y);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=(new Date).getTime();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){window.console&&window.console.info&&window.console.info(t.toString()),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)}}}]))(),q=Symbol("properties"),H=(()=>{function n(t){var e;return l(this,n),(e=h(this,n))[q]={},t&&t.mode&&(e.mode=t.mode),e}return c(n,X),e(n,[{key:"property",value:function(){for(var t,e,n,i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];if(r)return t=this[q],e=r[0],1<r.length?(n=r[1],n={oldValue:t[e],newValue:n},t[e]=r[1],this.emit&&this.emit("propertyChange",e,n),r[1]):e?t[e]:void 0}},{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 g.requestAnimationFrame(t,this.graph?this.graph.canvas:null)}},{key:"cancelAnimationFrame",value:function(t){return g.cancelAnimationFrame(t,this.graph?this.graph.canvas:null)}}])})(),x=(()=>e(function t(e,n,i,r){l(this,t),"string"!=typeof e||n||i||r?(this.x=e,this.y=n,this.blur=i,this.color=r):this.fromString(e)},[{key:"fromString",value:function(t){if(t)return(t=t.match(/\s*([^,]+)\s*,\s*([^,]+)\s*(,[^,]+)?\s*(,[\s\S]+)?\s*/i))&&(this.x=t[1]||0,this.y=t[2]||0,t[3]&&(t[3]=g.trim(t[3],", "),0===t[3].indexOf("#")||/^rgb/i.test(t[3])?this.color=t[3]:this.blur=g.trim(t[3],", ")),t[4])&&(this.color=g.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}}]))(),m=(()=>e(function t(e){if(l(this,t),this.stops=new y,e&&"object"==p(e)){for(var n in e)"stops"!==n&&(this[n]=e[n]);var i;e.stops&&Array.isArray(e.stops)&&(i=this.stops).push.apply(i,d(e.stops))}else"string"==typeof e&&this.fromString(e)},[{key:"addStop",value:function(t,e){this.stops.add({offset:Number(t),color:e})}},{key:"toGradient",value:function(t){var i,e,n,r=t.context||t,o=t.absoluteBounds||t.getAbsoluteBounds(),s=this.x1||0,a=this.y1||0,h=this.x2,l=this.y2,u=t.getLocation(),c=0,u=(c=(c=u.radius?2*u.radius:c)||Math.min(u.width,u.height),g.checkPercent(s)&&(s=g.percentToNumber(s)*(o.width||c)),g.checkPercent(h)&&(h=g.percentToNumber(h)*(o.width||c)),g.checkPercent(a)&&(a=g.percentToNumber(a)*(o.height||c)),g.checkPercent(l)&&(l=g.percentToNumber(l)*(o.height||c)),Number(s)+o.left),f=Number(a)+o.top,v=Number(h)+o.left,d=Number(l)+o.top;return"linear"===this.type?"webgl"===t.mode&&t.webglControl?(i=t.webglControl.createLinearGradient(s,a,h,l,o)).key=this.toString():r.createLinearGradient&&(i=r.createLinearGradient(u,f,v,d)):"radial"===this.type&&(e=this.r1||0,n=this.r2,g.checkPercent(e)&&(e=g.percentToNumber(e),e*=c),g.checkPercent(n)&&(n=g.percentToNumber(n),n*=c),"webgl"===t.mode&&t.webglControl?(i=t.webglControl.createRadialGradient(s,a,e,h,l,n,o)).key=this.toString():r.createRadialGradient?i=r.createRadialGradient(u,f,e,v,d,n):r.createCircularGradient&&(i=r.createCircularGradient(u,f,n))),i?(this.stops.each(function(t,e){var n=g.toColor(e.color);i&&i.addColorStop(e.offset,n)}),i):(c=this.stops.get(0))&&c.color||"#000"}},{key:"fromString",value:function(t){if(t){t=t.match(/(linear|radial)-gradient\s*\(\s*([^,]+)\s*,\s*((.|\s)+)\)/i);if(t&&!(t.length<3)){this.type=t[1].toLowerCase();var e=g.trim(t[2]).split(/\s+/),n=("linear"==this.type?e.length<=2?(this.x2=e[0],this.y2=e[1]||0):(this.x1=e[0],this.y1=e[1],this.x2=e[2],this.y2=e[3]):e.length<=3?(this.x2=e[0],this.y2=e[1]||0,this.r2=e[2]||0):(this.x1=e[0],this.y1=e[1],this.r1=e[2],this.x2=e[3],this.y2=e[3],this.r2=e[3]),t[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=g.trim(n[i]),s=o.lastIndexOf(" ");-1<s&&(r=Number(o.substr(s+1)),o=g.trim(o.substr(0,s)),!isNaN(r))&&o&&this.addStop(r,o)}}}}},{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+")"}}]))(),Y=(()=>e(function t(e,n){l(this,t),this.container=e,this.target=n||e,this.mouseHandler=new W(this,e,n),this.keyHandler=new Z(this,e,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:"destroy",value:function(){this.mouseHandler.destroy(),this.keyHandler.destroy()}}]))(),W=(()=>e(function t(e,n,i){l(this,t),this.instance=e,this.container=n,this.target=i||n,this.eventEvents={},this.init(e,n,i)},[{key:"init",value:function(e,n,t){var i=this.target,r="undefined"!=typeof document?document:null;this.eventEvents.mousedown=g.bindEvent(this.target,"mousedown",function(t){(t=t||window.event).eventName="mousedown",n.raiseEvent("mousedown",t)}),this.eventEvents.mousemove=g.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=g.bindEvent(this.target,"mouseover",function(t){(t=t||window.event).eventName="mouseover",n.raiseEvent("mouseover",t)}),this.eventEvents.mouseleave=g.bindEvent(this.target,"mouseleave",function(t){(t=t||window.event).eventName="mouseleave",n.raiseEvent("mouseleave",t)}),this.eventEvents.mouseout=g.bindEvent(this.target,"mouseout",function(t){(t=t||window.event).eventName="mouseout",n.raiseEvent("mouseout",t)}),r&&(this.eventEvents.mouseup=g.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=g.bindEvent(this.target,"dblclick",function(t){(t=t||window.event).eventName="dblclick",n.raiseEvent("dblclick",t)}),this.eventEvents.click=g.bindEvent(this.target,"click",function(t){(t=t||window.event).eventName="click",n.raiseEvent("click",t)}),r&&(this.eventEvents.resize=g.bindEvent(r,"resize",function(t){return(t=t||window.event).eventName="resize",n.raiseEvent("resize",t)})),this.eventEvents.touchstart=g.bindEvent(this.target,"touchstart",function(t){return t.eventName="touchstart",e.touchStart(t)},{passive:!1}),this.eventEvents.touchmove=g.bindEvent(this.target,"touchmove",function(t){return t.eventName="touchmove",e.touchMove(t)},{passive:!1}),r&&(this.eventEvents.touchend=g.bindEvent(r,"touchend",function(t){return t.eventName="touchend",e.touchEnd(t)},{passive:!1})),r&&(this.eventEvents.touchcancel=g.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&&g.removeEvent(e.target,t,e.fun)}}}]))(),Z=(()=>e(function t(e,n,i){l(this,t),this.instance=e,this.container=n,this.target=i||n,this.eventEvents={},this.init(n,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=g.bindEvent(e,"keypress",function(t){var e;if(t=t||window.event,i(t))return!1===(e=n.raiseEvent("keypress",t))&&t.preventDefault&&t.preventDefault(),e})),e&&(this.eventEvents.keydown=g.bindEvent(e,"keydown",function(t){var e;if(t=t||window.event,i(t))return!1===(e=n.raiseEvent("keydown",t))&&t.preventDefault&&t.preventDefault(),e})),e&&(this.eventEvents.keyup=g.bindEvent(e,"keyup",function(t){var e;if(t=t||window.event,i(t))return!1===(e=n.raiseEvent("keyup",t))&&t.preventDefault&&t.preventDefault(),e}))}},{key:"destroy",value:function(){for(var t in this.eventEvents){var e=this.eventEvents[t];e&&e.fun&&g.removeEvent(e.target,t,e.fun)}}}]))();function n(t,e,n){n=n||2;var i,r,o,s,a,h=e&&e.length,l=h?e[0]*n:t.length,u=V(t,0,l,n,!0),c=[];if(u&&u.next!==u.prev){if(h&&(u=((t,e,n,i)=>{var r,o,s,a,h=[];for(r=0,o=e.length;r<o;r++)a=e[r]*i,s=r<o-1?e[r+1]*i:t.length,(a=V(t,a,s,i,!1))===a.next&&(a.steiner=!0),h.push((t=>{for(var e=t,n=t;(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),(e=e.next)!==t;);return n})(a));for(h.sort(K),r=0;r<h.length;r++)n=((t,e)=>{var n=((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)!==e);if(!n)return null;var h,l=n,u=n.x,c=n.y,f=1/0;for(i=n;r>=i.x&&i.x>=u&&r!==i.x&&S(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),M(i,t))&&(h<f||h===f&&(i.x>n.x||i.x===n.x&&((t,e)=>C(t.prev,t,e.prev)<0&&C(e.next,t,t.next)<0)(n,i)))&&(n=i,f=h),(i=i.next)!==l;);return n})(t,e);return n?(E(t=Q(n,t),t.next),E(n,n.next)):e})(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}T(u,c,n,f,v,a,0)}return c}function V(t,e,n,i,r){var o,s;if(r===0<k(t,e,n,i))for(o=e;o<n;o+=i)s=$(o,t[o],t[o+1],s);else for(o=n-i;e<=o;o-=i)s=$(o,t[o],t[o+1],s);return s&&R(s,s.next)&&(N(s),s=s.next),s}function E(t,e){if(!t)return t;e=e||t;var n,i=t;do{if(n=!1,i.steiner||!R(i,i.next)&&0!==C(i.prev,i,i.next))i=i.next;else{if(N(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function T(t,e,n,i,r,o,s){if(t){if(!s&&o){for(var a=t,h=i,l=r,u=o,c=a;0===c.z&&(c.z=P(c.x,c.y,h,l,u)),c.prevZ=c.prev,c.nextZ=c.next,(c=c.next)!==a;);c.prevZ.nextZ=null,c.prevZ=null;var f,v,d,p,y,g,x,m,b=c,w=1;do{for(v=b,y=b=null,g=0;v;){for(g++,d=v,f=x=0;f<w&&(x++,d=d.nextZ);f++);for(m=w;0<x||0<m&&d;)0!==x&&(0===m||!d||v.z<=d.z)?(v=(p=v).nextZ,x--):(d=(p=d).nextZ,m--),y?y.nextZ=p:b=p,p.prevZ=y,y=p;v=d}}while(y.nextZ=null,w*=2,1<g)}for(var _,k,A=t;t.prev!==t.next;)if(_=t.prev,k=t.next,o?((t,e,n,i)=>{var r=t.prev,o=t,s=t.next;if(!(0<=C(r,o,s))){for(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=P(v,d,e,n,i),x=P(p,y,e,n,i),m=t.prevZ,b=t.nextZ;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&&S(a,u,h,c,l,f,m.x,m.y)&&0<=C(m.prev,m,m.next))return;if(m=m.prevZ,b.x>=v&&b.x<=p&&b.y>=d&&b.y<=y&&b!==r&&b!==s&&S(a,u,h,c,l,f,b.x,b.y)&&0<=C(b.prev,b,b.next))return;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&&S(a,u,h,c,l,f,m.x,m.y)&&0<=C(m.prev,m,m.next))return;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&&S(a,u,h,c,l,f,b.x,b.y)&&0<=C(b.prev,b,b.next))return;b=b.nextZ}return 1}})(t,i,r,o):(t=>{var e=t.prev,n=t,t=t.next;if(!(0<=C(e,n,t))){for(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;v!==e;){if(v.x>=l&&v.x<=c&&v.y>=u&&v.y<=f&&S(i,s,r,a,o,h,v.x,v.y)&&0<=C(v.prev,v,v.next))return;v=v.next}return 1}})(t))e.push(_.i/n|0),e.push(t.i/n|0),e.push(k.i/n|0),N(t),t=k.next,A=k.next;else if((t=k)===A){s?1===s?T(t=((t,e,n)=>{var i=t;do{var r=i.prev,o=i.next.next}while(!R(r,o)&&J(r,i,i.next,o)&&M(r,o)&&M(o,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(o.i/n|0),N(i),N(i.next),i=t=o),(i=i.next)!==t);return E(i)})(E(t),e,n),e,n,i,r,o,2):2===s&&((t,e,n,i,r,o)=>{var s=t;do{for(var a,h=s.next.next;h!==s.prev;){if(s.i!==h.i&&((t,e)=>t.next.i!==e.i&&t.prev.i!==e.i&&!((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&&J(n,n.next,t,e))return 1}while((n=n.next)!==t)})(t,e)&&(M(t,e)&&M(e,t)&&((t,e)=>{for(var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;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)!==t;);return i})(t,e)&&(C(t.prev,t,e.prev)||C(t,e.prev,e))||R(t,e)&&0<C(t.prev,t,t.next)&&0<C(e.prev,e,e.next)))(s,h))return a=Q(s,h),s=E(s,s.next),a=E(a,a.next),T(s,e,n,i,r,o,0),T(a,e,n,i,r,o,0);h=h.next}}while((s=s.next)!==t)})(t,e,n,i,r,o):T(E(t),e,n,i,r,o,1);break}}}function K(t,e){return t.x-e.x}function P(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 S(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 C(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function R(t,e){return t.x===e.x&&t.y===e.y}function J(t,e,n,i){var r=w(C(t,e,n)),o=w(C(t,e,i)),s=w(C(n,i,t)),a=w(C(n,i,e));return r!==o&&s!==a||0===r&&b(t,n,e)||0===o&&b(t,i,e)||0===s&&b(n,t,i)||!(0!==a||!b(n,e,i))}function b(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 M(t,e){return C(t.prev,t,t.next)<0?0<=C(t,e,t.next)&&0<=C(t,t.prev,e):C(t,e,t.prev)<0||C(t,t.next,e)<0}function Q(t,e){var n=new _(t.i,t.x,t.y),i=new _(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,(o.next=n.prev=i).prev=o,i}function $(t,e,n,i){t=new _(t,e,n);return i?(t.next=i.next,(t.prev=i).next.prev=t,i.next=t):(t.prev=t).next=t,t}function N(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 _(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}n.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 l=e[a]*n,u=a<h-1?e[a+1]*n:t.length;s-=Math.abs(k(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)},n.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 A=(()=>e(function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"linear",n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};l(this,t),this.type=e||"linear",this.x1=n.x1||0,this.y1=n.y1||0,this.r1=n.r1||0,this.x2=n.x2||0,this.y2=n.y2||0,this.r2=n.r2||0,this.bounds=n.bounds||{left:0,top:0,width:0,height:0},this.control=n.control,this.stops=[],this.init()},[{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 r,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return i.textureContext?(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)}),i.toFillTexture(r,t,e)):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+")"}}]))();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]},B=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(!B){var n=Object.keys(it);B={};for(var i=0;i<n.length;++i){var r=n[i];B[t[r]]=it[r]}}return B[e]};function ot(t,e,n){var e=tt(t,t.VERTEX_SHADER,e),n=tt(t,t.FRAGMENT_SHADER,n),i=t.createProgram();return t.attachShader(i,e),t.attachShader(i,n),t.linkProgram(i),t.getProgramParameter(i,t.LINK_STATUS)||(console.error("PError: Could not initialize shader."),console.error("gl.VALIDATE_STATUS",t.getProgramParameter(i,t.VALIDATE_STATUS)),console.error("gl.getError()",t.getError()),""!==t.getProgramInfoLog(i)&&console.warn("Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(i)),t.deleteProgram(i)),st(t,i),t.deleteShader(e),t.deleteShader(n),{program:i,attrs:((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:nt(s),type:s,location:t.getAttribLocation(e,o.name)}}return n})(t,i),uniforms:((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,i)}}function st(t,e){t.useProgram(e)}function at(t,e,n,i){var n=2<arguments.length&&void 0!==n?n:t.ARRAY_BUFFER,i=3<arguments.length&&void 0!==i?i:t.STATIC_DRAW,r=t.createBuffer();if(r)return t.bindBuffer(n,r),t.bufferData(n,e.buffer||e,i),{type:n,drawType:i,buffer:r,unitSize:e.BYTES_PER_ELEMENT};throw Error("创建缓冲区对象失败")}function D(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 ht="\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"),ut=(()=>e(function t(e,n){l(this,t),this.graph=e,this.option=n||{},this.style={globalAlpha:1}},[{key:"context",get:function(){if(this.graph)return this.graph.context}},{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(ht,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=f(f({},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&&(st(this.context,t.program||t),this.context.__curent_program=t),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 f({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 f({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 D(this.context)}},{key:"createImgTexture",value:function(t){return e=this.context,t=t,n=D(e),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),{texture:n};var e,n}},{key:"createDataTexture",value:function(t){return e=this.context,t=t,n=new Uint8Array(t.data||t),i=D(e),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.width||1,t.height||1,0,e.RGBA,e.UNSIGNED_BYTE,n),{texture:i};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 n(this.pointsToArray(t))}},{key:"earCutPointsToTriangles",value:function(t){for(var e=this.earCutPoints(t),n=[],i=0;i<e.length;i+=3){var r=t[e[i]],o=t[e[i+1]],s=t[e[i+2]];n.push([r,o,s])}return n}},{key:"pointsToArray",value:function(t){var e;return(e=[]).concat.apply(e,d(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 A("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 A("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 A}},{key:"testSize",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.style,e=(this.textureContext.save&&this.textureContext.save(),(e.font||e.fontSize)&&(this.textureContext.font=e.font||e.fontSize+"px "+e.fontFamily),this.textureContext.measureText?this.textureContext.measureText(t):{width:15});return this.textureContext.restore&&this.textureContext.restore(),e.height=this.style.fontSize||15,e}},{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=u(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}}}]))(),ct=(()=>{function n(t,e){return l(this,n),(t=h(this,n,[t,e])).isRegular=e.isRegular||!1,t.needCut=e.needCut||!1,t.control=e.control,t.points=[],t}return c(n,ut),e(n,[{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=u(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=u(t);try{for(r.s();!(e=r.n()).done;){var o=e.value;i.push(o.x+this.parentAbsoluteBounds.left,o.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 l=t.x+s*h;n.push({x:l,y:t.y+a*h})}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,d(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))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)||(o={start:r.start,end:h},s={start:h,end:r.end},t.splice(n,1,o,s),n++)),n++,a)return this.cutLines(t,e,n)}}n=++e+1}return t}},{key:"getIntersection",value:function(t,e){var n,i;return this.equalPoint(t.start,e.start)||this.equalPoint(t.start,e.end)?t.start:this.equalPoint(t.end,e.start)||this.equalPoint(t.end,e.end)?t.end:0<(i=(t.start.x-e.start.x)*(t.end.y-e.start.y)-(t.start.y-e.start.y)*(t.end.x-e.start.x))*(n=(t.start.x-e.end.x)*(t.end.y-e.end.y)-(t.start.y-e.end.y)*(t.end.x-e.end.x))||0<(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))*(e+i-n)||n==i?null:(n=(e=e/(n-i))*(t.end.x-t.start.x),i=e*(t.end.y-t.start.y),{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))r.unshift(o.line.start),o.polygons.push(r);else 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,d(r),o||s):this.equalPoint(i,a.end)&&!r.includes(a.start)&&this.getIntersectionLines(a,e,n+1,a.start,d(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,d(r.polygons))}return e}},{key:"getTriangles",value:function(t){var e=[],t=this.getPolygon(t);if(t.length){var n,i=u(t);try{for(i.s();!(n=i.n()).done;){var r=n.value,o=this.earCutPointsToTriangles(r);e.push.apply(e,d(o))}}catch(t){i.e(t)}finally{i.f()}}return e}},{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))return r=t.toImageData(this,n,e),this.fillImage(r.data,r.points,n);this.context.uniform1i(this.program.uniforms.a_type.location,i);var r=this.setFragColor(t);this.fillPolygons(e),r&&this.deleteBuffer(r),r&&this.disableVertexAttribArray(r.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],n=this.writePoints(t),e=e?this.writePoints(t,this.program.attrs.a_text_coord):null;this.context.drawArrays(this.context.TRIANGLE_FAN,0,t.length),this.deleteBuffer(n),e&&this.deleteBuffer(e)}},{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));t=this.textureContext.getImageData(0,0,r.width,r.height);this.fillImage(t,this.points,i)}}])})(),ft={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"},O=(()=>{function i(t,e){var n;return l(this,i),(n=h(this,i,[t=t||{}])).property("type",e||(this instanceof i?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 ct(n.graph,{style:n.style,control:n,isRegular:t.isRegular,needCut:t.needCut})),n.initializing(),n.on=n.bind,n.option=t,n}return c(i,H),e(i,[{key:"type",get:function(){return this.property("type")}},{key:"context",get:function(){var t=this.property("context");return t||(this.is("jmGraph")&&this.canvas&&this.canvas.getContext?this.context=this.canvas.getContext(this.mode||"2d"):(t=this.graph)?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 y)},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,n=(this.children=this.children||new y,this.children.add);this.children.add=function(t){if("object"===p(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"===p(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 s=this;if(t=t||g.clone(this.style,!0)){var e,n,a=function(t,e,n){if(t){var i=t;if("function"==typeof i)try{i=i.call(s)}catch(t){return void console.warn(t)}var r=p(i),t=ft[n||e];if(i instanceof m||"string"==r&&-1<i.indexOf("-gradient"))"string"==r&&-1<i.indexOf("-gradient")&&(i=new m(i)),a(i.toGradient(s),t||e);else if(t)s.webglControl?s.webglControl.setStyle(t,i):("string"==r&&-1<["fillStyle","strokeStyle","shadowColor"].indexOf(t)&&(i=g.toColor(i)),s.context[t]=i);else switch(e){case"shadow":if("string"==r)a(new x(i),e);else for(var o in i)a(i[o],o,e+"."+o);break;case"translate":break;case"rotation":void 0===i.angle||isNaN(i.angle)||(i=s.getRotation(i),s.__translateAbsolutePosition=s.toAbsolutePoint({x:i.x,y:i.y}),s.context.translate&&s.context.translate(s.__translateAbsolutePosition.x,s.__translateAbsolutePosition.y),s.context.rotate&&s.context.rotate(i.angle),s.context.translate&&s.context.translate(-s.__translateAbsolutePosition.x,-s.__translateAbsolutePosition.y));break;case"transform":s.context.transform&&(Array.isArray(i)?s.context.transform.apply(s.context,i):"object"==p(i)&&s.context.transform(i.scaleX||1,i.skewX||0,i.skewY||0,i.scaleY||1,i.offsetX||0,i.offsetY||0));break;case"cursor":s.cursor=i}}};for(e in this.translate&&a(this.translate,"translate"),this.transform&&a(this.transform,"transform"),t)"constructor"!==e&&("string"==(n=p(t[e]))&&-1<t[e].indexOf("-gradient")?t[e]=new m(t[e]):"string"==n&&"shadow"==e&&(t[e]=new x(t[e])),a(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=u(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=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:null)||this.getRotation(),e=this.getBounds();if(!t||!t.angle)return e;var n,i,r={width:0,height:0,oldBounds:e},o=[],s=(this.points&&0<this.points.length?o=g.clone(this.points,!0):this.getLocation&&(n=this.getLocation())&&o.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}),u(o=g.rotatePoints(o,{x:t.x+e.left,y:t.y+e.top},t.angle)));try{for(s.s();!(i=s.n()).done;){var a=i.value;(void 0===r.left||r.left>a.x)&&(r.left=a.x),(void 0===r.top||r.top>a.y)&&(r.top=a.y),(void 0===r.right||r.right<a.x)&&(r.right=a.x),(void 0===r.bottom||r.bottom<a.y)&&(r.bottom=a.y)}}catch(t){s.e(t)}finally{s.f()}return r.left||(r.left=0),r.top||(r.top=0),r.right||(r.right=0),r.bottom||(r.bottom=0),r.width=r.right-r.left,r.height=r.bottom-r.top,r}},{key:"getLocation",value:function(){var t=this.location={left:0,top:0,width:0,height:0},e=(t.position="function"==typeof this.position?this.position():g.clone(this.position),t.center=this.center&&"function"==typeof this.center?this.center():g.clone(this.center),t.start=this.start&&"function"==typeof this.start?this.start():g.clone(this.start),t.end=this.end&&"function"==typeof this.end?this.end():g.clone(this.end),t.radius=this.radius,t.width=this.width,t.height=this.height,g.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(),g.checkPercent(t.left)&&(t.left=g.percentToNumber(t.left)*e.width),g.checkPercent(t.top)&&(t.top=g.percentToNumber(t.top)*e.height),g.checkPercent(t.width)&&(t.width=g.percentToNumber(t.width)*e.width),g.checkPercent(t.height)&&(t.height=g.percentToNumber(t.height)*e.height),t.center&&(g.checkPercent(t.center.x)&&(t.center.x=g.percentToNumber(t.center.x)*e.width),g.checkPercent(t.center.y))&&(t.center.y=g.percentToNumber(t.center.y)*e.height),t.radius)&&g.checkPercent(t.radius)&&(t.radius=g.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||g.clone(this.style.rotation))?(e=e||this.getBounds(),void 0===t.x&&(t.x="50%"),void 0===t.y&&(t.y="50%"),g.checkPercent(t.x)&&(t.x=g.percentToNumber(t.x)*e.width),g.checkPercent(t.y)&&(t.y=g.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),f(f({},t),{},{bounds:e})}},{key:"getTranslate",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return(t=t||this.style.translate)?(t={x:t.x||0,y:t.y||0},g.checkPercent(t.x)&&(!e&&this.parent&&(e=this.parent.getBounds()),t.x=g.percentToNumber(t.x)*e.width),g.checkPercent(t.y)&&(!e&&this.parent&&(e=this.parent.getBounds()),t.y=g.percentToNumber(t.y)*e.height),t):{x:0,y:0}}},{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"==p(r.start)&&(this.start.x=r.start.x+t,this.start.y=r.start.y+e,o=!0),r.end&&"object"==p(r.end)&&(this.end.x=r.end.x+t,this.end.y=r.end.y+e,o=!0),0==o&&this.cpoints){this.cpoints;var s=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,e=this.getBounds();return this.parent&&this.parent.absoluteBounds?{left:(t=this.parent.absoluteBounds||this.parent.getAbsoluteBounds()).left+e.left,top:t.top+e.top,right:t.left+e.right,bottom:t.top+e.bottom,width:e.width,height:e.height}:e}},{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(d(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=u(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 y);t.contain(e)||t.add(e)}}},{key:"unbind",value:function(t,e){if(t&&-1<t.indexOf(" ")){var n,i=u(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)return o=(i=this.getPosition()).left+this.width,n=i.top+this.height,!(t.x>o||t.x<i.left||n<t.y||t.y<i.top);var n,i,r,o=this.getBounds();if(this.hitArea)return n=this.hitArea.x+o.left,i=this.hitArea.y+o.top,a=this.hitArea.width+o.left,r=this.hitArea.height+o.top,!(t.x>a||t.x<n||r<t.y||t.y<i);var s=this.points;if(s&&s.length||((s=[]).push({x:o.left,y:o.top}),s.push({x:o.right,y:o.top}),s.push({x:o.right,y:o.bottom}),s.push({x:o.left,y:o.bottom}),s.push({x:o.left,y:o.top})),e=Number(e||this.style.touchPadding||this.style.lineWidth||1),s&&s.length){var a=this.getRotation(null,o);if(a&&a.angle&&(s=g.clone(s,!0),s=g.rotatePoints(s,{x:a.x+o.left,y:a.y+o.top},a.angle||0)),2<s.length&&(!this.style.fill||this.style.stroke)){for(var h=0,l=s.length,u=h+1;u<=l;u=++h+1)if(u==l){if(this.style.close)if(g.pointInPolygon(t,[s[h],s[0]],e))return!0}else if(g.pointInPolygon(t,[s[h],s[u]],e))return!0;if(!this.style.fill)return!1}return g.pointInPolygon(t,s,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){i.position||(t=this.graph,i.isWXMiniApp=t.isWXMiniApp,o=i.srcElement||i.target,e=g.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:o,isWXMiniApp:t.isWXMiniApp}),i.path=i.path||[];var t,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 e=(this.parent&&this.parent.absoluteBounds?this.parent:this).absoluteBounds;if(!e)return!1;i.position.x=i.position.offsetX-e.left,i.position.y=i.position.offsetY-e.top;var 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,n,i,r=o;if(r.__mvMonitor.mouseDown)return r.parent.bounds=null,e=t.position.offsetX-r.__mvMonitor.curposition.x,n=t.position.offsetY-r.__mvMonitor.curposition.y,r.option.lockSide&&(i=r.bounds||r.getAbsoluteBounds(),((i=g.checkOutSide(r.option.lockSide,i,{x:e,y:n})).left<0||0<i.right)&&(e=0),i.top<0||0<i.bottom)&&(n=0),(e||n)&&(r.offset(e,n,!0,t),e&&(r.__mvMonitor.curposition.x=t.position.offsetX),n)&&(r.__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){return!this.__mvMonitor.mouseDown&&(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}}])})(),vt=(()=>{function n(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"jmPath";return l(this,n),(e=h(this,n,[t,e])).points=t&&t.points?t.points:[],e}return c(n,O),e(n,[{key:"points",get:function(){return this.property("points")},set:function(t){return this.needUpdate=!0,this.property("points",t)}}])})(),dt=(()=>{function o(t,e,n){var i,r;return l(this,o),"function"==typeof e&&(n=e,e={}),(e=e||{}).interactive=!0,e.isRegular=!0,(i=h(this,o,[e,"jmGraph"])).option=e||{},i.devicePixelRatio=1,i.util=i.utils=g,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,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),g.bindEvent(t,"webglcontextlost",function(t){console.log("canvas webglcontextlost",t),i.emit("webglcontextlost",t)}),g.bindEvent(t,"webglcontextrestored",function(t){console.log("canvas webglcontextrestored",t),i.emit("webglcontextrestored",t)})),i.__init(n),i}return c(o,O),e(o,[{key:"__init",value:function(t){this.shapes=Object.assign({path:vt},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 Y(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}:g.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 x(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&&(t=this.style&&this.style.fill?this.utils.hexToRGBA(this.style.fill):{r:0,g:0,b:0,a:0},this.context.clearColor(t.r,t.g,t.b,t.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",f({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){var i,r;if(!this.___isAutoRefreshing)return(i=this).___isAutoRefreshing=!0,r=Date.now(),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 r(o,e)}}])})();t.default=dt,t.jmControl=O,t.jmEvents=Y,t.jmGradient=m,t.jmGraph=dt,t.jmList=y,t.jmPath=vt,t.jmProperty=H,t.jmShadow=x,t.jmUtils=g,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=jmgraph.core.min.js.map
|