dada-datav-vue3
Version:
dataV组件vue3版本
17 lines • 216 kB
JavaScript
(function(E,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(E=typeof globalThis!="undefined"?globalThis:E||self,t(E["dada/datav-vue3"]={},E.Vue))})(this,function(E,t){"use strict";var ut=new Map([["transparent","rgba(0,0,0,0)"],["black","#000000"],["silver","#C0C0C0"],["gray","#808080"],["white","#FFFFFF"],["maroon","#800000"],["red","#FF0000"],["purple","#800080"],["fuchsia","#FF00FF"],["green","#008000"],["lime","#00FF00"],["olive","#808000"],["yellow","#FFFF00"],["navy","#000080"],["blue","#0000FF"],["teal","#008080"],["aqua","#00FFFF"],["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["blanchedalmond","#ffebcd"],["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"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["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"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["oldlace","#fdf5e6"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["whitesmoke","#f5f5f5"],["yellowgreen","#9acd32"]]);const Ze=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/,ht=/^(rgb|rgba|RGB|RGBA)/,no=/^(rgba|RGBA)/;function gt(e){let i=Ze.test(e),r=ht.test(e);return i||r?e:(e=oo(e),e||(console.error("Color: Invalid color!"),!1))}function oo(e){return e?ut.has(e)?ut.get(e):!1:(console.error("getColorByKeywords: Missing parameters!"),!1)}function v(e){if(!e)return console.error("getRgbValue: Missing parameters!"),!1;if(e=gt(e),!e)return!1;const i=Ze.test(e),r=ht.test(e),o=e.toLowerCase();if(i)return ro(o);if(r)return io(o)}function ro(e){return e=e.replace("#",""),e.length===3&&(e=Array.from(e).map(i=>i+i).join("")),e=e.split(""),new Array(3).fill(0).map((i,r)=>parseInt(`0x${e[r*2]}${e[r*2+1]}`))}function io(e){return e.replace(/rgb\(|rgba\(|\)/g,"").split(",").slice(0,3).map(i=>parseInt(i))}function X(e){if(!e)return console.error("getRgbaValue: Missing parameters!"),!1;const i=v(e);return i?(i.push(mt(e)),i):!1}function mt(e){return e?(e=gt(e),e?no.test(e)?(e=e.toLowerCase(),Number(e.split(",").slice(-1)[0].replace(/[)|\s]/g,""))):1:!1):(console.error("getOpacity: Missing parameters!"),!1)}function ao(e,i){if(!e)return console.error("toRgb: Missing parameters!"),!1;const r=v(e);return r?typeof i=="number"?"rgba("+r.join(",")+`,${i})`:"rgb("+r.join(",")+")":!1}function lo(e){return e?Ze.test(e)?e:(e=v(e),e?"#"+e.map(i=>Number(i).toString(16)).map(i=>i==="0"?"00":i).join(""):!1):(console.error("toHex: Missing parameters!"),!1)}function H(e){if(!e)return console.error("getColorFromRgbValue: Missing parameters!"),!1;const i=e.length;if(i!==3&&i!==4)return console.error("getColorFromRgbValue: Value is illegal!"),!1;let r=i===3?"rgb(":"rgba(";return r+=e.join(",")+")",r}function so(e,i=0){if(!e)return console.error("darken: Missing parameters!"),!1;let r=X(e);return r?(r=r.map((o,n)=>n===3?o:o-Math.ceil(2.55*i)).map(o=>o<0?0:o),H(r)):!1}function co(e,i=0){if(!e)return console.error("lighten: Missing parameters!"),!1;let r=X(e);return r?(r=r.map((o,n)=>n===3?o:o+Math.ceil(2.55*i)).map(o=>o>255?255:o),H(r)):!1}function z(e,i=100){if(!e)return console.error("fade: Missing parameters!"),!1;const r=v(e);if(!r)return!1;const o=[...r,i/100];return H(o)}var fo={fade:z,toHex:lo,toRgb:ao,darken:so,lighten:co,getOpacity:mt,getRgbValue:v,getRgbaValue:X,getColorFromRgbValue:H};function ee(e,i){return arguments.length===1?parseInt((Math.random()*e+1).toString(),10):parseInt((Math.random()*(i-e+1)+e).toString(),10)}function uo(e,i,r){let o;return function(){clearTimeout(o),o=setTimeout(()=>{i.call(r,...arguments)},e)}}function ho(e,i){const r=window.MutationObserver,o=new r(i);return o.observe(e,{attributes:!0,attributeFilter:["style"],attributeOldValue:!0}),o}function ie(e,i){const r=Math.abs(e[0]-i[0]),o=Math.abs(e[1]-i[1]);return Math.sqrt(r*r+o*o)}function K(e,i,r,o){return[e+Math.cos(o)*r,i+Math.sin(o)*r]}function go(e){return e.filter(i=>typeof i=="number")}function mo(e){return e=go(e),e.reduce((i,r)=>i+r,0)}function po(e,i){const r=Math.abs(e.x-i.x),o=Math.abs(e.y-i.y);return Math.sqrt(r*r+o*o)}function pt(e){const r=new Array(e.length-1).fill(0).map((o,n)=>[e[n],e[n+1]]).map(o=>po(o[0],o[1]));return mo(r)}function yo(e){return`${e.x},${e.y}`}function yt(e){return e.map(yo).join(" ")}function j(e){return(e?"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx":"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx").replace(/[xy]/g,i=>{const r=Math.random()*16|0;return(i==="x"?r:r&3|8).toString(16)})}function S(e,i){for(const r in i){if(e[r]&&typeof e[r]=="object"){S(e[r],i[r]);continue}if(typeof i[r]=="object"){e[r]=L(i[r],!0);continue}e[r]=i[r]}return e}function L(e,i){if(!e)return e;const{parse:r,stringify:o}=JSON;if(!i)return r(o(e));const n=e instanceof Array?[]:{};if(e&&typeof e=="object")for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(e[a]&&typeof e[a]=="object"?n[a]=L(e[a],!0):n[a]=e[a]);return n}const D=(e,i,r)=>{const o=t.ref(0),n=t.ref(0);let a,l=null,s=null;const c=(x=!0)=>new Promise(b=>{t.nextTick(()=>{s=e.value,o.value=e.value?e.value.clientWidth:0,n.value=e.value?e.value.clientHeight:0,e.value?(!o.value||!n.value)&&console.warn("DataV: Component width or height is 0px, rendering abnormality may occur!"):console.warn("DataV: Failed to get dom node, component rendering may be abnormal!"),typeof i=="function"&&x&&i(),b(!0)})}),d=()=>{a=uo(100,c,void 0)},f=()=>{l=ho(s,a),window.addEventListener("resize",a)},u=()=>{!l||(l.disconnect(),l.takeRecords(),l=null,window.removeEventListener("resize",a))},m=async()=>{await c(!1),d(),f(),typeof r=="function"&&r()};return t.onMounted(()=>{m()}),t.onUnmounted(()=>{u()}),{width:o,height:n}};var Q0=(()=>`.dv-conical-column-chart{width:100%;height:100%}.dv-conical-column-chart text{text-anchor:middle}
`)();const bo=["width","height"],$o=["d","fill"],xo=["fill","x","y"],ko=["xlink:href","width","height","x","y"],Co=["fill","x","y"],bt={__name:"index",props:{config:{type:Object,default:()=>({})}},setup(e){const i=e,r=t.ref(null),{width:o,height:n}=D(r,s,l),a=t.reactive({defaultConfig:{data:[],img:[],fontSize:12,imgSideLength:30,columnColor:"rgba(0, 194, 255, 0.4)",textColor:"#fff",showValue:!1},mergedConfig:null,column:[]});t.watch(()=>i.config,()=>{c()},{deep:!0});function l(){c()}function s(){c()}function c(){d(),f(),u()}function d(){a.mergedConfig=S(L(a.defaultConfig,!0),i.config||{})}function f(){let{data:m}=a.mergedConfig;m=L(m,!0),m.sort(({value:b},{value:w})=>b>w?-1:b<w?1:0);const x=m[0]?m[0].value:10;m=m.map(b=>({...b,percent:b.value/x})),a.mergedConfig.data=m}function u(){const{imgSideLength:m,fontSize:x,data:b}=a.mergedConfig,w=b.length,$=o.value/(w+1),k=n.value-m-x-5,_=n.value-x-5;a.column=b.map((h,p)=>{const{percent:g}=h,y=$*(p+1),C=$*p,N=$*(p+2),B=_-k*g,A=k*g*.6+B,P=`
M${C}, ${_}
Q${y}, ${A} ${y},${B}
M${y},${B}
Q${y}, ${A} ${N},${_}
L${C}, ${_}
Z
`,M=(_+B)/2+x/2;return{...h,d:P,x:y,y:B,textY:M}})}return(m,x)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"conicalColumnChart",ref:r,class:"dv-conical-column-chart"},[(t.openBlock(),t.createElementBlock("svg",{width:t.unref(o),height:t.unref(n)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.column,(b,w)=>(t.openBlock(),t.createElementBlock("g",{key:w},[t.createElementVNode("path",{d:b.d,fill:a.mergedConfig.columnColor},null,8,$o),t.createElementVNode("text",{style:t.normalizeStyle(`fontSize:${a.mergedConfig.fontSize}px`),fill:a.mergedConfig.textColor,x:b.x,y:t.unref(n)-4},t.toDisplayString(b.name),13,xo),a.mergedConfig.img.length?(t.openBlock(),t.createElementBlock("image",{key:0,"xlink:href":a.mergedConfig.img[w%a.mergedConfig.img.length],width:a.mergedConfig.imgSideLength,height:a.mergedConfig.imgSideLength,x:b.x-a.mergedConfig.imgSideLength/2,y:b.y-a.mergedConfig.imgSideLength},null,8,ko)):t.createCommentVNode("",!0),a.mergedConfig.showValue?(t.openBlock(),t.createElementBlock("text",{key:1,style:t.normalizeStyle(`fontSize:${a.mergedConfig.fontSize}px`),fill:a.mergedConfig.textColor,x:b.x,y:b.textY},t.toDisplayString(b.value),13,Co)):t.createCommentVNode("",!0)]))),128))],8,bo))],512))}},ae={install(e){e.component("DvConicalColumnChart",bt)}};var X0=(()=>`.dv-percent-pond{position:relative;display:flex;flex-direction:column}.dv-percent-pond svg{position:absolute;left:0px;top:0px;width:100%;height:100%}.dv-percent-pond polyline{transition:all .3s}.dv-percent-pond text{font-size:25px;font-weight:700;text-anchor:middle;dominant-baseline:middle}
`)();const _o=["id"],wo=["offset","stop-color"],Eo=["id","x2"],No=["offset","stop-color"],Bo=["x","y","rx","ry","stroke-width","stroke","width","height"],Po=["stroke-width","stroke-dasharray","stroke","points"],Ao=["stroke","fill","x","y"],$t={__name:"index",props:{config:{type:Object,default:()=>({})}},setup(e){const i=e,r=j(),o=t.ref(null),n=t.reactive({gradientId1:`percent-pond-gradientId1-${r}`,gradientId2:`percent-pond-gradientId2-${r}`,width:0,height:0,defaultConfig:{value:0,colors:["#3DE7C9","#00BAFF"],borderWidth:3,borderGap:3,lineDash:[5,1],textColor:"#fff",borderRadius:5,localGradient:!1,formatter:"{value}%"},mergedConfig:null}),a=t.computed(()=>{if(!n.mergedConfig)return 0;const{borderWidth:$}=n.mergedConfig;return n.width-$}),l=t.computed(()=>{if(!n.mergedConfig)return 0;const{borderWidth:$}=n.mergedConfig;return n.height-$}),s=t.computed(()=>{const $=n.height/2;if(!n.mergedConfig)return`0, ${$} 0, ${$}`;const{borderWidth:k,borderGap:_,value:h}=n.mergedConfig,p=(n.width-(k+_)*2)/100*h;return`
${k+_}, ${$}
${k+_+p}, ${$+.001}
`}),c=t.computed(()=>{if(!n.mergedConfig)return 0;const{borderWidth:$,borderGap:k}=n.mergedConfig;return n.height-($+k)*2}),d=t.computed(()=>{if(!n.mergedConfig)return[];const{colors:$}=n.mergedConfig,k=$.length,_=100/(k-1);return $.map((h,p)=>[_*p,h])}),f=t.computed(()=>n.mergedConfig&&n.mergedConfig.localGradient?n.gradientId1:n.gradientId2),u=t.computed(()=>{if(!n.mergedConfig)return"100%";const{value:$}=n.mergedConfig;return`${200-$}%`}),m=t.computed(()=>{if(!n.mergedConfig)return"";const{value:$,formatter:k}=n.mergedConfig;return k.replace("{value}",$)});t.watch(()=>i.config,()=>{w()},{deep:!0}),t.onMounted(()=>{x()});async function x(){await b(),i.config&&w()}async function b(){await t.nextTick();const{clientWidth:$,clientHeight:k}=o.value;n.width=$,n.height=k}function w(){n.mergedConfig=S(L(n.defaultConfig,!0),i.config||{})}return($,k)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"percentPond",ref:o,class:"dv-percent-pond"},[(t.openBlock(),t.createElementBlock("svg",null,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.gradientId1,x1:"0%",y1:"0%",x2:"100%",y2:"0%"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(d),_=>(t.openBlock(),t.createElementBlock("stop",{key:_[0],offset:`${_[0]}%`,"stop-color":_[1]},null,8,wo))),128))],8,_o),t.createElementVNode("linearGradient",{id:n.gradientId2,x1:"0%",y1:"0%",x2:t.unref(u),y2:"0%"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(d),_=>(t.openBlock(),t.createElementBlock("stop",{key:_[0],offset:`${_[0]}%`,"stop-color":_[1]},null,8,No))),128))],8,Eo)]),t.createElementVNode("rect",{x:n.mergedConfig?n.mergedConfig.borderWidth/2:"0",y:n.mergedConfig?n.mergedConfig.borderWidth/2:"0",rx:n.mergedConfig?n.mergedConfig.borderRadius:"0",ry:n.mergedConfig?n.mergedConfig.borderRadius:"0",fill:"transparent","stroke-width":n.mergedConfig?n.mergedConfig.borderWidth:"0",stroke:`url(#${n.gradientId1})`,width:t.unref(a)>0?t.unref(a):0,height:t.unref(l)>0?t.unref(l):0},null,8,Bo),t.createElementVNode("polyline",{"stroke-width":t.unref(c),"stroke-dasharray":n.mergedConfig?n.mergedConfig.lineDash.join(","):"0",stroke:`url(#${t.unref(f)})`,points:t.unref(s)},null,8,Po),t.createElementVNode("text",{stroke:n.mergedConfig?n.mergedConfig.textColor:"#fff",fill:n.mergedConfig?n.mergedConfig.textColor:"#fff",x:n.width/2,y:n.height/2},t.toDisplayString(t.unref(m)),9,Ao)]))],512))}},le={install(e){e.component("DvPercentPond",$t)}},{sqrt:So,pow:Y,ceil:xt,abs:Lo}=Math,Vo=50;function kt(e,i=5){const r=e.length-1,o=e[0],n=e[r][2],a=e.slice(1),l=a.map((f,u)=>{let m=u===0?o:a[u-1][2];return Go(m,...f)});let s=new Array(r).fill(Vo),c=Ct(l,s);const d=Fo(c,l,a,i);return d.segmentPoints.push(n),d}function Go(e,i,r,o){return function(n){const a=1-n,l=Y(a,3),s=Y(a,2),c=Y(n,3),d=Y(n,2);return[e[0]*l+3*i[0]*n*s+3*r[0]*d*a+o[0]*c,e[1]*l+3*i[1]*n*s+3*r[1]*d*a+o[1]*c]}}function Mo([e,i],[r,o]){return So(Y(e-r,2)+Y(i-o,2))}function J(e){return e.reduce((i,r)=>i+r,0)}function se(e){return e.map((i,r)=>new Array(i.length-1).fill(0).map((o,n)=>Mo(i[n],i[n+1])))}function Ct(e,i){return e.map((r,o)=>{const n=1/i[o];return new Array(i[o]).fill("").map((a,l)=>r(l*n))})}function Do(e,i){return e.map(r=>r.map(o=>Lo(o-i))).map(r=>J(r)).reduce((r,o)=>r+o,0)}function Fo(e,i,r,o){let n=4,a=1;do{let l=e.reduce(($,k)=>$+k.length,0);e.forEach(($,k)=>$.push(r[k][2]));let s=se(e),c=s.reduce(($,k)=>$+k.length,0),d=s.map($=>J($)),f=J(d),u=f/c;if(Do(s,u)<=o)break;l=xt(u/o*l*1.1);const x=d.map($=>xt($/f*l));e=Ct(i,x),l=e.reduce(($,k)=>$+k.length,0);let b=JSON.parse(JSON.stringify(e));b.forEach(($,k)=>$.push(r[k][2])),s=se(b),c=s.reduce(($,k)=>$+k.length,0),d=s.map($=>J($)),f=J(d),u=f/c;const w=1/l/10;i.forEach(($,k)=>{const _=x[k],h=new Array(_).fill("").map((p,g)=>g/x[k]);for(let p=0;p<n;p++){const y=se([e[k]])[0].map(N=>N-u);let C=0;for(let N=0;N<_;N++){if(N===0)return;C+=y[N-1],h[N]-=w*C,h[N]>1&&(h[N]=1),h[N]<0&&(h[N]=0),e[k][N]=$(h[N])}}}),n*=4,a++}while(n<=1025);return e=e.reduce((l,s)=>l.concat(s),[]),{segmentPoints:e,cycles:a,rounds:n}}function Wo(e,i=5){if(!e)return console.error("bezierCurveToPolyline: Missing parameters!"),!1;if(!(e instanceof Array))return console.error("bezierCurveToPolyline: Parameter bezierCurve must be an array!"),!1;if(typeof i!="number")return console.error("bezierCurveToPolyline: Parameter precision must be a number!"),!1;const{segmentPoints:r}=kt(e,i);return r}function Io(e,i=5){if(!e)return console.error("getBezierCurveLength: Missing parameters!"),!1;if(!(e instanceof Array))return console.error("getBezierCurveLength: Parameter bezierCurve must be an array!"),!1;if(typeof i!="number")return console.error("getBezierCurveLength: Parameter precision must be a number!"),!1;const{segmentPoints:r}=kt(e,i),o=se([r])[0];return J(o)}function Ro(e,i=!1,r=.25,o=.25){if(!(e instanceof Array))return console.error("polylineToBezierCurve: Parameter polyline must be an array!"),!1;if(e.length<=2)return console.error("polylineToBezierCurve: Converting to a curve requires at least 3 points!"),!1;const n=e[0],a=e.length-1,l=new Array(a).fill(0).map((s,c)=>[...To(e,c,i,r,o),e[c+1]]);return i&&zo(l,n),l.unshift(e[0]),l}function To(e,i,r=!1,o=.25,n=.25){const a=e.length;if(a<3||i>=a)return;let l=i-1;l<0&&(l=r?a+l:0);let s=i+1;s>=a&&(s=r?s-a:a-1);let c=i+2;c>=a&&(c=r?c-a:a-1);const d=e[l],f=e[i],u=e[s],m=e[c];return[[f[0]+o*(u[0]-d[0]),f[1]+o*(u[1]-d[1])],[u[0]-n*(m[0]-f[0]),u[1]-n*(m[1]-f[1])]]}function zo(e,i){const r=e[0],o=e.slice(-1)[0];return e.push([_t(o[1],o[2]),_t(r[0],i),i]),e}function _t(e,i){const[r,o]=e,[n,a]=i,l=n-r,s=a-o;return[n+l,a+s]}var ve={bezierCurveToPolyline:Wo,getBezierCurveLength:Io,polylineToBezierCurve:Ro};const{abs:wt,sqrt:Oo,sin:et,cos:tt,max:Et,min:Ho,PI:te}=Math;function F(e,i=!1){if(!e)return e;const{parse:r,stringify:o}=JSON;if(!i)return r(o(e));const n=e instanceof Array?[]:{};if(e&&typeof e=="object")for(let a in e)e.hasOwnProperty(a)&&(e[a]&&typeof e[a]=="object"?n[a]=F(e[a],!0):n[a]=e[a]);return n}function jo(e){return e.map(([i,r])=>[parseInt(i)+.5,parseInt(r)+.5])}function qo(e,i,r,o){return ne(e,[i,r])<=o}function ne([e,i],[r,o]){const n=wt(e-r),a=wt(i-o);return Oo(n*n+a*a)}function oe(e,i){let r=0;const[o,n]=e,a=i.length;for(let l=1,s=i[0];l<=a;l++){const c=i[l%a];if(o>Ho(s[0],c[0])&&o<=Et(s[0],c[0])&&n<=Et(s[1],c[1])&&s[0]!==c[0]){const d=(o-s[0])*(c[1]-s[1])/(c[0]-s[0])+s[1];(s[1]===c[1]||n<=d)&&r++}s=c}return r%2===1}function nt(e,i,r,o,n,a,l){if(!e||ne(e,[i,r])>o)return!1;l||([n,a]=F([a,n]));const s=n>a;s&&([n,a]=[a,n]);const c=a-n;if(c>=te*2)return!0;const[d,f]=e,[u,m]=I(i,r,o,n),[x,b]=I(i,r,o,a),w=[d-i,f-r];let $=[u-i,m-r],k=[x-i,b-r];const _=c>te;_&&([$,k]=F([k,$]));let h=Nt($,w)&&!Nt(k,w);return _&&(h=!h),s&&(h=!h),h}function Nt(e,i){const[r,o]=e,[n,a]=i;return-o*n+r*a>0}function ot(e,i,r){const o=r/2,n=i.map(([s,c])=>[s,c-o]),a=i.map(([s,c])=>[s,c+o]),l=[...n,...a.reverse()];return oe(e,l)}function rt([e,i],r,o,n,a){return!(e<r||i<o||e>r+n||i>o+a)}function Uo(e=0,i,r=[0,0]){if(!i)return!1;if(e%360===0)return i;const[o,n]=i,[a,l]=r;return e*=te/180,[(o-a)*tt(e)-(n-l)*et(e)+a,(o-a)*et(e)+(n-l)*tt(e)+l]}function Qo(e=[1,1],i,r=[0,0]){if(!i)return!1;if(e===1)return i;const[o,n]=i,[a,l]=r,[s,c]=e,d=o-a,f=n-l;return[d*s+a,f*c+l]}function Xo(e,i){if(!e||!i)return!1;const[r,o]=i,[n,a]=e;return[r+n,o+a]}function I(e,i,r,o){return[e+tt(o)*r,i+et(o)*r]}function Ko(e,i,r,o,n=te*-.5){const a=te*2/o;return new Array(o).fill("").map((s,c)=>c*a+n).map(s=>I(e,i,r,s))}function Bt(e,i,r=!1,o=!1){if(!e||i.length<2)return!1;r&&e.beginPath(),i.forEach((n,a)=>n&&(a===0?e.moveTo(...n):e.lineTo(...n))),o&&e.closePath()}function Pt(e,i,r=!1,o=!1,n=!1){if(!e||!i)return!1;o&&e.beginPath(),r&&e.moveTo(...r),i.forEach(a=>a&&e.bezierCurveTo(...a[0],...a[1],...a[2])),n&&e.closePath()}const{polylineToBezierCurve:Yo,bezierCurveToPolyline:At}=ve,Jo={shape:{rx:0,ry:0,r:0},validator({shape:e}){const{rx:i,ry:r,r:o}=e;return typeof i!="number"||typeof r!="number"||typeof o!="number"?(console.error("Circle shape configuration is abnormal!"),!1):!0},draw({ctx:e},{shape:i}){e.beginPath();const{rx:r,ry:o,r:n}=i;e.arc(r,o,n>0?n:.01,0,Math.PI*2),e.fill(),e.stroke(),e.closePath()},hoverCheck(e,{shape:i}){const{rx:r,ry:o,r:n}=i;return qo(e,r,o,n)},setGraphCenter(e,{shape:i,style:r}){const{rx:o,ry:n}=i;r.graphCenter=[o,n]},move({movementX:e,movementY:i},{shape:r}){this.attr("shape",{rx:r.rx+e,ry:r.ry+i})}},Zo={shape:{rx:0,ry:0,hr:0,vr:0},validator({shape:e}){const{rx:i,ry:r,hr:o,vr:n}=e;return typeof i!="number"||typeof r!="number"||typeof o!="number"||typeof n!="number"?(console.error("Ellipse shape configuration is abnormal!"),!1):!0},draw({ctx:e},{shape:i}){e.beginPath();let{rx:r,ry:o,hr:n,vr:a}=i;e.ellipse(r,o,n>0?n:.01,a>0?a:.01,0,0,Math.PI*2),e.fill(),e.stroke(),e.closePath()},hoverCheck(e,{shape:i}){const{rx:r,ry:o,hr:n,vr:a}=i,l=Math.max(n,a),s=Math.min(n,a),c=Math.sqrt(l*l-s*s),d=[r-c,o],f=[r+c,o];return ne(e,d)+ne(e,f)<=2*l},setGraphCenter(e,{shape:i,style:r}){const{rx:o,ry:n}=i;r.graphCenter=[o,n]},move({movementX:e,movementY:i},{shape:r}){this.attr("shape",{rx:r.rx+e,ry:r.ry+i})}},vo={shape:{x:0,y:0,w:0,h:0},validator({shape:e}){const{x:i,y:r,w:o,h:n}=e;return typeof i!="number"||typeof r!="number"||typeof o!="number"||typeof n!="number"?(console.error("Rect shape configuration is abnormal!"),!1):!0},draw({ctx:e},{shape:i}){e.beginPath();let{x:r,y:o,w:n,h:a}=i;e.rect(r,o,n,a),e.fill(),e.stroke(),e.closePath()},hoverCheck(e,{shape:i}){let{x:r,y:o,w:n,h:a}=i;return rt(e,r,o,n,a)},setGraphCenter(e,{shape:i,style:r}){const{x:o,y:n,w:a,h:l}=i;r.graphCenter=[o+a/2,n+l/2]},move({movementX:e,movementY:i},{shape:r}){this.attr("shape",{x:r.x+e,y:r.y+i})}},er={shape:{rx:0,ry:0,r:0},validator({shape:e}){const{rx:i,ry:r,r:o}=e;return typeof i!="number"||typeof r!="number"||typeof o!="number"?(console.error("Ring shape configuration is abnormal!"),!1):!0},draw({ctx:e},{shape:i}){e.beginPath();const{rx:r,ry:o,r:n}=i;e.arc(r,o,n>0?n:.01,0,Math.PI*2),e.stroke(),e.closePath()},hoverCheck(e,{shape:i,style:r}){const{rx:o,ry:n,r:a}=i,{lineWidth:l}=r,s=l/2,c=a-s,d=a+s,f=ne(e,[o,n]);return f>=c&&f<=d},setGraphCenter(e,{shape:i,style:r}){const{rx:o,ry:n}=i;r.graphCenter=[o,n]},move({movementX:e,movementY:i},{shape:r}){this.attr("shape",{rx:r.rx+e,ry:r.ry+i})}},tr={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,clockWise:!0},validator({shape:e}){return["rx","ry","r","startAngle","endAngle"].find(r=>typeof e[r]!="number")?(console.error("Arc shape configuration is abnormal!"),!1):!0},draw({ctx:e},{shape:i}){e.beginPath();const{rx:r,ry:o,r:n,startAngle:a,endAngle:l,clockWise:s}=i;e.arc(r,o,n>0?n:.001,a,l,!s),e.stroke(),e.closePath()},hoverCheck(e,{shape:i,style:r}){const{rx:o,ry:n,r:a,startAngle:l,endAngle:s,clockWise:c}=i,{lineWidth:d}=r,f=d/2,u=a-f,m=a+f;return!nt(e,o,n,u,l,s,c)&&nt(e,o,n,m,l,s,c)},setGraphCenter(e,{shape:i,style:r}){const{rx:o,ry:n}=i;r.graphCenter=[o,n]},move({movementX:e,movementY:i},{shape:r}){this.attr("shape",{rx:r.rx+e,ry:r.ry+i})}},nr={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,clockWise:!0},validator({shape:e}){return["rx","ry","r","startAngle","endAngle"].find(r=>typeof e[r]!="number")?(console.error("Sector shape configuration is abnormal!"),!1):!0},draw({ctx:e},{shape:i}){e.beginPath();const{rx:r,ry:o,r:n,startAngle:a,endAngle:l,clockWise:s}=i;e.arc(r,o,n>0?n:.01,a,l,!s),e.lineTo(r,o),e.closePath(),e.stroke(),e.fill()},hoverCheck(e,{shape:i}){const{rx:r,ry:o,r:n,startAngle:a,endAngle:l,clockWise:s}=i;return nt(e,r,o,n,a,l,s)},setGraphCenter(e,{shape:i,style:r}){const{rx:o,ry:n}=i;r.graphCenter=[o,n]},move({movementX:e,movementY:i},{shape:r}){const{rx:o,ry:n}=r;this.attr("shape",{rx:o+e,ry:n+i})}},or={shape:{rx:0,ry:0,r:0,side:0},validator({shape:e}){const{side:i}=e;return["rx","ry","r","side"].find(o=>typeof e[o]!="number")?(console.error("RegPolygon shape configuration is abnormal!"),!1):i<3?(console.error("RegPolygon at least trigon!"),!1):!0},draw({ctx:e},{shape:i,cache:r}){e.beginPath();const{rx:o,ry:n,r:a,side:l}=i;if(!r.points||r.rx!==o||r.ry!==n||r.r!==a||r.side!==l){const c=Ko(o,n,a,l);Object.assign(r,{points:c,rx:o,ry:n,r:a,side:l})}const{points:s}=r;Bt(e,s),e.closePath(),e.stroke(),e.fill()},hoverCheck(e,{cache:i}){let{points:r}=i;return oe(e,r)},setGraphCenter(e,{shape:i,style:r}){const{rx:o,ry:n}=i;r.graphCenter=[o,n]},move({movementX:e,movementY:i},{shape:r,cache:o}){const{rx:n,ry:a}=r;o.rx+=e,o.ry+=i,this.attr("shape",{rx:n+e,ry:a+i}),o.points=o.points.map(([l,s])=>[l+e,s+i])}},rr={shape:{points:[],close:!1},validator({shape:e}){const{points:i}=e;return i instanceof Array?!0:(console.error("Polyline points should be an array!"),!1)},draw({ctx:e},{shape:i,style:{lineWidth:r}}){e.beginPath();let{points:o,close:n}=i;r===1&&(o=jo(o)),Bt(e,o),n&&(e.closePath(),e.fill()),e.stroke()},hoverCheck(e,{shape:i,style:r}){const{points:o,close:n}=i,{lineWidth:a}=r;return n?oe(e,o):ot(e,o,a)},setGraphCenter(e,{shape:i,style:r}){const{points:o}=i;r.graphCenter=o[0]},move({movementX:e,movementY:i},{shape:r}){const{points:o}=r,n=o.map(([a,l])=>[a+e,l+i]);this.attr("shape",{points:n})}},ir={shape:{points:[],close:!1},validator({shape:e}){const{points:i}=e;return i instanceof Array?!0:(console.error("Smoothline points should be an array!"),!1)},draw({ctx:e},{shape:i,cache:r}){const{points:o,close:n}=i;if(!r.points||r.points.toString()!==o.toString()){const l=Yo(o,n),s=At(l);Object.assign(r,{points:F(o,!0),bezierCurve:l,hoverPoints:s})}const{bezierCurve:a}=r;e.beginPath(),Pt(e,a.slice(1),a[0]),n&&(e.closePath(),e.fill()),e.stroke()},hoverCheck(e,{cache:i,shape:r,style:o}){const{hoverPoints:n}=i,{close:a}=r,{lineWidth:l}=o;return a?oe(e,n):ot(e,n,l)},setGraphCenter(e,{shape:i,style:r}){const{points:o}=i;r.graphCenter=o[0]},move({movementX:e,movementY:i},{shape:r,cache:o}){const{points:n}=r,a=n.map(([d,f])=>[d+e,f+i]);o.points=a;const[l,s]=o.bezierCurve[0],c=o.bezierCurve.slice(1);o.bezierCurve=[[l+e,s+i],...c.map(d=>d.map(([f,u])=>[f+e,u+i]))],o.hoverPoints=o.hoverPoints.map(([d,f])=>[d+e,f+i]),this.attr("shape",{points:a})}},ar={shape:{points:[],close:!1},validator({shape:e}){const{points:i}=e;return i instanceof Array?!0:(console.error("BezierCurve points should be an array!"),!1)},draw({ctx:e},{shape:i,cache:r}){let{points:o,close:n}=i;if(!r.points||r.points.toString()!==o.toString()){const a=At(o,20);Object.assign(r,{points:F(o,!0),hoverPoints:a})}e.beginPath(),Pt(e,o.slice(1),o[0]),n&&(e.closePath(),e.fill()),e.stroke()},hoverCheck(e,{cache:i,shape:r,style:o}){const{hoverPoints:n}=i,{close:a}=r,{lineWidth:l}=o;return a?oe(e,n):ot(e,n,l)},setGraphCenter(e,{shape:i,style:r}){const{points:o}=i;r.graphCenter=o[0]},move({movementX:e,movementY:i},{shape:r,cache:o}){const{points:n}=r,[a,l]=n[0],s=n.slice(1),c=[[a+e,l+i],...s.map(d=>d.map(([f,u])=>[f+e,u+i]))];o.points=c,o.hoverPoints=o.hoverPoints.map(([d,f])=>[d+e,f+i]),this.attr("shape",{points:c})}},St={shape:{content:"",position:[],maxWidth:void 0,rowGap:0},validator({shape:e}){const{content:i,position:r,rowGap:o}=e;return typeof i!="string"?(console.error("Text content should be a string!"),!1):r instanceof Array?typeof o!="number"?(console.error("Text rowGap should be a number!"),!1):!0:(console.error("Text position should be an array!"),!1)},draw({ctx:e},{shape:i}){let{content:r,position:o,maxWidth:n,rowGap:a}=i;const{textBaseline:l,font:s}=e,c=parseInt(s.replace(/\D/g,""));let[d,f]=o;r=r.split(`
`);const u=r.length,m=c+a,x=u*m-a;let b=0;l==="middle"&&(b=x/2,f+=c/2),l==="bottom"&&(b=x,f+=c),o=new Array(u).fill(0).map((w,$)=>[d,f+$*m-b]),e.beginPath(),r.forEach((w,$)=>{e.fillText(w,...o[$],n),e.strokeText(w,...o[$],n)}),e.closePath()},hoverCheck(e,{shape:i,style:r}){return!1},setGraphCenter(e,{shape:i,style:r}){const{position:o}=i;r.graphCenter=[...o]},move({movementX:e,movementY:i},{shape:r}){const{position:[o,n]}=r;this.attr("shape",{position:[o+e,n+i]})}},Lt=new Map([["circle",Jo],["ellipse",Zo],["rect",vo],["ring",er],["arc",tr],["sector",nr],["regPolygon",or],["polyline",rr],["smoothline",ir],["bezierCurve",ar],["text",St]]);function ce(e,i){if(!e||!i){console.error("ExtendNewGraph Missing Parameters!");return}if(!i.shape){console.error("Required attribute of shape to extendNewGraph!");return}if(!i.validator){console.error("Required function of validator to extendNewGraph!");return}if(!i.draw){console.error("Required function of draw to extendNewGraph!");return}Lt.set(e,i)}class Z{constructor(i){this.colorProcessor(i),Object.assign(this,{fill:[0,0,0,1],stroke:[0,0,0,0],opacity:1,lineCap:null,lineJoin:null,lineDash:null,lineDashOffset:null,shadowBlur:0,shadowColor:[0,0,0,0],shadowOffsetX:0,shadowOffsetY:0,lineWidth:0,graphCenter:null,scale:null,rotate:null,translate:null,hoverCursor:"pointer",fontStyle:"normal",fontVarient:"normal",fontWeight:"normal",fontSize:10,fontFamily:"Arial",textAlign:"center",textBaseline:"middle",gradientColor:null,gradientType:"linear",gradientParams:null,gradientWith:"stroke",gradientStops:"auto",colors:null},i)}}Z.prototype.colorProcessor=function(e,i=!1){const r=i?H:X,o=["fill","stroke","shadowColor"];Object.keys(e).filter(c=>o.find(d=>d===c)).forEach(c=>e[c]=r(e[c]));const{gradientColor:l,colors:s}=e;l&&(e.gradientColor=l.map(c=>r(c))),s&&Object.keys(s).forEach(d=>s[d]=r(s[d]))},Z.prototype.initStyle=function(e){lr(e,this),cr(e,this),dr(e,this)};function lr(e,i){e.save();const{graphCenter:r,rotate:o,scale:n,translate:a}=i;r instanceof Array&&(e.translate(...r),o&&e.rotate(o*Math.PI/180),n instanceof Array&&e.scale(...n),a&&e.translate(...a),e.translate(-r[0],-r[1]))}const sr=["lineCap","lineJoin","lineDashOffset","shadowOffsetX","shadowOffsetY","lineWidth","textAlign","textBaseline"];function cr(e,i){let{fill:r,stroke:o,shadowColor:n,opacity:a}=i;sr.forEach(x=>{(x||typeof x=="number")&&(e[x]=i[x])}),r=[...r],o=[...o],n=[...n],r[3]*=a,o[3]*=a,n[3]*=a,e.fillStyle=H(r),e.strokeStyle=H(o),e.shadowColor=H(n);let{lineDash:l,shadowBlur:s}=i;l&&(l=l.map(x=>x>=0?x:0),e.setLineDash(l)),typeof s=="number"&&(e.shadowBlur=s>0?s:.001);const{fontStyle:c,fontVarient:d,fontWeight:f,fontSize:u,fontFamily:m}=i;e.font=c+" "+d+" "+f+" "+u+"px "+m}function dr(e,i){if(!fr(i))return;let{gradientColor:r,gradientParams:o,gradientType:n,gradientWith:a,gradientStops:l,opacity:s}=i;r=r.map(d=>{let f=d[3]*s,u=[...d];return u[3]=f,u}),r=r.map(d=>H(d)),l==="auto"&&(l=ur(r));const c=e[`create${n.slice(0,1).toUpperCase()+n.slice(1)}Gradient`](...o);l.forEach((d,f)=>c.addColorStop(d,r[f])),e[`${a}Style`]=c}function fr(e){const{gradientColor:i,gradientParams:r,gradientType:o,gradientWith:n,gradientStops:a}=e;if(!i||!r)return!1;if(i.length===1)return console.warn("The gradient needs to provide at least two colors"),!1;if(o!=="linear"&&o!=="radial")return console.warn("GradientType only supports linear or radial, current value is "+o),!1;const l=r.length;return o==="linear"&&l!==4||o==="radial"&&l!==6?(console.warn("The expected length of gradientParams is "+(o==="linear"?"4":"6")),!1):n!=="fill"&&n!=="stroke"?(console.warn("GradientWith only supports fill or stroke, current value is "+n),!1):a!=="auto"&&!(a instanceof Array)?(console.warn("gradientStops only supports 'auto' or Number Array ([0, .5, 1]), current value is "+a),!1):!0}function ur(e){const i=1/(e.length-1);return e.map((r,o)=>i*o)}Z.prototype.restoreTransform=function(e){e.restore()},Z.prototype.update=function(e){this.colorProcessor(e),Object.assign(this,e)},Z.prototype.getStyle=function(){const e=F(this,!0);return this.colorProcessor(e,!0),e};const hr=[[[0,1],"",[.33,.67]],[[1,0],[.67,.33]]],gr=[[[0,1]],[[.538,.564],[.169,.912],[.88,.196]],[[1,0]]],mr=[[[0,1]],[[.444,.448],[.169,.736],[.718,.16]],[[1,0]]],pr=[[[0,1]],[[.5,.5],[.2,1],[.8,0]],[[1,0]]],yr=[[[0,1]],[[.55,.584],[.231,.904],[.868,.264]],[[1,0]]],br=[[[0,1]],[[.413,.428],[.065,.816],[.76,.04]],[[1,0]]],$r=[[[0,1]],[[.5,.5],[.3,.9],[.7,.1]],[[1,0]]],xr=[[[0,1]],[[.679,.688],[.366,.992],[.992,.384]],[[1,0]]],kr=[[[0,1]],[[.321,.312],[.008,.616],[.634,.008]],[[1,0]]],Cr=[[[0,1]],[[.5,.5],[.3,1],[.7,0]],[[1,0]]],_r=[[[0,1]],[[.812,.74],[.611,.988],[1.013,.492]],[[1,0]]],wr=[[[0,1]],[[.152,.244],[.001,.448],[.285,-.02]],[[1,0]]],Er=[[[0,1]],[[.5,.5],[.4,1],[.6,0]],[[1,0]]],Nr=[[[0,1]],[[.857,.856],[.714,1],[1,.712]],[[1,0]]],Br=[[[0,1]],[[.108,.2],[.001,.4],[.214,-.012]],[[1,0]]],Pr=[[[0,1]],[[.5,.5],[.5,1],[.5,0]],[[1,0]]],Ar=[[[0,1]],[[.667,.896],[.38,1.184],[.955,.616]],[[1,0]]],Sr=[[[0,1]],[[.335,.028],[.061,.22],[.631,-.18]],[[1,0]]],Lr=[[[0,1]],[[.5,.5],[.4,1.4],[.6,-.4]],[[1,0]]],Vr=[[[0,1]],[[.474,.964],[.382,.988],[.557,.952]],[[.619,1.076],[.565,1.088],[.669,1.08]],[[.77,.916],[.712,.924],[.847,.904]],[[.911,1.304],[.872,1.316],[.961,1.34]],[[1,0]]],Gr=[[[0,1]],[[.073,-.32],[.034,-.328],[.104,-.344]],[[.191,.092],[.11,.06],[.256,.08]],[[.31,-.076],[.26,-.068],[.357,-.076]],[[.432,.032],[.362,.028],[.683,-.004]],[[1,0]]],Mr=[[[0,1]],[[.21,.94],[.167,.884],[.252,.98]],[[.299,1.104],[.256,1.092],[.347,1.108]],[[.5,.496],[.451,.672],[.548,.324]],[[.696,-.108],[.652,-.112],[.741,-.124]],[[.805,.064],[.756,.012],[.866,.096]],[[1,0]]],Dr=[[[0,1]],[[.148,1],[.075,.868],[.193,.848]],[[.326,1],[.276,.836],[.405,.712]],[[.6,1],[.511,.708],[.671,.348]],[[1,0]]],Fr=[[[0,1]],[[.357,.004],[.27,.592],[.376,.252]],[[.604,-.004],[.548,.312],[.669,.184]],[[.82,0],[.749,.184],[.905,.132]],[[1,0]]],Wr=[[[0,1]],[[.102,1],[.05,.864],[.117,.86]],[[.216,.996],[.208,.844],[.227,.808]],[[.347,.996],[.343,.8],[.48,.292]],[[.635,.004],[.511,.676],[.656,.208]],[[.787,0],[.76,.2],[.795,.144]],[[.905,-.004],[.899,.164],[.944,.144]],[[1,0]]];var de=new Map([["linear",hr],["easeInSine",gr],["easeOutSine",mr],["easeInOutSine",pr],["easeInQuad",yr],["easeOutQuad",br],["easeInOutQuad",$r],["easeInCubic",xr],["easeOutCubic",kr],["easeInOutCubic",Cr],["easeInQuart",_r],["easeOutQuart",wr],["easeInOutQuart",Er],["easeInQuint",Nr],["easeOutQuint",Br],["easeInOutQuint",Pr],["easeInBack",Ar],["easeOutBack",Sr],["easeInOutBack",Lr],["easeInElastic",Vr],["easeOutElastic",Gr],["easeInOutElastic",Mr],["easeInBounce",Dr],["easeOutBounce",Fr],["easeInOutBounce",Wr]]);const Ir="linear";function Rr(e,i=null,r=null,o=30,n=!1){if(!Tr(...arguments))return!1;try{const a=zr(e),l=Or(a,o);return!n||typeof r=="number"?Vt(i,r,l):Mt(i,r,l)}catch{return console.warn("Transition parameter may be abnormal!"),[r]}}function Tr(e,i=!1,r=!1,o=30){if(!e||i===!1||r===!1||!o)return console.error("transition: Missing Parameters!"),!1;if(typeof i!=typeof r)return console.error("transition: Inconsistent Status Types!"),!1;const n=typeof r;return n==="string"||n==="boolean"||!e.length?(console.error("transition: Unsupported Data Type of State!"),!1):(!de.has(e)&&!(e instanceof Array)&&console.warn("transition: Transition curve not found, default curve will be used!"),!0)}function zr(e){let i="";return de.has(e)?i=de.get(e):e instanceof Array?i=e:i=de.get(Ir),i}function Or(e,i){const r=1/(i-1);return new Array(i).fill(0).map((a,l)=>l*r).map(a=>Hr(e,a))}function Hr(e,i){const r=jr(e,i),o=qr(r,i);return Ur(r,o)}function jr(e,i){const r=e.length-1;let[o,n]=["",""];e.findIndex((d,f)=>{if(f===r)return;o=d,n=e[f+1];const u=o[0][0],m=n[0][0];return i>=u&&i<m});const a=o[0],l=o[2]||o[0],s=n[1]||n[0],c=n[0];return[a,l,s,c]}function qr(e,i){const r=e[0][0],n=e[3][0]-r;return(i-r)/n}function Ur([[,e],[,i],[,r],[,o]],n){const{pow:a}=Math,l=1-n,s=e*a(l,3),c=3*i*n*a(l,2),d=3*r*a(n,2)*l,f=o*a(n,3);return 1-(s+c+d+f)}function Vt(e,i,r){let o="object";return typeof e=="number"&&(o="number"),e instanceof Array&&(o="array"),o==="number"?Qr(e,i,r):o==="array"?Gt(e,i,r):o==="object"?Xr(e,i,r):r.map(n=>i)}function Qr(e,i,r){const o=i-e;return r.map(n=>e+o*n)}function Gt(e,i,r){const o=i.map((n,a)=>typeof n!="number"?!1:n-e[a]);return r.map(n=>o.map((a,l)=>a===!1?i[l]:e[l]+a*n))}function Xr(e,i,r){const o=Object.keys(i),n=o.map(s=>e[s]),a=o.map(s=>i[s]);return Gt(n,a,r).map(s=>{const c={};return s.forEach((d,f)=>c[o[f]]=d),c})}function Mt(e,i,r){const o=Vt(e,i,r);for(let n in i){const a=e[n],l=i[n];if(typeof l!="object")continue;const s=Mt(a,l,r);o.forEach((c,d)=>c[n]=s[d])}return o}class O{constructor(i,r){r=F(r,!0);const o={visible:!0,drag:!1,hover:!1,index:1,animationDelay:0,animationFrame:30,animationCurve:"linear",animationPause:!1,hoverRect:null,mouseEnter:null,mouseOuter:null,click:null},n={status:"static",animationRoot:[],animationKeys:[],animationFrameState:[],cache:{}};r.shape||(r.shape={}),r.style||(r.style={});const a=Object.assign({},i.shape,r.shape);Object.assign(o,r,n),Object.assign(this,i,o),this.shape=a,this.style=new Z(r.style),this.addedProcessor()}}O.prototype.addedProcessor=function(){typeof this.setGraphCenter=="function"&&this.setGraphCenter(null,this),typeof this.added=="function"&&this.added(this)},O.prototype.drawProcessor=function(e,i){const{ctx:r}=e;i.style.initStyle(r),typeof this.beforeDraw=="function"&&this.beforeDraw(this,e),i.draw(e,i),typeof this.drawed=="function"&&this.drawed(this,e),i.style.restoreTransform(r)},O.prototype.hoverCheckProcessor=function(e,{hoverRect:i,style:r,hoverCheck:o}){const{graphCenter:n,rotate:a,scale:l,translate:s}=r;return n&&(a&&(e=Uo(-a,e,n)),l&&(e=Qo(l.map(c=>1/c),e,n)),s&&(e=Xo(s.map(c=>c*-1),e))),i?rt(e,...i):o(e,this)},O.prototype.moveProcessor=function(e){this.move(e,this),typeof this.beforeMove=="function"&&this.beforeMove(e,this),typeof this.setGraphCenter=="function"&&this.setGraphCenter(e,this),typeof this.moved=="function"&&this.moved(e,this)},O.prototype.attr=function(e,i=void 0){if(!e||i===void 0)return!1;const r=typeof this[e]=="object";r&&(i=F(i,!0));const{render:o}=this;e==="style"?this.style.update(i):r?Object.assign(this[e],i):this[e]=i,e==="index"&&o.sortGraphsByIndex(),o.drawAllGraph()},O.prototype.animation=async function(e,i,r=!1){if(e!=="shape"&&e!=="style"){console.error("Only supported shape and style animation!");return}i=F(i,!0),e==="style"&&this.style.colorProcessor(i);const o=this[e],n=Object.keys(i),a={};n.forEach(u=>a[u]=o[u]);const{animationFrame:l,animationCurve:s,animationDelay:c}=this,d=Rr(s,a,i,l,!0);if(this.animationRoot.push(o),this.animationKeys.push(n),this.animationFrameState.push(d),r)return;c>0&&await Kr(c);const{render:f}=this;return new Promise(async u=>{await f.launchAnimation(),u()})},O.prototype.turnNextAnimationFrame=function(e){const{animationDelay:i,animationRoot:r,animationKeys:o,animationFrameState:n,animationPause:a}=this;a||Date.now()-e<i||(r.forEach((l,s)=>{o[s].forEach(c=>{l[c]=n[s][0][c]})}),n.forEach((l,s)=>{l.shift();const c=l.length===0;c&&(r[s]=null),c&&(o[s]=null)}),this.animationFrameState=n.filter(l=>l.length),this.animationRoot=r.filter(l=>l),this.animationKeys=o.filter(l=>l))},O.prototype.animationEnd=function(){const{animationFrameState:e,animationKeys:i,animationRoot:r,render:o}=this;return r.forEach((n,a)=>{const l=i[a],s=e[a].pop();l.forEach(c=>n[c]=s[c])}),this.animationFrameState=[],this.animationKeys=[],this.animationRoot=[],o.drawAllGraph()},O.prototype.pauseAnimation=function(){this.attr("animationPause",!0)},O.prototype.playAnimation=function(){const{render:e}=this;return this.attr("animationPause",!1),new Promise(async i=>{await e.launchAnimation(),i()})},O.prototype.delProcessor=function(e){const{graphs:i}=e,r=i.findIndex(o=>o===this);r!==-1&&(typeof this.beforeDelete=="function"&&this.beforeDelete(this),i.splice(r,1,null),typeof this.deleted=="function"&&this.deleted(this))};function Kr(e){return new Promise(i=>{setTimeout(i,e)})}class q{constructor(i){if(!i){console.error("CRender Missing parameters!");return}const r=i.getContext("2d"),{clientWidth:o,clientHeight:n}=i,a=[o,n];i.setAttribute("width",o),i.setAttribute("height",n),this.ctx=r,this.area=a,this.animationStatus=!1,this.graphs=[],this.color=fo,this.bezierCurve=ve,i.addEventListener("mousedown",Jr.bind(this)),i.addEventListener("mousemove",Zr.bind(this)),i.addEventListener("mouseup",vr.bind(this))}}q.prototype.clearArea=function(){const{area:e}=this;this.ctx.clearRect(0,0,...e)},q.prototype.add=function(e={}){const{name:i}=e;if(!i){console.error("add Missing parameters!");return}const r=Lt.get(i);if(!r){console.warn("No corresponding graph configuration found!");return}const o=new O(r,e);if(!!o.validator(o))return o.render=this,this.graphs.push(o),this.sortGraphsByIndex(),this.drawAllGraph(),o},q.prototype.sortGraphsByIndex=function(){const{graphs:e}=this;e.sort((i,r)=>{if(i.index>r.index)return 1;if(i.index===r.index)return 0;if(i.index<r.index)return-1})},q.prototype.delGraph=function(e){typeof e.delProcessor=="function"&&(e.delProcessor(this),this.graphs=this.graphs.filter(i=>i),this.drawAllGraph())},q.prototype.delAllGraph=function(){this.graphs.forEach(e=>e.delProcessor(this)),this.graphs=this.graphs.filter(e=>e),this.drawAllGraph()},q.prototype.drawAllGraph=function(){this.clearArea(),this.graphs.filter(e=>e&&e.visible).forEach(e=>e.drawProcessor(this,e))},q.prototype.launchAnimation=function(){const{animationStatus:e}=this;if(!e)return this.animationStatus=!0,new Promise(i=>{Dt.call(this,()=>{this.animationStatus=!1,i()},Date.now())})};function Dt(e,i){const{graphs:r}=this;if(!Yr(r)){e();return}r.forEach(o=>o.turnNextAnimationFrame(i)),this.drawAllGraph(),requestAnimationFrame(Dt.bind(this,e,i))}function Yr(e){return e.find(i=>!i.animationPause&&i.animationFrameState.length)}function Jr(e){const{graphs:i}=this,r=i.find(o=>o.status==="hover");!r||(r.status="active")}function Zr(e){const{offsetX:i,offsetY:r}=e,o=[i,r],{graphs:n}=this,a=n.find(u=>u.status==="active"||u.status==="drag");if(a){if(!a.drag)return;if(typeof a.move!="function"){console.error("No move method is provided, cannot be dragged!");return}a.moveProcessor(e),a.status="drag";return}const l=n.find(u=>u.status==="hover"),c=n.filter(u=>u.hover&&(typeof u.hoverCheck=="function"||u.hoverRect)).find(u=>u.hoverCheckProcessor(o,u));c?document.body.style.cursor=c.style.hoverCursor:document.body.style.cursor="default";let[d,f]=[!1,!1];if(l&&(d=typeof l.mouseOuter=="function"),c&&(f=typeof c.mouseEnter=="function"),!(!c&&!l)){if(!c&&l){d&&l.mouseOuter(e,l),l.status="static";return}if(!(c&&c===l)){if(c&&!l){f&&c.mouseEnter(e,c),c.status="hover";return}c&&l&&c!==l&&(d&&l.mouseOuter(e,l),l.status="static",f&&c.mouseEnter(e,c),c.status="hover")}}}function vr(e){const{graphs:i}=this,r=i.find(n=>n.status==="active"),o=i.find(n=>n.status==="drag");r&&typeof r.click=="function"&&r.click(e,r),i.forEach(n=>n&&(n.status="static")),r&&(r.status="hover"),o&&(o.status="hover")}q.prototype.clone=function(e){const i=e.style.getStyle();let r={...e,style:i};return delete r.render,r=F(r,!0),this.add(r)};var K0=(()=>`.dv-water-pond-level{position:relative}.dv-water-pond-level svg{position:absolute;width:100%;height:100%;top:0px;left:0px}.dv-water-pond-level text{font-size:25px;font-weight:700;text-anchor:middle;dominant-baseline:middle}.dv-water-pond-level ellipse,.dv-water-pond-level rect{fill:none;stroke-width:3}.dv-water-pond-level canvas{margin-top:8px;margin-left:8px;width:calc(100% - 16px);height:calc(100% - 16px);box-sizing:border-box}
`)();const ei={class:"dv-water-pond-level"},ti={key:0},ni=["id"],oi=["offset","stop-color"],ri=["stroke","fill","x","y"],ii=["cx","cy","rx","ry","stroke"],ai=["rx","ry","width","height","stroke"],Ft={__name:"index",props:{config:Object,default:()=>({})},setup(e){const i=e,r=j(),o=t.ref(null),n=t.reactive({gradientId:`water-level-pond-${r}`,defaultConfig:{data:[],shape:"rect",waveNum:3,waveHeight:40,waveOpacity:.4,colors:["#3DE7C9","#00BAFF"],formatter:"{value}%"},mergedConfig:{},renderer:null,svgBorderGradient:[],details:"",waves:[],animation:!1}),a=t.computed(()=>{const{shape:h}=n.mergedConfig;return h==="round"?"50%":h==="rect"?"0":h==="roundRect"?"10px":"0"}),l=t.computed(()=>{const{shape:h}=n.mergedConfig;return h||"rect"});t.watch(()=>i.config,()=>{n.renderer.delAllGraph(),n.waves=[],setTimeout(d,0)},{deep:!0}),t.onMounted(()=>{s()}),t.onBeforeUnmount(()=>{n.renderer.delAllGraph(),n.waves=[]});function s(){c(),i.config&&d()}function c(){n.renderer=new q(o.value)}function d(){f(),u(),m(),x(),_()}function f(){n.mergedConfig=S(L(n.defaultConfig,!0),i.config)}function u(){const{colors:h}=n.mergedConfig,p=h.length,g=100/(p-1);n.svgBorderGradient=h.map((y,C)=>[g*C,y])}function m(){const{data:h,formatter:p}=n.mergedConfig;if(!h.length){n.details="";return}const g=Math.max(...h);n.details=p.replace("{value}",g)}function x(){const h=b(),p=$();n.waves=h.map(g=>n.renderer.add({name:"smoothline",animationFrame:300,shape:g,style:p,drawed:k}))}function b(){const{waveNum:h,waveHeight:p,data:g}=n.mergedConfig,[y,C]=n.renderer.area,N=h*4+4,B=y/h/2;return g.map(A=>{let P=new Array(N).fill(0).map((M,R)=>{const T=y-B*R,W=(1-A/100)*C,U=R%2===0?W:W-p;return[T,U]});return P=P.map(M=>w(M,[B*2,0])),{points:P}})}function w([h,p],[g,y]){return[h+g,p+y]}function $(){const h=n.renderer.area[1];return{gradientColor:n.mergedConfig.colors,gradientType:"linear",gradientParams:[0,0,0,h],gradientWith:"fill",opacity:n.mergedConfig.waveOpacity,translate:[0,0]}}function k({shape:{points:h}},{ctx:p,area:g}){const y=h[0],C=h.slice(-1)[0],N=g[1];p.lineTo(C[0],N),p.lineTo(y[0],N),p.closePath(),p.fill()}async function _(h=1){if(n.animation)return;n.animation=!0;const p=n.renderer.area[0];n.waves.forEach(g=>{g.attr("style",{translate:[0,0]}),g.animation("style",{translate:[p,0]},!0)}),await n.renderer.launchAnimation(),n.animation=!1,n.renderer.graphs.length&&_(h+1)}return(h,p)=>(t.openBlock(),t.createElementBlock("div",ei,[n.renderer?(t.openBlock(),t.createElementBlock("svg",ti,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.gradientId,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.svgBorderGradient,g=>(t.openBlock(),t.createElementBlock("stop",{key:g[0],offset:g[0],"stop-color":g[1]},null,8,oi))),128))],8,ni)]),n.renderer?(t.openBlock(),t.createElementBlock("text",{key:0,stroke:`url(#${n.gradientId})`,fill:`url(#${n.gradientId})`,x:n.renderer.area[0]/2+8,y:n.renderer.area[1]/2+8},t.toDisplayString(n.details),9,ri)):t.createCommentVNode("",!0),!t.unref(l)||t.unref(l)==="round"?(t.openBlock(),t.createElementBlock("ellipse",{key:1,cx:n.renderer.area[0]/2+8,cy:n.renderer.area[1]/2+8,rx:n.renderer.area[0]/2+5,ry:n.renderer.area[1]/2+5,stroke:`url(#${n.gradientId})`},null,8,ii)):(t.openBlock(),t.createElementBlock("rect",{key:2,x:"2",y:"2",rx:t.unref(l)==="roundRect"?10:0,ry:t.unref(l)==="roundRect"?10:0,width:n.renderer.area[0]+12,height:n.renderer.area[1]+12,stroke:`url(#${n.gradientId})`},null,8,ai))])):t.createCommentVNode("",!0),t.createElementVNode("canvas",{ref_key:"waterPondLevel",ref:o,style:t.normalizeStyle(`border-radius: ${t.unref(a)};`)},null,4)]))}},fe={install(e){e.component("DvWaterLevelPond",Ft)}};var Y0=(()=>`.dv-loading{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center}.dv-loading .loading-tip{font-size:15px}
`)(),li=(e,i)=>{const r=e.__vccOpts||e;for(const[o,n]of i)r[o]=n;return r};const si={},ci={class:"dv-loading"},di=t.createStaticVNode('<svg width="50px" height="50px"><circle cx="25" cy="25" r="20" fill="transparent" stroke-width="3" stroke-dasharray="31.415, 31.415" stroke="#02bcfe" stroke-linecap="round"><animateTransform attributeName="transform" type="rotate" values="0, 25 25;360, 25 25" dur="1.5s" repeatCount="indefinite"></animateTransform><animate attributeName="stroke" values="#02bcfe;#3be6cb;#02bcfe" dur="3s" repeatCount="indefinite"></animate></circle><circle cx="25" cy="25" r="10" fill="transparent" stroke-width="3" stroke-dasharray="15.7, 15.7" stroke="#3be6cb" stroke-linecap="round"><animateTransform attributeName="transform" type="rotate" values="360, 25 25;0, 25 25" dur="1.5s" repeatCount="indefinite"></animateTransform><animate attributeName="stroke" values="#3be6cb;#02bcfe;#3be6cb" dur="3s" repeatCount="indefinite"></animate></circle></svg>',1),fi={class:"loading-tip"};function ui(e,i){return t.openBlock(),t.createElementBlock("div",ci,[di,t.createElementVNode("div",fi,[t.renderSlot(e.$slots,"default")])])}var Wt=li(si,[["render",ui]]);const ue={install(e){e.component("DvLoading",Wt)}};var J0=(()=>`.dv-flyline-chart-enhanced{display:flex;flex-direction:column;background-size:100% 100%}.dv-flyline-chart-enhanced text{text-anchor:middle;dominant-baseline:middle}
`)();const hi=["width","height"],gi=["id"],mi=[t.createElementVNode("stop",{offset:"0%","stop-color":"#fff","stop-opacity":"1"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#fff","stop-opacity":"0"},null,-1)],pi=["id"],yi=[t.createElementVNode("stop",{offset:"0%","stop-color":"#fff","stop-opacity":"0"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#fff","stop-opacity":"1"},null,-1)],bi=["id","cx","cy"],$i=["values","dur"],xi=["dur"],ki=["id"],Ci=["xlink:href","fill"],_i=["xlink:href","fill","mask"],wi=["xlink:href","width","height","x","y"],Ei=["fill","x","y"],Ni=["id","d"],Bi=["xlink:href","stroke-width","stroke"],Pi=["id"],Ai=["r","fill"],Si=["dur","path"],Li=["xlink:href","stroke-width","stroke","mask"],Vi=["from","to","dur"],It={__name:"index",props:{config:{type:Object,default:()=>({})},dev:{type:Boolean,default:!1}},setup(e){const i=e,r=j(),o=t.ref(null),{width:n,height:a}=D(o,d,c),l=t.reactive({unique:Math.random(),flylineGradientId:`flyline-gradient-id-${r}`,haloGradientId:`halo-gradient-id-${r}`,defaultConfig:{points:[],lines:[],halo:{show:!1,duration:[20,30],color:"#fb7293",radius:120},text:{show:!1,offset:[0,15],color:"#ffdb5c",fontSize:12},icon:{show:!1,src:"",width:15,height:15},line:{width:1,color:"#ffde93",orbitColor:"