UNPKG

cvs

Version:

A basic canvas framework for 2d drawing.

1 lines 45.7 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{166:function(t,e,i){"use strict";i(23),i(13),i(18),i(93),i(177);var n=i(178),a=(i(22),i(68)),r=i(69),s=(i(172),i(173),i(9)),o=i(71),h=(i(94),i(171)),c=(i(185),i(74),i(191),i(56),i(98),i(192),i(194),function(){function t(e){Object(a.a)(this,t),e=e||[1,0,0,1,0,0],this.m=[e[0],e[1],e[2],e[3],e[4],e[5]]}return Object(r.a)(t,[{key:"unit",value:function(){return this.m=[1,0,0,1,0,0],this}},{key:"multiply",value:function(e){var i,n=this.m;i=e instanceof t?e.m:e;var a=n[0]*i[0]+n[2]*i[1],r=n[1]*i[0]+n[3]*i[1],s=n[0]*i[2]+n[2]*i[3],o=n[1]*i[2]+n[3]*i[3],h=n[0]*i[4]+n[2]*i[5]+n[4],c=n[1]*i[4]+n[3]*i[5]+n[5];return n[0]=a,n[1]=r,n[2]=s,n[3]=o,n[4]=h,n[5]=c,this}},{key:"inverse",value:function(){var e=new t(this.m),i=e.m,n=1/(i[0]*i[3]-i[1]*i[2]),a=i[3]*n,r=-i[1]*n,s=-i[2]*n,o=i[0]*n,h=n*(i[2]*i[5]-i[3]*i[4]),c=n*(i[1]*i[4]-i[0]*i[5]);return i[0]=a,i[1]=r,i[2]=s,i[3]=o,i[4]=h,i[5]=c,e}},{key:"translate",value:function(t,e){return this.multiply([1,0,0,1,t,e])}},{key:"rotate",value:function(t){var e=t*Math.PI/180,i=Math.cos(e),n=Math.sin(e);return this.multiply([i,n,-n,i,0,0])}},{key:"skew",value:function(t,e){e|=0;var i=t*Math.PI/180,n=e*Math.PI/180,a=Math.tan(i),r=Math.tan(n);return this.multiply([1,r,a,1,0,0])}},{key:"scale",value:function(t,e){return this.multiply([t,0,0,e,0,0])}},{key:"transformPoint",value:function(t,e){var i=t,n=e;return[t=i*this.m[0]+n*this.m[2]+this.m[4],e=i*this.m[1]+n*this.m[3]+this.m[5]]}},{key:"transformVector",value:function(t,e){var i=t,n=e;return[t=i*this.m[0]+n*this.m[2],e=i*this.m[1]+n*this.m[3]]}}]),t}());function u(t,e){var i=t.findIndex(function(t){return t.id===e.id});i>-1&&t.splice(i,1)}function l(t){throw Error("cvs: "+t)}function f(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function m(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t.length?(t.sort(function(t,n){return i?n.attr(e)-t.attr(e):t.attr(e)-n.attr(e)}),t):t}var v=requestAnimationFrame||webkitRequestAnimationFrame||mozRequestAnimationFrame||oRequestAnimationFrame||msRequestAnimationFrame||function(t){setTimeout(t,16)},y=cancelAnimationFrame||webkitCancelAnimationFrame||mozCancelAnimationFrame||msCancelAnimationFrame||function(t){clearTimeout(t)},p=(navigator.userAgent.match(/\b(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i),document.createElement("canvas"));function d(t,e){var i=p.cloneNode();return t&&(i.width=t),e&&(i.height=e),i.getContext("2d")}function b(t,e,i){var n=t.length;if(i)for(var a=n-1;a>-1;a--)e(t[a],a);else for(var r=0;r<n;r++)e(t[r],r)}function g(t,e){Object.entries(t).forEach(function(t){var i=Object(h.a)(t,2),n=i[0],a=i[1];e(n,a)})}function k(t){var e=new c;return Array.isArray(t)?e.multiply(t):"object"===Object(o.a)(t)&&Object.entries(t).forEach(function(t){var i=Object(h.a)(t,2),n=i[0],a=i[1];/\b(scale|translate|skew)\b/.test(n)?e[n].apply(e,Object(s.a)(x(a))):"rotate"===n?e[n](a):"transform"===n&&e.multiply(a)}),e.m}function x(t){return Array.isArray(t)?1===t.length?[t[0],t[0]]:t:[t,t]}function w(t){return t.split("%")[0]/100}i(174);var M=new Map;function O(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e4;if(M.has(t))return M.get(t);var n=new Promise(function(n,a){var r=setTimeout(function(){a(new Error("load image timeout"))},i);(function(t){return new Promise(function(e,i){var n=new Image;n.onload=function(){e(n)},n.onerror=function(){i(new Error("Could not load image at "+t))},n.src=t})})(e).then(function(e){n(e),M.set(t,e),clearTimeout(r)})});return M.set(t,n),n}i(24),i(20),i(57),i(175);var j=i(196),T=(i(103),i(186),2*Math.PI);function E(t,e,i,n){var a=t*i+e*n;return a>1&&(a=1),a<-1&&(a=-1),(t*n-e*i<0?-1:1)*Math.acos(a)}function P(t,e){var i=4/3*Math.tan(e/4),n=Math.cos(t),a=Math.sin(t),r=Math.cos(t+e),s=Math.sin(t+e);return[n,a,n-a*i,a+n*i,r+s*i,s-r*i,r,s]}function C(t,e,i,n,a,r,s,o,h){var c=Math.sin(h*T/360),u=Math.cos(h*T/360),l=u*(t-i)/2+c*(e-n)/2,f=-c*(t-i)/2+u*(e-n)/2;if(0===l&&0===f)return[];if(0===s||0===o)return[];s=Math.abs(s),o=Math.abs(o);var m=l*l/(s*s)+f*f/(o*o);m>1&&(s*=Math.sqrt(m),o*=Math.sqrt(m));var v=function(t,e,i,n,a,r,s,o,h,c){var u=c*(t-i)/2+h*(e-n)/2,l=-h*(t-i)/2+c*(e-n)/2,f=s*s,m=o*o,v=u*u,y=l*l,p=f*m-f*y-m*v;p<0&&(p=0),p/=f*y+m*v;var d=(p=Math.sqrt(p)*(a===r?-1:1))*s/o*l,b=p*-o/s*u,g=c*d-h*b+(t+i)/2,k=h*d+c*b+(e+n)/2,x=(u-d)/s,w=(l-b)/o,M=(-u-d)/s,O=(-l-b)/o,j=E(1,0,x,w),P=E(x,w,M,O);return 0===r&&P>0&&(P-=T),1===r&&P<0&&(P+=T),[g,k,j,P]}(t,e,i,n,a,r,s,o,c,u),y=[],p=v[2],d=v[3],b=Math.max(Math.ceil(Math.abs(d)/(T/4)),1);d/=b;for(var g=0;g<b;g++)y.push(P(p,d)),p+=d;return y.map(function(t){for(var e=0;e<t.length;e+=2){var i=t[e+0],n=t[e+1],a=u*(i*=s)-c*(n*=o),r=c*i+u*n;t[e+0]=a+v[0],t[e+1]=r+v[1]}return t})}function A(t){for(var e,i=[],n=0,a=0,r=0,s=0,o=null,c=null,u=0,l=0,f=0,m=t.length;f<m;f++){var v=t[f],y=v[0];switch(y){case"M":r=v[1],s=v[2];break;case"A":var p=C(u,l,v[6],v[7],v[4],v[5],v[1],v[2],v[3]);if(!p.length)continue;p=p.map(function(t){var e=Object(h.a)(t,8);e[0],e[1];return{x1:e[2],y1:e[3],x2:e[4],y2:e[5],x:e[6],y:e[7]}});for(var d,b=0;b<p.length;b++)v=["C",(d=p[b]).x1,d.y1,d.x2,d.y2,d.x,d.y],b<p.length-1&&i.push(v);break;case"S":var g=u,k=l;"C"!=e&&"S"!=e||(g+=g-n,k+=k-a),v=["C",g,k,v[1],v[2],v[3],v[4]];break;case"T":"Q"==e||"T"==e?(o=2*u-o,c=2*l-c):(o=u,c=l),v=z(u,l,o,c,v[1],v[2]);break;case"Q":o=v[1],c=v[2],v=z(u,l,v[1],v[2],v[3],v[4]);break;case"L":v=S(u,l,v[1],v[2]);break;case"H":v=S(u,l,v[1],l);break;case"V":v=S(u,l,u,v[1]);break;case"Z":v=S(u,l,r,s)}e=y,u=v[v.length-2],l=v[v.length-1],v.length>4?(n=v[v.length-4],a=v[v.length-3]):(n=u,a=l),i.push(v)}return i}function S(t,e,i,n){return["C",t,e,i,n,i,n]}function z(t,e,i,n,a,r){return["C",t/3+2/3*i,e/3+2/3*n,a/3+2/3*i,r/3+2/3*n,a,r]}var I=function t(e){if("function"==typeof e||Object(e)!==e)return e;var i=new e.constructor;for(var n in e)e.hasOwnProperty(n)&&(i[n]=t(e[n]));return i};function R(t){var e=R.ps=R.ps||{};return e[t]?e[t].sleep=100:e[t]={sleep:100},setTimeout(function(){for(var i in e)e.hasOwnProperty(i)&&i!==t&&(e[i].sleep--,e[i].sleep||delete e[i])}),e[t]}function F(t,e,i,n){return null==t&&(t=e=i=n=0),null==e&&(e=t.y,i=t.width,n=t.height,t=t.x),{x:t,y:e,width:i,w:i,height:n,h:n,x2:t+i,y2:e+n,cx:t+i/2,cy:e+n/2,r1:Math.min(i,n)/2,r2:Math.max(i,n)/2,r0:Math.sqrt(i*i+n*n)/2,path:function(t,e,i,n,a){if(a)return[["M",Number(t)+Number(a),e],["l",i-2*a,0],["a",a,a,0,0,1,a,a],["l",0,n-2*a],["a",a,a,0,0,1,-a,a],["l",2*a-i,0],["a",a,a,0,0,1,-a,-a],["l",0,2*a-n],["a",a,a,0,0,1,a,-a],["z"]];return[["M",t,e],["l",i,0],["l",0,n],["l",-i,0],["z"]]}(t,e,i,n),vb:[t,e,i,n].join(" ")}}function _(t,e,i,n,a,r,s,o,h){var c=1-h,u=Math.pow(c,3),l=Math.pow(c,2),f=h*h,m=f*h,v=t+2*h*(i-t)+f*(a-2*i+t),y=e+2*h*(n-e)+f*(r-2*n+e),p=i+2*h*(a-i)+f*(s-2*a+i),d=n+2*h*(r-n)+f*(o-2*r+n);return{x:u*t+3*l*h*i+3*c*h*h*a+m*s,y:u*e+3*l*h*n+3*c*h*h*r+m*o,m:{x:v,y:y},n:{x:p,y:d},start:{x:c*t+h*i,y:c*e+h*n},end:{x:c*a+h*s,y:c*r+h*o},alpha:90-180*Math.atan2(v-p,y-d)/Math.PI}}function q(t,e,i,n,a,r,o,h){Array.isArray(t)||(t=[t,e,i,n,a,r,o,h]);var c=B.apply(void 0,Object(s.a)(t));return F(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function N(t,e,i,n,a){return t*(t*(-3*e+9*i-9*n+3*a)+6*e-12*i+6*n)-3*e+3*i}function W(t,e,i,n,a,r,s,o,h){null==h&&(h=1);for(var c=(h=Math.max(0,Math.min(h,1)))/2,u=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],l=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,m=0;m<12;m++){var v=c*u[m]+c,y=N(v,t,i,a,s),p=N(v,e,n,r,o),d=y*y+p*p;f+=l[m]*Math.sqrt(d)}return c*f}function D(t,e,i,n,a,r,s,o){if(!(Math.max(t,i)<Math.min(a,s)||Math.min(t,i)>Math.max(a,s)||Math.max(e,n)<Math.min(r,o)||Math.min(e,n)>Math.max(r,o))){var h=(t-i)*(r-o)-(e-n)*(a-s);if(h){var c=((t*n-e*i)*(a-s)-(t-i)*(a*o-r*s))/h,u=((t*n-e*i)*(r-o)-(e-n)*(a*o-r*s))/h,l=Number(c.toFixed(2)),f=Number(u.toFixed(2));if(!(l<Number(Math.min(t,i).toFixed(2))||l>Number(Math.max(t,i).toFixed(2))||l<Number(Math.min(a,s).toFixed(2))||l>Number(Math.max(a,s).toFixed(2))||f<Number(Math.min(e,n).toFixed(2))||f>Number(Math.max(e,n).toFixed(2))||f<Number(Math.min(r,o).toFixed(2))||f>Number(Math.max(r,o).toFixed(2))))return{x:c,y:u}}}}function V(t,e,i){if(!function(t,e){t=F(t),e=F(e);var i=t,n=i.x,a=i.y,r=i.width,s=i.height,o=e,h=o.x,c=o.y,u=o.width,l=o.height,f=n+r/2,m=a+s/2,v=h+u/2,y=c+l/2;return Math.abs(f-v)<=(r+u)/2||Math.abs(m-y)<=(s+l)/2}(q(t),q(e)))return i?0:[];for(var n=W.apply(0,t),a=W.apply(0,e),r=Math.ceil(n/8),s=Math.ceil(a/8),o=[],h=[],c={},u=i?0:[],l=0;l<r+1;l++){var f=_.apply(0,t.concat(l/r));o.push({x:f.x,y:f.y,t:l/r})}for(var m=0;m<s+1;m++){var v=_.apply(0,e.concat(m/s));h.push({x:v.x,y:v.y,t:m/s})}for(var y=0;y<r;y++)for(var p=0;p<s;p++){var d=o[y],b=o[y+1],g=h[p],k=h[p+1],x=Math.abs(b.x-d.x)<.001?"y":"x",w=Math.abs(k.x-g.x)<.001?"y":"x",M=D(d.x,d.y,b.x,b.y,g.x,g.y,k.x,k.y);if(M&&c[M.x.toFixed(4)]!==M.y.toFixed(4)){c[M.x.toFixed(4)]=M.y.toFixed(4);var O=d.t+Math.abs((M[x]-d[x])/(b[x]-d[x]))*(b.t-d.t),j=g.t+Math.abs((M[w]-g[w])/(k[w]-g[w]))*(k.t-g.t);O>=0&&O<=1&&j>=0&&j<=1&&(i?u++:u.push({x:M.x,y:M.y,t1:O,t2:j}))}}return u}function B(t,e,i,n,a,r,s,o){for(var h,c,u,l,f,m,v,y,p=[],d=[[],[]],b=0;b<2;++b)if(0===b?(c=6*t-12*i+6*a,h=-3*t+9*i-9*a+3*s,u=3*i-3*t):(c=6*e-12*n+6*r,h=-3*e+9*n-9*r+3*o,u=3*n-3*e),Math.abs(h)<1e-12){if(Math.abs(c)<1e-12)continue;(l=-u/c)>0&&l<1&&p.push(l)}else v=c*c-4*u*h,y=Math.sqrt(v),v<0||((f=(-c+y)/(2*h))>0&&f<1&&p.push(f),(m=(-c-y)/(2*h))>0&&m<1&&p.push(m));for(var g,k=p.length,x=k;k--;)g=1-(l=p[k]),d[0][k]=g*g*g*t+3*g*g*l*i+3*g*l*l*a+l*l*l*s,d[1][k]=g*g*g*e+3*g*g*l*n+3*g*l*l*r+l*l*l*o;return d[0][x]=t,d[1][x]=e,d[0][x+1]=s,d[1][x+1]=o,d[0].length=d[1].length=x+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function L(t,e,i){var n=function(t){var e=R(t);if(e.bbox)return I(e.bbox);if(!t)return F();for(var i=0,n=0,a=[],r=[],s=[],o=0,h=t.length;o<h;o++)if("M"===(s=t[o])[0])i=s[1],n=s[2],a.push(i),r.push(n);else{var c=B(i,n,s[1],s[2],s[3],s[4],s[5],s[6]);a=a.concat(c.min.x,c.max.x),r=r.concat(c.min.y,c.max.y),i=s[5],n=s[6]}var u=Math.min.apply(0,a),l=Math.min.apply(0,r),f=F(u,l,Math.max.apply(0,a)-u,Math.max.apply(0,r)-l);return e.bbox=I(f),f}(t);return!!function(t,e,i){return e>=t.x&&e<=t.x+t.width&&i>=t.y&&i<=t.y+t.height}(n,e,i)&&function(t,e,i){for(var n,a,r,s,o,h,c,u,l,f,m=i?0:[],v=0,y=t.length;v<y;v++){var p=t[v];if("M"===p[0])n=o=p[1],a=h=p[2];else{"C"===p[0]?(n=(l=[n,a].concat(p.slice(1)))[6],a=l[7]):(l=[n,a,n,a,o,h,o,h],n=o,a=h);for(var d=0,b=e.length;d<b;d++){var g=e[d];if("M"===g[0])r=c=g[1],s=u=g[2];else{"C"===g[0]?(r=(f=[r,s].concat(g.slice(1)))[6],s=f[7]):(f=[r,s,r,s,c,u,c,u],r=c,s=u);var k=V(l,f,i);if(i)m+=k;else{for(var x=0,w=k.length;x<w;x++)k[x].segment1=v,k[x].segment2=d,k[x].bez1=l,k[x].bez2=f;m=m.concat(k)}}}}}return m}(t,A([["M",e,i],["H",n.x2+10]]),1)%2==1}var X=i(197),Y=new Map;function H(t){if(Y.has(t))return Y.get(t);var e=X(t);return Y.set(t,e),e}i(29);var J={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},U=/([astvzqmhlc])([^astvzqmhlc]*)/gi;function $(t){var e=[];return t.replace(U,function(t,i,n){var a=i.toLowerCase();for(n=function(t){var e=t.match(Q);return e?e.map(Number):[]}(n),"m"==a&&n.length>2&&(e.push([i].concat(n.splice(0,2))),a="l",i="m"==i?"l":"L");;){if(n.length==J[a])return n.unshift(i),e.push(n);if(n.length<J[a])throw new Error("malformed path data");e.push([i].concat(n.splice(0,J[a])))}}),e}var Q=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;var G=Symbol("path"),Z=Symbol("initialPath"),K=Symbol("bounds"),tt=Symbol("savedPaths"),et=Symbol("renderProps"),it=Symbol("beginPath");var nt=function(){function t(e){if(Object(a.a)(this,t),!function(t){return"string"==typeof t&&(t=t.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(t)&&/[\dz]$/i.test(t)&&t.length>4))}(e))throw new Error("Not an SVG path!");this[Z]=function(t){var e=0,i=0,n=0,a=0;return t.map(function(t){var r=(t=t.slice())[0],s=r.toUpperCase();if(r!=s)switch(t[0]=s,r){case"a":t[6]+=n,t[7]+=a;break;case"v":t[1]+=a;break;case"h":t[1]+=n;break;default:for(var o=1;o<t.length;)t[o++]+=n,t[o++]+=a}switch(s){case"Z":n=e,a=i;break;case"H":n=t[1];break;case"V":a=t[1];break;case"M":n=e=t[1],a=i=t[2];break;default:n=t[t.length-2],a=t[t.length-1]}return t})}($(e)),this[G]=A(this[Z]),this[K]=null,this[tt]=[],this[et]={},this[it]=!1}return Object(r.a)(t,[{key:"save",value:function(){return this[tt].push({path:this[G],bounds:this[K],renderProps:Object.assign({},this[et])}),this}},{key:"restore",value:function(){if(this[tt].length){var t=this[tt].pop(),e=t.path,i=t.bounds,n=t.renderProps;this[G]=e,this[K]=i,this[et]=n}return this}},{key:"isPointInPath",value:function(t,e){return function(t,e,i){return L(t.path,e,i)}(this,t,e)}},{key:"getPointAtLength",value:function(t){return function(t,e){return H(t).at(e)}(this.d,t)}},{key:"getTotalLength",value:function(){return function(t){return H(t).length()}(this.d)}},{key:"transform",value:function(){this[K]=null;for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=new c(e),a=this[G];return this[G]=a.map(function(t){for(var e=Object(j.a)(t),i=e[0],a=e.slice(1),r=[i],s=0;s<a.length;s+=2){var o=a[s],c=a[s+1],u=n.transformPoint(o,c),l=Object(h.a)(u,2),f=l[0],m=l[1];r.push(f,m)}return r}),this}},{key:"translate",value:function(t,e){var i=(new c).translate(t,e);return this.transform.apply(this,Object(s.a)(i.m))}},{key:"rotate",value:function(t){var e=(new c).rotate(t);return this.transform.apply(this,Object(s.a)(e.m))}},{key:"scale",value:function(t,e){null==e&&(e=t);var i=(new c).scale(t,e);return this.transform.apply(this,Object(s.a)(i.m))}},{key:"skew",value:function(t,e){var i=(new c).skew(t,e);return this.transform.apply(this,Object(s.a)(i.m))}},{key:"trim",value:function(){var t=Object(h.a)(this.bounds,2),e=t[0],i=t[1];return this.translate(-e,-i),this}},{key:"beginPath",value:function(){return this[it]=!0,this}},{key:"to",value:function(t){var e=this[G],i=this[et];return e.length&&(this[it]&&t.beginPath(),e.forEach(function(e){var i=Object(j.a)(e),n=i[0],a=i.slice(1);"M"===n?t.moveTo.apply(t,Object(s.a)(a)):"C"===n&&t.bezierCurveTo.apply(t,Object(s.a)(a))}),"Z"===this[Z][this[Z].length-1][0]&&t.closePath()),Object.assign(t,i),{stroke:function(){return t.stroke(),this},fill:function(){return t.fill(),this}}}},{key:"strokeStyle",value:function(t){return this[et].strokeStyle=t,this}},{key:"fillStyle",value:function(t){return this[et].fillStyle=t,this}},{key:"lineWidth",value:function(t){return this[et].lineWidth=t,this}},{key:"lineCap",value:function(t){return this[et].lineCap=t,this}},{key:"lineJoin",value:function(t){return this[et].lineJoin=t,this}},{key:"bounds",get:function(){if(!this[K]){var t=this[G];if(this[K]=[0,0,0,0],t.length){for(var e=[1/0,1/0,-1/0,-1/0],i=0,n=t.length;i<n;i++)for(var a=t[i].slice(1),r=0;r<a.length;r+=2)a[r+0]<e[0]&&(e[0]=a[r+0]),a[r+1]<e[1]&&(e[1]=a[r+1]),a[r+0]>e[2]&&(e[2]=a[r+0]),a[r+1]>e[3]&&(e[3]=a[r+1]);this[K]=e}}return this[K]}},{key:"size",get:function(){var t=this.bounds;return[t[2]-t[0],t[3]-t[1]]}},{key:"center",get:function(){var t=Object(h.a)(this.bounds,4),e=t[0],i=t[1];return[(e+t[2])/2,(i+t[3])/2]}},{key:"d",get:function(){return this[G].map(function(t){var e=Object(j.a)(t);return e[0]+e.slice(1).join()}).join("")}},{key:"path",get:function(){return this[G]}}]),t}();function at(t){if("string"==typeof t)return new nt(t);if("object"===Object(o.a)(t)){var e="";t.path?e=t.path:"rect"===t.type?e=function(t){if(t.borderRadius){var e=[],i=t.borderRadius,n=t.x||0,a=t.y||0,r=t.w,s=t.h;i instanceof Array?i.length>=4?e=i.slice(0,4):3===i.length?(e[1]=e[3]=i[1],e[0]=i[0],e[2]=i[2]):2===i.length&&(e[0]=e[2]=i[0],e[1]=e[3]=i[1]):e=new Array(4).fill(i);var o=e.map(function(t,e){return 0===e?"a ".concat(t," ").concat(t," 0 0 1 ").concat(t," -").concat(t):1===e?"a ".concat(t," ").concat(t," 0 0 1 ").concat(t," ").concat(t):2===e?"a ".concat(t," ").concat(t," 0 0 1 -").concat(t," ").concat(t):3===e?"a ".concat(t," ").concat(t," 0 0 1 -").concat(t," -").concat(t):void 0}),h=e.map(function(t,i){return 0===i?"h ".concat(r-e[0]-e[1]):1===i?"v ".concat(s-e[1]-e[2]):2===i?"h ".concat(-1*(r-e[2]-e[3])):void 0});return"M ".concat(n," ").concat(a+e[0]," ").concat(o[0]," ").concat(h[0]," ").concat(o[1]," ").concat(h[1]," ").concat(o[2]," ").concat(h[2]," ").concat(o[3]," z")}return"M ".concat(t.x||0," ").concat(t.y||0," h ").concat(t.w," v ").concat(t.h," h -").concat(t.w," z")}(t):"circle"===t.type?e=function(t){var e=x(t.r),i=Object(h.a)(e,2),n=i[0],a=i[1],r=t.cx,s=void 0===r?n:r,o=t.cy,c=void 0===o?a:o,u=t.rotate,l=void 0===u?0:u,f=function(t){var e=t.cx,i=t.cy,n=t.rx,a=t.ry,r=t.rotate;return function(t){var s=n*Math.cos(t*Math.PI/180),o=a*Math.sin(t*Math.PI/180),h=e+s*Math.cos(r*Math.PI/180)-o*Math.sin(r*Math.PI/180),c=i+s*Math.sin(r*Math.PI/180)+o*Math.cos(r*Math.PI/180);return{x:h,y:c}}}({cx:s,cy:c,rx:n,ry:a,rotate:l}),m=f(0),v=f(-1);return"M ".concat(m.x," ").concat(m.y," A ").concat(n," ").concat(a," ").concat(l," 1 1 ").concat(v.x," ").concat(v.y," z")}(t):l("unexpected type of path.");var i=new nt(e),n=k(t);return i.transform.apply(i,Object(s.a)(n)),i}}var rt=function(){function t(){Object(a.a)(this,t),Object.assign(this,{x:0,y:0,zIndex:0,_rotate:0,_scale:[1,1],_translate:[0,0],_skew:[0,0],lineWidth:1,visible:!0,enableCache:!1,opacity:1,transformOrigin:"",transformMatrix:[1,0,0,1,0,0],font:"16px Arial",textAlign:"left"})}return Object(r.a)(t,[{key:"get",value:function(t){return/\b(rotate|scale|skew|translate|offsetPath)\b/.test(t)&&(t="_".concat(t)),this[t]}},{key:"lastMatrix",get:function(){if(this.transformOrigin){var t=x(this.transformOrigin),e=new c;return e.translate.apply(e,Object(s.a)(t)),e.multiply(this.transformMatrix),e.translate.apply(e,Object(s.a)(t.map(function(t){return-t}))),e.m}return this.transformMatrix}},{key:"transform",set:function(t){var e=this;Array.isArray(t)&&6===t.length?this.transformMatrix=t:(this.transformMatrix=[1,0,0,1,0,0],Object.entries(t).forEach(function(t){var i=Object(h.a)(t,2),n=i[0],a=i[1];"matrix"===n&&Array.isArray(a)?e.transformMatrix=new c(a).m:e[n]=a}))}},{key:"rotate",set:function(t){var e=this._rotate-t;this._rotate=t;var i=new c(this.transformMatrix).rotate(-e);this.transformMatrix=i.m}},{key:"scale",set:function(t){t=x(t).map(function(t){return Math.abs(t)>.001?t:1/t>0?.001:-.001});var e=this._scale||[1,1],i=[t[0]/e[0],t[1]/e[1]];this._scale=t;var n=new c(this.transformMatrix);n.scale.apply(n,i),this.transformMatrix=n.m}},{key:"translate",set:function(t){t=x(t).map(function(t){return Math.abs(t)>.001?t:1/t>0?.001:-.001});var e=this._translate||[0,0],i=[t[0]-e[0],t[1]-e[1]];this._translate=t;var n=new c(this.transformMatrix);n.translate.apply(n,i),this.transformMatrix=n.m}},{key:"skew",set:function(t){var e,i;t=x(t).map(function(t){return Math.abs(t)>.001?t:1/t>0?.001:-.001});var n=this._skew||[0,0],a=(e=new c).skew.apply(e,Object(s.a)(n)).inverse();this._skew=t;var r=new c(this.transformMatrix);(i=r.multiply(a)).skew.apply(i,Object(s.a)(t)),this.transformMatrix=r.m}},{key:"offsetPath",set:function(t){this._offsetPath=at(t)}}]),t}(),st=i(170),ot=i(168),ht=i(169),ct=i(201),ut=i.n(ct),lt=new Map;function ft(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=lt.get(e);return n||(n=ut.a.apply(void 0,e),lt.set(e,n),n)}var mt={linear:function(t){return t},ease:ft(.25,.1,.25,1),"ease-in":ft(.42,0,1,1),"ease-out":ft(0,0,.58,1),"ease-in-out":ft(.42,0,.58,1)},vt=0,yt=Symbol("easing"),pt=function(){function t(e){Object(a.a)(this,t),this.id=vt++,this.delay=0,this.duration=0,this.retrace=!1,this.iterationCount=1,this.easing="linear",Object.assign(this,e);var i=this.easing;"string"==typeof i?this[yt]=mt[i]:Array.isArray(i)&&4===i.length?this[yt]=ft.apply(void 0,Object(s.a)(i)):l("easing must be a string or an array has four items")}return Object(r.a)(t,[{key:"calculatePercentage",value:function(t){return t>1?1:this[yt](t)}}]),t}(),dt=function(t){function e(t){return Object(a.a)(this,e),Object(ot.a)(this,Object(ht.a)(e).call(this,t))}return Object(r.a)(e,[{key:"loop",value:function(t){var e=t/this.duration;if(!(e>1)){var i=0;if(this.retrace)if(e<=.5)i=this.calculatePercentage(2*e);else{var n=1-2*(e-.5);(1-e)*this.duration<50&&(n=0),i=this.calculatePercentage(n)}else i=this.calculatePercentage(e);this.drawnode(i)}}},{key:"drawnode",value:function(t){this.$ele.attr(function(t,e){var i=0,n=0,a=t.length-1;return t.forEach(function(t,r){var s=function t(e,i){return 0===i?1:e===i?1:t(e-1,i-1)+t(e-1,i)}(a,r),o=Math.pow(1-e,a-r),h=Math.pow(e,r);i+=s*t.x*o*h,n+=s*t.y*o*h}),{x:i,y:n}}(this.points,t))}}]),Object(st.a)(e,t),e}(pt);var bt=i(202),gt=i.n(bt);function kt(t,e,i,n,a){return"number"==typeof t&&"number"==typeof e?t+(i-n)/(a-n)*(e-t):i-n>a-i?e:t}var xt=Symbol("timing"),wt=Symbol("easing"),Mt=Symbol("keyframes"),Ot=Symbol("element"),jt=Symbol("cb"),Tt=function(){function t(e,i,n,r){if(Object(a.a)(this,t),i.length<2&&l("keyframes need at least two items."),Array.isArray(i[0])||"string"==typeof i[0]){var o={};"string"==typeof i[0]&&(i[0]=[i[0]]),i[0].forEach(function(t){"offsetDistance"===t?o.offsetDistance=0:o[t]=e.attr(t)}),i[0]=o}(i[0].fill||i[0].stroke)&&i.forEach(function(t){t.fill&&(t.fill=gt.a.get.rgb(t.fill)),t.stroke&&(t.stroke=gt.a.get.rgb(t.stroke))}),"number"==typeof n&&(n={duration:n}),n.duration<=0&&l("duration must a number that greater than 0."),this[xt]=Object.assign({},{iterations:1,easing:"linear",delay:0},n);var h=this[xt].easing;"string"==typeof h?this[wt]=mt[h]:Array.isArray(h)&&4===h.length?this[wt]=ft.apply(void 0,Object(s.a)(h)):l("easing must be a string or an array has four items"),this[Mt]=function(t){var e=(t=t.slice(0))[0];t[t.length-1].offset=1,e.offset=0;for(var i=0,n=-1,a=0;a<t.length;a++){var r=t[a];if(null!=r.offset){var s=a-n;if(s>1)for(var o=(r.offset-i)/s,h=0;h<s-1;h++)t[n+h+1].offset=i+o*(h+1);i=r.offset,n=a}}return t}(i),this[Ot]=e,this[jt]=r,this.cbEmitCount=0}return Object(r.a)(t,[{key:"currentFrame",value:function(t){var e={},i=this[Mt];return i.some(function(n,a){if(n.offset>t||1===n.offset)return e.f=0===a?n:i[a-1],e.t=n,!0}),e}},{key:"result",value:function(t){var e=this.currentFrame(t),i=e.f,n=e.t,a={};return g(i,function(e,r){/\b(offset)\b/.test(e)||(/\b(fill|stroke)\b/.test(e)?a[e]=gt.a.to.rgb([kt(r[0],n[e][0],t,i.offset,n.offset),kt(r[1],n[e][1],t,i.offset,n.offset),kt(r[2],n[e][2],t,i.offset,n.offset),kt(r[3],n[e][3],t,i.offset,n.offset)]):a[e]=kt(r,n[e],t,i.offset,n.offset))}),a}},{key:"run",value:function(t){if(2!==this.cbEmitCount){var e=(t-this[xt].delay)/this[xt].duration;if(e>=1&&0===this.cbEmitCount)return this[Ot].attr(this.handle(this.result(1))),void(this.cbEmitCount=1);if(e>=1&&1===this.cbEmitCount)return this[jt]&&this[jt].call(this[Ot],this[Ot]),void(this.cbEmitCount=2);e=this[wt](e),this[Ot].attr(this.handle(this.result(e)))}}},{key:"handle",value:function(t){if(null!=t.offsetDistance){var e=this[Ot].attr("offsetPath").getTotalLength(),i=this[Ot].attr("offsetPath").getPointAtLength(e*t.offsetDistance),n=Object(h.a)(i,2),a=n[0],r=n[1];t.x=a,t.y=r,delete t.offsetDistance}return t}}]),t}(),Et=Symbol("keyframeArr"),Pt=Symbol("trackArr"),Ct=Symbol("attribute"),At=Symbol("events"),St=Symbol("collisionState"),zt=["lineCap","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"],It=["transform","translate","scale","skew","rotate","stroke","fill","transformOrigin"],Rt=0,Ft=function(){function t(e){var i=this;Object(a.a)(this,t),this[Ct]=new rt,"string"==typeof e.id?(this.id=e.id,delete e.id):this.id=Rt++,g(e,function(t,e){i[Ct][t]=e}),this[Et]=[],this[Pt]=[],this[At]=new Map,this[St]=!1,this.needUpdate=!1}return Object(r.a)(t,[{key:"clone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new(0,this.constructor)(Object.assign({},this.attr(),t))}},{key:"changeState",value:function(t){var e=this.attr();for(var i in e){var n=e[i];"stroke"===i?t.strokeStyle=n:"fill"===i?t.fillStyle=n:"opacity"===i?t.globalAlpha=n:zt.indexOf(i)>-1&&(t[i]=n)}}},{key:"attr",value:function(t){var e=this;return t?"string"==typeof t?this[Ct].get(t):(this.needUpdate=!1,void g(t,function(t,i){!/\b(x|y)\b/.test(t)&&(zt.indexOf(t)>-1||It.indexOf(t)>-1)&&(e.needUpdate=!0),"function"==typeof i?e[Ct][t]=i(e[Ct].get(t)):"object"===Object(o.a)(i)?e[Ct][t]=Object.assign({},e[Ct].get(t)||{},i):e[Ct][t]=i})):this[Ct]}},{key:"isCollision",value:function(t){var e=t.x,i=t.y;return this.outline.isPointInPath(e-this.attr("x"),i-this.attr("y"))}},{key:"on",value:function(t,e){this[At].set(t,e)}},{key:"off",value:function(t){this[At].delete(t)}},{key:"emit",value:function(t){if(this.attr("visible")&&("mousemove"===t.type||this[At].has(t.type))&&("mousemove"!==t.type||this[At].has(t.type)||this[At].has("mouseenter")||this[At].has("mouseleave"))){var e=this.isCollision(t);"mousemove"===t.type&&(e&&!this[St]?(this[St]=!0,this[At].has("mouseenter")&&this[At].get("mouseenter")(t)):!e&&this[St]&&(this[St]=!1,this[At].has("mouseleave")&&this[At].get("mouseleave")(t))),e&&this[At].has(t.type)&&this[At].get(t.type)(t)}}},{key:"keyframe",value:function(t,e,i){return this[Et].push(new Tt(this,t,e,i)),this}},{key:"track",value:function(t,e){/\b(line|bezier|round|ellipse|custom)\b/.test(t)||l("the type of track must be line, bezier, round or ellipse.");var i=null;return"bezier"===t&&(i=new dt(e)),"custom"===t&&(i=new pt(e)),i.$ele=this,this[Pt].push(i),this}},{key:"animate",value:function(){var t=this.timeline.currentTime;this[Et].forEach(function(e){e.run(t)})}},{key:"getCurTrack",value:function(t){var e={},i=0,n=0;return this[Pt].some(function(a,r){return i+=a.delay,n=i+a.duration*a.iterationCount,t<i?(e.index=r,e.cycle=-1,!0):t>=i&&t<=n?(e.index=r,a.duration===1/0?(e.cycle=0,e.time=t-i):(e.cycle=Math.floor((t-i)/a.duration),e.time=t-i-e.cycle*a.duration),!0):void(i=n)}),e}},{key:"size",get:function(){if("boolean"!=typeof this.isVirtual||!this.isVirtual)return this.outline||this.setOutline(),this.outline.size.slice()}},{key:"center",get:function(){if("boolean"!=typeof this.isVirtual||!this.isVirtual){this.outline||this.setOutline();var t=this.attr("x"),e=this.attr("y");return this.outline.center.map(function(i,n){return n%2?i+e:i+t})}}},{key:"bounds",get:function(){if("boolean"!=typeof this.isVirtual||!this.isVirtual){this.outline||this.setOutline();var t=this.attr("x"),e=this.attr("y");return this.outline.bounds.map(function(i,n){return n%2?i+e:i+t})}}},{key:"_ctx",set:function(t){this.ctx=t,this.children&&this.children.length>0&&this.children.forEach(function(e){e._ctx=t})}},{key:"_layer",set:function(t){this.layer=t,this.children&&this.children.length>0&&this.children.forEach(function(e){e._layer=t})}},{key:"_timeline",set:function(t){this.timeline=t,this.children&&this.children.length>0&&this.children.forEach(function(e){e._timeline=t})}},{key:"animatable",get:function(){return this[Pt].length>0||this[Et].length>0}}]),t}(),_t=0,qt=function(){function t(e){Object(a.a)(this,t),this.id=_t++,this.children=[],this.stop=null,this.initAnimateTime=0,this.pauseTime=0,this.finishedAinmCount=0,this.isPause=!1,Object.assign(this,{zIndex:0,handleEvent:!0},e),this.init()}return Object(r.a)(t,[{key:"preload",value:function(){var t=Object(n.a)(regeneratorRuntime.mark(function t(e){var i,n,a,r;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:for(r in i=[],n={},a=function(t){i.push(O(t,e[t]).then(function(e){n[t]=e}))},e)a(r);return t.next=5,Promise.all(i);case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"init",value:function(){this.width=this.container.clientWidth,this.height=this.container.clientHeight,this.ctx=d(this.width,this.height),this.ctx.canvas.style.cssText="position: absolute; top: 0px; left: 0px;z-index:".concat(this.zIndex),this.container.appendChild(this.ctx.canvas)}},{key:"element",value:function(t){return function(t,e){return t[t.findIndex(function(t){return t.id===e})]}(this.children,t)}},{key:"emitEvent",value:function(t,e){var i=this;b(t,function(t){t.emit&&t.emit(e),t.children&&t.children.length>0&&(e.x-=t.attr("x"),e.y-=t.attr("y"),i.emitEvent(t.children,e))},!0)}},{key:"dispatchEvent",value:function(t){var e=t.originalEvent,i=e.target.getBoundingClientRect(),n=i.left,a=i.top,r=e.changedTouches?e.changedTouches[0]:e,s=r.clientX,o=r.clientY;this.emitEvent(this.children,Object.assign(t,{x:Math.round((0|s)-n),y:Math.round((0|o)-a)}))}},{key:"append",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return i.forEach(function(e){e instanceof Ft||l("Function add only accept the instance of Element."),e._layer=t,e._ctx=t.ctx,e._timeline=t.timeline.fork(),t.children.push(e),m(t.children,"zIndex")}),this}},{key:"remove",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];i.length?i.forEach(function(e){u(t.children,e)}):this.children=[]}},{key:"draw",value:function(){var t=this;this.children.forEach(function(e){e.attr("visible")&&e.render.call(e,t.ctx)})}},{key:"clear",value:function(){this.ctx.clearRect(0,0,this.width,this.height)}},{key:"animate",value:function(){var t=this;v(function e(){t.stop=v(e),t.clear(),b(t.children,function(t){t.animatable&&t.animate()}),t.draw()})}},{key:"cancelAnimate",value:function(){this.stop&&y(this.stop)}}]),t}();i(204),i(206),i(208),i(108),i(209);var Nt=function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0],Date.now?Date.now:function(){return(new Date).getTime()}}(),Wt={originTime:0,playbackRate:1},Dt=Symbol("timeMark"),Vt=Symbol("playbackRate"),Bt=Symbol("timers"),Lt=Symbol("originTime"),Xt=Symbol("setTimer"),Yt=Symbol("parent"),Ht=function(){function t(e,i){Object(a.a)(this,t),e instanceof t&&(i=e,e={}),e=Object.assign({},Wt,e),i&&(this[Yt]=i);var n=e.nowtime||Nt;if(i)Object.defineProperty(this,"globalTime",{get:function(){return i.currentTime}});else{var r=n();Object.defineProperty(this,"globalTime",{get:function(){return n()-r}})}this[Dt]=[{globalTime:this.globalTime,localTime:-e.originTime,entropy:-e.originTime,playbackRate:e.playbackRate,globalEntropy:0}],this[Yt]&&(this[Dt][0].globalEntropy=this[Yt].entropy),this[Lt]=e.originTime,this[Vt]=e.playbackRate,this[Bt]=new Map}return Object(r.a)(t,[{key:"markTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.time,i=void 0===e?this.currentTime:e,n=t.entropy,a=void 0===n?this.entropy:n,r=t.playbackRate,s=void 0===r?this.playbackRate:r,o={globalTime:this.globalTime,localTime:i,entropy:a,playbackRate:s,globalEntropy:this.globalEntropy};this[Dt].push(o)}},{key:"fork",value:function(e){return new t(e,this)}},{key:"seekGlobalTime",value:function(t){var e=this.seekTimeMark(t),i=this[Dt][e],n=i.entropy,a=i.playbackRate;return i.globalTime+(t-n)/Math.abs(a)}},{key:"seekLocalTime",value:function(t){var e=this.seekTimeMark(t),i=this[Dt][e],n=i.localTime,a=i.entropy;return i.playbackRate>0?n+(t-a):n-(t-a)}},{key:"seekTimeMark",value:function(t){var e=this[Dt],i=0,n=e.length-1;if(t<=e[i].entropy)return i;if(t>=e[n].entropy)return n;for(var a=Math.floor((i+n)/2);a>i&&a<n;){if(t===e[a].entropy)return a;t<e[a].entropy?n=a:t>e[a].entropy&&(i=a),a=Math.floor((i+n)/2)}return i}},{key:"updateTimers",value:function(){var t=this;Object(s.a)(this[Bt]).forEach(function(e){var i=Object(h.a)(e,2),n=i[0],a=i[1];t[Xt](a.handler,a.time,n)})}},{key:"clearTimeout",value:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){var e=this[Bt].get(t);e&&null!=e.timerID&&(this[Yt]?this[Yt].clearTimeout(e.timerID):clearTimeout(e.timerID)),this[Bt].delete(t)})},{key:"clearInterval",value:function(t){return this.clearTimeout(t)}},{key:"clear",value:function(){var t=this,e=this[Bt];Object(s.a)(e.keys()).forEach(function(e){t.clearTimeout(e)})}},{key:"setTimeout",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{delay:0};return this[Xt](t,e)}},{key:"setInterval",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{delay:0},i=this,n=this[Xt](function a(){i[Xt](a,e,n),t()},e);return n}},{key:Xt,value:function(t,e){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Symbol("timerID");e=function(t){return"number"==typeof t?t={delay:t}:"entropy"in t&&(t={delay:t.entropy,isEntropy:!0}),t}(e);var a,r,s,o=this[Bt].get(n),h=null;o?(this.clearTimeout(n),a=e.isEntropy?(e.delay-(this.entropy-o.startEntropy))/Math.abs(this.playbackRate):(e.delay-(this.currentTime-o.startTime))/this.playbackRate,r=o.startTime,s=o.startEntropy):(a=e.delay/(e.isEntropy?Math.abs(this.playbackRate):this.playbackRate),r=this.currentTime,s=this.entropy);var c=this[Yt],u=c?c.setTimeout.bind(c):setTimeout,l=e.heading;return!c&&!1===l&&a<0&&(a=1/0),(isFinite(a)||c)&&(a=Math.ceil(a),u!==setTimeout&&(a={delay:a,heading:l}),h=u(function(){i[Bt].delete(n),t()},a)),this[Bt].set(n,{timerID:h,handler:t,time:e,startTime:r,startEntropy:s}),n}},{key:"parent",get:function(){return this[Yt]}},{key:"lastTimeMark",get:function(){return this[Dt][this[Dt].length-1]}},{key:"currentTime",get:function(){var t=this.lastTimeMark,e=t.localTime,i=t.globalTime;return e+(this.globalTime-i)*this.playbackRate},set:function(t){var e=this,i=this.currentTime,n=t,a=this[Bt];this.markTime({time:t}),Object(s.a)(a).forEach(function(t){var r=Object(h.a)(t,2),s=r[0],o=r[1];if(a.has(s)){var c=o.time,u=c.isEntropy,l=c.delay,f=c.heading,m=o.handler,v=o.startTime;if(u)0===l&&(m(),e.clearTimeout(s));else{var y=v+l;(0===l||!1!==f&&(n-i)*l<=0||i<=y&&y<=n||i>=y&&y>=n)&&(m(),e.clearTimeout(s))}}}),this.updateTimers()}},{key:"entropy",get:function(){var t=this.lastTimeMark,e=t.entropy,i=t.globalEntropy;return e+Math.abs((this.globalEntropy-i)*this.playbackRate)},set:function(t){if(this.entropy>t){var e=this.seekTimeMark(t);this[Dt].length=e+1}this.markTime({entropy:t}),this.updateTimers()}},{key:"globalEntropy",get:function(){return this[Yt]?this[Yt].entropy:this.globalTime}},{key:"playbackRate",get:function(){return this[Vt]},set:function(t){t!==this.playbackRate&&(this.markTime({playbackRate:t}),this[Vt]=t,this.updateTimers())}},{key:"paused",get:function(){if(0===this.playbackRate)return!0;for(var t=this.parent;t;){if(0===t.playbackRate)return!0;t=t.parent}return!1}}]),t}(),Jt=["mousedown","mouseup","mousemove","touchstart","touchend","touchmove","click"],Ut=Symbol("layers"),$t=function(){function t(e){var i=this;Object(a.a)(this,t),this.container=document.getElementById(e.containerId),this[Ut]=[],this.timeline=new Ht,Jt.forEach(function(t){return i.delegateEvent(t)})}return Object(r.a)(t,[{key:"preload",value:function(){var t=Object(n.a)(regeneratorRuntime.mark(function t(e){var i,n,a,r;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:for(r in i=[],n={},a=function(t){i.push(O(t,e[t]).then(function(e){n[t]=e}))},e)a(r);return t.next=5,Promise.all(i);case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"delegateEvent",value:function(t){var e=this;return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container).addEventListener(t,function(i){var n={type:t,originalEvent:i,stopDispatch:function(){this.terminated=!0}};e[Ut].forEach(function(t){t.handleEvent&&t.dispatchEvent(n)})}),!0}},{key:"layer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(t,{container:this.container});var e=new qt(t);return e.timeline=this.timeline.fork(),this[Ut].push(e),function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.length&&t.sort(function(t,n){return i?f(n,e)-f(t,e):f(t,e)-f(n,e)})}(this[Ut],"zIndex"),e}},{key:"remove",value:function(t){t?u(this[Ut],t):this[Ut]=[]}}]),t}(),Qt=function(t){function e(t){var i;return Object(a.a)(this,e),(i=Object(ot.a)(this,Object(ht.a)(e).call(this,t))).children=[],i}return Object(r.a)(e,[{key:"append",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return i.forEach(function(e){e instanceof Ft||l("Function group.append only accept the instance of Element."),e.group=t,t.children.push(e),m(t.children,"zIndex")}),this}},{key:"remove",value:function(){for(var t=this,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];i.length?i.forEach(function(e){u(t.children,e)}):this.children=[]}},{key:"render",value:function(t){t.save(),t.translate(this.attr("x"),this.attr("y")),t.transform.apply(t,Object(s.a)(this.attr("lastMatrix"))),this.changeState(t),this.isVirtual?this.buffer(t):(this.cacheCtx&&!this.needUpdate||this.buffer(),t.drawImage(this.cacheCtx.canvas,0,0)),t.restore()}},{key:"buffer",value:function(t){var e=null;t?e=t:(this.cacheCtx=d(this.attr("w"),this.attr("h")),e=this.cacheCtx,this.setOutline()),this.attr("clip")&&this.clip(e),this.attr("fill")&&(e.fillStyle=this.attr("fill"),e.rect(0,0,this.attr("w"),this.attr("h")),e.fill()),this.attr("stroke")&&(e.strokeStyle=this.attr("stroke"),e.rect(0,0,this.attr("w"),this.attr("h")),e.stroke()),this.children.forEach(function(t){t.render.call(t,e)})}},{key:"clip",value:function(t){var e;this.clipPath=at(this.attr("clip")),this.clipPath.restore().save().beginPath(),this.clipMatrix=k(this.attr("clip").transform),(e=this.clipPath).transform.apply(e,Object(s.a)(this.clipMatrix)),this.clipPath.to(t),t.clip()}},{key:"setOutline",value:function(){var t;this.outline=at("M ".concat(0," ",0," h ",this.attr("w")," v ").concat(this.attr("h")," h -").concat(this.attr("w")," z")),this.outline.restore().save().beginPath(),(t=this.outline).transform.apply(t,Object(s.a)(this.attr("lastMatrix")))}},{key:"isVirtual",get:function(){return!this.attr("w")||!this.attr("h")}}]),Object(st.a)(e,t),e}(Ft),Gt=function(t){function e(t){var i;return Object(a.a)(this,e),(i=Object(ot.a)(this,Object(ht.a)(e).call(this,t))).p=Math.floor(i.attr("lineWidth")/2)+1,i}return Object(r.a)(e,[{key:"render",value:function(t){t.save(),t.translate(this.attr("x"),this.attr("y")),this.cacheCtx&&!this.needUpdate||this.buffer(),t.translate(this.outline.bounds[0]-this.p,this.outline.bounds[1]-this.p),t.drawImage(this.cacheCtx.canvas,0,0),t.restore()}},{key:"buffer",value:function(){this.setOutline(),this.cacheCtx=d(this.outline.size[0]+2*this.p,this.outline.size[1]+2*this.p),this.changeState(this.cacheCtx),this.cacheCtx.translate(-this.outline.bounds[0]+this.p,-this.outline.bounds[1]+this.p),this.attr("fill")&&this.outline.to(this.cacheCtx).fill(),this.attr("stroke")&&this.outline.to(this.cacheCtx).stroke()}},{key:"setOutline",value:function(){var t;this.outline=at(this.attr("d")),this.outline.restore().save().beginPath(),this.attr("lineWidth")&&this.outline.lineWidth(this.attr("lineWidth")),this.attr("lineCap")&&this.outline.lineCap(this.attr("lineCap")),this.attr("lineJoin")&&this.outline.lineJoin(this.attr("lineJoin")),(t=this.outline).transform.apply(t,Object(s.a)(this.attr("lastMatrix")))}}]),Object(st.a)(e,t),e}(Ft),Zt=function(t){function e(t){return Object(a.a)(this,e),Object(ot.a)(this,Object(ht.a)(e).call(this,t))}return Object(r.a)(e,[{key:"render",value:function(t){t.save(),t.translate(this.attr("x"),this.attr("y")),t.transform.apply(t,Object(s.a)(this.attr("lastMatrix"))),this.changeState(t),this.cacheCtx&&!this.needUpdate||this.buffer(),t.drawImage(this.cacheCtx.canvas,0,0),t.restore()}},{key:"buffer",value:function(){this.setOutline(),this.cacheCtx=d(this.w,this.h),this.drawImg(this.cacheCtx)}},{key:"drawImg",value:function(t){t.save(),this.changeState(t),this.attr("sw")&&this.attr("sh")?t.drawImage(this.image,this.attr("sx"),this.attr("sy"),this.attr("sw"),this.attr("sh"),0,0,this.attr("w"),this.attr("h")):this.attr("w")&&this.attr("h")?t.drawImage(this.image,0,0,this.attr("w"),this.attr("h")):t.drawImage(this.image,0,0),t.restore()}},{key:"setOutline",value:function(){var t;this.image=M.get(this.attr("image")),this.w=this.attr("w")?this.attr("w"):this.image.width,this.h=this.attr("h")?this.attr("h"):this.image.height,this.outline=at("M ".concat(0," ",0," h ",this.w," v ").concat(this.h," h -").concat(this.w," z")),this.outline.restore().save().beginPath(),(t=this.outline).transform.apply(t,Object(s.a)(this.attr("lastMatrix")))}}]),Object(st.a)(e,t),e}(Ft),Kt=(i(105),"'([^']+)'|\"([^\"]+)\"|[\\w-]+"),te=new RegExp("(".concat("bold|bolder|lighter|[1-9]00",") +"),"i"),ee=new RegExp("(".concat("italic|oblique",") +"),"i"),ie=new RegExp("(".concat("small-caps",") +"),"i"),ne=new RegExp("(".concat("ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded",") +"),"i"),ae=new RegExp("([\\d\\.]+)(px|pt|pc|in|cm|mm|%|em|ex|ch|rem|q|vw|vh) *((?:"+Kt+")( *, *(?:"+Kt+"))*)"),re={};var se=d(),oe=function(t){function e(t){var i;return Object(a.a)(this,e),(i=Object(ot.a)(this,Object(ht.a)(e).call(this,t))).attr("lineHeight")||i.attr({lineHeight:1.2*function t(e,i){if(null==i)if("undefined"!=typeof window&&window.getComputedStyle){var n=window.getComputedStyle(document.documentElement).fontSize;i=t("".concat(n," Arial"),16).size}else i=16;if(re[e])return re[e];var a=ae.exec(e);if(a){var r,s,o,h,c={weight:"normal",style:"normal",stretch:"normal",variant:"normal",size:parseFloat(a[1]),unit:a[2],family:a[3].replace(/ *, */g,",")},u=e.substring(0,a.index);switch((r=te.exec(u))&&(c.weight=r[1]),(s=ee.exec(u))&&(c.style=s[1]),(o=ie.exec(u))&&(c.variant=o[1]),(h=ne.exec(u))&&(c.stretch=h[1]),c.size0=c.size,c.unit){case"pt":c.size/=.75;break;case"pc":c.size*=16;break;case"in":c.size*=96;break;case"cm":c.size*=96/2.54;break;case"mm":c.size*=96/25.4;break;case"%":break;case"em":case"rem":c.size*=i;break;case"q":c.size*=96/25.4/4}if("vw"===c.unit){if("undefined"!=typeof document&&document.documentElement){var l=document.documentElement.clientWidth;c.size=l*c.size/100}}else if("vh"===c.unit&&"undefined"!=typeof document&&document.documentElement){var f=document.documentElement.clientHeight;c.size=f*c.size/100}return re[e]=c}}(i.attr("font")).size}),i}return Object(r.a)(e,[{key:"render",value:function(t){t.save(),t.translate(this.attr("x"),this.attr("y")),t.transform.apply(t,Object(s.a)(this.attr("lastMatrix"))),this.changeState(t),this.cacheCtx&&!this.needUpdate||this.buffer(),t.drawImage(this.cacheCtx.canvas,0,0),t.restore()}},{key:"buffer",value:function(){var t=this;this.setOutline(),this.cacheCtx=d(this.attr("w"),this.attr("h")),this.cacheCtx.textBaseline="middle";var e=0,i=this.attr("textAlign");"center"===i?e=this.attr("w")/2:"right"===i&&(e=this.attr("w"));var n=this.attr("lineHeight");this.changeState(this.cacheCtx),this.cacheCtx.translate(e,0),this.lines.forEach(function(e,i){t.attr("fill")&&t.cacheCtx.fillText(e,0,(i+.5)*n),t.attr("stroke")&&t.cacheCtx.strokeText(e,0,(i+.5)*n)})}},{key:"setOutline",value:function(){var t,e=this;this.lines=this.attr("text").split(/\n/);var i=0;this.lines.forEach(function(t){var n=function(t,e){se.save(),se.font=e;var i=se.measureText(t).width;return se.restore(),Math.round(i)}(t,e.attr("font"));n>i&&(i=n)}),this.attr({w:i,h:this.attr("lineHeight")*this.lines.length}),this.outline=at("M 0 0 h ".concat(this.attr("w")," v ").concat(this.attr("h")," h -").concat(this.attr("w")," z")),this.outline.restore().save().beginPath(),this.attr("lineWidth")&&this.outline.lineWidth(this.attr("lineWidth")),(t=this.outline).transform.apply(t,Object(s.a)(this.attr("lastMatrix")))}}]),Object(st.a)(e,t),e}(Ft),he=i(179),ce=function(t){function e(t){var i;return Object(a.a)(this,e),i=Object(ot.a)(this,Object(ht.a)(e).call(this,t)),Object.assign(Object(he.a)(Object(he.a)(i)),{activeAngle:360,relativeX:0,relativeY:0,anticlockwise:!0},t),i}return Object(r.a)(e,[{key:"loop",value:function(t){var e=this,i=this.centerX,n=this.centerY,a=this.$ele.attr("x")-i,r=this.$ele.attr("y")-n,s=a>=0?180*Math.atan(r/a)/Math.PI:180*Math.atan(r/a)/Math.PI+180,o=Math.sqrt(Math.pow(r,2)+Math.pow(a,2));this.angle||(this.angle=s),this.r||(this.r=o),"number"==typeof this.centerX&&"number"==typeof this.centerY||l("centerX|centerY参数类型错误");var h=t/this.duration;if(!(h>1)){var c=0;if(this.retrace)if(h<=.5)c=this.calculatePercentage(2*h);else{var u=1-2*(h-.5);(1-h)*this.duration<80&&(u=0),c=this.calculatePercentage(u)}else c=this.calculatePercentage(h);var f=c*this.activeAngle;(!this.activeAngle||f<this.activeAngle)&&function(){var t;t=!1===e.anticlockwise?e.angle-f:e.angle+f;var i=e.getPosition(e,t),n=i.x,a=i.y;e.$ele.attr({x:n,y:a})}()}}},{key:"getPosition",value:function(t,e){var i="number"==typeof t.relativeX?t.relativeX:this.$ele.attr("w")*w(t.relativeX),n="number"==typeof t.relativeY?t.relativeY:this.$ele.attr("h")*w(t.relativeY),a=t.centerX,r=t.centerY,s=t.r;return{x:a+s*Math.cos(e*Math.PI/180)-i,y:r+s*Math.sin(e*Math.PI/180)-n}}}]),Object(st.a)(e,t),e}(pt);i.d(e,"g",function(){return $t}),i.d(e,"c",function(){return Qt}),i.d(e,"d",function(){return Zt}),i.d(e,"h",function(){return oe}),i.d(e,"e",function(){return Gt}),i.d(e,"a",function(){return dt}),i.d(e,"f",function(){return ce})},167:function(t,e,i){"use strict";var n={data:function(){return{}},methods:{}},a=(i(210),i(0)),r=Object(a.a)(n,function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"main-contaienr"},[this._t("default")],2)},[],!1,null,"69eddc6b",null);r.options.__file="Container.vue";e.a=r.exports},180:function(t,e,i){},210:function(t,e,i){"use strict";var n=i(180);i.n(n).a}}]);