blob: 31eb34211a61219f1e735ddb1fb515268f6fdf31 [file] [log] [blame]
(function(window){function Matrix(t){var e=this;e._t=e.transform,e.a=e.d=1,e.b=e.c=e.e=e.f=0,e.props=[1,0,0,1,0,0],e.cssParts=["matrix(","",")"],e.a1=e.b1=e.c1=e.d1=e.e1=e.f1=0,e.context=t,e.cos=e.sin=0,t&&t.setTransform(1,0,0,1,0,0)}function matrixManagerFunction(){var t=new Matrix,e=function(t,e,a,i,r,s,n,o,h){var l,m,p,d,c,u,f;return l=$M([[1,0,0,0],[0,Math.cos(t),Math.sin(-t),0],[0,Math.sin(t),Math.cos(t),0],[0,0,0,1]]),m=$M([[Math.cos(e),0,Math.sin(e),0],[0,1,0,0],[Math.sin(-e),0,Math.cos(e),0],[0,0,0,1]]),p=$M([[Math.cos(a),Math.sin(-a),0,0],[Math.sin(a),Math.cos(a),0,0],[0,0,1,0],[0,0,0,1]]),c=$M([[i,0,0,0],[0,r,0,0],[0,0,s,0],[0,0,0,1]]),u=l.x(m).x(p).x(c),u=u.transpose(),f=$M([[1,0,0,0],[0,1,0,0],[0,0,1,0],[n,o,h,1]]),u=u.x(f),d="matrix3d(",d+=u.e(1,1).toFixed(5)+","+u.e(1,2).toFixed(5)+","+u.e(1,3).toFixed(5)+","+u.e(1,4).toFixed(5)+",",d+=u.e(2,1).toFixed(5)+","+u.e(2,2).toFixed(5)+","+u.e(2,3).toFixed(5)+","+u.e(2,4).toFixed(5)+",",d+=u.e(3,1).toFixed(5)+","+u.e(3,2).toFixed(5)+","+u.e(3,3).toFixed(5)+","+u.e(3,4).toFixed(5)+",",d+=u.e(4,1).toFixed(5)+","+u.e(4,2).toFixed(5)+","+u.e(4,3).toFixed(5)+","+u.e(4,4).toFixed(5),d+=")"},a=function(e,a,i,r,s){return t.reset().translate(r,s).rotate(e).scale(a,i).toCSS()},i=function(e,a,i,r,s){return t.reset().translate(r,s).rotate(e).scale(a,i).toArray()},r=function(t){return a(t.r,t.s[0],t.s[1],t.p[0],t.p[1])},s=function(t,i){return i?e(-t.tr.r[0],t.tr.r[1],t.tr.r[2],t.tr.s[0],t.tr.s[1],t.tr.s[2],t.tr.p[0],t.tr.p[1],t.tr.p[2]):a(t.tr.r[2],t.tr.s[0],t.tr.s[1],t.tr.p[0],t.tr.p[1])},n=function(t,i){return i?e(-t.r[0],t.r[1],t.r[2],t.s[0],t.s[1],t.s[2],t.p[0],t.p[1],t.p[2]):a(t.r[2],t.s[0],t.s[1],t.p[0],t.p[1])},o=function(t,e){return e?null:i(t.r[2],t.s[0],t.s[1],t.p[0],t.p[1])};return{get2DMatrix:r,getMatrix:s,getMatrix2:n,getMatrixArray:o,getMatrixArrayFromParams:i,getMatrix2FromParams:a}}function styleDiv(t){t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.display="block",t.style.verticalAlign="top",t.style.backfaceVisibility=t.style.webkitBackfaceVisibility="hidden",styleUnselectableDiv(t)}function styleUnselectableDiv(t){t.style.userSelect="none",t.style.MozUserSelect="none",t.style.webkitUserSelect="none",t.style.oUserSelect="none"}function randomString(t,e){void 0===e&&(e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");var a,i="";for(a=t;a>0;--a)i+=e[Math.round(Math.random()*(e.length-1))];return i}function componentToHex(t){var e=t.toString(16);return 1==e.length?"0"+e:e}function fillToRgba(t,e){if(!cachedColors[t]){var a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);cachedColors[t]=parseInt(a[1],16)+","+parseInt(a[2],16)+","+parseInt(a[3],16)}return"rgba("+cachedColors[t]+","+e+")"}function createElement(t,e,a){if(!e){var i=Object.create(t.prototype,a),r={};return i&&"[object Function]"===r.toString.call(i.init)&&i.init(),i}e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.prototype.parent=t.prototype}function defineDescriptor(t,e,a,i){var r={writable:!1,configurable:!1,enumerable:!1,value:a};if(i)for(var s in i)r[s]=i[s];var n={};t&&"[object Function]"===n.toString.call(t)&&(t=t.prototype),Object.defineProperty(t,e,r)}function defineAccessor(t,e,a){var i,r={enumerable:!1,configurable:!1,get:function(){return i},set:function(t){i=t}};if(a)for(var s in a)r[s]=a[s];var n={};t&&"[object Function]"===n.toString.call(t)&&(t=t.prototype),Object.defineProperty(t,e,r)}function bezFunction(){function t(t,e,a,i,r,s){return o.abs((a-t)*(s-e)-(r-t)*(i-e))<1e-5}function e(t){return s[t].fnc}function a(t,e,a,i,r){if(r||(r=("bez_"+t+"_"+e+"_"+a+"_"+i).replace(/\./g,"p")),s[r])return s[r];var n,o,h,l,m,p;return s[r]=function(r,s,d,c,u){var f=s/u;r=f;for(var y,g=0;++g<14&&(h=3*t,o=3*(a-t)-h,n=1-h-o,y=r*(h+r*(o+r*n))-f,!(Math.abs(y)<.001));)r-=y/(h+r*(2*o+3*n*r));p=3*e,m=3*(i-e)-p,l=1-p-m;var v=r*(p+r*(m+r*l));return c*v+d},s[r]}function i(e,a,i,r){var s=(e.join("_")+"_"+a.join("_")+"_"+i.join("_")+"_"+r.join("_")).replace(/\./g,"p");if(n[s])return n[s];var o,h,l,m,p,d,c,u,f,y,g,v,x=500,b=0,E=null,C={points:[],segmentLength:0};for(t(e[0],e[1],a[0],a[1],i[0],i[1])&&t(e[0],e[1],a[0],a[1],r[0],r[1])&&(x=2),l=i.length,o=0;x>o;o+=1){for(v=[],y=o/(x-1),g=0,h=0;l>h;h+=1)m=e[h]+(i[h]-e[h])*y,p=i[h]+(r[h]-i[h])*y,d=r[h]+(a[h]-r[h])*y,c=m+(p-m)*y,u=p+(d-p)*y,f=c+(u-c)*y,v.push(f),null!==E&&(g+=Math.pow(v[h]-E[h],2));g=Math.sqrt(g),b+=g,C.points.push({partialLength:g,cumulatedLength:b,point:v}),E=v}return C.segmentLength=b,n[s]=C,C}function r(e){var a,i,r,s,n,o,h,l,m,p,d,c,u=e.s,f=e.e,y=e.to,g=e.ti,v=500,x=0,b=null,E={points:[],segmentLength:0};for(t(u[0],u[1],f[0],f[1],u[0]+y[0],u[1]+y[1])&&t(u[0],u[1],f[0],f[1],f[0]+g[0],f[1]+g[1])&&(v=2),r=y.length,a=0;v>a;a+=1){for(c=[],p=a/(v-1),d=0,i=0;r>i;i+=1)s=u[i]+y[i]*p,n=u[i]+y[i]+(f[i]+g[i]-(u[i]+y[i]))*p,o=f[i]+g[i]+-g[i]*p,h=s+(n-s)*p,l=n+(o-n)*p,m=h+(l-h)*p,c.push(m),null!==b&&(d+=Math.pow(c[i]-b[i],2));d=Math.sqrt(d),x+=d,E.points.push({partialLength:d,cumulatedLength:x,point:c}),b=c}E.segmentLength=x,e.bezierData=E}var s=[],n={},o=Math,h={getEasingCurve:a,getEasingCurveByIndex:e,drawBezierCurve:i,buildBezierData:r};return h}function dataFunctionManager(){function t(t,e,a){var i,r=o(t,e,a),s=[];for(i=0;e>i;i+=1)s.push(Math.floor(r[i]*g));return s}function e(t,e){var a,i,r,s=t.length;for(a=0;s>a;a+=1)if(void 0!==t[a].t)if(t[a].s instanceof Array)for(r=t[a].s.length,i=0;r>i;i+=1)t[a].s[i]*=e,t[a].e[i]*=e;else t[a].s&&(t[a].s*=e,t[a].e*=e);else t[a]=t[a]*e}function a(s){var o,h,l,m,p,d,c,u,f,y,g=s.length;for(d=0;g>d;d+=1){if(l=s[d],o=l.outPoint-l.startTime,h=l.startTime,l.layerName=n(l.layerName),l.parent&&(l.parent=n(l.parent)),l.renderedFrame={},l.renderedData={},m=[],p=-1,l.tm&&(l.trmp=l.tm,l.tm=t(l.tm,o,h)),l.ks.o instanceof Array?e(l.ks.o,.01):l.ks.o/=100,l.ks.s instanceof Array?e(l.ks.s,.01):l.ks.s/=100,l.ks.r instanceof Array?e(l.ks.r,b):l.ks.r*=b,l.hasMask){var v=l.masksProperties;for(u=v.length,c=0;u>c;c+=1)if(v[c].pt.i)r(v[c].pt);else for(y=v[c].pt.length,f=0;y>f;f+=1)v[c].pt[f].s&&r(v[c].pt[f].s[0]),v[c].pt[f].e&&r(v[c].pt[f].e[0])}"PreCompLayer"==l.type?a(l.layers):"ShapeLayer"==l.type&&i(l.shapes)}}function i(t){var a,s,n,o,h=t.length;for(a=0;h>a;a+=1)if(t[a].renderedData=[],"fl"==t[a].ty||"st"==t[a].ty)t[a].o instanceof Array?e(t[a].o,.01):t[a].o*=.01;else if("sh"==t[a].ty)if(t[a].ks.i)r(t[a].ks);else for(n=t[a].ks.length,s=0;n>s;s+=1)t[a].ks[s].s&&(r(t[a].ks[s].s[0]),r(t[a].ks[s].e[0]));else"gr"==t[a].ty?i(t[a].it):"tr"==t[a].ty&&(o=t[a],o.renderedData=[],o.o instanceof Array?e(o.o,.01):o.o/=100,o.s instanceof Array?e(o.s,.01):o.s/=100,o.r instanceof Array?e(o.r,b):o.r*=b)}function r(t){var e,a=t.i.length;for(e=0;a>e;e+=1)t.i[e][0]+=t.v[e][0],t.i[e][1]+=t.v[e][1],t.o[e][0]+=t.v[e][0],t.o[e][1]+=t.v[e][1]}function s(t){x[t._id]={data:t,renderedFrames:[]},g=t.animation.frameRate,a(t.animation.layers)}function n(t){return t=t.replace(/ /g,"_"),t=t.replace(/-/g,"_"),t=t.replace(/\./g,"_"),t=t.replace(/\//g,"_")}function o(t,e,a){var i,r,s=[];if(!(t instanceof Array)||null===t[0].t)return s.push(t),s;var n,o;s=[];var h,l,m,p=[];r=t.length;var d,c,u;for(i=0;r>i;i+=1)n=t[i],n.t-=a;var f=0,y=0;for(i=0;e>i;i+=1){h=f;for(var g=!1;r-1>h;){if(n=t[h],o=t[h+1],i<n.t&&0===h){for(m=n.s.length,p=[],l=0;m>l;l+=1)p.push(n.s[l]);s.push(p),g=!0,f!=h&&(f=h,y=0);break}if(i>=n.t&&i<o.t){if(p=[],n.to){d=bez.getEasingCurve(n.o.x,n.o.y,n.i.x,n.i.y)("",i-n.t,0,1,o.t-n.t),c=n.bezierData;var v,x,b=c.segmentLength*d;for(l=y;l<c.points.length;){if(0===i||0===b||0===d){p=c.points[l].point,y=l;break}if(l==c.points.length-1)p=c.points[l].point;else if(b>c.points[l].partialLength&&b<c.points[l+1].partialLength){for(v=c.points[l].point.length,x=(b-c.points[l].partialLength)/(c.points[l+1].partialLength-c.points[l].partialLength),u=0;v>u;u+=1)p.push(c.points[l].point[u]+(c.points[l+1].point[u]-c.points[l].point[u])*x);y=l;break}l+=1}}else{var E,C,S,D;n.s.forEach(function(t,e){if(1!==n.h&&(n.o.x instanceof Array?(E=n.o.x[e],C=n.o.y[e],S=n.i.x[e],D=n.i.y[e]):(E=n.o.x,C=n.o.y,S=n.i.x,D=n.i.y),d=bez.getEasingCurve(E,C,S,D)("",i-n.t,0,1,o.t-n.t)),t.i){var a={i:[],o:[],v:[]};t.i.forEach(function(i,r){var s=[],o=[],h=[];i.forEach(function(a,i){1===n.h?(s.push(a),o.push(t.o[r][i]),h.push(t.v[r][i])):(s.push(a+(n.e[e].i[r][i]-a)*d),o.push(t.o[r][i]+(n.e[e].o[r][i]-t.o[r][i])*d),h.push(t.v[r][i]+(n.e[e].v[r][i]-t.v[r][i])*d))}),a.i.push(s),a.o.push(o),a.v.push(h)}),p.push(a)}else p.push(1===n.h?t:t+(n.e[e]-t)*d)})}s.push(p),g=!0,f!=h&&(f=h,y=0);break}h+=1}g===!1&&(n=t[t.length-2],p=[],n.e.forEach(function(t){p.push(t)}),s.push(p))}for(h=s.length;e>h;)s.push(p),h+=1;return s}function h(t,e,a,i){var r,s,n,o,h,l;if(!t.length)return"p"==i.type?(C.px=t,C.py=t):"s"==i.type?(C.sx=t,C.sy=t):"r"==i.type&&(C.r=t),i.toArray?[t]:t;if(void 0===t[0].t)return"p"==i.type?(C.px=t[0],C.py=t[1]):"s"==i.type?(C.sx=t[0],C.sy=t[1]):"r"==i.type&&(C.r=t[0]),t;h=0,l=t.length-1;for(var m=1,p=!0;!(!p||(r=t[h],s=t[h+1],h==l-1&&e>=s.t-a)||s.t-a>e&&1==m);){if(s.t-a<e&&-1==m){h+=1,r=t[h],s=t[h+1];break}l-1>h&&1==m||h>0&&-1==m?h+=m:p=!1}r.to&&!r.bezierData&&bez.buildBezierData(r);var d,c,u,f,y,g=0;if("default"==i.type&&(n=[]),r.to){if(o=r.bezierData,e>=s.t-a)return"p"==i.type?(C.px=o.points[o.points.length-1].point[0],C.py=o.points[o.points.length-1].point[1]):"s"==i.type?(C.sx=o.points[o.points.length-1].point[0],C.sy=o.points[o.points.length-1].point[1]):"r"==i.type&&(C.r=o.points[o.points.length-1].point[0]),o.points[o.points.length-1].point;if(e<r.t-a)return"p"==i.type?(C.px=o.points[0].point[0],C.py=o.points[0].point[1]):"s"==i.type?(C.sx=o.points[0].point[0],C.sy=o.points[0].point[1]):"r"==i.type&&(C.r=o.points[0].point[0]),o.points[0].point;r.__fnct?y=r.__fnct:(y=bez.getEasingCurve(r.o.x,r.o.y,r.i.x,r.i.y,r.n),r.__fnct=y),u=y("",e-(r.t-a),0,1,s.t-a-(r.t-a));var v,x=o.segmentLength*u,b=0;for(m=1,p=!0,f=o.points.length;p;){if(b+=o.points[g].partialLength*m,0===x||0===u){"p"==i.type?(C.px=o.points[g].point[0],C.py=o.points[g].point[1]):"s"==i.type?(C.sx=o.points[g].point[0],C.sy=o.points[g].point[1]):"r"==i.type?C.r=o.points[g].point[0]:n=o.points[g].point;break}if(g==o.points.length-1){"p"==i.type?(C.px=o.points[g].point[0],C.py=o.points[g].point[1]):"s"==i.type?(C.sx=o.points[g].point[0],C.sy=o.points[g].point[1]):"r"==i.type?C.r=o.points[g].point[0]:n=o.points[g].point;break}if(x>b&&x<b+o.points[g+1].partialLength){if(v=(x-b)/o.points[g+1].partialLength,"p"==i.type)C.px=o.points[g].point[0]+(o.points[g+1].point[0]-o.points[g].point[0])*v,C.py=o.points[g].point[1]+(o.points[g+1].point[1]-o.points[g].point[1])*v;else if("s"==i.type)C.sx=o.points[g].point[0]+(o.points[g+1].point[0]-o.points[g].point[0])*v,C.sy=o.points[g].point[1]+(o.points[g+1].point[1]-o.points[g].point[1])*v;else if("r"==i.type)C.r=o.points[g].point[0]+(o.points[g+1].point[0]-o.points[g].point[0])*v;else for(c=o.points[g].point.length,d=0;c>d;d+=1)n.push(o.points[g].point[d]+(o.points[g+1].point[d]-o.points[g].point[d])*v);break}f-1>g&&1==m||g>0&&-1==m?g+=m:p=!1}}else{var E,S,D,w,F=!1;for(l=r.s.length,h=0;l>h;h+=1)1!==r.h&&(r.o.x instanceof Array?(F=!0,E=r.o.x[h]?r.o.x[h]:r.o.x[0],S=r.o.y[h]?r.o.y[h]:r.o.y[0],D=r.i.x[h]?r.i.x[h]:r.i.x[0],w=r.i.y[h]?r.i.y[h]:r.i.y[0],r.__fnct||(r.__fnct=[])):(F=!1,E=r.o.x,S=r.o.y,D=r.i.x,w=r.i.y),F?r.__fnct[h]?y=r.__fnct[h]:(y=bez.getEasingCurve(E,S,D,w),r.__fnct[h]=y):r.__fnct?y=r.__fnct:(y=bez.getEasingCurve(E,S,D,w),r.__fnct=y),u=e>=s.t-a?1:e<r.t-a?0:y("",e-(r.t-a),0,1,s.t-a-(r.t-a))),1===r.h?"p"==i.type?0===h?C.px=r.s[h]:1==h&&(C.py=r.s[h]):"s"==i.type?0===h?C.sx=r.s[h]:1==h&&(C.sy=r.s[h]):"r"==i.type?C.r=r.s[h]:n.push(r.s[h]):"p"==i.type?0===h?C.px=r.s[h]+(r.e[h]-r.s[h])*u:1==h&&(C.py=r.s[h]+(r.e[h]-r.s[h])*u):"s"==i.type?0===h?C.sx=r.s[h]+(r.e[h]-r.s[h])*u:1==h&&(C.sy=r.s[h]+(r.e[h]-r.s[h])*u):"r"==i.type?C.r=r.s[h]+(r.e[h]-r.s[h])*u:n.push(r.s[h]+(r.e[h]-r.s[h])*u)}return n}function l(t,e,a,i,r){var s={};s.closed=r?t.cl:t.closed;var n=r?t.pt:t.ks;if(n.v)return"svg"==i?(n.__pathString||(n.__pathString=m(n,s.closed)),s.pathString=n.__pathString):s.pathNodes=n,s;t={i:[],o:[],v:[]};var o,h,l,p,d,c,u,f=[];if(e<n[0].t-a){if(!n.__minValue){for(h=n[0].s[0].i.length,o=0;h>o;o+=1){for(d=[],c=[],u=[],p=n[0].s[0].i[o].length,l=0;p>l;l+=1)d.push(n[0].s[0].i[o][l]),c.push(n[0].s[0].o[o][l]),u.push(n[0].s[0].v[o][l]);t.i.push(d),t.o.push(c),t.v.push(u)}f.push(t),n.__minValue="svg"==i?m(f,s.closed):f[0]}return"svg"==i?s.pathString=n.__minValue:s.pathNodes=n.__minValue,s}if(e>n[n.length-1].t-a){if(!n.__maxValue){var y=n.length-2;for(h=n[y].s[0].i.length,o=0;h>o;o+=1){for(d=[],c=[],u=[],p=n[y].s[0].i[o].length,l=0;p>l;l+=1)d.push(n[y].e[0].i[o][l]),c.push(n[y].e[0].o[o][l]),u.push(n[y].e[0].v[o][l]);t.i.push(d),t.o.push(c),t.v.push(u)}f.push(t),n.__maxValue="svg"==i?m(f,s.closed):f[0]}return"svg"==i?s.pathString=n.__maxValue:s.pathNodes=n.__maxValue,s}for(var g,v,x=0,b=n.length-1,E=1,C=!0;C&&(g=n[x],v=n[x+1],!(v.t-a>e&&1==E));)b-1>x&&1==E||x>0&&-1==E?x+=E:C=!1;var S,D,w,F,I;if(1!==g.h){S=g.o.x,D=g.o.y,w=g.i.x,F=g.i.y;var A;g.__fnct?A=g.__fnct:(A=bez.getEasingCurve(S,D,w,F),g.__fnct=A),I=A("",e-(g.t-a),0,1,v.t-a-(g.t-a)),e>=v.t-a?I=1:e<g.t-a&&(I=0)}if(1===g.h&&g.__hValue)f.push(g.__hValue);else for(t={i:[],o:[],v:[]},h=g.s[0].i.length,o=0;h>o;o+=1){for(d=[],c=[],u=[],p=g.s[0].i[o].length,l=0;p>l;l+=1)1===g.h?(d.push(g.s[0].i[o][l]),c.push(g.s[0].o[o][l]),u.push(g.s[0].v[o][l])):(d.push(g.s[0].i[o][l]+(g.e[0].i[o][l]-g.s[0].i[o][l])*I),c.push(g.s[0].o[o][l]+(g.e[0].o[o][l]-g.s[0].o[o][l])*I),u.push(g.s[0].v[o][l]+(g.e[0].v[o][l]-g.s[0].v[o][l])*I));t.i.push(d),t.o.push(c),t.v.push(u),1===g.h&&(g.__hValue=t),f.push(t)}return"svg"==i?s.pathString=m(f[0],s.closed):s.pathNodes=f[0],s}function m(t,e){var a,i,r,s,n,o,h="";if(!(t instanceof Array)){for(a=t.v,i=t.o,r=t.i,o=a.length,h+="M"+a[0].join(","),n=1;o>n;n++)h+=" C"+i[n-1].join(",")+" "+r[n].join(",")+" "+a[n].join(",");return e!==!1&&(h+=" C"+i[n-1].join(",")+" "+r[0].join(",")+" "+a[0].join(",")),h}var l,m=t.length;for(h="",l=0;m>l;l+=1){for(s=t[l],a=s.v,i=s.o,r=s.i,o=a.length,h+="M"+a[0].join(","),n=1;o>n;n++)h+=" C"+i[n-1].join(",")+" "+r[n].join(",")+" "+a[n].join(",");e!==!1&&(h+=" C"+i[n-1].join(",")+" "+r[0].join(",")+" "+a[0].join(","))}return h}function p(t,e,a){var i,r,s,n,o,m,c,u,f,y=t.length;for(u=0;y>u;u+=1)if(f=t[u],n=e-f.startTime,!f.an[n]){if(i={},E.arrayFlag=!1,E.type="default",i.a=h(f.ks.a,n,f.startTime,E),i.o=h(f.ks.o,n,f.startTime,E),E.arrayFlag=!1,E.type="p",h(f.ks.p,n,f.startTime,E),E.arrayFlag=!0,E.type="r",h(f.ks.r,n,f.startTime,E),E.arrayFlag=!0,E.type="s",h(f.ks.s,n,f.startTime,E),c={},c.an={tr:i},E.arrayFlag=!1,E.type="default","canvas"==a?c.an.matrixArray=v.getMatrixArrayFromParams(C.r,C.sx,C.sy,C.px,C.py):(c.an.matrixArray=v.getMatrixArrayFromParams(C.r,C.sx,C.sy,C.px,C.py),c.an.matrixValue=v.getMatrix2FromParams(C.r,C.sx,C.sy,C.px,C.py)+"translate("+-i.a[0]+" "+-i.a[1]+")"),f.renderedData[n]=c,f.hasMask)for(r=f.masksProperties,m=r.length,o=0;m>o;o+=1)r[o].paths||(r[o].paths=[],r[o].opacity=[]),r[o].paths[n]=l(r[o],n,f.startTime,a,!0),r[o].opacity[n]=h(r[o].o,n,f.startTime,E),r[o].opacity[n]=r[o].opacity[n]instanceof Array?r[o].opacity[n][0]/100:r[o].opacity[n]/100;e<f.inPoint||e>f.outPoint||("PreCompLayer"==f.type?(s=f.tm?f.tm[n]<0?0:n>=f.tm.length?f.tm[f.tm.length-1]:f.tm[n]:n,void 0===s&&(s=h(f.trmp,n,0,E)[0]*g,f.tm[n]=s),p(f.layers,s,a)):"ShapeLayer"==f.type&&d(f.shapes,n,f.startTime,a))}}function d(t,e,a,i){var r,s,n,o,m,p,u,f,y,g,x,b,S,D=t.length;for(r=0;D>r;r+=1)s=t[r],"sh"==s.ty?s.renderedData[e]={path:l(s,e,a,i)}:"fl"==s.ty?(n=h(s.c,e,a,E),o=h(s.o,e,a,E),s.renderedData[e]={opacity:o instanceof Array?o[0]:o},"canvas"==i?(c(n),s.renderedData[e].color=n):s.renderedData[e].color=rgbToHex(Math.round(n[0]),Math.round(n[1]),Math.round(n[2]))):"rc"==s.ty?(m=h(s.p,e,a,E),p=h(s.s,e,a,E),u=h(s.r,e,a,E),s.renderedData[e]={position:m,size:p,roundness:u}):"el"==s.ty?(m=h(s.p,e,a,E),p=h(s.s,e,a,E),s.renderedData[e]={p:m,size:p}):"st"==s.ty?(f=h(s.c,e,a,E),y=h(s.o,e,a,E),g=h(s.w,e,a,E),s.renderedData[e]={opacity:y instanceof Array?y[0]:y,width:g instanceof Array?g[0]:g},"canvas"==i?(c(f),s.renderedData[e].color=f):s.renderedData[e].color=rgbToHex(Math.round(f[0]),Math.round(f[1]),Math.round(f[2]))):"tr"==s.ty?(s.renderedData[e]={a:h(s.a,e,a,E),o:h(s.o,e,a,E)},E.arrayFlag=!0,E.type="s",h(s.s,e,a,E),E.arrayFlag=!0,E.type="r",h(s.r,e,a,E),E.arrayFlag=!1,E.type="p",h(s.p,e,a,E),E.arrayFlag=!1,E.type="default","canvas"==i?s.renderedData[e].mtArr=v.getMatrixArrayFromParams(C.r,C.sx,C.sy,C.px,C.py):(s.renderedData[e].mtArr=v.getMatrixArrayFromParams(C.r,C.sx,C.sy,C.px,C.py),s.renderedData[e].mt=v.getMatrix2FromParams(C.r,C.sx,C.sy,C.px,C.py))):"tm"==s.ty?(x=h(s.s,e,a,E),b=h(s.e,e,a,E),S=h(s.o,e,a,E),s.renderedData[e]={s:x,e:b,o:S}):"gr"==s.ty&&d(s.it,e,a,i)}function c(t){var e,a=t.length;for(e=0;a>e;e+=1)t[e]=Math.round(t[e])}function u(t,e){for(var a=1;a>0;){if(e+=1,e>=t.data.animation.totalFrames){t.renderFinished=!0;break}t.renderedFrames[e]||(f(t.data._id,e),a-=1)}}function f(t,e){return 2==x[t].renderedFrames[e]?void(x[t].renderFinished||u(x[t],e)):(g=x[t].data.animation.frameRate,x[t].renderedFrames[e]=2,void p(x[t].data.animation.layers,e,x[t].data._animType))}function y(t){var e,a=x[t].data,i=a.animation.totalFrames,r=[];for(e=0;i>e;e+=1)r.push({num:e,data:f(t,e)})}var g=0,v=new MatrixManager,x={},b=Math.PI/180,E={arrayFlag:!1},C={r:0,sx:1,sy:1,px:1,py:1},S={};return S.completeData=s,S.renderFrame=f,S.renderAllFrames=y,S}function SVGRenderer(t){this.animationItem=t,this.layers=null,this.lastFrame=-1,this.globalData={frameNum:-1}}function CanvasRenderer(t,e){this.animationItem=t,this.renderConfig=e?e:{clearCanvas:!0,context:null,scaleMode:"fit"},this.lastFrame=-1,this.globalData={frameNum:-1}}function MaskElement(t){this.data=null,this.element=null,this.globalData=t,this.paths=[]}function ICompElement(t,e,a,i){this.parent.constructor.call(this,t,e,a,i),this.layers=t.layers}function IImageElement(t,e,a,i){this.animationItem=e,this.assets=this.animationItem.getAssets(),this.path=this.animationItem.getPath(),this.parent.constructor.call(this,t,e,a,i)}function IShapeElement(t,e,a,i){this.shapes=[],this.parent.constructor.call(this,t,e,a,i)}function ShapeItemElement(t,e,a){this.stylesList=[],this.currentMatrix=new Matrix,this.shape=e,this.data=t,this.globalData=a,this.searchShapes(this.data),styleUnselectableDiv(this.shape)}function ISolidElement(t,e,a,i){this.parent.constructor.call(this,t,e,a,i)}function ITextElement(t,e,a,i){this.parent.constructor.call(this,t,e,a,i)}function CVBaseElement(t,e,a){this.renderer=e,this.data=t,this.globalData=a,this.currentAnimData=null,this.renderFrame=!1,this.init()}function CVCompElement(t,e,a){this.parent.constructor.call(this,t,e,a),this.layers=t.layers}function CVImageElement(t,e,a){this.renderer=e,this.animationItem=e.animationItem,this.assets=this.animationItem.getAssets(),this.path=this.animationItem.getPath(),this.parent.constructor.call(this,t,e,a),this.animationItem.pendingElements+=1}function CVShapeElement(t,e,a){this.shapes=[],this.parent.constructor.call(this,t,e,a)}function CVShapeItemElement(t,e,a,i){this.data=t,this.globalData=i,this.renderer=e,this.frameNum=-1,this.trims=[],this.dataLength=this.data.length,this.mainFlag=a,this.stylesList=[],this.ownStylesList=[],this.stylesPool=[],this.currentStylePoolPos=0,this.currentMatrix=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGMatrix(),this.mat=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGMatrix();var r,s=this.dataLength-1;this.renderedPaths={};var n;for(r=s;r>=0;r-=1)"gr"==this.data[r].ty?this.data[r].item=new CVShapeItemElement(this.data[r].it,this.renderer,!1,this.globalData):"st"==this.data[r].ty||"fl"==this.data[r].ty?(n={type:"fill",styleOpacity:0,opacity:0,value:"rgba(0,0,0,0)",closed:!1},"fl"==this.data[r].ty?n.type="fill":(n.type="stroke",n.width=0),this.stylesPool.push(n)):"sh"==this.data[r].ty||"el"==this.data[r].ty||"rc"==this.data[r].ty}function CVSolidElement(t,e,a){this.parent.constructor.call(this,t,e,a)}function CVTextElement(t,e){this.parent.constructor.call(this,t,e)}function CVMaskElement(){}var svgNS="http://www.w3.org/2000/svg";Matrix.prototype={concat:function(t){return this.clone()._t(t.a,t.b,t.c,t.d,t.e,t.f)},flipX:function(){return this._t(-1,0,0,1,0,0)},flipY:function(){return this._t(1,0,0,-1,0,0)},reflectVector:function(t,e){var a=this.applyToPoint(0,1),i=2*(a.x*t+a.y*e);return t-=i*a.x,e-=i*a.y,{x:t,y:e}},reset:function(){return this.setTransform(1,0,0,1,0,0)},rotate:function(t){return 0===t?this:(this.cos=Math.cos(t),this.sin=Math.sin(t),this._t(this.cos,this.sin,-this.sin,this.cos,0,0))},rotateFromVector:function(t,e){return this.rotate(Math.atan2(e,t))},rotateDeg:function(t){return this.rotate(t*Math.PI/180)},scaleU:function(t){return this._t(t,0,0,t,0,0)},scale:function(t,e){return 1==t&&1==e?this:this._t(t,0,0,e,0,0)},scaleX:function(t){return this._t(t,0,0,1,0,0)},scaleY:function(t){return this._t(1,0,0,t,0,0)},shear:function(t,e){return this._t(1,e,t,1,0,0)},shearX:function(t){return this._t(1,0,t,1,0,0)},shearY:function(t){return this._t(1,t,0,1,0,0)},skew:function(t,e){return this.shear(Math.tan(t),Math.tan(e))},skewX:function(t){return this.shearX(Math.tan(t))},skewY:function(t){return this.shearY(Math.tan(t))},setTransform:function(t,e,a,i,r,s){return this.props[0]=t,this.props[1]=e,this.props[2]=a,this.props[3]=i,this.props[4]=r,this.props[5]=s,this._x()},translate:function(t,e){return this._t(1,0,0,1,t,e)},translateX:function(t){return this._t(1,0,0,1,t,0)},translateY:function(t){return this._t(1,0,0,1,0,t)},transform:function(t,e,a,i,r,s){return this.a1=this.props[0],this.b1=this.props[1],this.c1=this.props[2],this.d1=this.props[3],this.e1=this.props[4],this.f1=this.props[5],this.props[0]=this.a1*t+this.c1*e,this.props[1]=this.b1*t+this.d1*e,this.props[2]=this.a1*a+this.c1*i,this.props[3]=this.b1*a+this.d1*i,this.props[4]=this.a1*r+this.c1*s+this.e1,this.props[5]=this.b1*r+this.d1*s+this.f1,this._x()},divide:function(t){if(!t.isInvertible())throw"Input matrix is not invertible";var e=t.inverse();return this._t(e.a,e.b,e.c,e.d,e.e,e.f)},divideScalar:function(t){var e=this;return e.a/=t,e.b/=t,e.c/=t,e.d/=t,e.e/=t,e.f/=t,e._x()},inverse:function(){if(this.isIdentity())return new Matrix;if(this.isInvertible()){var t=this,e=t.a,a=t.b,i=t.c,r=t.d,s=t.e,n=t.f,o=new Matrix,h=e*r-a*i;return o.a=r/h,o.b=-a/h,o.c=-i/h,o.d=e/h,o.e=(i*n-r*s)/h,o.f=-(e*n-a*s)/h,o}throw"Matrix is not invertible."},interpolate:function(t,e,a){var i=this,r=a?new Matrix(a):new Matrix;return r.a=i.a+(t.a-i.a)*e,r.b=i.b+(t.b-i.b)*e,r.c=i.c+(t.c-i.c)*e,r.d=i.d+(t.d-i.d)*e,r.e=i.e+(t.e-i.e)*e,r.f=i.f+(t.f-i.f)*e,r._x()},interpolateAnim:function(t,e,a){var i=this,r=a?new Matrix(a):new Matrix,s=i.decompose(),n=t.decompose(),o=s.rotation+(n.rotation-s.rotation)*e,h=s.translate.x+(n.translate.x-s.translate.x)*e,l=s.translate.y+(n.translate.y-s.translate.y)*e,m=s.scale.x+(n.scale.x-s.scale.x)*e,p=s.scale.y+(n.scale.y-s.scale.y)*e;return r.translate(h,l),r.rotate(o),r.scale(m,p),r._x()},decompose:function(t){var e=this.props[0],a=this.props[1],i=this.props[2],r=this.props[3],s=Math.acos,n=Math.atan,o=Math.sqrt,h=Math.PI,l={x:this.props[4],y:this.props[5]},m=0,p={x:1,y:1},d={x:0,y:0},c=e*r-a*i;if(t)e?(d={x:n(i/e),y:n(a/e)},p={x:e,y:c/e}):a?(m=.5*h,p={x:a,y:c/a},d.x=n(r/a)):(p={x:i,y:r},d.x=.25*h);else if(e||a){var u=o(e*e+a*a);m=a>0?s(e/u):-s(e/u),p={x:u,y:c/u},d.x=n((e*i+a*r)/(u*u))}else if(i||r){var f=o(i*i+r*r);m=.5*h-(r>0?s(-i/f):-s(i/f)),p={x:c/f,y:f},d.y=n((e*i+a*r)/(f*f))}else p={x:0,y:0};return{scale:p,translate:l,rotation:m,skew:d}},determinant:function(){return this.a*this.d-this.b*this.c},applyToPoint:function(t,e){return{x:t*this.props[0]+e*this.props[2]+this.props[4],y:t*this.props[1]+e*this.props[3]+this.props[5]}},applyToArray:function(t){var e,a,i=0,r=[];if("number"==typeof t[0])for(a=t.length;a>i;)e=this.applyToPoint(t[i++],t[i++]),r.push(e.x,e.y);else for(a=t.length,i=0;a>i;i++)r.push(this.applyToPoint(t[i].x,t[i].y));return r},applyToTypedArray:function(t,e){for(var a,i=0,r=t.length,s=e?new Float64Array(r):new Float32Array(r);r>i;)a=this.applyToPoint(t[i],t[i+1]),s[i++]=a.x,s[i++]=a.y;return s},applyToContext:function(t){var e=this;return t.setTransform(e.a,e.b,e.c,e.d,e.e,e.f),e},isIdentity:function(){var t=this;return t._q(t.a,1)&&t._q(t.b,0)&&t._q(t.c,0)&&t._q(t.d,1)&&t._q(t.e,0)&&t._q(t.f,0)},isInvertible:function(){return!this._q(this.determinant(),0)},isValid:function(){return!this._q(this.a*this.d,0)},clone:function(t){var e=this,a=new Matrix;return a.a=e.a,a.b=e.b,a.c=e.c,a.d=e.d,a.e=e.e,a.f=e.f,t||(a.context=e.context),a},isEqual:function(t){var e=this,a=e._q;return a(e.a,t.a)&&a(e.b,t.b)&&a(e.c,t.c)&&a(e.d,t.d)&&a(e.e,t.e)&&a(e.f,t.f)},toArray:function(){return[this.props[0],this.props[1],this.props[2],this.props[3],this.props[4],this.props[5]]},toCSS:function(){return this.cssParts[1]=this.props.join(","),this.cssParts.join("")},toJSON:function(){var t=this;return'{"a":'+t.a+',"b":'+t.b+',"c":'+t.c+',"d":'+t.d+',"e":'+t.e+',"f":'+t.f+"}"},toString:function(){return""+this.toArray()},_q:function(t,e){return Math.abs(t-e)<1e-14},_x:function(){return this.context&&this.context.setTransform(this.a,this.b,this.c,this.d,this.e,this.f),this}},void 0===CanvasRenderingContext2D.prototype.ellipse&&(CanvasRenderingContext2D.prototype.ellipse=function(t,e,a,i,r,s,n,o){this.save(),this.translate(t,e),this.rotate(r),this.scale(a,i),this.arc(0,0,1,s,n,o),this.restore()}),("function"!=typeof Path2D||"function"!=typeof Path2D.prototype.addPath||"function"!=typeof Path2D.prototype.ellipse)&&!function(){function t(t){if(this.ops_=[],void 0!==t)if("string"==typeof t)try{this.ops_=parser.parse(t)}catch(e){}else{if(!t.hasOwnProperty("ops_"))throw"Error: "+typeof t+"is not a valid argument to Path";this.ops_=t.ops_.slice(0)}}function e(t){return function(){var e,a=arguments.length,i=[];for(e=0;a>e;e+=1)i.push(arguments[e]);this.ops_.push({type:t,args:i})}}for(var a=CanvasRenderingContext2D.prototype,i=["closePath","moveTo","lineTo","quadraticCurveTo","bezierCurveTo","rect","arc","arcTo","ellipse"],r=0;r<i.length;r++){var s=i[r];t.prototype[s]=e(s)}t.prototype.addPath=function(t,e){var a=!1;!e||1==e.a&&0==e.b&&0==e.c&&1==e.d&&0==e.e&&0==e.f||(a=!0,this.ops_.push({type:"save",args:[]}),this.ops_.push({type:"transform",args:[e.a,e.b,e.c,e.d,e.e,e.f]})),this.ops_=this.ops_.concat(t.ops_),a&&this.ops_.push({type:"restore",args:[]})};var n=a.fill,o=a.stroke,h=a.clip;a.fill=function(e){if(e instanceof t){this.beginPath();for(var i=0,r=e.ops_.length;r>i;i++){var s=e.ops_[i];a[s.type].apply(this,s.args)}r=arguments.length;var o=[];for(i=1;r>i;i+=1)o.push(arguments[i]);n.apply(this,o)}else n.apply(this,arguments)},a.stroke=function(e){if(e instanceof t){this.beginPath();for(var i=0,r=e.ops_.length;r>i;i++){var s=e.ops_[i];a[s.type].apply(this,s.args)}o.call(this)}else o.call(this)},a.clip=function(e){if(e instanceof t){this.beginPath();for(var i=0,r=e.ops_.length;r>i;i++){var s=e.ops_[i];a[s.type].apply(this,s.args)}r=arguments.length;var n=[];for(i=1;r>i;i+=1)n.push(arguments[i]);h.apply(this,n)}else h.apply(this,arguments)},Path2D=t}();var MatrixManager=matrixManagerFunction;!function(){for(var t=0,e=["ms","moz","webkit","o"],a=0;a<e.length&&!window.requestAnimationFrame;++a)window.requestAnimationFrame=window[e[a]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[a]+"CancelAnimationFrame"]||window[e[a]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e){var a=(new Date).getTime(),i=Math.max(0,16-(a-t)),r=window.setTimeout(function(){e(a+i)},i);return t=a+i,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}();var subframeEnabled=!1,cachedColors={},rgbToHex=function(){var t,e,a=[];for(t=0;256>t;t+=1)e=t.toString(16),a[t]=1==e.length?"0"+e:e;return function(t,e,i){return 0>t&&(t=0),0>e&&(e=0),0>i&&(i=0),"#"+a[t]+a[e]+a[i]}}(),fillColorToString=function(){var t=[];return function(e,a){return t[e[0]]||(t[e[0]]=[]),t[e[0]][e[1]]||(t[e[0]][e[1]]=[]),t[e[0]][e[1]][e[2]]||(void 0!==a&&(e[3]=a),t[e[0]][e[1]][e[2]]="rgba("+e.join(",")+")"),t[e[0]][e[1]][e[2]]}}(),bez=bezFunction(),dataManager=dataFunctionManager();SVGRenderer.prototype.buildItems=function(t,e){var a,i=0,r=t.length;for(a=r-1;a>=0;a--)"StillLayer"==t[a].type?(i++,this.createImage(t[a],e)):"PreCompLayer"==t[a].type?this.createComp(t[a],e):"SolidLayer"==t[a].type?this.createSolid(t[a],e):"ShapeLayer"==t[a].type?this.createShape(t[a],e):"TextLayer"==t[a].type?this.createText(t[a],e):this.createBase(t[a],e)},SVGRenderer.prototype.createBase=function(t,e){t.element=new BaseElement(t,this.animationItem,e,this.globalData)},SVGRenderer.prototype.createShape=function(t,e){t.element=new IShapeElement(t,this.animationItem,e,this.globalData)},SVGRenderer.prototype.createText=function(t,e){t.element=new ITextElement(t,this.animationItem,e,this.globalData)},SVGRenderer.prototype.createImage=function(t,e){t.element=new IImageElement(t,this.animationItem,e,this.globalData)},SVGRenderer.prototype.createComp=function(t,e){t.element=new ICompElement(t,this.animationItem,e,this.globalData),this.buildItems(t.layers,t.element.getDomElement())},SVGRenderer.prototype.createSolid=function(t,e){t.element=new ISolidElement(t,this.animationItem,e,this.globalData)},SVGRenderer.prototype.configAnimation=function(t){this.animationItem.container=document.createElementNS(svgNS,"svg"),this.animationItem.container.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.animationItem.container.setAttribute("width",t.animation.compWidth),this.animationItem.container.setAttribute("height",t.animation.compHeight),this.animationItem.container.setAttribute("viewBox","0 0 "+t.animation.compWidth+" "+t.animation.compHeight),this.animationItem.container.setAttribute("preserveAspectRatio","xMidYMid meet"),this.animationItem.container.style.width="100%",this.animationItem.container.style.height="100%",this.animationItem.container.style.transformOrigin=this.animationItem.container.style.mozTransformOrigin=this.animationItem.container.style.webkitTransformOrigin=this.animationItem.container.style["-webkit-transform"]="0px 0px 0px",this.animationItem.wrapper.appendChild(this.animationItem.container);var e=document.createElementNS(svgNS,"defs");this.globalData.defs=e,this.animationItem.container.appendChild(e);var a=document.createElementNS(svgNS,"clipPath"),i=document.createElementNS(svgNS,"rect");i.setAttribute("width",t.animation.compWidth),i.setAttribute("height",t.animation.compHeight),i.setAttribute("x",0),i.setAttribute("y",0),a.setAttribute("id","animationMask"),a.appendChild(i);var r=document.createElementNS(svgNS,"g");r.setAttribute("clip-path","url(#animationMask)"),this.animationItem.container.appendChild(r),e.appendChild(a),this.animationItem.container=r,this.layers=t.animation.layers},SVGRenderer.prototype.buildStage=function(t,e){var a,i,r,s=e.length;for(a=s-1;a>=0;a--)i=e[a],i.parent?(this.buildItemParenting(i,e,i.parent),r=i.element.getDomElement(),t!=r&&r.setAttribute("data-layer-name",i.layerName),i.element.setMainElement(r)):(r=i.element.getDomElement(),t!=r&&r.setAttribute("data-layer-name",i.layerName),i.element.setMainElement(r)),"PreCompLayer"==i.type&&this.buildStage(i.element.getComposingElement(),i.layers,i.element.getType())},SVGRenderer.prototype.buildItemParenting=function(t,e,a){t.parents||(t.parents=[]);for(var i=0,r=e.length;r>i;){if(e[i].layerName==a){t.parents.push({elem:e[i]}),e[i].parent&&this.buildItemParenting(t,e,e[i].parent);break}i+=1}},SVGRenderer.prototype.updateContainerSize=function(){},SVGRenderer.prototype.renderFrame=function(t){if(this.lastFrame!=t){this.lastFrame=t,this.globalData.frameNum=t;var e,a=this.layers.length;for(e=0;a>e;e++)this.layers[e].element.prepareFrame(t-this.layers[e].startTime);for(e=0;a>e;e++)this.layers[e].element.renderFrame(t-this.layers[e].startTime)
}},CanvasRenderer.prototype.buildItems=function(t){var e,a=0,i=t.length;for(e=0;i>e;e++)"StillLayer"==t[e].type?(a++,this.createImage(t[e])):"PreCompLayer"==t[e].type?this.createComp(t[e]):"SolidLayer"==t[e].type?this.createSolid(t[e]):"ShapeLayer"==t[e].type?this.createShape(t[e]):"TextLayer"==t[e].type?this.createText(t[e]):this.createBase(t[e])},CanvasRenderer.prototype.createBase=function(t){t.element=new CVBaseElement(t,this,this.globalData)},CanvasRenderer.prototype.createShape=function(t){t.element=new CVShapeElement(t,this,this.globalData)},CanvasRenderer.prototype.createText=function(t){t.element=new CVTextElement(t,this,this.globalData)},CanvasRenderer.prototype.createImage=function(t){t.element=new CVImageElement(t,this,this.globalData)},CanvasRenderer.prototype.createComp=function(t){t.element=new CVCompElement(t,this,this.globalData),this.buildItems(t.layers)},CanvasRenderer.prototype.createSolid=function(t){t.element=new CVSolidElement(t,this,this.globalData)},CanvasRenderer.prototype.configAnimation=function(t){this.animationItem.wrapper?(this.animationItem.container=document.createElement("canvas"),this.animationItem.container.style.width="100%",this.animationItem.container.style.height="100%",this.animationItem.container.style.transformOrigin=this.animationItem.container.style.mozTransformOrigin=this.animationItem.container.style.webkitTransformOrigin=this.animationItem.container.style["-webkit-transform"]="0px 0px 0px",this.animationItem.wrapper.appendChild(this.animationItem.container),this.canvasContext=this.animationItem.container.getContext("2d")):this.canvasContext=this.renderConfig.context,this.layers=t.animation.layers,this.transformCanvas={},this.transformCanvas.w=t.animation.compWidth,this.transformCanvas.h=t.animation.compHeight,this.updateContainerSize()},CanvasRenderer.prototype.updateContainerSize=function(){var t,e;if(this.animationItem.wrapper&&this.animationItem.container?(t=this.animationItem.wrapper.offsetWidth,e=this.animationItem.wrapper.offsetHeight,this.animationItem.container.setAttribute("width",t),this.animationItem.container.setAttribute("height",e)):(t=this.canvasContext.canvas.width,e=this.canvasContext.canvas.height),"fit"==this.renderConfig.scaleMode){var a=t/e,i=this.transformCanvas.w/this.transformCanvas.h;i>a?(this.transformCanvas.sx=t/this.transformCanvas.w,this.transformCanvas.sy=t/this.transformCanvas.w,this.transformCanvas.tx=0,this.transformCanvas.ty=(e-this.transformCanvas.h*(t/this.transformCanvas.w))/2):(this.transformCanvas.sx=e/this.transformCanvas.h,this.transformCanvas.sy=e/this.transformCanvas.h,this.transformCanvas.tx=(t-this.transformCanvas.w*(e/this.transformCanvas.h))/2,this.transformCanvas.ty=0)}else this.transformCanvas.sx=1,this.transformCanvas.sy=1,this.transformCanvas.tx=0,this.transformCanvas.ty=0},CanvasRenderer.prototype.buildStage=function(t,e){var a,i,r=e.length;for(a=r-1;a>=0;a--)i=e[a],i.parent&&(i.parentHierarchy=[],this.buildItemHierarchy(i,e,i.parent)),"PreCompLayer"==i.type&&this.buildStage(null,i.layers)},CanvasRenderer.prototype.buildItemHierarchy=function(t,e,a){for(var i=0,r=e.length;r>i;){if(e[i].layerName==a){t.parentHierarchy.push(e[i]),void 0===e[i].parent||this.buildItemHierarchy(t,e,e[i].parent);break}i+=1}},CanvasRenderer.prototype.prepareFrame=function(t){var e,a=this.layers.length;for(e=0;a>e;e++)this.layers[e].element.prepareFrame(t-this.layers[e].startTime)},CanvasRenderer.prototype.draw=function(){var t,e=this.layers.length;for(t=e-1;t>=0;t-=1)this.layers[t].element.draw()},CanvasRenderer.prototype.renderFrame=function(t){this.lastFrame!=t&&(this.lastFrame=t,this.globalData.frameNum=t,this.renderConfig.clearCanvas===!0?this.canvasContext.canvas.width=this.canvasContext.canvas.width:this.canvasContext.save(),this.canvasContext.transform(this.transformCanvas.sx,0,0,this.transformCanvas.sy,this.transformCanvas.tx,this.transformCanvas.ty),this.canvasContext.beginPath(),this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h),this.canvasContext.clip(),this.prepareFrame(t),this.draw(),this.renderConfig.clearCanvas!==!0&&this.canvasContext.restore())},MaskElement.prototype.init=function(){this.registeredEffects=[],this.masksProperties=this.data.masksProperties,this.totalMasks=this.masksProperties.length;var t=this.element.maskedElement,e=this.globalData.defs,a=0,i=this.masksProperties.length;this.layerSize=this.element.getLayerSize(),this.maskElement=document.createElementNS(svgNS,"clipPath");var r,s=this.data.masksProperties;for(a=0;i>a;a++)s[a].inv&&!this.solidPath&&(this.solidPath=this.createLayerSolidPath()),r=document.createElementNS(svgNS,"path"),s[a].cl?r.setAttribute("fill","#ffffff"):(r.setAttribute("fill","none"),r.setAttribute("stroke","#ffffff"),r.setAttribute("stroke-width","1"),r.setAttribute("stroke-miterlimit","10")),r.setAttribute("clip-rule","nonezero"),this.maskElement.appendChild(r),s[a].elem=r,s[a].lastPath="";var n=randomString(10);this.maskElement.setAttribute("id",n),t.setAttribute("clip-path","url(#"+n+")"),e.appendChild(this.maskElement)},MaskElement.prototype.renderFrame=function(t){var e,a=this.data.masksProperties.length;for(e=0;a>e;e++)this.drawPath(this.data.masksProperties[e],this.data.masksProperties[e].paths[t].pathString)},MaskElement.prototype.processMaskFromEffects=function(t,e){var a,i=this.registeredEffects.length;for(a=0;i>a;a++)this.registeredEffects[a].renderMask(t,e)},MaskElement.prototype.registerEffect=function(t){this.registeredEffects.push(t)},MaskElement.prototype.getMaskelement=function(){return this.maskElement},MaskElement.prototype.createLayerSolidPath=function(){var t="M0,0 ";return t+="h"+this.layerSize.w,t+="v"+this.layerSize.h,t+="h"+-this.layerSize.w,t+="v"+-this.layerSize.h},MaskElement.prototype.drawPath=function(t,e){t.lastPath!==e&&(t.inv?t.elem.setAttribute("d",this.solidPath+e):t.elem.setAttribute("d",e),t.lastPath=e)};var BaseElement=function(t,e,a,i){this.animationItem=e,this.globalData=i,this.data=t,this.ownMatrix=new Matrix,this.finalTransform={mat:new Matrix,op:1},this.renderedFrames=[],this.lastData={},this.parentContainer=a,this.init()};BaseElement.prototype.init=function(){this.createElements(),this.data.hasMask&&this.addMasks(this.data),this.data.eff&&this.createEffectsManager(this.data)},BaseElement.prototype.createElements=function(){this.data.hasMask?(this.layerElement=document.createElementNS(svgNS,"g"),this.parentContainer.appendChild(this.layerElement),this.maskedElement=this.layerElement):this.layerElement=this.parentContainer},BaseElement.prototype.prepareFrame=function(t){this.currentAnimData=this.data.renderedData[t].an,this.data.renderedFrame.tr=this.currentAnimData.matrixValue;var e=this.currentAnimData.matrixArray;this.ownMatrix.reset(),this.ownMatrix.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this.ownMatrix.translate(-this.currentAnimData.tr.a[0],-this.currentAnimData.tr.a[1])},BaseElement.prototype.renderFrame=function(t,e){if(this.data.inPoint-this.data.startTime<=t&&this.data.outPoint-this.data.startTime>=t?(this.isVisible!==!0&&(this.isVisible=!0),this.finalTransform.opacity=1):(this.isVisible!==!1&&(this.isVisible=!1),this.finalTransform.opacity=0),this.data.eff&&this.effectsManager.renderFrame(t,this.currentAnimData.mk),t===this.data.renderedFrame.num)return this.isVisible;if(this.data.hasMask&&this.maskManager.renderFrame(t),this.finalTransform.opacity*=this.currentAnimData.tr.o,e&&(this.finalTransform.mat.reset(),r=e.mat.props,this.finalTransform.mat.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this.finalTransform.opacity*=e.opacity),this.data.parents){var a,i,r,s=this.data.parents.length;for(e||this.finalTransform.mat.reset(),a=s-1;a>=0;a-=1)r=this.data.parents[a].elem.element.ownMatrix.props,this.finalTransform.mat.transform(r[0],r[1],r[2],r[3],r[4],r[5]),i=this.data.parents[a].elem.element.currentAnimData;r=this.ownMatrix.props,this.finalTransform.mat.transform(r[0],r[1],r[2],r[3],r[4],r[5])}else this.isVisible&&(e?(r=this.ownMatrix.props,this.finalTransform.mat.transform(r[0],r[1],r[2],r[3],r[4],r[5])):this.finalTransform.mat=this.ownMatrix);if(this.data.hasMask){this.renderedFrames[this.globalData.frameNum]||(this.renderedFrames[this.globalData.frameNum]={tr:"matrix("+this.finalTransform.mat.props.join(",")+")",o:this.finalTransform.opacity});var n=this.renderedFrames[this.globalData.frameNum];this.lastData.tr!=n.tr&&(this.lastData.tr=n.tr,this.layerElement.setAttribute("transform",n.tr)),this.lastData.o!=n.o&&(this.lastData.o=n.o,this.layerElement.setAttribute("opacity",n.o))}return this.isVisible},BaseElement.prototype.getDomElement=function(){return this.layerElement},BaseElement.prototype.setMainElement=function(t){this.mainElement=t},BaseElement.prototype.getMaskManager=function(){return this.maskManager},BaseElement.prototype.addMasks=function(t){var e={data:{value:t},element:{value:this},globalData:{value:this.globalData}};this.maskManager=createElement(MaskElement,null,e)},BaseElement.prototype.createEffectsManager=function(t){var e={effects:{value:t.eff},element:{value:this}};this.effectsManager=createElement(EffectsManager,null,e)},BaseElement.prototype.getType=function(){return this.type},BaseElement.prototype.getLayerSize=function(){return"TextLayer"==this.data.type?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}},BaseElement.prototype.hide=function(){},createElement(BaseElement,ICompElement),ICompElement.prototype.getComposingElement=function(){return this.layerElement},ICompElement.prototype.hide=function(){if(!this.hidden){var t,e=this.layers.length;for(t=0;e>t;t+=1)this.layers[t].element.hide();this.hidden=!0}},ICompElement.prototype.renderFrame=function(t,e){var a=this.parent.renderFrame.call(this,t,e);if(a===!1)return void this.hide();this.hidden=!1;var i,r=this.layers.length,s=this.data.tm?this.data.tm[t]<0?0:t>=this.data.tm.length?this.data.tm[this.data.tm.length-1]:this.data.tm[t]:t;for(i=0;r>i;i+=1)this.layers[i].element.prepareFrame(s-this.layers[i].startTime);for(i=0;r>i;i+=1)this.data.hasMask?this.layers[i].element.renderFrame(s-this.layers[i].startTime):this.layers[i].element.renderFrame(s-this.layers[i].startTime,this.finalTransform)},createElement(BaseElement,IImageElement),IImageElement.prototype.createElements=function(){var t=this,e=function(){t.image.setAttributeNS("http://www.w3.org/1999/xlink","href",t.path+t.assets[t.data.assetId].path),t.maskedElement=t.image,t.animationItem.elementLoaded()},a=new Image;a.addEventListener("load",e,!1),a.src=this.path+this.assets[this.data.assetId].path,this.parent.createElements.call(this),this.image=document.createElementNS(svgNS,"image"),this.image.setAttribute("width",this.data.width+"px"),this.image.setAttribute("height",this.data.height+"px"),this.layerElement.appendChild(this.image)},IImageElement.prototype.hide=function(){this.hidden||(this.image.setAttribute("opacity","0"),this.hidden=!0)},IImageElement.prototype.renderFrame=function(t,e){var a=this.parent.renderFrame.call(this,t,e);if(a===!1)return void this.hide();if(this.hidden=!1,!this.data.hasMask){this.renderedFrames[this.globalData.frameNum]||(this.renderedFrames[this.globalData.frameNum]={tr:"matrix("+this.finalTransform.mat.props.join(",")+")",o:this.finalTransform.opacity});var i=this.renderedFrames[this.globalData.frameNum];this.lastData.tr!=i.tr&&(this.lastData.tr=i.tr,this.image.setAttribute("transform",i.tr)),this.lastData.o!=i.o&&(this.lastData.o=i.o,this.image.setAttribute("opacity",i.o))}},createElement(BaseElement,IShapeElement),IShapeElement.prototype.createElements=function(){this.parent.createElements.call(this),this.mainShape=new ShapeItemElement(this.data.shapes,this.layerElement,this.globalData)},IShapeElement.prototype.renderFrame=function(t,e){var a=this.parent.renderFrame.call(this,t,e);return a===!1?void this.hide():void this.renderShapes(t)},IShapeElement.prototype.hide=function(){this.hidden||(this.mainShape.hideShape(),this.hidden=!0)},IShapeElement.prototype.renderShapes=function(t){this.hidden=!1,this.data.hasMask?this.mainShape.renderShape(t):this.mainShape.renderShape(t,this.finalTransform)},ShapeItemElement.prototype.searchShapes=function(t){var e,a,i,r,s=t.length-1,n=[];for(e=s;e>=0;e-=1)if("fl"==t[e].ty||"st"==t[e].ty)t[e].renderedFrames=[],t[e].lastData={c:"",o:"",w:""},this.stylesList.push({elements:[],type:t[e].ty,d:""}),t[e].style=this.stylesList[this.stylesList.length-1],n.push(t[e].style);else if("gr"==t[e].ty)this.searchShapes(t[e].it);else if("tr"==t[e].ty)t[e].transform={mat:new Matrix,opacity:1};else if("sh"==t[e].ty)for(t[e].elements=[],t[e].renderedFrames=[],t[e].lastData={d:"",o:"",tr:""},i=this.stylesList.length,a=0;i>a;a+=1)this.stylesList[a].closed||(r=document.createElementNS(svgNS,"path"),t[e].elements.push(r),this.shape.appendChild(r),this.stylesList[a].elements.push(r),"st"==this.stylesList[a].type&&(r.setAttribute("fill-opacity",0),r.setAttribute("stroke-linejoin","round"),r.setAttribute("stroke-linecap","round")));else if("rc"==t[e].ty)for(t[e].elements=[],t[e].renderedFrames=[],t[e].lastData={roundness:"",w:"",h:"",x:"",y:"",o:"",tr:""},t[e].renderedFrames=[],i=this.stylesList.length,a=0;i>a;a+=1)this.stylesList[a].closed||(r=document.createElementNS(svgNS,"rect"),t[e].elements.push(r),this.shape.appendChild(r),this.stylesList[a].elements.push(r),"st"==this.stylesList[a].type&&r.setAttribute("fill-opacity",0));else if("el"==t[e].ty)for(t[e].elements=[],t[e].renderedFrames=[],t[e].lastData={cx:"",cy:"",rx:"",ry:"",o:"",tr:""},i=this.stylesList.length,a=0;i>a;a+=1)this.stylesList[a].closed||(r=document.createElementNS(svgNS,"ellipse"),t[e].elements.push(r),this.shape.appendChild(r),this.stylesList[a].elements.push(r),"st"==this.stylesList[a].type&&r.setAttribute("fill-opacity",0));for(s=n.length,e=0;s>e;e+=1)n[e].closed=!0},ShapeItemElement.prototype.getElement=function(){return this.shape},ShapeItemElement.prototype.hideShape=function(t){t||(t=this.data);var e,a,i,r,s=this.stylesList.length;for(s=t.length-1,e=s;e>=0;e-=1)if("sh"==t[e].ty||"el"==t[e].ty||"rc"==t[e].ty)for(t[e].lastData.o="",r=t[e].elements,i=r.length,a=0;i>a;a+=1)r[a].setAttribute("opacity","0");else"gr"==t[e].ty&&this.hideShape(t[e].it)},ShapeItemElement.prototype.renderShape=function(t,e,a){a||(a=this.data),this.posCount=0,this.frameNum=t;var i,r;r=a.length-1;var s,n;for(s=e,i=r;i>=0;i-=1)if("tr"==a[i].ty){var o=a[i].renderedData[t].mtArr;if(s=a[i].transform,n=s.mat,n.reset(),e){var h=e.mat.props;s.opacity=e.opacity,s.opacity*=a[i].renderedData[t].o,n.transform(h[0],h[1],h[2],h[3],h[4],h[5])}else s.opacity=a[i].renderedData[t].o;n.transform(o[0],o[1],o[2],o[3],o[4],o[5]).translate(-a[i].renderedData[t].a[0],-a[i].renderedData[t].a[1])}else"sh"==a[i].ty?this.renderPath(a[i],t,s):"el"==a[i].ty?this.renderEllipse(a[i],t,s):"rc"==a[i].ty?this.renderRect(a[i],t,s):"fl"==a[i].ty?this.renderFill(a[i],t):"st"==a[i].ty?this.renderStroke(a[i],t):"gr"==a[i].ty&&this.renderShape(t,s,a[i].it)},ShapeItemElement.prototype.renderPath=function(t,e,a){t.renderedFrames[this.globalData.frameNum]||(t.renderedFrames[this.globalData.frameNum]={d:t.renderedData[e].path.pathString,tr:"matrix("+a.mat.props.join(",")+")",o:a.opacity});var i,r=t.renderedFrames[this.globalData.frameNum],s=r.d,n=r.tr,o=r.o,h=t.elements,l=h.length;for(i=0;l>i;i+=1)t.lastData.d!=s&&h[i].setAttribute("d",s),t.lastData.tr!=n&&h[i].setAttribute("transform",n),t.lastData.o!=o&&h[i].setAttribute("opacity",o);t.lastData.d=s,t.lastData.tr=n,t.lastData.o=o},ShapeItemElement.prototype.renderEllipse=function(t,e,a){var i=t.renderedData[e];t.renderedFrames[this.globalData.frameNum]||(t.renderedFrames[this.globalData.frameNum]={cx:i.p[0],cy:i.p[1],rx:i.size[0]/2,ry:i.size[1]/2,tr:"matrix("+a.mat.props.join(",")+")",o:a.opacity});var r,s=t.renderedFrames[this.globalData.frameNum],n=s.cx,o=s.cy,h=s.rx,l=s.ry,m=s.tr,p=s.o,d=t.elements,c=d.length;for(r=0;c>r;r+=1)t.lastData.cx!=n&&d[r].setAttribute("cx",n),t.lastData.cy!=o&&d[r].setAttribute("cy",o),t.lastData.rx!=h&&d[r].setAttribute("rx",h),t.lastData.ry!=l&&d[r].setAttribute("ry",l),t.lastData.tr!=m&&d[r].setAttribute("transform",m),t.lastData.o!=p&&d[r].setAttribute("opacity",p);t.lastData.cx=n,t.lastData.cy=o,t.lastData.rx=h,t.lastData.ry=l,t.lastData.tr=m,t.lastData.o=p},ShapeItemElement.prototype.renderRect=function(t,e,a){var i,r=t.elements,s=t.renderedData[e];t.renderedFrames[this.globalData.frameNum]||(i=s.roundness,i>s.size[0]/2&&(i=s.size[0]/2),i>s.size[1]/2&&(i=s.size[1]/2),t.renderedFrames[this.globalData.frameNum]={round:i,w:s.size[0],h:s.size[1],x:s.position[0]-s.size[0]/2,y:s.position[1]-s.size[1]/2,tr:"matrix("+a.mat.props.join(",")+")",o:a.opacity});var n=t.renderedFrames[this.globalData.frameNum];i=n.round;var o,h=n.w,l=n.h,m=n.x,p=n.y,d=n.tr,c=n.o,u=r.length;for(o=0;u>o;o+=1)t.lastData.roundness!=i&&(r[o].setAttribute("rx",i),r[o].setAttribute("ry",i)),t.lastData.w!=h&&r[o].setAttribute("width",h),t.lastData.h!=l&&r[o].setAttribute("height",l),t.lastData.x!=m&&r[o].setAttribute("x",m),t.lastData.y!=p&&r[o].setAttribute("y",p),t.lastData.tr!=d&&r[o].setAttribute("transform",d),t.lastData.o!=c&&r[o].setAttribute("opacity",c);t.lastData.roundness=i,t.lastData.w=h,t.lastData.h=l,t.lastData.x=m,t.lastData.y=p,t.lastData.o=c},ShapeItemElement.prototype.renderFill=function(t,e){var a=t.renderedData[e],i=t.style;t.renderedFrames[this.globalData.frameNum]||(t.renderedFrames[this.globalData.frameNum]={c:a.color,o:a.opacity});var r,s=t.renderedFrames[this.globalData.frameNum],n=s.c,o=s.o,h=i.elements,l=h.length;for(r=0;l>r;r+=1)t.lastData.c!=n&&h[r].setAttribute("fill",n),t.lastData.o!=o&&h[r].setAttribute("fill-opacity",o);t.lastData.c=n,t.lastData.o=o},ShapeItemElement.prototype.renderStroke=function(t,e){var a=t.renderedData[e],i=t.style;t.renderedFrames[this.globalData.frameNum]||(t.renderedFrames[this.globalData.frameNum]={c:a.color,o:a.opacity,w:a.width});var r,s=t.renderedFrames[this.globalData.frameNum],n=s.c,o=s.o,h=s.w,l=i.elements,m=l.length;for(r=0;m>r;r+=1)t.lastData.c!=n&&l[r].setAttribute("stroke",n),t.lastData.o!=o&&l[r].setAttribute("stroke-opacity",o),t.lastData.o!=o&&l[r].setAttribute("stroke-width",h);t.lastData.c=n,t.lastData.o=o,t.lastData.w=h},createElement(BaseElement,ISolidElement),ISolidElement.prototype.createElements=function(){this.parent.createElements.call(this);var t=document.createElementNS(svgNS,"rect");t.setAttribute("width",this.data.width),t.setAttribute("height",this.data.height),t.setAttribute("fill",this.data.color),this.layerElement.appendChild(t),this.rectElement=t},ISolidElement.prototype.hide=function(){this.hidden||(this.rectElement.setAttribute("opacity","0"),this.hidden=!0)},ISolidElement.prototype.renderFrame=function(t,e){var a=this.parent.renderFrame.call(this,t,e);if(a===!1)return void this.hide();if(this.hidden=!1,!this.data.hasMask){this.renderedFrames[this.globalData.frameNum]||(this.renderedFrames[this.globalData.frameNum]={tr:"matrix("+this.finalTransform.mat.props.join(",")+")",o:this.finalTransform.opacity});var i=this.renderedFrames[this.globalData.frameNum];this.lastData.tr!=i.tr&&(this.lastData.tr=i.tr,this.rectElement.setAttribute("transform",i.tr)),this.lastData.o!=i.o&&(this.lastData.o=i.o,this.rectElement.setAttribute("opacity",i.o))}},createElement(BaseElement,ITextElement),ITextElement.prototype.createElements=function(){this.svgElem=document.createElementNS(svgNS,"g");var t=document.createElementNS(svgNS,"text");t.textContent=this.data.textData.text,t.setAttribute("fill",this.data.textData.fillColor),t.setAttribute("x","0"),t.setAttribute("y",this.data.textData.height-(this.data.textData.fontSize-this.data.textData.height)/2),this.svgElem.setAttribute("width",this.data.textData.width),this.svgElem.setAttribute("height",this.data.textData.height),this.svgElem.style.transform=this.svgElem.style.webkitTransform="translate("+this.data.textData.xOffset+"px,"+this.data.textData.yOffset+"px)",t.setAttribute("font-size",this.data.textData.fontSize),t.setAttribute("font-family","Arial, sans-serif"),this.svgElem.appendChild(t),this.parent.createElements.call(this),this.anchorElement.appendChild(this.svgElem),this.maskedElement=t},CVBaseElement.prototype.init=function(){this.createElements(),this.data.hasMask&&this.addMasks(this.data),this.data.eff&&this.createEffectsManager(this.data)},CVBaseElement.prototype.createElements=function(){},CVBaseElement.prototype.prepareFrame=function(t){return this.data.inPoint-this.data.startTime<=t&&this.data.outPoint-this.data.startTime>=t?(this.renderFrame=!0,this.currentAnimData=this.data.renderedData[t].an,void(this.data.hasMask&&this.maskManager.prepareFrame(t))):(this.renderFrame=!1,this.currentAnimData=this.data.renderedData[t].an,!1)},CVBaseElement.prototype.draw=function(t){if(t!==!1&&this.renderer.canvasContext.save(),!this.renderFrame)return!1;var e,a=this.renderer.canvasContext;if(this.data.parentHierarchy){var i,r,s=this.data.parentHierarchy.length;for(i=s-1;i>=0;i-=1)r=this.data.parentHierarchy[i].element.getCurrentAnimData(),e=r.matrixArray,a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),a.translate(-r.tr.a[0],-r.tr.a[1])}a.globalAlpha=a.globalAlpha*this.currentAnimData.tr.o,e=this.currentAnimData.matrixArray,a.transform(e[0],e[1],e[2],e[3],e[4],e[5]),a.translate(-this.currentAnimData.tr.a[0],-this.currentAnimData.tr.a[1]),this.data.hasMask&&this.maskManager.draw(),t!==!1&&this.renderer.canvasContext.restore()},CVBaseElement.prototype.getCurrentAnimData=function(){return this.currentAnimData},CVBaseElement.prototype.addMasks=function(t){var e={data:{value:t},element:{value:this}};this.maskManager=createElement(CVMaskElement,null,e)},CVBaseElement.prototype.createEffectsManager=function(t){var e={effects:{value:t.eff},element:{value:this}};this.effectsManager=createElement(EffectsManager,null,e)},CVBaseElement.prototype.getType=function(){return this.type},CVBaseElement.prototype.getLayerSize=function(){return"TextLayer"==this.data.type?{w:this.data.textData.width,h:this.data.textData.height}:{w:this.data.width,h:this.data.height}},createElement(CVBaseElement,CVCompElement),CVCompElement.prototype.prepareFrame=function(t){var e=this.parent.prepareFrame.call(this,t);if(e!==!1){var a,i=this.layers.length,r=this.data.tm?this.data.tm[t]<0?0:t>=this.data.tm.length?this.data.tm[this.data.tm.length-1]:this.data.tm[t]:t;for(a=0;i>a;a+=1)this.layers[a].element.prepareFrame(r-this.layers[a].startTime)}},CVCompElement.prototype.draw=function(){if(this.renderer.canvasContext.save(),this.parent.draw.call(this,!1)===!1)return void this.renderer.canvasContext.restore();var t,e=this.layers.length;for(t=e-1;t>=0;t-=1)this.layers[t].element.draw();this.renderer.canvasContext.restore()},createElement(CVBaseElement,CVImageElement),CVImageElement.prototype.createElements=function(){var t=this,e=function(){t.animationItem.elementLoaded()};this.img=new Image,this.img.addEventListener("load",e,!1),this.img.src=this.path+this.assets[this.data.assetId].path,this.parent.createElements.call(this)},CVImageElement.prototype.draw=function(){if(this.renderer.canvasContext.save(),this.parent.draw.call(this,!1)===!1)return void this.renderer.canvasContext.restore();var t=this.renderer.canvasContext;t.drawImage(this.img,0,0),this.renderer.canvasContext.restore()},createElement(CVBaseElement,CVShapeElement),CVShapeElement.prototype.createElements=function(){this.parent.createElements.call(this),this.mainShape=new CVShapeItemElement(this.data.shapes,this.renderer,!0,this.globalData)},CVShapeElement.prototype.prepareFrame=function(t){var e=this.parent.prepareFrame.call(this,t);e!==!1&&this.mainShape.prepareFrame(t)},CVShapeElement.prototype.draw=function(){return this.renderer.canvasContext.save(),this.parent.draw.call(this,!1)===!1?void this.renderer.canvasContext.restore():(this.drawShapes(),void this.renderer.canvasContext.restore())},CVShapeElement.prototype.drawShapes=function(){this.mainShape.renderShape()},CVShapeItemElement.prototype.drawPaths=function(t){var e;if(t){var a=[];e=this.stylesList}else e=this.renderedPaths[this.globalData.frameNum];var i,r=e.length;for(this.renderer.canvasContext.save(),i=0;r>i;i+=1)"stroke"==e[i].type?(this.renderer.canvasContext.globalAlpha*=e[i].opacity,this.renderer.canvasContext.strokeStyle=e[i].value,this.renderer.canvasContext.lineWidth=e[i].width,this.renderer.canvasContext.stroke(e[i].path),t&&a.push({type:e[i].type,opacity:e[i].opacity,value:e[i].value,width:e[i].width,path:e[i].path})):"fill"==e[i].type&&(this.renderer.canvasContext.globalAlpha*=e[i].opacity,this.renderer.canvasContext.fillStyle=e[i].value,this.renderer.canvasContext.fill(e[i].path),t&&a.push({type:e[i].type,opacity:e[i].opacity,value:e[i].value,path:e[i].path}));this.renderer.canvasContext.restore(),t&&(this.renderedPaths[this.globalData.frameNum]=a)},CVShapeItemElement.prototype.prepareFrame=function(t){this.frameNum=t;var e,a=this.dataLength-1;for(e=a;e>=0;e-=1)"gr"==this.data[e].ty&&this.data[e].item.prepareFrame(t)},CVShapeItemElement.prototype.renderShape=function(t,e){if(this.renderedPaths[this.globalData.frameNum])return void this.drawPaths(!1);this.opacityMultiplier=1;var a,i;this.ownStylesList.length=0,this.currentStylePoolPos=0,t?this.stylesList=t:this.stylesList.length=0,e?this.currentMatrix=e:(this.currentMatrix.a=this.currentMatrix.d=1,this.currentMatrix.b=this.currentMatrix.c=this.currentMatrix.e=this.currentMatrix.f=0),i=this.dataLength-1;var r=this.renderer.canvasContext;for(r.lineCap="round",r.lineJoin="round",a=i;a>=0;a-=1)"gr"==this.data[a].ty?this.data[a].item.renderShape(this.stylesList,this.currentMatrix):"tr"==this.data[a].ty?this.renderTransform(this.data[a]):"sh"==this.data[a].ty?this.renderPath(this.data[a]):"el"==this.data[a].ty?this.renderEllipse(this.data[a]):"rc"==this.data[a].ty?this.renderRect(this.data[a]):"fl"==this.data[a].ty?this.renderFill(this.data[a]):"st"==this.data[a].ty&&this.renderStroke(this.data[a]);if(this.mainFlag)this.drawPaths(!0);else for(i=this.ownStylesList.length,a=0;i>a;a+=1)this.ownStylesList[a].closed=!0},CVShapeItemElement.prototype.renderTransform=function(t){var e=t.renderedData[this.frameNum],a=e.mtArr;this.mat.a=a[0],this.mat.b=a[1],this.mat.c=a[2],this.mat.d=a[3],this.mat.e=a[4],this.mat.f=a[5],this.mat=this.mat.translate(-e.a[0],-e.a[1]),this.opacityMultiplier*=e.o,this.currentMatrix=this.currentMatrix.multiply(this.mat)},CVShapeItemElement.prototype.renderPath=function(t){var e=t.renderedData[this.frameNum].path,a=new Path2D,i=e.pathNodes;i instanceof Array&&(i=i[0]);var r,s=i.i.length;for(a.moveTo(i.v[0][0],i.v[0][1]),r=1;s>r;r+=1)a.bezierCurveTo(i.o[r-1][0],i.o[r-1][1],i.i[r][0],i.i[r][1],i.v[r][0],i.v[r][1]);e.closed&&a.bezierCurveTo(i.o[r-1][0],i.o[r-1][1],i.i[0][0],i.i[0][1],i.v[0][0],i.v[0][1]),this.addPathToStyles(a)},CVShapeItemElement.prototype.renderEllipse=function(t){var e=new Path2D,a=t.renderedData[this.frameNum];e.moveTo(a.p[0]+a.size[0]/2,a.p[1]),e.ellipse(a.p[0],a.p[1],a.size[0]/2,a.size[1]/2,0,0,2*Math.PI,!1),this.addPathToStyles(e)},CVShapeItemElement.prototype.renderRect=function(t){var e=new Path2D,a=t.renderedData[this.frameNum],i=a.roundness;if(0===i)e.rect(a.position[0]-a.size[0]/2,a.position[1]-a.size[1]/2,a.size[0],a.size[1]);else{var r=a.position[0]-a.size[0]/2,s=a.position[1]-a.size[1]/2,n=a.size[0],o=a.size[1];i instanceof Array&&(i=i[0]),i>n/2&&(i=n/2),i>o/2&&(i=o/2),e.moveTo(r+i,s),e.lineTo(r+n-i,s),e.quadraticCurveTo(r+n,s,r+n,s+i),e.lineTo(r+n,s+o-i),e.quadraticCurveTo(r+n,s+o,r+n-i,s+o),e.lineTo(r+i,s+o),e.quadraticCurveTo(r,s+o,r,s+o-i),e.lineTo(r,s+i),e.quadraticCurveTo(r,s,r+i,s)}this.addPathToStyles(e)},CVShapeItemElement.prototype.addPathToStyles=function(t){var e,a=this.stylesList.length,i=!0,r=0;for(e=a-1;e>=0;e-=1)this.stylesList[e].closed||("stroke"==this.stylesList[e].type?(this.stylesList[e].width>r&&this.stylesList[e].path.addPath(t,this.currentMatrix),1==this.stylesList[e].styleOpacity&&1==this.stylesList[e].opacity&&(r=this.stylesList[e].width)):i&&"fill"==this.stylesList[e].type&&(this.stylesList[e].path.addPath(t,this.currentMatrix),1==this.stylesList[e].styleOpacity&&1==this.stylesList[e].opacity&&(i=!1)))},CVShapeItemElement.prototype.renderFill=function(t){var e=t.renderedData[this.frameNum];return t.fillEnabled!==!1?(this.stylesPool[this.currentStylePoolPos].path=new Path2D,this.stylesPool[this.currentStylePoolPos].closed=!1,this.stylesPool[this.currentStylePoolPos].styleOpacity=e.opacity<1?e.opacity:1,this.stylesPool[this.currentStylePoolPos].opacity=this.opacityMultiplier,this.stylesPool[this.currentStylePoolPos].value=e.opacity<1?fillColorToString(e.color,e.opacity):fillColorToString(e.color),this.stylesList.push(this.stylesPool[this.currentStylePoolPos]),this.ownStylesList.push(this.stylesList[this.stylesList.length-1]),void(this.currentStylePoolPos+=1)):(this.stylesList.push(this.stylesPool[this.currentStylePoolPos]),this.ownStylesList.push(this.stylesList[this.stylesList.length-1]),void(this.currentStylePoolPos+=1))},CVShapeItemElement.prototype.renderStroke=function(t){var e=t.renderedData[this.frameNum];return this.data.strokeEnabled!==!1?(this.stylesPool[this.currentStylePoolPos].path=new Path2D,this.stylesPool[this.currentStylePoolPos].closed=!1,this.stylesPool[this.currentStylePoolPos].styleOpacity=e.opacity<1?e.opacity:1,this.stylesPool[this.currentStylePoolPos].width=e.width,this.stylesPool[this.currentStylePoolPos].opacity=this.opacityMultiplier,this.stylesPool[this.currentStylePoolPos].value=e.opacity<1?fillColorToString(e.color,e.opacity):fillColorToString(e.color),this.stylesList.push(this.stylesPool[this.currentStylePoolPos]),this.ownStylesList.push(this.stylesList[this.stylesList.length-1]),void(this.currentStylePoolPos+=1)):(this.stylesList.push(this.stylesPool[this.currentStylePoolPos]),this.ownStylesList.push(this.stylesList[this.stylesList.length-1]),void(this.currentStylePoolPos+=1))},createElement(CVBaseElement,CVSolidElement),CVSolidElement.prototype.draw=function(){if(this.renderer.canvasContext.save(),this.parent.draw.call(this,!1)===!1)return void this.renderer.canvasContext.restore();var t=this.renderer.canvasContext;t.fillStyle=this.data.color,t.fillRect(0,0,this.data.width,this.data.height),this.renderer.canvasContext.restore()},createElement(CVBaseElement,CVTextElement),CVTextElement.prototype.createElements=function(){this.svgElem=document.createElementNS(svgNS,"g");var t=document.createElementNS(svgNS,"text");t.textContent=this.data.textData.text,t.setAttribute("fill",this.data.textData.fillColor),t.setAttribute("x","0"),t.setAttribute("y",this.data.textData.height-(this.data.textData.fontSize-this.data.textData.height)/2),this.svgElem.setAttribute("width",this.data.textData.width),this.svgElem.setAttribute("height",this.data.textData.height),this.svgElem.style.transform=this.svgElem.style.webkitTransform="translate("+this.data.textData.xOffset+"px,"+this.data.textData.yOffset+"px)",t.setAttribute("font-size",this.data.textData.fontSize),t.setAttribute("font-family","Arial, sans-serif"),this.svgElem.appendChild(t),this.parent.createElements.call(this),this.anchorElement.appendChild(this.svgElem),this.maskedElement=t},CVMaskElement.prototype.init=function(){this.registeredEffects=[],this.masksProperties=this.data.masksProperties,this.totalMasks=this.masksProperties.length,this.ctx=this.element.renderer.canvasContext,this.layerSize=this.element.getLayerSize()},CVMaskElement.prototype.prepareFrame=function(t){this.frameNum=t},CVMaskElement.prototype.draw=function(){var t,e=this.data.masksProperties.length;for(this.ctx.beginPath(),t=0;e>t;t++)this.masksProperties[t].inv?this.createInvertedMask(this.masksProperties[t],this.frameNum):this.drawShape(this.ctx,this.data.masksProperties[t].paths[this.frameNum].pathNodes);this.ctx.closePath(),this.ctx.clip()},CVMaskElement.prototype.drawShape=function(t,e){var a,i=e.v.length;for(t.moveTo(e.v[0][0],e.v[0][1]),a=1;i>a;a++)t.bezierCurveTo(e.o[a-1][0],e.o[a-1][1],e.i[a][0],e.i[a][1],e.v[a][0],e.v[a][1]);t.bezierCurveTo(e.o[a-1][0],e.o[a-1][1],e.i[0][0],e.i[0][1],e.v[0][0],e.v[0][1])
},CVMaskElement.prototype.createInvertedMask=function(){};var animationManager=function(){function t(t){if(!t)return null;for(var e=0;v>e;){if(f[e].elem==t&&null!==f[e].elem)return f[e].animation;e+=1}var a=new AnimationItem;return a.setData(t),f.push({elem:t,animation:a}),v+=1,a}function e(t){var e=new AnimationItem;return e.setParams(t),f.push({elem:null,animation:e}),v+=1,e}function a(t,e){var a;for(a=0;v>a;a+=1)f[a].animation.setSpeed(t,e)}function i(t,e){var a;for(a=0;v>a;a+=1)f[a].animation.setDirection(t,e)}function r(t){var e;for(e=0;v>e;e+=1)f[e].animation.play(t)}function s(t,e){g=!1,y=Date.now();var a;for(a=0;v>a;a+=1)f[a].animation.moveFrame(t,e)}function n(){var t,e=Date.now(),a=e-y;for(t=0;v>t;t+=1)f[t].animation.advanceTime(a);y=e,requestAnimationFrame(n)}function o(t){var e;for(e=0;v>e;e+=1)f[e].animation.pause(t)}function h(t,e,a){var i;for(i=0;v>i;i+=1)f[i].animation.goToAndStop(t,e,a)}function l(t){var e;for(e=0;v>e;e+=1)f[e].animation.stop(t)}function m(t){var e;for(e=0;v>e;e+=1)f[e].animation.togglePause(t)}function p(){var e=document.getElementsByClassName("bodymovin");Array.prototype.forEach.call(e,t)}function d(){var t;for(t=0;v>t;t+=1)f[t].animation.resize()}function c(){y=Date.now(),requestAnimationFrame(n)}var u={},f=[],y=0,g=!0,v=0;return setTimeout(c,0),u.registerAnimation=t,u.loadAnimation=e,u.setSpeed=a,u.setDirection=i,u.play=r,u.moveFrame=s,u.pause=o,u.stop=l,u.togglePause=m,u.searchAnimations=p,u.resize=d,u.start=c,u.goToAndStop=h,u}(),AnimationItem=function(){this.name="",this.path="",this.isLoaded=!1,this.currentFrame=0,this.currentRawFrame=0,this.totalFrames=0,this.frameRate=0,this.frameMult=0,this.playSpeed=1,this.playDirection=1,this.pendingElements=0,this.playCount=0,this.prerenderFramesFlag=!0,this.repeat="indefinite",this.animationData={},this.layers=[],this.assets=[],this.isPaused=!0,this.isScrolling=!1,this.autoplay=!1,this.loop=!0,this.renderer=null,this.animationID=randomString(10),this.renderedFrameCount=0,this.scaleMode="fit",this.math=Math};AnimationItem.prototype.setParams=function(t){var e=this;t.context&&(this.context=t.context),t.wrapper&&(this.wrapper=t.wrapper);var a=t.animType?t.animType:"canvas";switch(a){case"canvas":this.renderer=new CanvasRenderer(this,t.renderer);break;case"svg":this.renderer=new SVGRenderer(this,t.renderer)}if(this.animType=a,""===t.loop||null===t.loop||(this.loop=t.loop===!1?!1:t.loop===!0?!0:parseInt(t.loop)),this.autoplay="autoplay"in t?t.autoplay:!0,this.name=t.name?t.name:"",this.prerenderFramesFlag="prerender"in t?t.prerender:!0,t.animationData)e.configAnimation(t.animationData);else if(t.path){"json"!=t.path.substr(-4)&&("/"!=t.path.substr(-1,1)&&(t.path+="/"),t.path+="data.json");var i=new XMLHttpRequest;this.path=t.path.substr(0,t.path.lastIndexOf("/")+1),i.open("GET",t.path,!0),i.send(),i.onreadystatechange=function(){if(4==i.readyState)if(200==i.status)e.configAnimation(JSON.parse(i.responseText));else try{var t=JSON.parse(i.responseText);e.configAnimation(t)}catch(a){}}}},AnimationItem.prototype.setData=function(t){var e={wrapper:t},a=t.attributes;e.path=a.getNamedItem("data-animation-path")?a.getNamedItem("data-animation-path").value:a.getNamedItem("data-bm-path")?a.getNamedItem("data-bm-path").value:a.getNamedItem("bm-path")?a.getNamedItem("bm-path").value:"",e.animType=a.getNamedItem("data-anim-type")?a.getNamedItem("data-anim-type").value:a.getNamedItem("data-bm-type")?a.getNamedItem("data-bm-type").value:a.getNamedItem("bm-type")?a.getNamedItem("bm-type").value:"canvas";var i=a.getNamedItem("data-anim-loop")?a.getNamedItem("data-anim-loop").value:a.getNamedItem("data-bm-loop")?a.getNamedItem("data-bm-loop").value:a.getNamedItem("bm-loop")?a.getNamedItem("bm-loop").value:"";""===i||(e.loop="false"===i?!1:"true"===i?!0:parseInt(i)),e.name=a.getNamedItem("data-name")?a.getNamedItem("data-name").value:a.getNamedItem("data-bm-name")?a.getNamedItem("data-bm-name").value:a.getNamedItem("bm-name")?a.getNamedItem("bm-name").value:"";var r=a.getNamedItem("data-anim-prerender")?a.getNamedItem("data-anim-prerender").value:a.getNamedItem("data-bm-prerender")?a.getNamedItem("data-bm-prerender").value:a.getNamedItem("bm-prerender")?a.getNamedItem("bm-prerender").value:"";"false"===r&&(e.prerender=!1),this.setParams(e)},AnimationItem.prototype.configAnimation=function(t){this.renderer.configAnimation(t),this.animationData=t,this.animationData._id=this.animationID,this.animationData._animType=this.animType,this.layers=this.animationData.animation.layers,this.assets=this.animationData.assets,this.totalFrames=this.animationData.animation.totalFrames,this.frameRate=this.animationData.animation.frameRate,this.firstFrame=Math.round(this.animationData.animation.ff*this.frameRate),this.frameMult=this.animationData.animation.frameRate/1e3,dataManager.completeData(this.animationData),this.renderer.buildItems(this.animationData.animation.layers,this.container),this.updaFrameModifier(),this.checkLoaded()},AnimationItem.prototype.elementLoaded=function(){this.pendingElements--,this.checkLoaded()},AnimationItem.prototype.checkLoaded=function(){this.renderer.buildStage(this.container,this.layers),0===this.pendingElements&&(this.prerenderFramesFlag?(this.prerenderFrames(0),dataManager.renderFrame(this.animationID,this.currentFrame+this.firstFrame),this.renderer.renderFrame(this.currentFrame+this.firstFrame)):(this.isLoaded=!0,this.gotoFrame(),this.autoplay&&this.play()))},AnimationItem.prototype.prerenderFrames=function(t){t||(t=0),this.renderedFrameCount===this.totalFrames?(this.isLoaded=!0,this.gotoFrame(),this.autoplay&&this.play()):(dataManager.renderFrame(this.animationID,this.renderedFrameCount+this.firstFrame),this.renderedFrameCount+=1,t>5?setTimeout(this.prerenderFrames.bind(this),0):(t+=1,this.prerenderFrames(t)))},AnimationItem.prototype.resize=function(){this.renderer.updateContainerSize()},AnimationItem.prototype.gotoFrame=function(){this.currentFrame=subframeEnabled?this.math.round(100*this.currentRawFrame)/100:this.math.floor(this.currentRawFrame),this.renderFrame()},AnimationItem.prototype.renderFrame=function(){this.isLoaded!==!1&&(dataManager.renderFrame(this.animationID,this.currentFrame+this.firstFrame),this.renderer.renderFrame(this.currentFrame+this.firstFrame))},AnimationItem.prototype.play=function(t){t&&this.name!=t||this.isPaused===!0&&(this.isPaused=!1)},AnimationItem.prototype.pause=function(t){t&&this.name!=t||this.isPaused===!1&&(this.isPaused=!0)},AnimationItem.prototype.togglePause=function(t){t&&this.name!=t||(this.isPaused===!0?(this.isPaused=!1,this.play()):(this.isPaused=!0,this.pause()))},AnimationItem.prototype.stop=function(t){t&&this.name!=t||(this.isPaused=!0,this.currentFrame=this.currentRawFrame=0,this.playCount=0,this.gotoFrame())},AnimationItem.prototype.goToAndStop=function(t,e,a){a&&this.name!=a||(this.setCurrentRawFrameValue(e?t:t*this.frameModifier),this.isPaused=!0)},AnimationItem.prototype.advanceTime=function(t){this.isPaused!==!0&&this.isScrolling!==!0&&this.isLoaded!==!1&&this.setCurrentRawFrameValue(this.currentRawFrame+t*this.frameModifier)},AnimationItem.prototype.updateAnimation=function(t){this.setCurrentRawFrameValue(this.totalFrames*t)},AnimationItem.prototype.moveFrame=function(t,e){e&&this.name!=e||this.setCurrentRawFrameValue(this.currentRawFrame+t)},AnimationItem.prototype.setCurrentRawFrameValue=function(t){if(this.currentRawFrame=t,this.currentRawFrame>=this.totalFrames){if(this.loop===!1)return this.currentRawFrame=this.totalFrames-1,this.gotoFrame(),void this.pause();if(this.playCount+=1,this.loop!==!0&&this.playCount==this.loop)return this.currentRawFrame=this.totalFrames-1,this.gotoFrame(),void this.pause()}else if(this.currentRawFrame<0)return this.playCount-=1,this.playCount<0&&(this.playCount=0),this.loop===!1?(this.currentRawFrame=0,this.gotoFrame(),void this.pause()):(this.currentRawFrame=this.totalFrames+this.currentRawFrame,void this.gotoFrame());this.currentRawFrame=this.currentRawFrame%this.totalFrames,this.gotoFrame()},AnimationItem.prototype.setSpeed=function(t){this.playSpeed=t,this.updaFrameModifier()},AnimationItem.prototype.setDirection=function(t){this.playDirection=0>t?-1:1,this.updaFrameModifier()},AnimationItem.prototype.updaFrameModifier=function(){this.frameModifier=this.frameMult*this.playSpeed*this.playDirection},AnimationItem.prototype.getPath=function(){return this.path},AnimationItem.prototype.getAssets=function(){return this.assets},function(t){function e(t){animationManager.play(t)}function a(t){animationManager.pause(t)}function i(t){animationManager.togglePause(t)}function r(t,e){animationManager.setSpeed(t,e)}function s(t,e){animationManager.setDirection(t,e)}function n(t){animationManager.stop(t)}function o(t){animationManager.moveFrame(t)}function h(){animationManager.searchAnimations()}function l(t){return animationManager.registerAnimation(t)}function m(){animationManager.resize()}function p(){animationManager.start()}function d(t,e,a){animationManager.goToAndStop(t,e,a)}function c(t){subframeEnabled=t}function u(t){return animationManager.loadAnimation(t)}function f(){"complete"===document.readyState&&(clearInterval(g),h())}var y={};y.play=e,y.pause=a,y.togglePause=i,y.setSpeed=r,y.setDirection=s,y.stop=n,y.moveFrame=o,y.searchAnimations=h,y.registerAnimation=l,y.loadAnimation=u,y.setSubframeRendering=c,y.resize=m,y.start=p,y.goToAndStop=d,y.checkReady=f,t.bodymovin=y;var g=setInterval(f,100)}(window);}(window));