!function(){function t(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function e(t){return null===t?NaN:+t}function n(t){return!isNaN(t)}function i(t){return{left:function(e,n,i,r){for(arguments.length<3&&(i=0),arguments.length<4&&(r=e.length);r>i;){var o=i+r>>>1;t(e[o],n)<0?i=o+1:r=o}return i},right:function(e,n,i,r){for(arguments.length<3&&(i=0),arguments.length<4&&(r=e.length);r>i;){var o=i+r>>>1;t(e[o],n)>0?r=o:i=o+1}return i}}}function r(t){return t.length}function o(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function a(){this._=Object.create(null)}function s(t){return(t+="")===io||t[0]===ro?ro+t:t}function l(t){return(t+="")[0]===ro?t.slice(1):t}function c(t){return s(t)in this._}function u(t){return(t=s(t))in this._&&delete this._[t]}function h(){var t=[];for(var e in this._)t.push(l(e));return t}function p(){var t=0;for(var e in this._)++t;return t}function d(){for(var t in this._)return!1;return!0}function f(){this._=Object.create(null)}function g(t,e,n){return function(){var i=n.apply(e,arguments);return i===e?t:i}}function m(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,i=oo.length;i>n;++n){var r=oo[n]+e;if(r in t)return r}}function y(){}function v(){}function C(t){function e(){for(var e,i=n,r=-1,o=i.length;++rn;n++)for(var r,o=t[n],a=0,s=o.length;s>a;a++)(r=o[a])&&e(r,a,n);return t}function I(t){return so(t,go),t}function R(t,e,n){function i(){var e=this[r];e&&(this.removeEventListener(t,e,e.$),delete this[r])}var r="__on"+t,o=t.indexOf("."),a=Y;o>0&&(t=t.slice(0,o));var s=yo.get(t);return s&&(t=s,a=Z),o?e?function(){var o=a(e,jr(arguments));i.call(this),this.addEventListener(t,this[r]=o,o.$=n),o._=e}:i:e?y:function(){var e,n=new RegExp("^__on([^.]+)"+Hr.requote(t)+"$");for(var i in this)if(e=i.match(n)){var r=this[i];this.removeEventListener(e[1],r,r.$),delete this[i]}}}function Y(t,e){return function(n){var i=Hr.event;Hr.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{Hr.event=i}}}function Z(t,e){var n=Y(t,e);return function(t){var e=this,i=t.relatedTarget;i&&(i===e||8&i.compareDocumentPosition(e))||n.call(e,t)}}function H(){var t=".dragsuppress-"+ ++Co,e="click"+t,n=Hr.select(Wr).on("touchmove"+t,b).on("dragstart"+t,b).on("selectstart"+t,b);if(vo){var i=Vr.style,r=i[vo];i[vo]="none"}return function(o){if(n.on(t,null),vo&&(i[vo]=r),o){var a=function(){n.on(e,null)};n.on(e,function(){b(),a()},!0),setTimeout(a,0)}}}function q(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();if(0>bo&&(Wr.scrollX||Wr.scrollY)){var r=(n=Hr.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();bo=!(r.f||r.e),n.remove()}return bo?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}function j(){return Hr.event.changedTouches[0].identifier}function K(){return Hr.event.target}function V(){return Wr}function W(t){return t>0?1:0>t?-1:0}function X(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function G(t){return t>1?0:-1>t?ko:Math.acos(t)}function Q(t){return t>1?So:-1>t?-So:Math.asin(t)}function J(t){return((t=Math.exp(t))+1/t)/2}function tt(t){return(t=Math.sin(t/2))*t}function et(){}function nt(t,e,n){return this instanceof nt?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof nt?new nt(t.h,t.s,t.l):mt(""+t,yt,nt):new nt(t,e,n)}function it(t,e,n){function i(t){return Math.round(255*function(t){return t>360?t-=360:0>t&&(t+=360),60>t?r+(o-r)*t/60:180>t?o:240>t?r+(o-r)*(240-t)/60:r}(t))}var r,o;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:0>e?0:e>1?1:e,r=2*(n=0>n?0:n>1?1:n)-(o=.5>=n?n*(1+e):n+e-n*e),new pt(i(t+120),i(t),i(t-120))}function rt(t,e,n){return this instanceof rt?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof rt?new rt(t.h,t.c,t.l):lt(t instanceof at?t.l:(t=vt((t=Hr.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new rt(t,e,n)}function ot(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new at(n,Math.cos(t*=Mo)*e,Math.sin(t)*e)}function at(t,e,n){return this instanceof at?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof at?new at(t.l,t.a,t.b):t instanceof rt?ot(t.h,t.c,t.l):vt((t=pt(t)).r,t.g,t.b):new at(t,e,n)}function st(t,e,n){var i=(t+16)/116,r=i+e/500,o=i-n/200;return new pt(ht(3.2404542*(r=ct(r)*$o)-1.5371385*(i=ct(i)*Oo)-.4985314*(o=ct(o)*Uo)),ht(-.969266*r+1.8760108*i+.041556*o),ht(.0556434*r-.2040259*i+1.0572252*o))}function lt(t,e,n){return t>0?new rt(Math.atan2(n,e)*Fo,Math.sqrt(e*e+n*n),t):new rt(NaN,NaN,t)}function ct(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ut(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ht(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function pt(t,e,n){return this instanceof pt?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof pt?new pt(t.r,t.g,t.b):mt(""+t,pt,it):new pt(t,e,n)}function dt(t){return new pt(t>>16,255&t>>8,255&t)}function ft(t){return dt(t)+""}function gt(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function mt(t,e,n){var i,r,o,a=0,s=0,l=0;if(i=/([a-z]+)\((.*)\)/i.exec(t))switch(r=i[2].split(","),i[1]){case"hsl":return n(parseFloat(r[0]),parseFloat(r[1])/100,parseFloat(r[2])/100);case"rgb":return e(bt(r[0]),bt(r[1]),bt(r[2]))}return(o=Yo.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(a=(3840&o)>>4,a|=a>>4,s=240&o,s|=s>>4,l=15&o,l|=l<<4):7===t.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,l=255&o)),e(a,s,l))}function yt(t,e,n){var i,r,o=Math.min(t/=255,e/=255,n/=255),a=Math.max(t,e,n),s=a-o,l=(a+o)/2;return s?(r=.5>l?s/(a+o):s/(2-a-o),i=t==a?(e-n)/s+(n>e?6:0):e==a?(n-t)/s+2:(t-e)/s+4,i*=60):(i=NaN,r=l>0&&1>l?0:i),new nt(i,r,l)}function vt(t,e,n){var i=ut((.4124564*(t=Ct(t))+.3575761*(e=Ct(e))+.1804375*(n=Ct(n)))/$o),r=ut((.2126729*t+.7151522*e+.072175*n)/Oo);return at(116*r-16,500*(i-r),200*(r-ut((.0193339*t+.119192*e+.9503041*n)/Uo)))}function Ct(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function bt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function xt(t){return"function"==typeof t?t:function(){return t}}function Lt(t){return t}function kt(t){return function(e,n,i){return 2===arguments.length&&"function"==typeof n&&(i=n,n=null),wt(e,n,t,i)}}function wt(t,e,n,i){function r(){var t,e=l.status;if(!e&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(l)||e>=200&&300>e||304===e){try{t=n.call(o,l)}catch(t){return void a.error.call(o,t)}a.load.call(o,t)}else a.error.call(o,l)}var o={},a=Hr.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,c=null;return!Wr.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=r:l.onreadystatechange=function(){l.readyState>3&&r()},l.onprogress=function(t){var e=Hr.event;Hr.event=t;try{a.progress.call(o,l)}finally{Hr.event=e}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return n=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(jr(arguments)))}}),o.send=function(n,i,r){if(2===arguments.length&&"function"==typeof i&&(r=i,i=null),l.open(n,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var u in s)l.setRequestHeader(u,s[u]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=c&&(l.responseType=c),null!=r&&o.on("error",r).on("load",function(t){r(null,t)}),a.beforesend.call(o,l),l.send(null==i?null:i),o},o.abort=function(){return l.abort(),o},Hr.rebind(o,a,"on"),null==i?o:o.get(function(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}(i))}function _t(){var t=St(),e=Mt()-t;e>24?(isFinite(e)&&(clearTimeout(jo),jo=setTimeout(_t,e)),qo=0):(qo=1,Vo(_t))}function St(){var t=Date.now();for(Ko=Zo;Ko;)t>=Ko.t&&(Ko.f=Ko.c(t-Ko.t)),Ko=Ko.n;return t}function Mt(){for(var t,e=Zo,n=1/0;e;)e.f?e=t?t.n=e.n:Zo=e.n:(e.t1?Date.UTC.apply(this,arguments):arguments[0])}function Tt(t,e,n){function i(e){var n=t(e),i=o(n,1);return i-e>e-n?n:i}function r(n){return e(n=t(new Jo(n-1)),1),n}function o(t,n){return e(t=new Jo(+t),n),t}function a(t,i,o){var a=r(t),s=[];if(o>1)for(;i>a;)n(a)%o||s.push(new Date(+a)),e(a,1);else for(;i>a;)s.push(new Date(+a)),e(a,1);return s}t.floor=t,t.round=i,t.ceil=r,t.offset=o,t.range=a;var s=t.utc=At(t);return s.floor=s,s.round=At(i),s.ceil=At(r),s.offset=At(o),s.range=function(t,e,n){try{Jo=Pt;var i=new Pt;return i._=t,a(i,e,n)}finally{Jo=Date}},t}function At(t){return function(e,n){try{Jo=Pt;var i=new Pt;return i._=e,t(i,n)._}finally{Jo=Date}}}function zt(t,e,n){var i=0>t?"-":"",r=(i?-t:t)+"",o=r.length;return i+(n>o?new Array(n-o+1).join(e)+r:r)}function Bt(t){return new RegExp("^(?:"+t.map(Hr.requote).join("|")+")","i")}function Nt(t){for(var e=new a,n=-1,i=t.length;++n68?1900:2e3)}(+i[0]),n+i[0].length):-1}function Rt(t,e,n){return/^[+-]\d{4}$/.test(e=e.slice(n,n+5))?(t.Z=-e,n+5):-1}function Yt(t,e,n){na.lastIndex=0;var i=na.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function Zt(t,e,n){na.lastIndex=0;var i=na.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function Ht(t,e,n){na.lastIndex=0;var i=na.exec(e.slice(n,n+3));return i?(t.j=+i[0],n+i[0].length):-1}function qt(t,e,n){na.lastIndex=0;var i=na.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function jt(t,e,n){na.lastIndex=0;var i=na.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function Kt(t,e,n){na.lastIndex=0;var i=na.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function Vt(t,e,n){na.lastIndex=0;var i=na.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function Wt(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",i=0|no(e)/60,r=no(e)%60;return n+zt(i,"0",2)+zt(r,"0",2)}function Xt(t,e,n){ia.lastIndex=0;var i=ia.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function Gt(t){for(var e=t.length,n=-1;++n=0?1:-1,s=a*n,l=Math.cos(e),c=Math.sin(e),u=o*c,h=r*l+u*Math.cos(s),p=u*a*Math.sin(s);ca.add(Math.atan2(p,h)),i=t,r=l,o=c}var e,n,i,r,o;ua.point=function(a,s){ua.point=t,i=(e=a)*Mo,r=Math.cos(s=(n=s)*Mo/2+ko/4),o=Math.sin(s)},ua.lineEnd=function(){t(e,n)}}function re(t){var e=t[0],n=t[1],i=Math.cos(n);return[i*Math.cos(e),i*Math.sin(e),Math.sin(n)]}function oe(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ae(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function se(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function le(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function ce(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function ue(t){return[Math.atan2(t[1],t[0]),Q(t[2])]}function he(t,e){return no(t[0]-e[0])s;++s)r.point((n=t[s])[0],n[1]);return void r.lineEnd()}var l=new xe(n,t,null,!0),c=new xe(n,null,l,!1);l.o=c,o.push(l),a.push(c),c=new xe(i,null,l=new xe(i,t,null,!1),!0),l.o=c,o.push(l),a.push(c)}}),a.sort(e),be(o),be(a),o.length){for(var s=0,l=n,c=a.length;c>s;++s)a[s].e=l=!l;for(var u,h,p=o[0];;){for(var d=p,f=!0;d.v;)if((d=d.n)===p)return;u=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(f)for(s=0,c=u.length;c>s;++s)r.point((h=u[s])[0],h[1]);else i(d.x,d.n.x,1,r);d=d.n}else{if(f)for(s=(u=d.p.z).length-1;s>=0;--s)r.point((h=u[s])[0],h[1]);else i(d.x,d.p.x,-1,r);d=d.p}u=(d=d.o).z,f=!f}while(!d.v);r.lineEnd()}}}function be(t){if(e=t.length){for(var e,n,i=0,r=t[0];++i0){for(x||(o.polygonStart(),x=!0),o.lineStart();++a1&&2&e&&n.push(n.pop().concat(n.shift())),d.push(n.filter(ke))}var d,f,g,m=e(o),y=r.invert(i[0],i[1]),v={point:a,lineStart:l,lineEnd:c,polygonStart:function(){v.point=u,v.lineStart=h,v.lineEnd=p,d=[],f=[]},polygonEnd:function(){v.point=a,v.lineStart=l,v.lineEnd=c,d=Hr.merge(d);var t=function(t,e){var n=t[0],i=t[1],r=[Math.sin(n),-Math.cos(n),0],o=0,a=0;ca.reset();for(var s=0,l=e.length;l>s;++s){var c=e[s],u=c.length;if(u)for(var h=c[0],p=h[0],d=h[1]/2+ko/4,f=Math.sin(d),g=Math.cos(d),m=1;;){m===u&&(m=0);var y=(t=c[m])[0],v=t[1]/2+ko/4,C=Math.sin(v),b=Math.cos(v),x=y-p,L=x>=0?1:-1,k=L*x,w=k>ko,_=f*C;if(ca.add(Math.atan2(_*L*Math.sin(k),g*b+_*Math.cos(k))),o+=w?x+L*wo:x,w^p>=n^y>=n){var S=ae(re(h),re(t));ce(S);var M=ae(r,S);ce(M);var F=(w^x>=0?-1:1)*Q(M[2]);(i>F||i===F&&(S[0]||S[1]))&&(a+=w^x>=0?1:-1)}if(!m++)break;p=y,f=C,g=b,h=t}}return(-xo>o||xo>o&&0>ca)^1&a}(y,f);d.length?(x||(o.polygonStart(),x=!0),Ce(d,_e,t,n,o)):t&&(x||(o.polygonStart(),x=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),x&&(o.polygonEnd(),x=!1),d=f=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}},C=we(),b=e(C),x=!1;return v}}function ke(t){return t.length>1}function we(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:y,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function _e(t,e){return((t=t.x)[0]<0?t[1]-So-xo:So-t[1])-((e=e.x)[0]<0?e[1]-So-xo:So-e[1])}function Se(t,e,n,i){return function(r){var o,a=r.a,s=r.b,l=a.x,c=a.y,u=0,h=1,p=s.x-l,d=s.y-c;if(o=t-l,p||!(o>0)){if(o/=p,0>p){if(u>o)return;h>o&&(h=o)}else if(p>0){if(o>h)return;o>u&&(u=o)}if(o=n-l,p||!(0>o)){if(o/=p,0>p){if(o>h)return;o>u&&(u=o)}else if(p>0){if(u>o)return;h>o&&(h=o)}if(o=e-c,d||!(o>0)){if(o/=d,0>d){if(u>o)return;h>o&&(h=o)}else if(d>0){if(o>h)return;o>u&&(u=o)}if(o=i-c,d||!(0>o)){if(o/=d,0>d){if(o>h)return;o>u&&(u=o)}else if(d>0){if(u>o)return;h>o&&(h=o)}return u>0&&(r.a={x:l+u*p,y:c+u*d}),1>h&&(r.b={x:l+h*p,y:c+h*d}),r}}}}}}function Me(t,e,n,i){function r(i,r){return no(i[0]-t)0?0:3:no(i[0]-n)0?2:1:no(i[1]-e)0?1:0:r>0?3:2}function o(t,e){return a(t.x,e.x)}function a(t,e){var n=r(t,1),i=r(e,1);return n!==i?n-i:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){function l(o,s,l,c){var u=0,h=0;if(null==o||(u=r(o,l))!==(h=r(s,l))||a(o,s)<0^l>0)do{c.point(0===u||3===u?t:n,u>1?i:e)}while((u=(u+l+4)%4)!==h);else c.point(s[0],s[1])}function c(r,o){return r>=t&&n>=r&&o>=e&&i>=o}function u(t,e){c(t,e)&&s.point(t,e)}function h(t,e){var n=c(t=Math.max(-wa,Math.min(wa,t)),e=Math.max(-wa,Math.min(wa,e)));if(d&&f.push([t,e]),x)g=t,m=e,y=n,x=!1,n&&(s.lineStart(),s.point(t,e));else if(n&&b)s.point(t,e);else{var i={a:{x:v,y:C},b:{x:t,y:e}};_(i)?(b||(s.lineStart(),s.point(i.a.x,i.a.y)),s.point(i.b.x,i.b.y),n||s.lineEnd(),L=!1):n&&(s.lineStart(),s.point(t,e),L=!1)}v=t,C=e,b=n}var p,d,f,g,m,y,v,C,b,x,L,k=s,w=we(),_=Se(t,e,n,i),S={point:u,lineStart:function(){S.point=h,d&&d.push(f=[]),x=!0,b=!1,v=C=NaN},lineEnd:function(){p&&(h(g,m),y&&b&&w.rejoin(),p.push(w.buffer())),S.point=u,b&&s.lineEnd()},polygonStart:function(){s=w,p=[],d=[],L=!0},polygonEnd:function(){s=k,p=Hr.merge(p);var e=function(t){for(var e=0,n=d.length,i=t[1],r=0;n>r;++r)for(var o,a=1,s=d[r],l=s.length,c=s[0];l>a;++a)o=s[a],c[1]<=i?o[1]>i&&X(c,o,t)>0&&++e:o[1]<=i&&X(c,o,t)<0&&--e,c=o;return 0!==e}([t,i]),n=L&&e,r=p.length;(n||r)&&(s.polygonStart(),n&&(s.lineStart(),l(null,null,1,s),s.lineEnd()),r&&Ce(p,o,e,l,s),s.polygonEnd()),p=d=f=null}};return S}}function Fe(t){var e=0,n=ko/3,i=Ie(t),r=i(e,n);return r.parallels=function(t){return arguments.length?i(e=t[0]*ko/180,n=t[1]*ko/180):[e/ko*180,n/ko*180]},r}function Ee(t,e){function n(t,e){var n=Math.sqrt(o-2*r*Math.sin(e))/r;return[n*Math.sin(t*=r),a-n*Math.cos(t)]}var i=Math.sin(t),r=(i+Math.sin(e))/2,o=1+i*(2*r-i),a=Math.sqrt(o)/r;return n.invert=function(t,e){var n=a-e;return[Math.atan2(t,n)/r,Q((o-(t*t+n*n)*r*r)/(2*r))]},n}function Pe(){function t(t,e){Sa+=r*t-i*e,i=t,r=e}var e,n,i,r;Ta.point=function(o,a){Ta.point=t,e=i=o,n=r=a},Ta.lineEnd=function(){t(e,n)}}function Te(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ae(t,e){da+=t,fa+=e,++ga}function ze(){function t(t,i){var r=t-e,o=i-n,a=Math.sqrt(r*r+o*o);ma+=a*(e+t)/2,ya+=a*(n+i)/2,va+=a,Ae(e=t,n=i)}var e,n;za.point=function(i,r){za.point=t,Ae(e=i,n=r)}}function Be(){za.point=Ae}function Ne(){function t(t,e){var n=t-i,o=e-r,a=Math.sqrt(n*n+o*o);ma+=a*(i+t)/2,ya+=a*(r+e)/2,va+=a,Ca+=(a=r*t-i*e)*(i+t),ba+=a*(r+e),xa+=3*a,Ae(i=t,r=e)}var e,n,i,r;za.point=function(o,a){za.point=t,Ae(e=i=o,n=r=a)},za.lineEnd=function(){t(e,n)}}function De(t){function e(t){return(s?i:n)(t)}function n(e){return Oe(e,function(n,i){n=t(n,i),e.point(n[0],n[1])})}function i(e){function n(n,i){n=t(n,i),e.point(n[0],n[1])}function i(){v=NaN,k.point=o,e.lineStart()}function o(n,i){var o=re([n,i]),a=t(n,i);r(v,C,y,b,x,L,v=a[0],C=a[1],y=n,b=o[0],x=o[1],L=o[2],s,e),e.point(v,C)}function a(){k.point=n,e.lineEnd()}function l(){i(),k.point=c,k.lineEnd=u}function c(t,e){o(h=t,e),p=v,d=C,f=b,g=x,m=L,k.point=o}function u(){r(v,C,y,b,x,L,p,d,h,f,g,m,s,e),k.lineEnd=a,a()}var h,p,d,f,g,m,y,v,C,b,x,L,k={point:n,lineStart:i,lineEnd:a,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=i}};return k}function r(e,n,i,s,l,c,u,h,p,d,f,g,m,y){var v=u-e,C=h-n,b=v*v+C*C;if(b>4*o&&m--){var x=s+d,L=l+f,k=c+g,w=Math.sqrt(x*x+L*L+k*k),_=Math.asin(k/=w),S=no(no(k)-1)o||no((v*P+C*T)/b-.5)>.3||a>s*d+l*f+c*g)&&(r(e,n,i,s,l,c,F,E,S,x/=w,L/=w,k,m,y),y.point(F,E),r(F,E,S,x,L,k,u,h,p,d,f,g,m,y))}}var o=.5,a=Math.cos(30*Mo),s=16;return e.precision=function(t){return arguments.length?(s=(o=t*t)>0&&16,e):Math.sqrt(o)},e}function $e(t){this.stream=t}function Oe(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Ue(t){return Ie(function(){return t})()}function Ie(t){function e(t){return[(t=s(t[0]*Mo,t[1]*Mo))[0]*p+l,c-t[1]*p]}function n(t){return(t=s.invert((t[0]-l)/p,(c-t[1])/p))&&[t[0]*Fo,t[1]*Fo]}function i(){s=ye(a=He(y,v,C),o);var t=o(g,m);return l=d-t[0]*p,c=f+t[1]*p,r()}function r(){return u&&(u.valid=!1,u=null),e}var o,a,s,l,c,u,h=De(function(t,e){return[(t=o(t,e))[0]*p+l,c-t[1]*p]}),p=150,d=480,f=250,g=0,m=0,y=0,v=0,C=0,b=ka,x=Lt,L=null,k=null;return e.stream=function(t){return u&&(u.valid=!1),(u=Re(b(a,h(x(t))))).valid=!0,u},e.clipAngle=function(t){return arguments.length?(b=null==t?(L=t,ka):function(t){function e(t,e){return Math.cos(t)*Math.cos(e)>r}function n(t,e,n){var i=[1,0,0],o=ae(re(t),re(e)),a=oe(o,o),s=o[0],l=a-s*s;if(!l)return!n&&t;var c=r*a/l,u=-r*s/l,h=ae(i,o),p=le(i,c);se(p,le(o,u));var d=h,f=oe(p,d),g=oe(d,d),m=f*f-g*(oe(p,p)-1);if(!(0>m)){var y=Math.sqrt(m),v=le(d,(-f-y)/g);if(se(v,p),v=ue(v),!n)return v;var C,b=t[0],x=e[0],L=t[1],k=e[1];b>x&&(C=b,b=x,x=C);var w=x-b,_=no(w-ko)k&&(C=L,L=k,k=C),_||xo>w?_?L+k>0^v[1]<(no(v[0]-b)ko^(b<=v[0]&&v[0]<=x)){var S=le(d,(-f+y)/g);return se(S,p),[v,ue(S)]}}}function i(e,n){var i=o?t:ko-t,r=0;return-i>e?r|=1:e>i&&(r|=2),-i>n?r|=4:n>i&&(r|=8),r}var r=Math.cos(t),o=r>0,a=no(r)>xo;return Le(e,function(t){var r,s,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,p){var d,f=[h,p],g=e(h,p),m=o?g?0:i(h,p):g?i(h+(0>h?ko:-ko),p):0;if(!r&&(c=l=g)&&t.lineStart(),g!==l&&(d=n(r,f),(he(r,d)||he(f,d))&&(f[0]+=xo,f[1]+=xo,g=e(f[0],f[1]))),g!==l)u=0,g?(t.lineStart(),d=n(f,r),t.point(d[0],d[1])):(d=n(r,f),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(a&&r&&o^g){var y;m&s||!(y=n(f,r,!0))||(u=0,o?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!g||r&&he(r,f)||t.point(f[0],f[1]),r=f,l=g,s=m},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return u|(c&&l)<<1}}},Ve(t,6*Mo),o?[0,-t]:[-ko,t-ko])}((L=+t)*Mo),r()):L},e.clipExtent=function(t){return arguments.length?(k=t,x=t?Me(t[0][0],t[0][1],t[1][0],t[1][1]):Lt,r()):k},e.scale=function(t){return arguments.length?(p=+t,i()):p},e.translate=function(t){return arguments.length?(d=+t[0],f=+t[1],i()):[d,f]},e.center=function(t){return arguments.length?(g=t[0]%360*Mo,m=t[1]%360*Mo,i()):[g*Fo,m*Fo]},e.rotate=function(t){return arguments.length?(y=t[0]%360*Mo,v=t[1]%360*Mo,C=t.length>2?t[2]%360*Mo:0,i()):[y*Fo,v*Fo,C*Fo]},Hr.rebind(e,h,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&n,i()}}function Re(t){return Oe(t,function(e,n){t.point(e*Mo,n*Mo)})}function Ye(t,e){return[t,e]}function Ze(t,e){return[t>ko?t-wo:-ko>t?t+wo:t,e]}function He(t,e,n){return t?e||n?ye(je(t),Ke(e,n)):je(t):e||n?Ke(e,n):Ze}function qe(t){return function(e,n){return[(e+=t)>ko?e-wo:-ko>e?e+wo:e,n]}}function je(t){var e=qe(t);return e.invert=qe(-t),e}function Ke(t,e){function n(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,c=Math.sin(e),u=c*i+s*r;return[Math.atan2(l*o-u*a,s*i-c*r),Q(u*o+l*a)]}var i=Math.cos(t),r=Math.sin(t),o=Math.cos(e),a=Math.sin(e);return n.invert=function(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,c=Math.sin(e),u=c*o-l*a;return[Math.atan2(l*o+c*a,s*i+u*r),Q(u*i-s*r)]},n}function Ve(t,e){var n=Math.cos(t),i=Math.sin(t);return function(r,o,a,s){var l=a*e;null!=r?(r=We(n,r),o=We(n,o),(a>0?o>r:r>o)&&(r+=a*wo)):(r=t+a*wo,o=t-.5*l);for(var c,u=r;a>0?u>o:o>u;u-=l)s.point((c=ue([n,-i*Math.cos(u),-i*Math.sin(u)]))[0],c[1])}}function We(t,e){var n=re(e);n[0]-=t,ce(n);var i=G(-n[1]);return((-n[2]<0?-i:i)+2*Math.PI-xo)%(2*Math.PI)}function Xe(t,e,n){var i=Hr.range(t,e-xo,n).concat(e);return function(t){return i.map(function(e){return[t,e]})}}function Ge(t,e,n){var i=Hr.range(t,e-xo,n).concat(e);return function(t){return i.map(function(e){return[e,t]})}}function Qe(t){return t.source}function Je(t){return t.target}function tn(t,e){function n(e,n){var i=Math.cos(e),r=Math.cos(n),o=t(i*r);return[o*r*Math.sin(e),o*Math.sin(n)]}return n.invert=function(t,n){var i=Math.sqrt(t*t+n*n),r=e(i),o=Math.sin(r),a=Math.cos(r);return[Math.atan2(t*o,i*a),Math.asin(i&&n*o/i)]},n}function en(t,e){function n(t,e){a>0?-So+xo>e&&(e=-So+xo):e>So-xo&&(e=So-xo);var n=a/Math.pow(r(e),o);return[n*Math.sin(o*t),a-n*Math.cos(o*t)]}var i=Math.cos(t),r=function(t){return Math.tan(ko/4+t/2)},o=t===e?Math.sin(t):Math.log(i/Math.cos(e))/Math.log(r(e)/r(t)),a=i*Math.pow(r(t),o)/o;return o?(n.invert=function(t,e){var n=a-e,i=W(o)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/o,2*Math.atan(Math.pow(a/i,1/o))-So]},n):rn}function nn(t,e){function n(t,e){var n=o-e;return[n*Math.sin(r*t),o-n*Math.cos(r*t)]}var i=Math.cos(t),r=t===e?Math.sin(t):(i-Math.cos(e))/(e-t),o=i/r+t;return no(r)r;r++){for(;i>1&&X(t[n[i-2]],t[n[i-1]],t[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}function un(t,e){return t[0]-e[0]||t[1]-e[1]}function hn(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function pn(t,e,n,i){var r=t[0],o=n[0],a=e[0]-r,s=i[0]-o,l=t[1],c=n[1],u=e[1]-l,h=i[1]-c,p=(s*(l-c)-h*(r-o))/(h*a-s*u);return[r+p*a,l+p*u]}function dn(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function fn(t){var e=Ka.pop()||new function(){Tn(this),this.edge=this.site=this.circle=null};return e.site=t,e}function gn(t){kn(t),Ha.remove(t),Ka.push(t),Tn(t)}function mn(t){var e=t.circle,n=e.x,i=e.cy,r={x:n,y:i},o=t.P,a=t.N,s=[t];gn(t);for(var l=o;l.circle&&no(n-l.circle.x)u;++u)c=s[u],l=s[u-1],Fn(c.edge,l.site,c.site,r);l=s[0],(c=s[h-1]).edge=Sn(l.site,c.site,null,r),Ln(l),Ln(c)}function yn(t){for(var e,n,i,r,o=t.x,a=t.y,s=Ha._;s;)if((i=vn(s,a)-o)>xo)s=s.L;else{if(!((r=o-Cn(s,a))>xo)){i>-xo?(e=s.P,n=s):r>-xo?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}var l=fn(t);if(Ha.insert(e,l),e||n){if(e===n)return kn(e),n=fn(e.site),Ha.insert(l,n),l.edge=n.edge=Sn(e.site,l.site),Ln(e),void Ln(n);if(!n)return void(l.edge=Sn(e.site,l.site));kn(e),kn(n);var c=e.site,u=c.x,h=c.y,p=t.x-u,d=t.y-h,f=n.site,g=f.x-u,m=f.y-h,y=2*(p*m-d*g),v=p*p+d*d,C=g*g+m*m,b={x:(m*v-d*C)/y+u,y:(p*C-g*v)/y+h};Fn(n.edge,c,f,b),l.edge=Sn(c,t,null,b),n.edge=Sn(t,f,null,b),Ln(e),Ln(n)}}function vn(t,e){var n=t.site,i=n.x,r=n.y,o=r-e;if(!o)return i;var a=t.P;if(!a)return-1/0;var s=(n=a.site).x,l=n.y,c=l-e;if(!c)return s;var u=s-i,h=1/o-1/c,p=u/c;return h?(-p+Math.sqrt(p*p-2*h*(u*u/(-2*c)-l+c/2+r-o/2)))/h+i:(i+s)/2}function Cn(t,e){var n=t.N;if(n)return vn(n,e);var i=t.site;return i.y===e?i.x:1/0}function bn(t){this.site=t,this.edges=[]}function xn(t,e){return e.angle-t.angle}function Ln(t){var e=t.P,n=t.N;if(e&&n){var i=e.site,r=t.site,o=n.site;if(i!==o){var a=r.x,s=r.y,l=i.x-a,c=i.y-s,u=o.x-a,h=2*(l*(m=o.y-s)-c*u);if(!(h>=-Lo)){var p=l*l+c*c,d=u*u+m*m,f=(m*p-c*d)/h,g=(l*d-u*p)/h,m=g+s,y=Va.pop()||new function(){Tn(this),this.x=this.y=this.arc=this.site=this.cy=null};y.arc=t,y.site=r,y.x=f+a,y.y=m+Math.sqrt(f*f+g*g),y.cy=m,t.circle=y;for(var v=null,C=ja._;C;)if(y.ym||m>=s)return;if(p>f){if(o){if(o.y>=c)return}else o={x:m,y:l};n={x:m,y:c}}else{if(o){if(o.yi||i>1)if(p>f){if(o){if(o.y>=c)return}else o={x:(l-r)/i,y:l};n={x:(c-r)/i,y:c}}else{if(o){if(o.yd){if(o){if(o.x>=s)return}else o={x:a,y:i*a+r};n={x:s,y:i*s+r}}else{if(o){if(o.xa;)i=(u=s[a].end()).x,r=u.y,e=(c=s[++a%l].start()).x,n=c.y,(no(i-e)>xo||no(r-n)>xo)&&(s.splice(a,0,new En(Mn(o.site,u,no(i-h)xo?{x:h,y:no(e-h)xo?{x:no(n-f)xo?{x:p,y:no(e-p)xo?{x:no(n-d)o&&(r=e.slice(o,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:Yn(n,i)})),o=Ga.lastIndex;return oi;++i)s[(n=l[i]).i]=n.x(t);return s.join("")})}function Hn(t,e){for(var n,i=Hr.interpolators.length;--i>=0&&!(n=Hr.interpolators[i](t,e)););return n}function qn(t,e){var n,i=[],r=[],o=t.length,a=e.length,s=Math.min(t.length,e.length);for(n=0;s>n;++n)i.push(Hn(t[n],e[n]));for(;o>n;++n)r[n]=t[n];for(;a>n;++n)r[n]=e[n];return function(t){for(n=0;s>n;++n)r[n]=i[n](t);return r}}function jn(t){return function(e){return 1-t(1-e)}}function Kn(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}}function Vn(t){return t*t}function Wn(t){return t*t*t}function Xn(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(.5>t?n:3*(t-e)+n-.75)}function Gn(t){return 1-Math.cos(t*So)}function Qn(t){return Math.pow(2,10*(t-1))}function Jn(t){return 1-Math.sqrt(1-t*t)}function ti(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function ei(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function ni(t){var e=[t.a,t.b],n=[t.c,t.d],i=ri(e),r=ii(e,n),o=ri(function(t,e,n){return t[0]+=n*e[0],t[1]+=n*e[1],t}(n,e,-r))||0;e[0]*n[1]180?u+=360:u-c>180&&(c+=360),r.push({i:i.push(i.pop()+"rotate(",null,")")-2,x:Yn(c,u)})):u&&i.push(i.pop()+"rotate("+u+")"),h!=p?r.push({i:i.push(i.pop()+"skewX(",null,")")-2,x:Yn(h,p)}):p&&i.push(i.pop()+"skewX("+p+")"),d[0]!=f[0]||d[1]!=f[1]?(n=i.push(i.pop()+"scale(",null,",",null,")"),r.push({i:n-4,x:Yn(d[0],f[0])},{i:n-2,x:Yn(d[1],f[1])})):(1!=f[0]||1!=f[1])&&i.push(i.pop()+"scale("+f+")"),n=r.length,function(t){for(var e,o=-1;++o=0;)n.push(r[i])}function mi(t,e){for(var n=[t],i=[];null!=(t=n.pop());)if(i.push(t),(o=t.children)&&(r=o.length))for(var r,o,a=-1;++an;++n)(e=t[n][1])>r&&(i=n,r=e);return i}function Mi(t){return t.reduce(Fi,0)}function Fi(t,e){return t+e[1]}function Ei(t,e){return Pi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Pi(t,e){for(var n=-1,i=+t[0],r=(t[1]-i)/e,o=[];++n<=e;)o[n]=r*n+i;return o}function Ti(t){return[Hr.min(t),Hr.max(t)]}function Ai(t,e){return t.value-e.value}function zi(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Bi(t,e){t._pack_next=e,e._pack_prev=t}function Ni(t,e){var n=e.x-t.x,i=e.y-t.y,r=t.r+e.r;return.999*r*r>n*n+i*i}function Di(t){function e(t){u=Math.min(t.x-t.r,u),h=Math.max(t.x+t.r,h),p=Math.min(t.y-t.r,p),d=Math.max(t.y+t.r,d)}if((n=t.children)&&(c=n.length)){var n,i,r,o,a,s,l,c,u=1/0,h=-1/0,p=1/0,d=-1/0;if(n.forEach($i),(i=n[0]).x=-i.r,i.y=0,e(i),c>1&&((r=n[1]).x=r.r,r.y=0,e(r),c>2))for(Ui(i,r,o=n[2]),e(o),zi(i,o),i._pack_prev=o,zi(o,r),r=i._pack_next,a=3;c>a;a++){Ui(i,r,o=n[a]);var f=0,g=1,m=1;for(s=r._pack_next;s!==r;s=s._pack_next,g++)if(Ni(s,o)){f=1;break}if(1==f)for(l=i._pack_prev;l!==s._pack_prev&&!Ni(l,o);l=l._pack_prev,m++);f?(m>g||g==m&&r.ra;a++)(o=n[a]).x-=y,o.y-=v,C=Math.max(C,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=C,n.forEach(Oi)}}function $i(t){t._pack_next=t._pack_prev=t}function Oi(t){delete t._pack_next,delete t._pack_prev}function Ui(t,e,n){var i=t.r+n.r,r=e.x-t.x,o=e.y-t.y;if(i&&(r||o)){var a=e.r+n.r,s=r*r+o*o,l=.5+((i*=i)-(a*=a))/(2*s),c=Math.sqrt(Math.max(0,2*a*(i+s)-(i-=s)*i-a*a))/(2*s);n.x=t.x+l*r+c*o,n.y=t.y+l*o-c*r}else n.x=t.x+i,n.y=t.y}function Ii(t,e){return t.parent==e.parent?1:2}function Ri(t){var e=t.children;return e.length?e[0]:t.t}function Yi(t){var e,n=t.children;return(e=n.length)?n[e-1]:t.t}function Zi(t,e,n){var i=n/(e.i-t.i);e.c-=i,e.s+=n,t.c+=i,e.z+=n,e.m+=n}function Hi(t,e,n){return t.a.parent===e.parent?t.a:n}function qi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function ji(t,e){var n=t.x+e[3],i=t.y+e[0],r=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return 0>r&&(n+=r/2,r=0),0>o&&(i+=o/2,o=0),{x:n,y:i,dx:r,dy:o}}function Ki(t){var e=t[0],n=t[t.length-1];return n>e?[e,n]:[n,e]}function Vi(t){return t.rangeExtent?t.rangeExtent():Ki(t.range())}function Wi(t,e,n,i){var r=n(t[0],t[1]),o=i(e[0],e[1]);return function(t){return o(r(t))}}function Xi(t,e){var n,i=0,r=t.length-1,o=t[i],a=t[r];return o>a&&(n=i,i=r,r=n,n=o,o=a,a=n),t[i]=e.floor(o),t[r]=e.ceil(a),t}function Gi(t,e,n,i){var r=[],o=[],a=0,s=Math.min(t.length,e.length)-1;for(t[s]=o?r*=10:.35>=o?r*=5:.75>=o&&(r*=2),n[0]=Math.ceil(n[0]/r)*r,n[1]=Math.floor(n[1]/r)*r+.5*r,n[2]=r,n}function er(t,e){return Hr.range.apply(Hr,tr(t,e))}function nr(t,e,n){var i=tr(t,e);if(n){var r=Xo.exec(n);if(r.shift(),"s"===r[8]){var o=Hr.formatPrefix(Math.max(no(i[0]),no(i[1])));return r[7]||(r[7]="."+ir(o.scale(i[2]))),r[8]="f",n=Hr.format(r.join("")),function(t){return n(o.scale(t))+o.symbol}}r[7]||(r[7]="."+function(t,e){var n=ir(e[2]);return t in cs?Math.abs(n-ir(Math.max(no(e[0]),no(e[1]))))+ +("e"!==t):n-2*("%"===t)}(r[8],i)),n=r.join("")}else n=",."+ir(i[2])+"f";return Hr.format(n)}function ir(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function rr(t){return function(e){return 0>e?-Math.pow(-e,t):Math.pow(e,t)}}function or(){return 0}function ar(t){return t.innerRadius}function sr(t){return t.outerRadius}function lr(t){return t.startAngle}function cr(t){return t.endAngle}function ur(t){return t&&t.padAngle}function hr(t,e,n,i){return(t-n)*e-(e-i)*t>0?0:1}function pr(t,e,n,i,r){var o=t[0]-e[0],a=t[1]-e[1],s=(r?i:-i)/Math.sqrt(o*o+a*a),l=s*a,c=-s*o,u=t[0]+l,h=t[1]+c,p=e[0]+l,d=e[1]+c,f=(u+p)/2,g=(h+d)/2,m=p-u,y=d-h,v=m*m+y*y,C=n-i,b=u*d-p*h,x=(0>y?-1:1)*Math.sqrt(C*C*v-b*b),L=(b*y-m*x)/v,k=(-b*m-y*x)/v,w=(b*y+m*x)/v,_=(-b*m+y*x)/v,S=L-f,M=k-g,F=w-f,E=_-g;return S*S+M*M>F*F+E*E&&(L=w,k=_),[[L-l,k-c],[L*n/C,k*n/C]]}function dr(t){function e(e){function a(){c.push("M",o(t(u),s))}for(var l,c=[],u=[],h=-1,p=e.length,d=xt(n),f=xt(i);++h1){s=e[1],o=t[l],l++,i+="C"+(r[0]+a[0])+","+(r[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var c=2;c9&&(r=3*e/Math.sqrt(r),a[s]=r*n,a[s+1]=r*i);for(s=-1;++s<=l;)r=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([r||0,a[s]*r||0]);return o}function wr(t){for(var e,n,i,r=-1,o=t.length;++ri)return u();var r=o[o.active];r&&(--o.count,delete o[o.active],r.event&&r.event.interrupt.call(t,t.__data__,r.index)),o.active=i,s.event&&s.event.start.call(t,t.__data__,e),s.tween.forEach(function(n,i){(i=i.call(t,t.__data__,e))&&g.push(i)}),p=s.ease,h=s.duration,Hr.timer(function(){return f.c=c(n||1)?ve:c,1},0,l)}function c(n){if(o.active!==i)return 1;for(var r=n/h,a=p(r),l=g.length;l>0;)g[--l].call(t,a);return r>=1?(s.event&&s.event.end.call(t,t.__data__,e),u()):void 0}function u(){return--o.count?delete o[i]:delete t[n],1}var h,p,d=s.delay,f=Ko,g=[];return f.t=d+l,r>=d?a(r-d):void(f.c=a)},0,l)}}function $r(t,e,n){t.attr("transform",function(t){var i=e(t);return"translate("+(isFinite(i)?i:n(t))+",0)"})}function Or(t,e,n){t.attr("transform",function(t){var i=e(t);return"translate(0,"+(isFinite(i)?i:n(t))+")"})}function Ur(t){return t.toISOString()}function Ir(t,e,n){function i(e){return t(e)}function r(t,n){var i=(t[1]-t[0])/n,r=Hr.bisect(Ds,i);return r==Ds.length?[e.year,tr(t.map(function(t){return t/31536e6}),n)[2]]:r?e[i/Ds[r-1]1?{floor:function(e){for(;n(e=t.floor(e));)e=Rr(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=Rr(+e+1);return e}}:t))},i.ticks=function(t,e){var n=Ki(i.domain()),o=null==t?r(n,10):"number"==typeof t?r(n,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(n[0],Rr(+n[1]+1),1>e?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Ir(t.copy(),e,n)},Qi(i,t)}function Rr(t){return new Date(t)}function Yr(t){return JSON.parse(t.responseText)}function Zr(t){var e=Kr.createRange();return e.selectNode(Kr.body),e.createContextualFragment(t.responseText)}var Hr={version:"3.5.2"};Date.now||(Date.now=function(){return+new Date});var qr=[].slice,jr=function(t){return qr.call(t)},Kr=document,Vr=Kr.documentElement,Wr=window;try{jr(Vr.childNodes)[0].nodeType}catch(t){jr=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}try{Kr.createElement("div").style.setProperty("opacity",0,"")}catch(t){var Xr=Wr.Element.prototype,Gr=Xr.setAttribute,Qr=Xr.setAttributeNS,Jr=Wr.CSSStyleDeclaration.prototype,to=Jr.setProperty;Xr.setAttribute=function(t,e){Gr.call(this,t,e+"")},Xr.setAttributeNS=function(t,e,n){Qr.call(this,t,e,n+"")},Jr.setProperty=function(t,e,n){to.call(this,t,e+"",n)}}Hr.ascending=t,Hr.descending=function(t,e){return t>e?-1:e>t?1:e>=t?0:NaN},Hr.min=function(t,e){var n,i,r=-1,o=t.length;if(1===arguments.length){for(;++r=i){n=i;break}for(;++ri&&(n=i)}else{for(;++r=i){n=i;break}for(;++ri&&(n=i)}return n},Hr.max=function(t,e){var n,i,r=-1,o=t.length;if(1===arguments.length){for(;++r=i){n=i;break}for(;++rn&&(n=i)}else{for(;++r=i){n=i;break}for(;++rn&&(n=i)}return n},Hr.extent=function(t,e){var n,i,r,o=-1,a=t.length;if(1===arguments.length){for(;++o=i){n=r=i;break}for(;++oi&&(n=i),i>r&&(r=i))}else{for(;++o=i){n=r=i;break}for(;++oi&&(n=i),i>r&&(r=i))}return[n,r]},Hr.sum=function(t,e){var i,r=0,o=t.length,a=-1;if(1===arguments.length)for(;++a1?l/(u-1):void 0},Hr.deviation=function(){var t=Hr.variance.apply(this,arguments);return t?Math.sqrt(t):t};var eo=i(t);Hr.bisectLeft=eo.left,Hr.bisect=Hr.bisectRight=eo.right,Hr.bisector=function(e){return i(1===e.length?function(n,i){return t(e(n),i)}:e)},Hr.shuffle=function(t,e,n){(o=arguments.length)<3&&(n=t.length,2>o&&(e=0));for(var i,r,o=n-e;o;)r=0|Math.random()*o--,i=t[o+e],t[o+e]=t[r+e],t[r+e]=i;return t},Hr.permute=function(t,e){for(var n=e.length,i=new Array(n);n--;)i[n]=t[e[n]];return i},Hr.pairs=function(t){for(var e=0,n=t.length-1,i=t[0],r=new Array(0>n?0:n);n>e;)r[e]=[i,i=t[++e]];return r},Hr.zip=function(){if(!(i=arguments.length))return[];for(var t=-1,e=Hr.min(arguments,r),n=new Array(e);++t=0;)for(e=(i=t[r]).length;--e>=0;)n[--a]=i[e];return n};var no=Math.abs;Hr.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),1/0==(e-t)/n)throw new Error("infinite range");var i,r=[],o=function(t){for(var e=1;t*e%1;)e*=10;return e}(no(n)),a=-1;if(t*=o,e*=o,0>(n*=o))for(;(i=t+n*++a)>e;)r.push(i/o);else for(;(i=t+n*++a)=r.length)return n?n.call(i,s):e?s.sort(e):s;for(var c,u,h,p,d=-1,f=s.length,g=r[l++],m=new a;++d=r.length)return e;var i=[],a=o[n++];return e.forEach(function(e,r){i.push({key:e,values:t(r,n)})}),a?i.sort(function(t,e){return a(t.key,e.key)}):i}(t(Hr.map,e,0),0)},i.key=function(t){return r.push(t),i},i.sortKeys=function(t){return o[r.length-1]=t,i},i.sortValues=function(t){return e=t,i},i.rollup=function(t){return n=t,i},i},Hr.set=function(t){var e=new f;if(t)for(var n=0,i=t.length;i>n;++n)e.add(t[n]);return e},o(f,{has:c,add:function(t){return this._[s(t+="")]=!0,t},remove:u,values:h,size:p,empty:d,forEach:function(t){for(var e in this._)t.call(this,l(e))}}),Hr.behavior={},Hr.rebind=function(t,e){for(var n,i=1,r=arguments.length;++i=0&&(i=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(i):this[t].on(i,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(i,null);return this}},Hr.event=null,Hr.requote=function(t){return t.replace(ao,"\\$&")};var ao=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,so={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},lo=function(t,e){return e.querySelector(t)},co=function(t,e){return e.querySelectorAll(t)},uo=Vr.matches||Vr[m(Vr,"matchesSelector")],ho=function(t,e){return uo.call(t,e)};"function"==typeof Sizzle&&(lo=function(t,e){return Sizzle(t,e)[0]||null},co=Sizzle,ho=Sizzle.matchesSelector),Hr.selection=function(){return mo};var po=Hr.selection.prototype=[];po.select=function(t){var e,n,i,r,o=[];t=w(t);for(var a=-1,s=this.length;++a=0&&(n=t.slice(0,e),t=t.slice(e+1)),fo.hasOwnProperty(n)?{space:fo[n],local:t}:t}},po.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=Hr.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(S(e,t[e]));return this}return this.each(S(t,e))},po.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),i=(t=E(t)).length,r=-1;if(e=n.classList){for(;++ri){if("string"!=typeof t){for(n in 2>i&&(e=""),t)this.each(A(n,t[n],e));return this}if(2>i)return Wr.getComputedStyle(this.node(),null).getPropertyValue(t);n=""}return this.each(A(t,e,n))},po.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(z(e,t[e]));return this}return this.each(z(t,e))},po.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},po.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},po.append=function(t){return t=B(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},po.insert=function(t,e){return t=B(t),e=w(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},po.remove=function(){return this.each(N)},po.data=function(t,e){function n(t,n){var i,r,o,s=t.length,h=n.length,p=Math.min(s,h),d=new Array(h),f=new Array(h),g=new Array(s);if(e){var m,y=new a,v=new Array(s);for(i=-1;++ii;++i)f[i]=D(n[i]);for(;s>i;++i)g[i]=t[i]}f.update=d,f.parentNode=d.parentNode=g.parentNode=t.parentNode,l.push(f),c.push(d),u.push(g)}var i,r,o=-1,s=this.length;if(!arguments.length){for(t=new Array(s=(i=this[0]).length);++oo;o++){r.push(e=[]),e.parentNode=(n=this[o]).parentNode;for(var s=0,l=n.length;l>s;s++)(i=n[s])&&t.call(i,i.__data__,s,o)&&e.push(i)}return k(r)},po.order=function(){for(var t=-1,e=this.length;++t=0;)(n=i[r])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},po.sort=function(t){t=O.apply(this,arguments);for(var e=-1,n=this.length;++et;t++)for(var n=this[t],i=0,r=n.length;r>i;i++){var o=n[i];if(o)return o}return null},po.size=function(){var t=0;return U(this,function(){++t}),t};var go=[];Hr.selection.enter=I,Hr.selection.enter.prototype=go,go.append=po.append,go.empty=po.empty,go.node=po.node,go.call=po.call,go.size=po.size,go.select=function(t){for(var e,n,i,r,o,a=[],s=-1,l=this.length;++s=e&&(e=r+1);!(a=s[e])&&++ei){if("string"!=typeof t){for(n in 2>i&&(e=!1),t)this.each(R(n,t[n],e));return this}if(2>i)return(i=this.node()["__on"+t])&&i._;n=!1}return this.each(R(t,e,n))};var yo=Hr.map({mouseenter:"mouseover",mouseleave:"mouseout"});yo.forEach(function(t){"on"+t in Kr&&yo.remove(t)});var vo="onselectstart"in Kr?null:m(Vr.style,"userSelect"),Co=0;Hr.mouse=function(t){return q(t,x())};var bo=/WebKit/.test(Wr.navigator.userAgent)?-1:0;Hr.touch=function(t,e,n){if(arguments.length<3&&(n=e,e=x().changedTouches),e)for(var i,r=0,o=e.length;o>r;++r)if((i=e[r]).identifier===n)return q(t,i)},Hr.behavior.drag=function(){function t(){this.on("mousedown.drag",r).on("touchstart.drag",o)}function e(t,e,r,o,a){return function(){var s,l=this,c=Hr.event.target,u=l.parentNode,h=n.of(l,arguments),p=0,d=t(),f=".drag"+(null==d?"":"-"+d),g=Hr.select(r()).on(o+f,function(){var t,n,i=e(u,d);i&&(t=i[0]-y[0],n=i[1]-y[1],p|=t|n,y=i,h({type:"drag",x:i[0]+s[0],y:i[1]+s[1],dx:t,dy:n}))}).on(a+f,function(){e(u,d)&&(g.on(o+f,null).on(a+f,null),m(p&&Hr.event.target===c),h({type:"dragend"}))}),m=H(),y=e(u,d);i?s=[(s=i.apply(l,arguments)).x-y[0],s.y-y[1]]:s=[0,0],h({type:"dragstart"})}}var n=L(t,"drag","dragstart","dragend"),i=null,r=e(y,Hr.mouse,V,"mousemove","mouseup"),o=e(j,Hr.touch,K,"touchmove","touchend");return t.origin=function(e){return arguments.length?(i=e,t):i},Hr.rebind(t,n,"on")},Hr.touches=function(t,e){return arguments.length<2&&(e=x().touches),e?jr(e).map(function(e){var n=q(t,e);return n.identifier=e.identifier,n}):[]};var xo=1e-6,Lo=xo*xo,ko=Math.PI,wo=2*ko,_o=wo-xo,So=ko/2,Mo=ko/180,Fo=180/ko,Eo=Math.SQRT2,Po=2;Hr.interpolateZoom=function(t,e){function n(t){var e=t*y;if(m){var n=J(g),a=o/(Po*p)*(n*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(Eo*e+g)-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+a*c,r+a*u,o*n/J(Eo*e+g)]}return[i+t*c,r+t*u,o*Math.exp(Eo*e)]}var i=t[0],r=t[1],o=t[2],a=e[0],s=e[1],l=e[2],c=a-i,u=s-r,h=c*c+u*u,p=Math.sqrt(h),d=(l*l-o*o+4*h)/(2*o*Po*p),f=(l*l-o*o-4*h)/(2*l*Po*p),g=Math.log(Math.sqrt(d*d+1)-d),m=Math.log(Math.sqrt(f*f+1)-f)-g,y=(m||Math.log(l/o))/Eo;return n.duration=1e3*y,n},Hr.behavior.zoom=function(){function t(t){t.on(E,c).on(zo+".zoom",h).on("dblclick.zoom",p).on(A,u)}function e(t){return[(t[0]-w.x)/w.k,(t[1]-w.y)/w.k]}function n(t){w.k=Math.max(S[0],Math.min(S[1],t))}function i(t,e){e=function(t){return[t[0]*w.k+w.x,t[1]*w.k+w.y]}(e),w.x+=t[0]-e[0],w.y+=t[1]-e[1]}function r(e,r,o,a){e.__chart__={x:w.x,y:w.y,k:w.k},n(Math.pow(2,a)),i(f=r,o),e=Hr.select(e),M>0&&(e=e.transition().duration(M)),e.call(t.event)}function o(){C&&C.domain(v.range().map(function(t){return(t-w.x)/w.k}).map(v.invert)),k&&k.domain(x.range().map(function(t){return(t-w.y)/w.k}).map(x.invert))}function a(t){F++||t({type:"zoomstart"})}function s(t){o(),t({type:"zoom",scale:w.k,translate:[w.x,w.y]})}function l(t){--F||t({type:"zoomend"}),f=null}function c(){var t=this,n=Hr.event.target,r=z.of(t,arguments),o=0,c=Hr.select(Wr).on(P,function(){o=1,i(Hr.mouse(t),u),s(r)}).on(T,function(){c.on(P,null).on(T,null),h(o&&Hr.event.target===n),l(r)}),u=e(Hr.mouse(t)),h=H();Ss.call(t),a(r)}function u(){function t(){var t=Hr.touches(f);return d=w.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function o(){var e=Hr.event.target;Hr.select(e).on(x,h).on(L,p),k.push(e);for(var n=Hr.event.changedTouches,i=0,o=n.length;o>i;++i)m[n[i].identifier]=null;var a=t(),s=Date.now();if(1===a.length){if(500>s-y){var l=a[0];r(f,l,m[l.identifier],Math.floor(Math.log(w.k)/Math.LN2)+1),b()}y=s}else if(a.length>1){l=a[0];var c=a[1],u=l[0]-c[0],d=l[1]-c[1];v=u*u+d*d}}function h(){var t,e,r,o,a=Hr.touches(f);Ss.call(f);for(var l=0,c=a.length;c>l;++l,o=null)if(r=a[l],o=m[r.identifier]){if(e)break;t=r,e=o}if(o){var u=(u=r[0]-t[0])*u+(u=r[1]-t[1])*u,h=v&&Math.sqrt(u/v);t=[(t[0]+r[0])/2,(t[1]+r[1])/2],e=[(e[0]+o[0])/2,(e[1]+o[1])/2],n(h*d)}y=null,i(t,e),s(g)}function p(){if(Hr.event.touches.length){for(var e=Hr.event.changedTouches,n=0,i=e.length;i>n;++n)delete m[e[n].identifier];for(var r in m)return void t()}Hr.selectAll(k).on(C,null),_.on(E,c).on(A,u),S(),l(g)}var d,f=this,g=z.of(f,arguments),m={},v=0,C=".zoom-"+Hr.event.changedTouches[0].identifier,x="touchmove"+C,L="touchend"+C,k=[],_=Hr.select(f),S=H();o(),a(g),_.on(E,null).on(A,o)}function h(){var t=z.of(this,arguments);m?clearTimeout(m):(d=e(f=g||Hr.mouse(this)),Ss.call(this),a(t)),m=setTimeout(function(){m=null,l(t)},50),b(),n(Math.pow(2,.002*To())*w.k),i(f,d),s(t)}function p(){var t=Hr.mouse(this),n=Math.log(w.k)/Math.LN2;r(this,t,e(t),Hr.event.shiftKey?Math.ceil(n)-1:Math.floor(n)+1)}var d,f,g,m,y,v,C,x,k,w={x:0,y:0,k:1},_=[960,500],S=Ao,M=250,F=0,E="mousedown.zoom",P="mousemove.zoom",T="mouseup.zoom",A="touchstart.zoom",z=L(t,"zoomstart","zoom","zoomend");return t.event=function(t){t.each(function(){var t=z.of(this,arguments),e=w;ws?Hr.select(this).transition().each("start.zoom",function(){w=this.__chart__||{x:0,y:0,k:1},a(t)}).tween("zoom:zoom",function(){var n=_[0],i=_[1],r=f?f[0]:n/2,o=f?f[1]:i/2,a=Hr.interpolateZoom([(r-w.x)/w.k,(o-w.y)/w.k,n/w.k],[(r-e.x)/e.k,(o-e.y)/e.k,n/e.k]);return function(e){var i=a(e),l=n/i[2];this.__chart__=w={x:r-i[0]*l,y:o-i[1]*l,k:l},s(t)}}).each("interrupt.zoom",function(){l(t)}).each("end.zoom",function(){l(t)}):(this.__chart__=w,a(t),s(t),l(t))})},t.translate=function(e){return arguments.length?(w={x:+e[0],y:+e[1],k:w.k},o(),t):[w.x,w.y]},t.scale=function(e){return arguments.length?(w={x:w.x,y:w.y,k:+e},o(),t):w.k},t.scaleExtent=function(e){return arguments.length?(S=null==e?Ao:[+e[0],+e[1]],t):S},t.center=function(e){return arguments.length?(g=e&&[+e[0],+e[1]],t):g},t.size=function(e){return arguments.length?(_=e&&[+e[0],+e[1]],t):_},t.duration=function(e){return arguments.length?(M=+e,t):M},t.x=function(e){return arguments.length?(C=e,v=e.copy(),w={x:0,y:0,k:1},t):C},t.y=function(e){return arguments.length?(k=e,x=e.copy(),w={x:0,y:0,k:1},t):k},Hr.rebind(t,z,"on")};var To,Ao=[0,1/0],zo="onwheel"in Kr?(To=function(){return-Hr.event.deltaY*(Hr.event.deltaMode?120:1)},"wheel"):"onmousewheel"in Kr?(To=function(){return Hr.event.wheelDelta},"mousewheel"):(To=function(){return-Hr.event.detail},"MozMousePixelScroll");Hr.color=et,et.prototype.toString=function(){return this.rgb()+""},Hr.hsl=nt;var Bo=nt.prototype=new et;Bo.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new nt(this.h,this.s,this.l/t)},Bo.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new nt(this.h,this.s,t*this.l)},Bo.rgb=function(){return it(this.h,this.s,this.l)},Hr.hcl=rt;var No=rt.prototype=new et;No.brighter=function(t){return new rt(this.h,this.c,Math.min(100,this.l+Do*(arguments.length?t:1)))},No.darker=function(t){return new rt(this.h,this.c,Math.max(0,this.l-Do*(arguments.length?t:1)))},No.rgb=function(){return ot(this.h,this.c,this.l).rgb()},Hr.lab=at;var Do=18,$o=.95047,Oo=1,Uo=1.08883,Io=at.prototype=new et;Io.brighter=function(t){return new at(Math.min(100,this.l+Do*(arguments.length?t:1)),this.a,this.b)},Io.darker=function(t){return new at(Math.max(0,this.l-Do*(arguments.length?t:1)),this.a,this.b)},Io.rgb=function(){return st(this.l,this.a,this.b)},Hr.rgb=pt;var Ro=pt.prototype=new et;Ro.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,n=this.g,i=this.b,r=30;return e||n||i?(e&&r>e&&(e=r),n&&r>n&&(n=r),i&&r>i&&(i=r),new pt(Math.min(255,e/t),Math.min(255,n/t),Math.min(255,i/t))):new pt(r,r,r)},Ro.darker=function(t){return new pt((t=Math.pow(.7,arguments.length?t:1))*this.r,t*this.g,t*this.b)},Ro.hsl=function(){return yt(this.r,this.g,this.b)},Ro.toString=function(){return"#"+gt(this.r)+gt(this.g)+gt(this.b)};var Yo=Hr.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});Yo.forEach(function(t,e){Yo.set(t,dt(e))}),Hr.functor=xt,Hr.xhr=kt(Lt),Hr.dsv=function(t,e){function n(t,n,o){arguments.length<3&&(o=n,n=null);var a=wt(t,e,null==n?i:r(n),o);return a.row=function(t){return arguments.length?a.response(null==(n=t)?i:r(t)):n},a}function i(t){return n.parse(t.responseText)}function r(t){return function(e){return n.parse(e.responseText,t)}}function o(e){return e.map(a).join(t)}function a(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return n.parse=function(t,e){var i;return n.parseRows(t,function(t,n){if(i)return i(t,n-1);var r=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");i=e?function(t,n){return e(r(t),n)}:r})},n.parseRows=function(t,e){function n(){if(u>=c)return a;if(r)return r=!1,o;var e=u;if(34===t.charCodeAt(e)){for(var n=e;n++u;){var i,s=1;if(10===(i=t.charCodeAt(u++)))r=!0;else if(13===i)r=!0,10===t.charCodeAt(u)&&(++u,++s);else if(i!==l)continue;return t.slice(e,u-s)}return t.slice(e)}for(var i,r,o={},a={},s=[],c=t.length,u=0,h=0;(i=n())!==a;){for(var p=[];i!==o&&i!==a;)p.push(i),i=n();e&&null==(p=e(p,h++))||s.push(p)}return s},n.format=function(e){if(Array.isArray(e[0]))return n.formatRows(e);var i=new f,r=[];return e.forEach(function(t){for(var e in t)i.has(e)||r.push(i.add(e))}),[r.map(a).join(t)].concat(e.map(function(e){return r.map(function(t){return a(e[t])}).join(t)})).join("\n")},n.formatRows=function(t){return t.map(o).join("\n")},n},Hr.csv=Hr.dsv(",","text/csv"),Hr.tsv=Hr.dsv("\t","text/tab-separated-values");var Zo,Ho,qo,jo,Ko,Vo=Wr[m(Wr,"requestAnimationFrame")]||function(t){setTimeout(t,17)};Hr.timer=function(t,e,n){var i=arguments.length;2>i&&(e=0),3>i&&(n=Date.now());var r={c:t,t:n+e,f:!1,n:null};Ho?Ho.n=r:Zo=r,Ho=r,qo||(jo=clearTimeout(jo),qo=1,Vo(_t))},Hr.timer.flush=function(){St(),Mt()},Hr.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var Wo=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(function(t,e){var n=Math.pow(10,3*no(8-e));return{scale:e>8?function(t){return t/n}:function(t){return t*n},symbol:t}});Hr.formatPrefix=function(t,e){var n=0;return t&&(0>t&&(t*=-1),e&&(t=Hr.round(t,Ft(t,e))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Wo[8+n/3]};var Xo=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Go=Hr.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=Hr.round(t,Ft(t,e))).toFixed(Math.max(0,Math.min(20,Ft(t*(1+1e-15),e))))}}),Qo=Hr.time={},Jo=Date;Pt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ta.setUTCDate.apply(this._,arguments)},setDay:function(){ta.setUTCDay.apply(this._,arguments)},setFullYear:function(){ta.setUTCFullYear.apply(this._,arguments)},setHours:function(){ta.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ta.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ta.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ta.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ta.setUTCSeconds.apply(this._,arguments)},setTime:function(){ta.setTime.apply(this._,arguments)}};var ta=Date.prototype;Qo.year=Tt(function(t){return(t=Qo.day(t)).setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),Qo.years=Qo.year.range,Qo.years.utc=Qo.year.utc.range,Qo.day=Tt(function(t){var e=new Jo(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),Qo.days=Qo.day.range,Qo.days.utc=Qo.day.utc.range,Qo.dayOfYear=function(t){var e=Qo.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=Qo[t]=Tt(function(t){return(t=Qo.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=Qo.year(t).getDay();return Math.floor((Qo.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});Qo[t+"s"]=n.range,Qo[t+"s"].utc=n.utc.range,Qo[t+"OfYear"]=function(t){var n=Qo.year(t).getDay();return Math.floor((Qo.dayOfYear(t)+(n+e)%7)/7)}}),Qo.week=Qo.sunday,Qo.weeks=Qo.sunday.range,Qo.weeks.utc=Qo.sunday.utc.range,Qo.weekOfYear=Qo.sundayOfYear;var ea={"-":"",_:" ",0:"0"},na=/^\s*\d+/,ia=/^%/;Hr.locale=function(t){return{numberFormat:function(t){var e=t.decimal,n=t.thousands,i=t.grouping,r=t.currency,o=i&&n?function(t,e){for(var r=t.length,o=[],a=0,s=i[0],l=0;r>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),o.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=i[a=(a+1)%i.length];return o.reverse().join(n)}:Lt;return function(t){var n=Xo.exec(t),i=n[1]||" ",a=n[2]||">",s=n[3]||"-",l=n[4]||"",c=n[5],u=+n[6],h=n[7],p=n[8],d=n[9],f=1,g="",m="",y=!1,v=!0;switch(p&&(p=+p.substring(1)),(c||"0"===i&&"="===a)&&(c=i="0",a="="),d){case"n":h=!0,d="g";break;case"%":f=100,m="%",d="f";break;case"p":f=100,m="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":v=!1;case"d":y=!0,p=0;break;case"s":f=-1,d="r"}"$"===l&&(g=r[0],m=r[1]),"r"!=d||p||(d="g"),null!=p&&("g"==d?p=Math.max(1,Math.min(21,p)):("e"==d||"f"==d)&&(p=Math.max(0,Math.min(20,p)))),d=Go.get(d)||Et;var C=c&&h;return function(t){var n=m;if(y&&t%1)return"";var r=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===s?"":s;if(0>f){var l=Hr.formatPrefix(t,p);t=l.scale(t),n=l.symbol+m}else t*=f;var b,x,L=(t=d(t,p)).lastIndexOf(".");if(0>L){var k=v?t.lastIndexOf("e"):-1;0>k?(b=t,x=""):(b=t.substring(0,k),x=t.substring(k))}else b=t.substring(0,L),x=e+t.substring(L+1);!c&&h&&(b=o(b,1/0));var w=g.length+b.length+x.length+(C?0:r.length),_=u>w?new Array(w=u-w+1).join(i):"";return C&&(b=o(_+b,_.length?u-x.length:1/0)),r+=g,t=b+x,("<"===a?r+t+_:">"===a?_+r+t:"^"===a?_.substring(0,w>>=1)+r+t+_.substring(w):r+(C?t:_+t))+n}}}(t),timeFormat:function(t){function e(t){function e(e){for(var n,r,o,a=[],s=-1,l=0;++ss;){if(i>=c)return-1;if(37===(r=e.charCodeAt(s++))){if(a=e.charAt(s++),!(o=x[a in ea?e.charAt(s++):a])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}var i=t.dateTime,r=t.date,o=t.time,a=t.periods,s=t.days,l=t.shortDays,c=t.months,u=t.shortMonths;e.utc=function(t){function n(t){try{var e=new(Jo=Pt);return e._=t,i(e)}finally{Jo=Date}}var i=e(t);return n.parse=function(t){try{Jo=Pt;var e=i.parse(t);return e&&e._}finally{Jo=Date}},n.toString=i.toString,n},e.multi=e.utc.multi=Gt;var h=Hr.map(),p=Bt(s),d=Nt(s),f=Bt(l),g=Nt(l),m=Bt(c),y=Nt(c),v=Bt(u),C=Nt(u);a.forEach(function(t,e){h.set(t.toLowerCase(),e)});var b={a:function(t){return l[t.getDay()]},A:function(t){return s[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return c[t.getMonth()]},c:e(i),d:function(t,e){return zt(t.getDate(),e,2)},e:function(t,e){return zt(t.getDate(),e,2)},H:function(t,e){return zt(t.getHours(),e,2)},I:function(t,e){return zt(t.getHours()%12||12,e,2)},j:function(t,e){return zt(1+Qo.dayOfYear(t),e,3)},L:function(t,e){return zt(t.getMilliseconds(),e,3)},m:function(t,e){return zt(t.getMonth()+1,e,2)},M:function(t,e){return zt(t.getMinutes(),e,2)},p:function(t){return a[+(t.getHours()>=12)]},S:function(t,e){return zt(t.getSeconds(),e,2)},U:function(t,e){return zt(Qo.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return zt(Qo.mondayOfYear(t),e,2)},x:e(r),X:e(o),y:function(t,e){return zt(t.getFullYear()%100,e,2)},Y:function(t,e){return zt(t.getFullYear()%1e4,e,4)},Z:Wt,"%":function(){return"%"}},x={a:function(t,e,n){f.lastIndex=0;var i=f.exec(e.slice(n));return i?(t.w=g.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){p.lastIndex=0;var i=p.exec(e.slice(n));return i?(t.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){v.lastIndex=0;var i=v.exec(e.slice(n));return i?(t.m=C.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){m.lastIndex=0;var i=m.exec(e.slice(n));return i?(t.m=y.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,e,i){return n(t,b.c.toString(),e,i)},d:Zt,e:Zt,H:qt,I:qt,j:Ht,L:Vt,m:Yt,M:jt,p:function(t,e,n){var i=h.get(e.slice(n,n+=2).toLowerCase());return null==i?-1:(t.p=i,n)},S:Kt,U:$t,w:Dt,W:Ot,x:function(t,e,i){return n(t,b.x.toString(),e,i)},X:function(t,e,i){return n(t,b.X.toString(),e,i)},y:It,Y:Ut,Z:Rt,"%":Xt};return e}(t)}};var ra=Hr.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Hr.format=ra.numberFormat,Hr.geo={},Qt.prototype={s:0,t:0,add:function(t){Jt(t,this.t,oa),Jt(oa.s,this.s,this),this.s?this.t+=oa.t:this.s=oa.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var oa=new Qt;Hr.geo.stream=function(t,e){t&&aa.hasOwnProperty(t.type)?aa[t.type](t,e):te(t,e)};var aa={Feature:function(t,e){te(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,r=n.length;++it?4*ko+t:t,ua.lineStart=ua.lineEnd=ua.point=y}};Hr.geo.bounds=function(){function t(t,e){C.push(b=[u=t,p=t]),h>e&&(h=e),e>d&&(d=e)}function e(e,n){var i=re([e*Mo,n*Mo]);if(y){var r=ae(y,i),o=ae([r[1],-r[0],0],r);ce(o),o=ue(o);var a=e-f,l=a>0?1:-1,c=o[0]*Fo*l,g=no(a)>180;if(g^(c>l*f&&l*e>c))(m=o[1]*Fo)>d&&(d=m);else if(g^((c=(c+360)%360-180)>l*f&&l*e>c)){var m=-o[1]*Fo;h>m&&(h=m)}else h>n&&(h=n),n>d&&(d=n);g?f>e?s(u,e)>s(u,p)&&(p=e):s(e,p)>s(u,p)&&(u=e):p>=u?(u>e&&(u=e),e>p&&(p=e)):e>f?s(u,e)>s(u,p)&&(p=e):s(e,p)>s(u,p)&&(u=e)}else t(e,n);y=i,f=e}function n(){x.point=e}function i(){b[0]=u,b[1]=p,x.point=t,y=null}function r(t,n){if(y){var i=t-f;v+=no(i)>180?i+(i>0?360:-360):i}else g=t,m=n;ua.point(t,n),e(t,n)}function o(){ua.lineStart()}function a(){r(g,m),ua.lineEnd(),no(v)>xo&&(u=-(p=180)),b[0]=u,b[1]=p,y=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tca?(u=-(p=180),h=-(d=90)):v>xo?d=90:-xo>v&&(h=-90),b[0]=u,b[1]=p}};return function(t){if(d=p=-(u=h=1/0),C=[],Hr.geo.stream(t,x),o=C.length){C.sort(l);for(var e=1,n=[f=C[0]];o>e;++e)c((r=C[e])[0],f)||c(r[1],f)?(s(f[0],r[1])>s(f[0],f[1])&&(f[1]=r[1]),s(r[0],f[1])>s(f[0],f[1])&&(f[0]=r[0])):n.push(f=r);for(var i,r,o,a=-1/0,f=(e=0,n[o=n.length-1]);o>=e;f=r,++e)r=n[e],(i=s(f[1],r[0]))>a&&(a=i,u=r[0],p=f[1])}return C=b=null,1/0===u||1/0===h?[[NaN,NaN],[NaN,NaN]]:[[u,h],[p,d]]}}(),Hr.geo.centroid=function(t){ha=pa=da=fa=ga=ma=ya=va=Ca=ba=xa=0,Hr.geo.stream(t,La);var e=Ca,n=ba,i=xa,r=e*e+n*n+i*i;return Lo>r&&(e=ma,n=ya,i=va,xo>pa&&(e=da,n=fa,i=ga),Lo>(r=e*e+n*n+i*i))?[NaN,NaN]:[Math.atan2(n,e)*Fo,Q(i/Math.sqrt(r))*Fo]};var ha,pa,da,fa,ga,ma,ya,va,Ca,ba,xa,La={sphere:y,point:pe,lineStart:fe,lineEnd:ge,polygonStart:function(){La.lineStart=me},polygonEnd:function(){La.lineStart=fe}},ka=Le(ve,function(t){var e,n=NaN,i=NaN,r=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?ko:-ko,l=no(o-n);no(l-ko)0?So:-So),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(s,i),t.point(o,i),e=0):r!==s&&l>=ko&&(no(n-r)xo?Math.atan((Math.sin(e)*(o=Math.cos(i))*Math.sin(n)-Math.sin(i)*(r=Math.cos(e))*Math.sin(t))/(r*o*a)):(e+i)/2}(n,i,o,a),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(s,i),e=0),t.point(n=o,i=a),r=s},lineEnd:function(){t.lineEnd(),n=i=NaN},clean:function(){return 2-e}}},function(t,e,n,i){var r;if(null==t)r=n*So,i.point(-ko,r),i.point(0,r),i.point(ko,r),i.point(ko,0),i.point(ko,-r),i.point(0,-r),i.point(-ko,-r),i.point(-ko,0),i.point(-ko,r);else if(no(t[0]-e[0])>xo){var o=t[0]=.12&&.234>r&&i>=-.425&&-.214>i?a:r>=.166&&.234>r&&i>=-.214&&-.115>i?s:o).invert(t)},t.stream=function(t){var e=o.stream(t),n=a.stream(t),i=s.stream(t);return{point:function(t,r){e.point(t,r),n.point(t,r),i.point(t,r)},sphere:function(){e.sphere(),n.sphere(),i.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),i.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),i.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),i.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),i.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),a.precision(e),s.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),a.scale(.35*e),s.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var c=o.scale(),u=+e[0],h=+e[1];return n=o.translate(e).clipExtent([[u-.455*c,h-.238*c],[u+.455*c,h+.238*c]]).stream(l).point,i=a.translate([u-.307*c,h+.201*c]).clipExtent([[u-.425*c+xo,h+.12*c+xo],[u-.214*c-xo,h+.234*c-xo]]).stream(l).point,r=s.translate([u-.205*c,h+.212*c]).clipExtent([[u-.214*c+xo,h+.166*c+xo],[u-.115*c-xo,h+.234*c-xo]]).stream(l).point,t},t.scale(1070)};var _a,Sa,Ma,Fa,Ea,Pa,Ta={point:y,lineStart:y,lineEnd:y,polygonStart:function(){Sa=0,Ta.lineStart=Pe},polygonEnd:function(){Ta.lineStart=Ta.lineEnd=Ta.point=y,_a+=no(Sa/2)}},Aa={point:function(t,e){Ma>t&&(Ma=t),t>Ea&&(Ea=t),Fa>e&&(Fa=e),e>Pa&&(Pa=e)},lineStart:y,lineEnd:y,polygonStart:y,polygonEnd:y},za={point:Ae,lineStart:ze,lineEnd:Be,polygonStart:function(){za.lineStart=Ne},polygonEnd:function(){za.point=Ae,za.lineStart=ze,za.lineEnd=Be}};Hr.geo.path=function(){function t(t){return t&&("function"==typeof s&&o.pointRadius(+s.apply(this,arguments)),a&&a.valid||(a=r(o)),Hr.geo.stream(t,a)),o.result()}function e(){return a=null,t}var n,i,r,o,a,s=4.5;return t.area=function(t){return _a=0,Hr.geo.stream(t,r(Ta)),_a},t.centroid=function(t){return da=fa=ga=ma=ya=va=Ca=ba=xa=0,Hr.geo.stream(t,r(za)),xa?[Ca/xa,ba/xa]:va?[ma/va,ya/va]:ga?[da/ga,fa/ga]:[NaN,NaN]},t.bounds=function(t){return Ea=Pa=-(Ma=Fa=1/0),Hr.geo.stream(t,r(Aa)),[[Ma,Fa],[Ea,Pa]]},t.projection=function(t){return arguments.length?(r=(n=t)?t.stream||function(t){var e=De(function(e,n){return t([e*Fo,n*Fo])});return function(t){return Re(e(t))}}(t):Lt,e()):n},t.context=function(t){return arguments.length?(o=null==(i=t)?new function(){function t(t,e){a.push("M",t,",",e,o)}function e(t,e){a.push("M",t,",",e),s.point=n}function n(t,e){a.push("L",t,",",e)}function i(){s.point=t}function r(){a.push("Z")}var o=Te(4.5),a=[],s={point:t,lineStart:function(){s.point=e},lineEnd:i,polygonStart:function(){s.lineEnd=r},polygonEnd:function(){s.lineEnd=i,s.point=t},pointRadius:function(t){return o=Te(t),s},result:function(){if(a.length){var t=a.join("");return a=[],t}}};return s}:new function(t){function e(e,n){t.moveTo(e+a,n),t.arc(e,n,a,0,wo)}function n(e,n){t.moveTo(e,n),s.point=i}function i(e,n){t.lineTo(e,n)}function r(){s.point=e}function o(){t.closePath()}var a=4.5,s={point:e,lineStart:function(){s.point=n},lineEnd:r,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=r,s.point=e},pointRadius:function(t){return a=t,s},result:y};return s}(t),"function"!=typeof s&&o.pointRadius(s),e()):i},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(o.pointRadius(+e),+e),t):s},t.projection(Hr.geo.albersUsa()).context(null)},Hr.geo.transform=function(t){return{stream:function(e){var n=new $e(e);for(var i in t)n[i]=t[i];return n}}},$e.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},Hr.geo.projection=Ue,Hr.geo.projectionMutator=Ie,(Hr.geo.equirectangular=function(){return Ue(Ye)}).raw=Ye.invert=Ye,Hr.geo.rotation=function(t){function e(e){return(e=t(e[0]*Mo,e[1]*Mo))[0]*=Fo,e[1]*=Fo,e}return t=He(t[0]%360*Mo,t[1]*Mo,t.length>2?t[2]*Mo:0),e.invert=function(e){return(e=t.invert(e[0]*Mo,e[1]*Mo))[0]*=Fo,e[1]*=Fo,e},e},Ze.invert=Ye,Hr.geo.circle=function(){function t(){var t="function"==typeof i?i.apply(this,arguments):i,e=He(-t[0]*Mo,-t[1]*Mo,0).invert,r=[];return n(null,null,1,{point:function(t,n){r.push(t=e(t,n)),t[0]*=Fo,t[1]*=Fo}}),{type:"Polygon",coordinates:[r]}}var e,n,i=[0,0],r=6;return t.origin=function(e){return arguments.length?(i=e,t):i},t.angle=function(i){return arguments.length?(n=Ve((e=+i)*Mo,r*Mo),t):e},t.precision=function(i){return arguments.length?(n=Ve(e*Mo,(r=+i)*Mo),t):r},t.angle(90)},Hr.geo.distance=function(t,e){var n,i=(e[0]-t[0])*Mo,r=t[1]*Mo,o=e[1]*Mo,a=Math.sin(i),s=Math.cos(i),l=Math.sin(r),c=Math.cos(r),u=Math.sin(o),h=Math.cos(o);return Math.atan2(Math.sqrt((n=h*a)*n+(n=c*u-l*h*s)*n),l*u+c*h*s)},Hr.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return Hr.range(Math.ceil(o/m)*m,r,m).map(p).concat(Hr.range(Math.ceil(c/y)*y,l,y).map(d)).concat(Hr.range(Math.ceil(i/f)*f,n,f).filter(function(t){return no(t%m)>xo}).map(u)).concat(Hr.range(Math.ceil(s/g)*g,a,g).filter(function(t){return no(t%y)>xo}).map(h))}var n,i,r,o,a,s,l,c,u,h,p,d,f=10,g=f,m=90,y=360,v=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[p(o).concat(d(l).slice(1),p(r).reverse().slice(1),d(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],r=+e[1][0],c=+e[0][1],l=+e[1][1],o>r&&(e=o,o=r,r=e),c>l&&(e=c,c=l,l=e),t.precision(v)):[[o,c],[r,l]]},t.minorExtent=function(e){return arguments.length?(i=+e[0][0],n=+e[1][0],s=+e[0][1],a=+e[1][1],i>n&&(e=i,i=n,n=e),s>a&&(e=s,s=a,a=e),t.precision(v)):[[i,s],[n,a]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],y=+e[1],t):[m,y]},t.minorStep=function(e){return arguments.length?(f=+e[0],g=+e[1],t):[f,g]},t.precision=function(e){return arguments.length?(v=+e,u=Xe(s,a,90),h=Ge(i,n,v),p=Xe(c,l,90),d=Ge(o,r,v),t):v},t.majorExtent([[-180,-90+xo],[180,90-xo]]).minorExtent([[-180,-80-xo],[180,80+xo]])},Hr.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||i.apply(this,arguments),n||r.apply(this,arguments)]}}var e,n,i=Qe,r=Je;return t.distance=function(){return Hr.geo.distance(e||i.apply(this,arguments),n||r.apply(this,arguments))},t.source=function(n){return arguments.length?(i=n,e="function"==typeof n?null:n,t):i},t.target=function(e){return arguments.length?(r=e,n="function"==typeof e?null:e,t):r},t.precision=function(){return arguments.length?t:0},t},Hr.geo.interpolate=function(t,e){return function(t,e,n,i){var r=Math.cos(e),o=Math.sin(e),a=Math.cos(i),s=Math.sin(i),l=r*Math.cos(t),c=r*Math.sin(t),u=a*Math.cos(n),h=a*Math.sin(n),p=2*Math.asin(Math.sqrt(tt(i-e)+r*a*tt(n-t))),d=1/Math.sin(p),f=p?function(t){var e=Math.sin(t*=p)*d,n=Math.sin(p-t)*d,i=n*l+e*u,r=n*c+e*h,a=n*o+e*s;return[Math.atan2(r,i)*Fo,Math.atan2(a,Math.sqrt(i*i+r*r))*Fo]}:function(){return[t*Fo,e*Fo]};return f.distance=p,f}(t[0]*Mo,t[1]*Mo,e[0]*Mo,e[1]*Mo)},Hr.geo.length=function(t){return Ba=0,Hr.geo.stream(t,Na),Ba};var Ba,Na={sphere:y,point:y,lineStart:function(){function t(t,r){var o=Math.sin(r*=Mo),a=Math.cos(r),s=no((t*=Mo)-e),l=Math.cos(s);Ba+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=i*o-n*a*l)*s),n*o+i*a*l),e=t,n=o,i=a}var e,n,i;Na.point=function(r,o){e=r*Mo,n=Math.sin(o*=Mo),i=Math.cos(o),Na.point=t},Na.lineEnd=function(){Na.point=Na.lineEnd=y}},lineEnd:y,polygonStart:y,polygonEnd:y},Da=tn(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(Hr.geo.azimuthalEqualArea=function(){return Ue(Da)}).raw=Da;var $a=tn(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},Lt);(Hr.geo.azimuthalEquidistant=function(){return Ue($a)}).raw=$a,(Hr.geo.conicConformal=function(){return Fe(en)}).raw=en,(Hr.geo.conicEquidistant=function(){return Fe(nn)}).raw=nn;var Oa=tn(function(t){return 1/t},Math.atan);(Hr.geo.gnomonic=function(){return Ue(Oa)}).raw=Oa,rn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-So]},(Hr.geo.mercator=function(){return on(rn)}).raw=rn;var Ua=tn(function(){return 1},Math.asin);(Hr.geo.orthographic=function(){return Ue(Ua)}).raw=Ua;var Ia=tn(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(Hr.geo.stereographic=function(){return Ue(Ia)}).raw=Ia,an.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-So]},(Hr.geo.transverseMercator=function(){var t=on(an),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90])}).raw=an,Hr.geom={},Hr.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,r=xt(n),o=xt(i),a=t.length,s=[],l=[];for(e=0;a>e;e++)s.push([+r.call(this,t[e],e),+o.call(this,t[e],e),e]);for(s.sort(un),e=0;a>e;e++)l.push([s[e][0],-s[e][1]]);var c=cn(s),u=cn(l),h=u[0]===c[0],p=u[u.length-1]===c[c.length-1],d=[];for(e=c.length-1;e>=0;--e)d.push(t[s[c[e]][2]]);for(e=+h;e=i&&c.x<=o&&c.y>=r&&c.y<=a?[[i,a],[o,a],[o,r],[i,r]]:[]).point=t[s]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/xo)*xo,y:Math.round(a(t,e)/xo)*xo,i:e}})}var i=sn,r=ln,o=i,a=r,s=Wa;return t?e(t):(e.links=function(t){return Nn(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return Nn(n(t)).cells.forEach(function(n,i){for(var r,o=n.site,a=n.edges.sort(xn),s=-1,l=a.length,c=a[l-1].edge,u=c.l===o?c.r:c.l;++s=c,p=i>=u,d=p<<1|h;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){o(_,t,+C(t,++d),+b(t,d),g,m,y,v)}}),h?r=c:s=c,p?a=u:l=u,o(t,e,n,i,r,a,s,l)}var u,h,p,d,f,g,m,y,v,C=xt(s),b=xt(l);if(null!=e)g=e,m=n,y=i,v=r;else if(y=v=-(g=m=1/0),h=[],p=[],f=t.length,a)for(d=0;f>d;++d)(u=t[d]).xy&&(y=u.x),u.y>v&&(v=u.y),h.push(u.x),p.push(u.y);else for(d=0;f>d;++d){var x=+C(u=t[d],d),L=+b(u,d);g>x&&(g=x),m>L&&(m=L),x>y&&(y=x),L>v&&(v=L),h.push(x),p.push(L)}var k=y-g,w=v-m;k>w?v=m+k:y=g+w;var _={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){o(_,t,+C(t,++d),+b(t,d),g,m,y,v)}};if(_.visit=function(t){!function t(e,n,i,r,o,a){if(!e(n,i,r,o,a)){var s=.5*(i+o),l=.5*(r+a),c=n.nodes;c[0]&&t(e,c[0],i,r,s,l),c[1]&&t(e,c[1],s,r,o,l),c[2]&&t(e,c[2],i,l,s,a),c[3]&&t(e,c[3],s,l,o,a)}}(t,_,g,m,y,v)},_.find=function(t){return function(t,e,n,i,r,o,a){var s,l=1/0;return function t(c,u,h,p,d){if(!(u>o||h>a||i>p||r>d)){if(f=c.point){var f,g=e-f[0],m=n-f[1],y=g*g+m*m;if(l>y){var v=Math.sqrt(l=y);i=e-v,r=n-v,o=e+v,a=n+v,s=f}}for(var C=c.nodes,b=.5*(u+p),x=.5*(h+d),L=(n>=x)<<1|e>=b,k=L+4;k>L;++L)if(c=C[3&L])switch(3&L){case 0:t(c,u,h,b,x);break;case 1:t(c,b,h,p,x);break;case 2:t(c,u,x,b,d);break;case 3:t(c,b,x,p,d)}}}(t,i,r,o,a),s}(_,t[0],t[1],g,m,y,v)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return n=Ja.get(n)||Qa,function(t){return function(e){return 0>=e?0:e>=1?1:t(e)}}((i=ts.get(i)||Lt)(n.apply(null,qr.call(arguments,1))))},Hr.interpolateHcl=function(t,e){t=Hr.hcl(t),e=Hr.hcl(e);var n=t.h,i=t.c,r=t.l,o=e.h-n,a=e.c-i,s=e.l-r;return isNaN(a)&&(a=0,i=isNaN(i)?e.c:i),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:-180>o&&(o+=360),function(t){return ot(n+o*t,i+a*t,r+s*t)+""}},Hr.interpolateHsl=function(t,e){t=Hr.hsl(t),e=Hr.hsl(e);var n=t.h,i=t.s,r=t.l,o=e.h-n,a=e.s-i,s=e.l-r;return isNaN(a)&&(a=0,i=isNaN(i)?e.s:i),isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:-180>o&&(o+=360),function(t){return it(n+o*t,i+a*t,r+s*t)+""}},Hr.interpolateLab=function(t,e){t=Hr.lab(t),e=Hr.lab(e);var n=t.l,i=t.a,r=t.b,o=e.l-n,a=e.a-i,s=e.b-r;return function(t){return st(n+o*t,i+a*t,r+s*t)+""}},Hr.interpolateRound=ei,Hr.transform=function(t){var e=Kr.createElementNS(Hr.ns.prefix.svg,"g");return(Hr.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new ni(n?n.matrix:es)})(t)},ni.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var es={a:1,b:0,c:0,d:1,e:0,f:0};Hr.interpolateTransform=oi,Hr.layout={},Hr.layout.bundle=function(){return function(t){for(var e=[],n=-1,i=t.length;++ns*s/m){if(f>l){var c=e.charge/l;t.px-=o*c,t.py-=a*c}return!0}if(e.point&&l&&f>l){c=e.pointCharge/l;t.px-=o*c,t.py-=a*c}}return!e.charge}}function e(t){t.px=Hr.event.x,t.py=Hr.event.y,s.resume()}var n,i,r,o,a,s={},l=Hr.dispatch("start","tick","end"),c=[1,1],u=.9,h=ns,p=is,d=-30,f=rs,g=.1,m=.64,y=[],v=[];return s.tick=function(){if((i*=.99)<.005)return l.end({type:"end",alpha:i=0}),!0;var e,n,s,h,p,f,m,C,b,x=y.length,L=v.length;for(n=0;L>n;++n)h=(s=v[n]).source,(f=(C=(p=s.target).x-h.x)*C+(b=p.y-h.y)*b)&&(C*=f=i*o[n]*((f=Math.sqrt(f))-r[n])/f,b*=f,p.x-=C*(m=h.weight/(p.weight+h.weight)),p.y-=b*m,h.x+=C*(m=1-m),h.y+=b*m);if((m=i*g)&&(C=c[0]/2,b=c[1]/2,n=-1,m))for(;++n0?t:0:t>0&&(l.start({type:"start",alpha:i=t}),Hr.timer(s.tick)),s):i},s.start=function(){function t(t,i){if(!n){for(n=new Array(l),s=0;l>s;++s)n[s]=[];for(s=0;c>s;++s){var r=v[s];n[r.source.index].push(r.target),n[r.target.index].push(r.source)}}for(var o,a=n[e],s=-1,c=a.length;++se;++e)(i=y[e]).index=e,i.weight=0;for(e=0;u>e;++e)"number"==typeof(i=v[e]).source&&(i.source=y[i.source]),"number"==typeof i.target&&(i.target=y[i.target]),++i.source.weight,++i.target.weight;for(e=0;l>e;++e)i=y[e],isNaN(i.x)&&(i.x=t("x",f)),isNaN(i.y)&&(i.y=t("y",g)),isNaN(i.px)&&(i.px=i.x),isNaN(i.py)&&(i.py=i.y);if(r=[],"function"==typeof h)for(e=0;u>e;++e)r[e]=+h.call(this,v[e],e);else for(e=0;u>e;++e)r[e]=h;if(o=[],"function"==typeof p)for(e=0;u>e;++e)o[e]=+p.call(this,v[e],e);else for(e=0;u>e;++e)o[e]=p;if(a=[],"function"==typeof d)for(e=0;l>e;++e)a[e]=+d.call(this,y[e],e);else for(e=0;l>e;++e)a[e]=d;return s.resume()},s.resume=function(){return s.alpha(.1)},s.stop=function(){return s.alpha(0)},s.drag=function(){return n||(n=Hr.behavior.drag().origin(Lt).on("dragstart.force",ui).on("drag.force",e).on("dragend.force",hi)),arguments.length?void this.on("mouseover.force",pi).on("mouseout.force",di).call(n):n},Hr.rebind(s,l,"on")};var ns=20,is=1,rs=1/0;Hr.layout.hierarchy=function(){function t(r){var o,a=[r],s=[];for(r.depth=0;null!=(o=a.pop());)if(s.push(o),(c=n.call(t,o,o.depth))&&(l=c.length)){for(var l,c,u;--l>=0;)a.push(u=c[l]),u.parent=o,u.depth=o.depth+1;i&&(o.value=0),o.children=c}else i&&(o.value=+i.call(t,o,o.depth)||0),delete o.children;return mi(r,function(t){var n,r;e&&(n=t.children)&&n.sort(e),i&&(r=t.parent)&&(r.value+=t.value)}),s}var e=Ci,n=yi,i=vi;return t.sort=function(n){return arguments.length?(e=n,t):e},t.children=function(e){return arguments.length?(n=e,t):n},t.value=function(e){return arguments.length?(i=e,t):i},t.revalue=function(e){return i&&(gi(e,function(t){t.children&&(t.value=0)}),mi(e,function(e){var n;e.children||(e.value=+i.call(t,e,e.depth)||0),(n=e.parent)&&(n.value+=e.value)})),e},t},Hr.layout.partition=function(){function t(t,i){var r=e.call(this,t,i);return function t(e,n,i,r){var o=e.children;if(e.x=n,e.y=e.depth*r,e.dx=i,e.dy=r,o&&(a=o.length)){var a,s,l,c=-1;for(i=e.value?i/e.value:0;++ch?-1:1),f=(h-l*d)/Hr.sum(c),g=Hr.range(l),m=[];return null!=n&&g.sort(n===os?function(t,e){return c[e]-c[t]}:function(t,e){return n(a[t],a[e])}),g.forEach(function(t){m[t]={data:a[t],value:s=c[t],startAngle:u,endAngle:u+=s*f+d,padAngle:p}}),m}var e=Number,n=os,i=0,r=wo,o=0;return t.value=function(n){return arguments.length?(e=n,t):e},t.sort=function(e){return arguments.length?(n=e,t):n},t.startAngle=function(e){return arguments.length?(i=e,t):i},t.endAngle=function(e){return arguments.length?(r=e,t):r},t.padAngle=function(e){return arguments.length?(o=e,t):o},t};var os={};Hr.layout.stack=function(){function t(s,l){if(!(p=s.length))return s;var c=s.map(function(n,i){return e.call(t,n,i)}),u=c.map(function(e){return e.map(function(e,n){return[o.call(t,e,n),a.call(t,e,n)]})}),h=n.call(t,u,l);c=Hr.permute(c,h),u=Hr.permute(u,h);var p,d,f,g,m=i.call(t,u,l),y=c[0].length;for(f=0;y>f;++f)for(r.call(t,c[0][f],g=m[f],u[0][f][1]),d=1;p>d;++d)r.call(t,c[d][f],g+=u[d-1][f][1],u[d][f][1]);return s}var e=Lt,n=wi,i=_i,r=ki,o=xi,a=Li;return t.values=function(n){return arguments.length?(e=n,t):e},t.order=function(e){return arguments.length?(n="function"==typeof e?e:as.get(e)||wi,t):n},t.offset=function(e){return arguments.length?(i="function"==typeof e?e:ss.get(e)||_i,t):i},t.x=function(e){return arguments.length?(o=e,t):o},t.y=function(e){return arguments.length?(a=e,t):a},t.out=function(e){return arguments.length?(r=e,t):r},t};var as=Hr.map({"inside-out":function(t){var e,n,i=t.length,r=t.map(Si),o=t.map(Mi),a=Hr.range(i).sort(function(t,e){return r[t]-r[e]}),s=0,l=0,c=[],u=[];for(e=0;i>e;++e)n=a[e],l>s?(s+=o[n],c.push(n)):(l+=o[n],u.push(n));return u.reverse().concat(c)},reverse:function(t){return Hr.range(t.length).reverse()},default:wi}),ss=Hr.map({silhouette:function(t){var e,n,i,r=t.length,o=t[0].length,a=[],s=0,l=[];for(n=0;o>n;++n){for(e=0,i=0;r>e;e++)i+=t[e][n][1];i>s&&(s=i),a.push(i)}for(n=0;o>n;++n)l[n]=(s-a[n])/2;return l},wiggle:function(t){var e,n,i,r,o,a,s,l,c,u=t.length,h=t[0],p=h.length,d=[];for(d[0]=l=c=0,n=1;p>n;++n){for(e=0,r=0;u>e;++e)r+=t[e][n][1];for(e=0,o=0,s=h[n][0]-h[n-1][0];u>e;++e){for(i=0,a=(t[e][n][1]-t[e][n-1][1])/(2*s);e>i;++i)a+=(t[i][n][1]-t[i][n-1][1])/s;o+=a*t[e][n][1]}d[n]=l-=r?o/r*s:0,c>l&&(c=l)}for(n=0;p>n;++n)d[n]-=c;return d},expand:function(t){var e,n,i,r=t.length,o=t[0].length,a=1/r,s=[];for(n=0;o>n;++n){for(e=0,i=0;r>e;e++)i+=t[e][n][1];if(i)for(e=0;r>e;e++)t[e][n][1]/=i;else for(e=0;r>e;e++)t[e][n][1]=a}for(n=0;o>n;++n)s[n]=0;return s},zero:_i});Hr.layout.histogram=function(){function t(t,o){for(var a,s,l=[],c=t.map(n,this),u=i.call(this,c,o),h=r.call(this,u,c,o),p=(o=-1,c.length),d=h.length-1,f=e?1:1/p;++o0)for(o=-1;++o=u[0]&&s<=u[1]&&((a=l[Hr.bisect(h,s,1,d)-1]).y+=f,a.push(t[o]));return l}var e=!0,n=Number,i=Ti,r=Ei;return t.value=function(e){return arguments.length?(n=e,t):n},t.range=function(e){return arguments.length?(i=xt(e),t):i},t.bins=function(e){return arguments.length?(r="number"==typeof e?function(t){return Pi(t,e)}:xt(e),t):r},t.frequency=function(n){return arguments.length?(e=!!n,t):e},t},Hr.layout.pack=function(){function t(t,o){var a=n.call(this,t,o),s=a[0],l=r[0],c=r[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,mi(s,function(t){t.r=+u(t.value)}),mi(s,Di),i){var h=i*(e?1:Math.max(2*s.r/l,2*s.r/c))/2;mi(s,function(t){t.r+=h}),mi(s,Di),mi(s,function(t){t.r-=h})}return function t(e,n,i,r){var o=e.children;if(e.x=n+=r*e.x,e.y=i+=r*e.y,e.r*=r,o)for(var a=-1,s=o.length;++aa;++a)i.push((o[a]=r={_:o[a],parent:e,children:(r=o[a].children)&&r.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=r);return n.children[0]}(u);if(mi(h,e),h.parent.m=-h.z,gi(h,n),s)gi(u,i);else{var p=u,d=u,f=u;gi(u,function(t){t.xd.x&&(d=t),t.depth>f.depth&&(f=t)});var g=o(p,d)/2-p.x,m=a[0]/(d.x+o(d,p)/2+g),y=a[1]/(f.depth||1);gi(u,function(t){t.x=(t.x+g)*m,t.y=t.depth*y})}return c}function e(t){var e=t.children,n=t.parent.children,i=t.i?n[t.i-1]:null;if(e.length){!function(t){for(var e,n=0,i=0,r=t.children,o=r.length;--o>=0;)(e=r[o]).z+=n,e.m+=n,n+=e.s+(i+=e.c)}(t);var r=(e[0].z+e[e.length-1].z)/2;i?(t.z=i.z+o(t._,i._),t.m=t.z-r):t.z=r}else i&&(t.z=i.z+o(t._,i._));t.parent.A=function(t,e,n){if(e){for(var i,r=t,a=t,s=e,l=r.parent.children[0],c=r.m,u=a.m,h=s.m,p=l.m;s=Yi(s),r=Ri(r),s&&r;)l=Ri(l),(a=Yi(a)).a=t,(i=s.z+h-r.z-c+o(s._,r._))>0&&(Zi(Hi(s,t,n),t,i),c+=i,u+=i),h+=s.m,c+=r.m,p+=l.m,u+=a.m;s&&!Yi(a)&&(a.t=s,a.m+=h-u),r&&!Ri(l)&&(l.t=r,l.m+=c-p,n=t)}return n}(t,i,t.parent.A||n[0])}function n(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t){t.x*=a[0],t.y=t.depth*a[1]}var r=Hr.layout.hierarchy().sort(null).value(null),o=Ii,a=[1,1],s=null;return t.separation=function(e){return arguments.length?(o=e,t):o},t.size=function(e){return arguments.length?(s=null==(a=e)?i:null,t):s?null:a},t.nodeSize=function(e){return arguments.length?(s=null==(a=e)?null:i,t):s?a:null},fi(t,r)},Hr.layout.cluster=function(){function t(t,o){var a,s=e.call(this,t,o),l=s[0],c=0;mi(l,function(t){var e=t.children;e&&e.length?(t.x=function(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}(e),t.y=function(t){return 1+Hr.max(t,function(t){return t.y})}(e)):(t.x=a?c+=n(t,a):0,t.y=0,a=t)});var u=function t(e){var n=e.children;return n&&n.length?t(n[0]):e}(l),h=function t(e){var n,i=e.children;return i&&(n=i.length)?t(i[n-1]):e}(l),p=u.x-n(u,h)/2,d=h.x+n(h,u)/2;return mi(l,r?function(t){t.x=(t.x-l.x)*i[0],t.y=(l.y-t.y)*i[1]}:function(t){t.x=(t.x-p)/(d-p)*i[0],t.y=(1-(l.y?t.y/l.y:1))*i[1]}),s}var e=Hr.layout.hierarchy().sort(null).value(null),n=Ii,i=[1,1],r=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(e){return arguments.length?(r=null==(i=e),t):r?null:i},t.nodeSize=function(e){return arguments.length?(r=null!=(i=e),t):r?i:null},fi(t,e)},Hr.layout.treemap=function(){function t(t,e){for(var n,i,r=-1,o=t.length;++re?0:e),n.area=isNaN(i)||0>=i?0:i}function e(n){var o=n.children;if(o&&o.length){var a,s,l,c=h(n),u=[],p=o.slice(),f=1/0,g="slice"===d?c.dx:"dice"===d?c.dy:"slice-dice"===d?1&n.depth?c.dy:c.dx:Math.min(c.dx,c.dy);for(t(p,c.dx*c.dy/n.value),u.area=0;(l=p.length)>0;)u.push(a=p[l-1]),u.area+=a.area,"squarify"!==d||(s=i(u,g))<=f?(p.pop(),f=s):(u.area-=u.pop().area,r(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,f=1/0);u.length&&(r(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function n(e){var i=e.children;if(i&&i.length){var o,a=h(e),s=i.slice(),l=[];for(t(s,a.dx*a.dy/e.value),l.area=0;o=s.pop();)l.push(o),l.area+=o.area,null!=o.z&&(r(l,o.z?a.dx:a.dy,a,!s.length),l.length=l.area=0);i.forEach(n)}}function i(t,e){for(var n,i=t.area,r=0,o=1/0,a=-1,s=t.length;++an&&(o=n),n>r&&(r=n));return e*=e,(i*=i)?Math.max(e*r*f/i,i/(e*o*f)):1/0}function r(t,e,n,i){var r,o=-1,a=t.length,s=n.x,c=n.y,u=e?l(t.area/e):0;if(e==n.dx){for((i||u>n.dy)&&(u=n.dy);++on.dx)&&(u=n.dx);++on&&(e=1),1>n&&(t=0),function(){var n,i,r;do{r=(n=2*Math.random()-1)*n+(i=2*Math.random()-1)*i}while(!r||r>1);return t+e*n*Math.sqrt(-2*Math.log(r)/r)}},logNormal:function(){var t=Hr.random.normal.apply(Hr,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=Hr.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;t>n;n++)e+=Math.random();return e}}},Hr.scale={};var ls={floor:Lt,ceil:Lt};Hr.scale.linear=function(){return function t(e,n,i,r){function o(){var t=Math.min(e.length,n.length)>2?Gi:Wi,o=r?si:ai;return s=t(e,n,o,i),l=t(n,e,o,Hn),a}function a(t){return s(t)}var s,l;return a.invert=function(t){return l(t)},a.domain=function(t){return arguments.length?(e=t.map(Number),o()):e},a.range=function(t){return arguments.length?(n=t,o()):n},a.rangeRound=function(t){return a.range(t).interpolate(ei)},a.clamp=function(t){return arguments.length?(r=t,o()):r},a.interpolate=function(t){return arguments.length?(i=t,o()):i},a.ticks=function(t){return er(e,t)},a.tickFormat=function(t,n){return nr(e,t,n)},a.nice=function(t){return Ji(e,t),o()},a.copy=function(){return t(e,n,i,r)},o()}([0,1],[0,1],Hn,!1)};var cs={s:1,g:1,p:1,r:1,e:1};Hr.scale.log=function(){return function t(e,n,i,r){function o(t){return(i?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function a(t){return i?Math.pow(n,t):-Math.pow(n,-t)}function s(t){return e(o(t))}return s.invert=function(t){return a(e.invert(t))},s.domain=function(t){return arguments.length?(i=t[0]>=0,e.domain((r=t.map(Number)).map(o)),s):r},s.base=function(t){return arguments.length?(n=+t,e.domain(r.map(o)),s):n},s.nice=function(){var t=Xi(r.map(o),i?Math:hs);return e.domain(t),r=t.map(a),s},s.ticks=function(){var t=Ki(r),e=[],s=t[0],l=t[1],c=Math.floor(o(s)),u=Math.ceil(o(l)),h=n%1?2:n;if(isFinite(u-c)){if(i){for(;u>c;c++)for(var p=1;h>p;p++)e.push(a(c)*p);e.push(a(c))}else for(e.push(a(c));c++0;p--)e.push(a(c)*p);for(c=0;e[c]l;u--);e=e.slice(c,u)}return e},s.tickFormat=function(t,e){if(!arguments.length)return us;arguments.length<2?e=us:"function"!=typeof e&&(e=Hr.format(e));var n,r=Math.max(.1,t/s.ticks().length),l=i?(n=1e-12,Math.ceil):(n=-1e-12,Math.floor);return function(t){return t/a(l(o(t)+n))<=r?e(t):""}},s.copy=function(){return t(e.copy(),n,i,r)},Qi(s,e)}(Hr.scale.linear().domain([0,1]),10,!0,[1,10])};var us=Hr.format(".0e"),hs={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};Hr.scale.pow=function(){return function t(e,n,i){function r(t){return e(o(t))}var o=rr(n),a=rr(1/n);return r.invert=function(t){return a(e.invert(t))},r.domain=function(t){return arguments.length?(e.domain((i=t.map(Number)).map(o)),r):i},r.ticks=function(t){return er(i,t)},r.tickFormat=function(t,e){return nr(i,t,e)},r.nice=function(t){return r.domain(Ji(i,t))},r.exponent=function(t){return arguments.length?(o=rr(n=t),a=rr(1/n),e.domain(i.map(o)),r):n},r.copy=function(){return t(e.copy(),n,i)},Qi(r,e)}(Hr.scale.linear(),1,[0,1])},Hr.scale.sqrt=function(){return Hr.scale.pow().exponent(.5)},Hr.scale.ordinal=function(){return function t(e,n){function i(t){return s[((o.get(t)||("range"===n.t?o.set(t,e.push(t)):NaN))-1)%s.length]}function r(t,n){return Hr.range(e.length).map(function(e){return t+n*e})}var o,s,l;return i.domain=function(t){if(!arguments.length)return e;e=[],o=new a;for(var r,s=-1,l=t.length;++s(t=o.indexOf(t))?[NaN,NaN]:[t>0?l[t-1]:r[0],t(t=i.indexOf(t))?NaN:t/a+e,t+1/a]},r.copy=function(){return t(e,n,i)},o()}(0,1,[0,1])},Hr.scale.threshold=function(){return function t(e,n){function i(t){return t>=t?n[Hr.bisect(e,t)]:void 0}return i.domain=function(t){return arguments.length?(e=t,i):e},i.range=function(t){return arguments.length?(n=t,i):n},i.invertExtent=function(t){return t=n.indexOf(t),[e[t-1],e[t]]},i.copy=function(){return t(e,n)},i}([.5],[0,1])},Hr.scale.identity=function(){return function t(e){function n(t){return+t}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=t.map(n),n):e},n.ticks=function(t){return er(e,t)},n.tickFormat=function(t,n){return nr(e,t,n)},n.copy=function(){return t(e)},n}([0,1])},Hr.svg={},Hr.svg.arc=function(){function t(){var t=Math.max(0,+n.apply(this,arguments)),c=Math.max(0,+i.apply(this,arguments)),u=a.apply(this,arguments)-So,h=s.apply(this,arguments)-So,p=Math.abs(h-u),d=u>h?0:1;if(t>c&&(f=c,c=t,t=f),p>=_o)return e(c,d)+(t?e(t,1-d):"")+"Z";var f,g,m,y,v,C,b,x,L,k,w,_,S=0,M=0,F=[];if((y=(+l.apply(this,arguments)||0)/2)&&(m=o===ms?Math.sqrt(t*t+c*c):+o.apply(this,arguments),d||(M*=-1),c&&(M=Q(m/c*Math.sin(y))),t&&(S=Q(m/t*Math.sin(y)))),c){v=c*Math.cos(u+M),C=c*Math.sin(u+M),b=c*Math.cos(h-M),x=c*Math.sin(h-M);var E=Math.abs(h-u-2*M)<=ko?0:1;if(M&&hr(v,C,b,x)===d^E){var P=(u+h)/2;v=c*Math.cos(P),C=c*Math.sin(P),b=x=null}}else v=C=0;if(t){L=t*Math.cos(h-S),k=t*Math.sin(h-S),w=t*Math.cos(u+S),_=t*Math.sin(u+S);var T=Math.abs(u-h+2*S)<=ko?0:1;if(S&&hr(L,k,w,_)===1-d^T){var A=(u+h)/2;L=t*Math.cos(A),k=t*Math.sin(A),w=_=null}}else L=k=0;if((f=Math.min(Math.abs(c-t)/2,+r.apply(this,arguments)))>.001){g=c>t^d?0:1;var z=null==w?[L,k]:null==b?[v,C]:pn([v,C],[w,_],[b,x],[L,k]),B=v-z[0],N=C-z[1],D=b-z[0],$=x-z[1],O=1/Math.sin(Math.acos((B*D+N*$)/(Math.sqrt(B*B+N*N)*Math.sqrt(D*D+$*$)))/2),U=Math.sqrt(z[0]*z[0]+z[1]*z[1]);if(null!=b){var I=Math.min(f,(c-U)/(O+1)),R=pr(null==w?[L,k]:[w,_],[v,C],c,I,d),Y=pr([b,x],[L,k],c,I,d);f===I?F.push("M",R[0],"A",I,",",I," 0 0,",g," ",R[1],"A",c,",",c," 0 ",1-d^hr(R[1][0],R[1][1],Y[1][0],Y[1][1]),",",d," ",Y[1],"A",I,",",I," 0 0,",g," ",Y[0]):F.push("M",R[0],"A",I,",",I," 0 1,",g," ",Y[0])}else F.push("M",v,",",C);if(null!=w){var Z=Math.min(f,(t-U)/(O-1)),H=pr([v,C],[w,_],t,-Z,d),q=pr([L,k],null==b?[v,C]:[b,x],t,-Z,d);f===Z?F.push("L",q[0],"A",Z,",",Z," 0 0,",g," ",q[1],"A",t,",",t," 0 ",d^hr(q[1][0],q[1][1],H[1][0],H[1][1]),",",1-d," ",H[1],"A",Z,",",Z," 0 0,",g," ",H[0]):F.push("L",q[0],"A",Z,",",Z," 0 0,",g," ",H[0])}else F.push("L",L,",",k)}else F.push("M",v,",",C),null!=b&&F.push("A",c,",",c," 0 ",E,",",d," ",b,",",x),F.push("L",L,",",k),null!=w&&F.push("A",t,",",t," 0 ",T,",",1-d," ",w,",",_);return F.push("Z"),F.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var n=ar,i=sr,r=or,o=ms,a=lr,s=cr,l=ur;return t.innerRadius=function(e){return arguments.length?(n=xt(e),t):n},t.outerRadius=function(e){return arguments.length?(i=xt(e),t):i},t.cornerRadius=function(e){return arguments.length?(r=xt(e),t):r},t.padRadius=function(e){return arguments.length?(o=e==ms?ms:xt(e),t):o},t.startAngle=function(e){return arguments.length?(a=xt(e),t):a},t.endAngle=function(e){return arguments.length?(s=xt(e),t):s},t.padAngle=function(e){return arguments.length?(l=xt(e),t):l},t.centroid=function(){var t=(+n.apply(this,arguments)+ +i.apply(this,arguments))/2,e=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-So;return[Math.cos(e)*t,Math.sin(e)*t]},t};var ms="auto";Hr.svg.line=function(){return dr(Lt)};var ys=Hr.map({linear:fr,"linear-closed":function(t){return fr(t)+"Z"},step:function(t){for(var e=0,n=t.length,i=t[0],r=[i[0],",",i[1]];++e1&&r.push("H",i[0]),r.join("")},"step-before":gr,"step-after":mr,basis:Cr,"basis-open":function(t){if(t.length<4)return fr(t);for(var e,n=[],i=-1,r=t.length,o=[0],a=[0];++i<3;)e=t[i],o.push(e[0]),a.push(e[1]);for(n.push(br(bs,o)+","+br(bs,a)),--i;++iko)+",1 "+e}function i(t,e,n,i){return"Q 0,0 "+i}var r=Qe,o=Je,a=Sr,s=lr,l=cr;return t.radius=function(e){return arguments.length?(a=xt(e),t):a},t.source=function(e){return arguments.length?(r=xt(e),t):r},t.target=function(e){return arguments.length?(o=xt(e),t):o},t.startAngle=function(e){return arguments.length?(s=xt(e),t):s},t.endAngle=function(e){return arguments.length?(l=xt(e),t):l},t},Hr.svg.diagonal=function(){function t(t,r){var o=e.call(this,t,r),a=n.call(this,t,r),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];return"M"+(l=l.map(i))[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=Qe,n=Je,i=Mr;return t.source=function(n){return arguments.length?(e=xt(n),t):e},t.target=function(e){return arguments.length?(n=xt(e),t):n},t.projection=function(e){return arguments.length?(i=e,t):i},t},Hr.svg.diagonal.radial=function(){var t=Hr.svg.diagonal(),e=Mr,n=t.projection;return t.projection=function(t){return arguments.length?n(function(t){return function(){var e=t.apply(this,arguments),n=e[0],i=e[1]-So;return[n*Math.cos(i),n*Math.sin(i)]}}(e=t)):e},t},Hr.svg.symbol=function(){function t(t,i){return(xs.get(e.call(this,t,i))||Pr)(n.call(this,t,i))}var e=Er,n=Fr;return t.type=function(n){return arguments.length?(e=xt(n),t):e},t.size=function(e){return arguments.length?(n=xt(e),t):n},t};var xs=Hr.map({circle:Pr,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*ks)),n=e*ks;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Ls),n=e*Ls/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Ls),n=e*Ls/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});Hr.svg.symbolTypes=xs.keys();var Ls=Math.sqrt(3),ks=Math.tan(30*Mo);po.transition=function(t){for(var e,n,i=ws||++Fs,r=Nr(t),o=[],a=_s||{time:Date.now(),ease:Xn,delay:0,duration:250},s=-1,l=this.length;++sr;r++){i.push(e=[]);for(var a,s=0,l=(a=this[r]).length;l>s;s++)(n=a[s])&&t.call(n,n.__data__,s,r)&&e.push(n)}return Ar(i,this.namespace,this.id)},Ms.tween=function(t,e){var n=this.id,i=this.namespace;return arguments.length<2?this.node()[i][n].tween.get(t):U(this,null==e?function(e){e[i][n].tween.remove(t)}:function(r){r[i][n].tween.set(t,e)})},Ms.attr=function(t,e){function n(){this.removeAttribute(o)}function i(){this.removeAttributeNS(o.space,o.local)}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var r="transform"==t?oi:Hn,o=Hr.ns.qualify(t);return zr(this,"attr."+t,e,o.local?function(t){return null==t?i:(t+="",function(){var e,n=this.getAttributeNS(o.space,o.local);return n!==t&&(e=r(n,t),function(t){this.setAttributeNS(o.space,o.local,e(t))})})}:function(t){return null==t?n:(t+="",function(){var e,n=this.getAttribute(o);return n!==t&&(e=r(n,t),function(t){this.setAttribute(o,e(t))})})})},Ms.attrTween=function(t,e){var n=Hr.ns.qualify(t);return this.tween("attr."+t,n.local?function(t,i){var r=e.call(this,t,i,this.getAttributeNS(n.space,n.local));return r&&function(t){this.setAttributeNS(n.space,n.local,r(t))}}:function(t,i){var r=e.call(this,t,i,this.getAttribute(n));return r&&function(t){this.setAttribute(n,r(t))}})},Ms.style=function(t,e,n){function i(){this.style.removeProperty(t)}var r=arguments.length;if(3>r){if("string"!=typeof t){for(n in 2>r&&(e=""),t)this.style(n,t[n],e);return this}n=""}return zr(this,"style."+t,e,function(e){return null==e?i:(e+="",function(){var i,r=Wr.getComputedStyle(this,null).getPropertyValue(t);return r!==e&&(i=Hn(r,e),function(e){this.style.setProperty(t,i(e),n)})})})},Ms.styleTween=function(t,e,n){return arguments.length<3&&(n=""),this.tween("style."+t,function(i,r){var o=e.call(this,i,r,Wr.getComputedStyle(this,null).getPropertyValue(t));return o&&function(e){this.style.setProperty(t,o(e),n)}})},Ms.text=function(t){return zr(this,"text",t,Br)},Ms.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Ms.ease=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].ease:("function"!=typeof t&&(t=Hr.ease.apply(Hr,arguments)),U(this,function(i){i[n][e].ease=t}))},Ms.delay=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].delay:U(this,"function"==typeof t?function(i,r,o){i[n][e].delay=+t.call(i,i.__data__,r,o)}:(t=+t,function(i){i[n][e].delay=t}))},Ms.duration=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].duration:U(this,"function"==typeof t?function(i,r,o){i[n][e].duration=Math.max(1,t.call(i,i.__data__,r,o))}:(t=Math.max(1,t),function(i){i[n][e].duration=t}))},Ms.each=function(t,e){var n=this.id,i=this.namespace;if(arguments.length<2){var r=_s,o=ws;try{ws=n,U(this,function(e,r,o){_s=e[i][n],t.call(e,e.__data__,r,o)})}finally{_s=r,ws=o}}else U(this,function(r){var o=r[i][n];(o.event||(o.event=Hr.dispatch("start","end","interrupt"))).on(t,e)});return this},Ms.transition=function(){for(var t,e,n,i=this.id,r=++Fs,o=this.namespace,a=[],s=0,l=this.length;l>s;s++){a.push(t=[]);for(var c,u=0,h=(c=this[s]).length;h>u;u++)(e=c[u])&&Dr(e,u,o,r,{time:(n=e[o][i]).time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration}),t.push(e)}return Ar(a,o,r)},Hr.svg.axis=function(){function t(t){t.each(function(){var t,c=Hr.select(this),u=this.__chart__||n,h=this.__chart__=n.copy(),p=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,d=null==e?h.tickFormat?h.tickFormat.apply(h,s):Lt:e,f=c.selectAll(".tick").data(p,h),g=f.enter().insert("g",".domain").attr("class","tick").style("opacity",xo),m=Hr.transition(f.exit()).style("opacity",xo).remove(),y=Hr.transition(f.order()).style("opacity",1),v=Math.max(r,0)+a,C=Vi(h),b=c.selectAll(".domain").data([0]),x=(b.enter().append("path").attr("class","domain"),Hr.transition(b));g.append("line"),g.append("text");var L,k,w,_,S=g.select("line"),M=y.select("line"),F=f.select("text").text(d),E=g.select("text"),P=y.select("text"),T="top"===i||"left"===i?-1:1;if("bottom"===i||"top"===i?(t=$r,L="x",w="y",k="x2",_="y2",F.attr("dy",0>T?"0em":".71em").style("text-anchor","middle"),x.attr("d","M"+C[0]+","+T*o+"V0H"+C[1]+"V"+T*o)):(t=Or,L="y",w="x",k="y2",_="x2",F.attr("dy",".32em").style("text-anchor",0>T?"end":"start"),x.attr("d","M"+T*o+","+C[0]+"H0V"+C[1]+"H"+T*o)),S.attr(_,T*r),E.attr(w,T*v),M.attr(k,0).attr(_,T*r),P.attr(L,0).attr(w,T*v),h.rangeBand){var A=h,z=A.rangeBand()/2;u=h=function(t){return A(t)+z}}else u.rangeBand?u=h:m.call(t,h,u);g.call(t,u,h),y.call(t,h,h)})}var e,n=Hr.scale.linear(),i=Es,r=6,o=6,a=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(n=e,t):n},t.orient=function(e){return arguments.length?(i=e in Ps?e+"":Es,t):i},t.ticks=function(){return arguments.length?(s=arguments,t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(n){return arguments.length?(e=n,t):e},t.tickSize=function(e){var n=arguments.length;return n?(r=+e,o=+arguments[n-1],t):r},t.innerTickSize=function(e){return arguments.length?(r=+e,t):r},t.outerTickSize=function(e){return arguments.length?(o=+e,t):o},t.tickPadding=function(e){return arguments.length?(a=+e,t):a},t.tickSubdivide=function(){return arguments.length&&t},t};var Es="bottom",Ps={top:1,right:1,bottom:1,left:1};Hr.svg.brush=function(){function t(o){o.each(function(){var o=Hr.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",r).on("touchstart.brush",r),a=o.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),o.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=o.selectAll(".resize").data(f,Lt);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Ts[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var u,h=Hr.transition(o),p=Hr.transition(a);l&&(u=Vi(l),p.attr("x",u[0]).attr("width",u[1]-u[0]),n(h)),c&&(u=Vi(c),p.attr("y",u[0]).attr("height",u[1]-u[0]),i(h)),e(h)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+u[+/e$/.test(t)]+","+h[+/^s/.test(t)]+")"})}function n(t){t.select(".extent").attr("x",u[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",u[1]-u[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function r(){function r(){var t=Hr.mouse(v),r=!1;y&&(t[0]+=y[0],t[1]+=y[1]),S||(Hr.event.altKey?(m||(m=[(u[0]+u[1])/2,(h[0]+h[1])/2]),F[0]=u[+(t[0]f?(r=i,i=f):r=f),g[0]!=i||g[1]!=r?(n?a=null:o=null,g[0]=i,g[1]=r,!0):void 0}function g(){r(),L.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),Hr.select("body").style("cursor",null),E.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),M(),x({type:"brushend"})}var m,y,v=this,C=Hr.select(Hr.event.target),x=s.of(v,arguments),L=Hr.select(v),k=C.datum(),w=!/^(n|s)$/.test(k)&&l,_=!/^(e|w)$/.test(k)&&c,S=C.classed("extent"),M=H(),F=Hr.mouse(v),E=Hr.select(Wr).on("keydown.brush",function(){32==Hr.event.keyCode&&(S||(m=null,F[0]-=u[1],F[1]-=h[1],S=2),b())}).on("keyup.brush",function(){32==Hr.event.keyCode&&2==S&&(F[0]+=u[1],F[1]+=h[1],S=0,b())});if(Hr.event.changedTouches?E.on("touchmove.brush",r).on("touchend.brush",g):E.on("mousemove.brush",r).on("mouseup.brush",g),L.interrupt().selectAll("*").interrupt(),S)F[0]=u[0]-F[0],F[1]=h[0]-F[1];else if(k){var P=+/w$/.test(k),T=+/^n/.test(k);y=[u[1-P]-F[0],h[1-T]-F[1]],F[0]=u[P],F[1]=h[T]}else Hr.event.altKey&&(m=F.slice());L.style("pointer-events","none").selectAll(".resize").style("display",null),Hr.select("body").style("cursor",C.style("cursor")),x({type:"brushstart"}),r()}var o,a,s=L(t,"brushstart","brush","brushend"),l=null,c=null,u=[0,0],h=[0,0],p=!0,d=!0,f=As[0];return t.event=function(t){t.each(function(){var t=s.of(this,arguments),e={x:u,y:h,i:o,j:a},n=this.__chart__||e;this.__chart__=e,ws?Hr.select(this).transition().each("start.brush",function(){o=n.i,a=n.j,u=n.x,h=n.y,t({type:"brushstart"})}).tween("brush:brush",function(){var n=qn(u,e.x),i=qn(h,e.y);return o=a=null,function(r){u=e.x=n(r),h=e.y=i(r),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=e.i,a=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(f=As[!(l=e)<<1|!c],t):l},t.y=function(e){return arguments.length?(f=As[!l<<1|!(c=e)],t):c},t.clamp=function(e){return arguments.length?(l&&c?(p=!!e[0],d=!!e[1]):l?p=!!e:c&&(d=!!e),t):l&&c?[p,d]:l?p:c?d:null},t.extent=function(e){var n,i,r,s,p;return arguments.length?(l&&(n=e[0],i=e[1],c&&(n=n[0],i=i[0]),o=[n,i],l.invert&&(n=l(n),i=l(i)),n>i&&(p=n,n=i,i=p),(n!=u[0]||i!=u[1])&&(u=[n,i])),c&&(r=e[0],s=e[1],l&&(r=r[1],s=s[1]),a=[r,s],c.invert&&(r=c(r),s=c(s)),r>s&&(p=r,r=s,s=p),(r!=h[0]||s!=h[1])&&(h=[r,s])),t):(l&&(o?(n=o[0],i=o[1]):(n=u[0],i=u[1],l.invert&&(n=l.invert(n),i=l.invert(i)),n>i&&(p=n,n=i,i=p))),c&&(a?(r=a[0],s=a[1]):(r=h[0],s=h[1],c.invert&&(r=c.invert(r),s=c.invert(s)),r>s&&(p=r,r=s,s=p))),l&&c?[[n,r],[i,s]]:l?[n,i]:c&&[r,s])},t.clear=function(){return t.empty()||(u=[0,0],h=[0,0],o=a=null),t},t.empty=function(){return!!l&&u[0]==u[1]||!!c&&h[0]==h[1]},Hr.rebind(t,s,"on")};var Ts={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},As=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],zs=Qo.format=ra.timeFormat,Bs=zs.utc,Ns=Bs("%Y-%m-%dT%H:%M:%S.%LZ");zs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Ur:Ns,Ur.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Ur.toString=Ns.toString,Qo.second=Tt(function(t){return new Jo(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),Qo.seconds=Qo.second.range,Qo.seconds.utc=Qo.second.utc.range,Qo.minute=Tt(function(t){return new Jo(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),Qo.minutes=Qo.minute.range,Qo.minutes.utc=Qo.minute.utc.range,Qo.hour=Tt(function(t){var e=t.getTimezoneOffset()/60;return new Jo(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),Qo.hours=Qo.hour.range,Qo.hours.utc=Qo.hour.utc.range,Qo.month=Tt(function(t){return(t=Qo.day(t)).setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),Qo.months=Qo.month.range,Qo.months.utc=Qo.month.utc.range;var Ds=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],$s=[[Qo.second,1],[Qo.second,5],[Qo.second,15],[Qo.second,30],[Qo.minute,1],[Qo.minute,5],[Qo.minute,15],[Qo.minute,30],[Qo.hour,1],[Qo.hour,3],[Qo.hour,6],[Qo.hour,12],[Qo.day,1],[Qo.day,2],[Qo.week,1],[Qo.month,1],[Qo.month,3],[Qo.year,1]],Os=zs.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",ve]]),Us={range:function(t,e,n){return Hr.range(Math.ceil(t/n)*n,+e,n).map(Rr)},floor:Lt,ceil:Lt};$s.year=Qo.year,Qo.scale=function(){return Ir(Hr.scale.linear(),$s,Os)};var Is=$s.map(function(t){return[t[0].utc,t[1]]}),Rs=Bs.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",ve]]);Is.year=Qo.year.utc,Qo.scale.utc=function(){return Ir(Hr.scale.linear(),Is,Rs)},Hr.text=kt(function(t){return t.responseText}),Hr.json=function(t,e){return wt(t,"application/json",Yr,e)},Hr.html=function(t,e){return wt(t,"text/html",Zr,e)},Hr.xml=kt(function(t){return t.responseXML}),"function"==typeof define&&define.amd?define(Hr):"object"==typeof module&&module.exports&&(module.exports=Hr),this.d3=Hr}(),function(t,e,n,i){"use strict";var r=function(){return this.init.apply(this,arguments)};r.prototype={defaults:{onstatechange:function(){},ondragend:function(){},ondragstart:function(){},isRange:!1,showLabels:!0,showScale:!0,step:1,format:"%s",theme:"theme-green",width:300,disable:!1},template:'
\t\t\t
123456
456789
\t\t
',init:function(e,n){this.options=t.extend({},this.defaults,n),this.inputNode=t(e),this.options.value=this.inputNode.val()||(this.options.isRange?this.options.from+","+this.options.from:this.options.from),this.domNode=t(this.template),this.domNode.addClass(this.options.theme),this.inputNode.after(this.domNode),this.domNode.on("change",this.onChange),this.pointers=t(".pointer",this.domNode),this.lowPointer=this.pointers.first(),this.highPointer=this.pointers.last(),this.labels=t(".pointer-label",this.domNode),this.lowLabel=this.labels.first(),this.highLabel=this.labels.last(),this.scale=t(".scale",this.domNode),this.bar=t(".selected-bar",this.domNode),this.clickableBar=this.domNode.find(".clickable-dummy"),this.interval=this.options.to-this.options.from,this.render()},render:function(){(0!==this.inputNode.width()||this.options.width)&&(this.domNode.width(this.options.width||this.inputNode.width()),this.inputNode.hide(),this.isSingle()&&(this.lowPointer.hide(),this.lowLabel.hide()),this.options.showLabels||this.labels.hide(),this.attachEvents(),this.options.showScale&&this.renderScale(),this.setValue(this.options.value))},isSingle:function(){return"number"==typeof this.options.value||-1===this.options.value.indexOf(",")&&!this.options.isRange},attachEvents:function(){this.clickableBar.click(t.proxy(this.barClicked,this)),this.pointers.on("mousedown touchstart",t.proxy(this.onDragStart,this)),this.pointers.bind("dragstart",function(t){t.preventDefault()})},onDragStart:function(e){if(!(this.options.disable||"mousedown"===e.type&&1!==e.which)){e.stopPropagation(),e.preventDefault();var i=t(e.target);this.pointers.removeClass("last-active"),i.addClass("focused last-active"),this[(i.hasClass("low")?"low":"high")+"Label"].addClass("focused"),t(n).on("mousemove.slider touchmove.slider",t.proxy(this.onDrag,this,i)),t(n).on("mouseup.slider touchend.slider touchcancel.slider",t.proxy(this.onDragEnd,this)),this.options.ondragstart.call(this)}},onDrag:function(t,e){e.stopPropagation(),e.preventDefault(),e.originalEvent.touches&&e.originalEvent.touches.length?e=e.originalEvent.touches[0]:e.originalEvent.changedTouches&&e.originalEvent.changedTouches.length&&(e=e.originalEvent.changedTouches[0]);var n=e.clientX-this.domNode.offset().left;this.domNode.trigger("change",[this,t,n])},onDragEnd:function(e){this.pointers.removeClass("focused"),this.labels.removeClass("focused"),t(n).off(".slider"),this.options.ondragend.call(this,this.options.value)},barClicked:function(t){if(!this.options.disable){var e=t.pageX-this.clickableBar.offset().left;if(this.isSingle())this.setPosition(this.pointers.last(),e,!0,!0);else{var n=Math.abs(parseInt(this.pointers.first().css("left"),10)-e+this.pointers.first().width()/2)'+("|"!=e[r]?""+e[r]+"":"")+"";this.scale.html(i),t("ins",this.scale).each(function(){t(this).css({marginLeft:-t(this).outerWidth()/2})})},getBarWidth:function(){var t=this.options.value.split(",");return t.length>1?parseInt(t[1],10)-parseInt(t[0],10):parseInt(t[0],10)},showPointerValue:function(e,n,i){var r,o=t(".pointer-label",this.domNode)[e.hasClass("low")?"first":"last"](),a=this.positionToValue(n);if(t.isFunction(this.options.format)){var s=this.isSingle()?void 0:e.hasClass("low")?"low":"high";r=this.options.format(a,s)}else r=this.options.format.replace("%s",a);var l=o.html(r).width(),c=n-l/2;c=Math.min(Math.max(c,0),this.options.width-l),o[i?"animate":"css"]({left:c}),this.setInputValue(e,a)},valuesToPrc:function(t){return[100*(t[0]-this.options.from)/this.interval,100*(t[1]-this.options.from)/this.interval]},prcToPx:function(t){return this.domNode.width()*t/100},positionToValue:function(t){var e=t/this.domNode.width()*this.interval;return e+=this.options.from,Math.round(e/this.options.step)*this.options.step},setInputValue:function(e,n){if(this.isSingle()){this.options.value=n.toString();var i="";i=t.isFunction(this.options.format)?this.options.format(this.options.value):this.options.format.replace("%s",this.options.value),t(".numeric-value",this.domNode).html(i)}else{var r=this.options.value.split(",");e.hasClass("low")?this.options.value=n+","+r[1]:this.options.value=r[0]+","+n}this.inputNode.val()!==this.options.value&&(this.inputNode.val(this.options.value),this.options.onstatechange.call(this,this.options.value))},getValue:function(){return this.options.value},isReadonly:function(){this.domNode.toggleClass("slider-readonly",this.options.disable)},disable:function(){this.options.disable=!0,this.isReadonly()},enable:function(){this.options.disable=!1,this.isReadonly()},toggleDisable:function(){this.options.disable=!this.options.disable,this.isReadonly()}};t.fn.jRange=function(n){var i,o=arguments;return this.each(function(){var a=t(this),s=t.data(this,"plugin_jRange"),l="object"==typeof n&&n;s||(a.data("plugin_jRange",s=new r(this,l)),t(e).resize(function(){s.setValue(s.getValue())})),"string"==typeof n&&(i=s[n].apply(s,Array.prototype.slice.call(o,1)))}),i||this}}(jQuery,window,document),function(t,e){var n=!0;function i(){this._state=[],this._defaults={classHolder:"sbHolder",classHolderDisabled:"sbHolderDisabled",classSelector:"sbSelector",classOptions:"sbOptions",classGroup:"sbGroup",classSub:"sbSub",classDisabled:"sbDisabled",classToggleOpen:"sbToggleOpen",classToggle:"sbToggle",classFocus:"sbFocus",speed:200,effect:"slide",onChange:null,onOpen:null,onClose:null}}t.extend(i.prototype,{_isOpenSelectbox:function(t){return!!t&&this._getInst(t).isOpen},_isDisabledSelectbox:function(t){return!!t&&this._getInst(t).isDisabled},_attachSelectbox:function(e,i){if(this._getInst(e))return!1;var r,o,a,s,l=t(e),c=this,u=c._newInst(l),h=!1,p=(l.find("optgroup"),l.find("option")),d=p.length;function f(){var e,n,i=this.attr("id").split("_")[1];for(e in c._state)e!==i&&c._state.hasOwnProperty(e)&&(n=t("select[sb='"+e+"']")[0])&&c._closeSelectbox(n)}function g(){var i=!(!arguments[1]||!arguments[1].sub),r=!(!arguments[1]||!arguments[1].disabled);arguments[0].each(function(l){var p,f=t(this),g=t("
  • ");f.is(":selected")&&(o.text(f.text()),h=n),l===d-1&&g.addClass("last"),f.is(":disabled")||r?(p=t("",{text:f.text()}).addClass(u.settings.classDisabled),i&&p.addClass(u.settings.classSub),p.appendTo(g)):(p=t("",{href:"#"+f.val(),rel:f.val()}).text(f.text()).bind("click.sb",function(n){n&&n.preventDefault&&n.preventDefault();var i=a,r=t(this);i.attr("id").split("_")[1];c._changeSelectbox(e,r.attr("rel"),r.text()),c._closeSelectbox(e)}).bind("mouseover.sb",function(){var e=t(this);e.parent().siblings().find("a").removeClass(u.settings.classFocus),e.addClass(u.settings.classFocus)}).bind("mouseout.sb",function(){t(this).removeClass(u.settings.classFocus)}),i&&p.addClass(u.settings.classSub),f.is(":selected")&&p.addClass(u.settings.classFocus),p.appendTo(g)),g.appendTo(s)})}l.attr("sb",u.uid),t.extend(u.settings,c._defaults,i),c._state[u.uid]=!1,l.hide(),r=t("
    ",{id:"sbHolder_"+u.uid,class:u.settings.classHolder,tabindex:l.attr("tabindex")}),o=t("",{id:"sbSelector_"+u.uid,href:"#",class:u.settings.classSelector,click:function(n){n.preventDefault(),f.apply(t(this),[]);var i=t(this).attr("id").split("_")[1];c._state[i]?c._closeSelectbox(e):c._openSelectbox(e)}}),(a=t("",{id:"sbToggle_"+u.uid,href:"#",class:u.settings.classToggle,click:function(n){n.preventDefault(),f.apply(t(this),[]);var i=t(this).attr("id").split("_")[1];c._state[i]?c._closeSelectbox(e):c._openSelectbox(e)}})).appendTo(r),s=t("
      ",{id:"sbOptions_"+u.uid,class:u.settings.classOptions,css:{display:"none"}}),l.children().each(function(e){var n,i=t(this),r={};i.is("option")?g(i):i.is("optgroup")&&(n=t("
    • "),t("",{text:i.attr("label")}).addClass(u.settings.classGroup).appendTo(n),n.appendTo(s),i.is(":disabled")&&(r.disabled=!0),r.sub=!0,g(i.find("option"),r))}),h||o.text(p.first().text()),t.data(e,"selectbox",u),r.data("uid",u.uid).bind("keydown.sb",function(e){var n=e.charCode?e.charCode:e.keyCode?e.keyCode:0,i=t(this),r=i.data("uid"),o=i.siblings("select[sb='"+r+"']").data("selectbox"),a=i.siblings(["select[sb='",r,"']"].join("")).get(0),s=i.find("ul").find("a."+o.settings.classFocus);switch(n){case 37:case 38:if(s.length>0)t("a",i).removeClass(o.settings.classFocus),(l=s.parent().prevAll("li:has(a)").eq(0).find("a")).length>0&&(l.addClass(o.settings.classFocus).focus(),t("#sbSelector_"+r).text(l.text()));break;case 39:case 40:var l;t("a",i).removeClass(o.settings.classFocus),(l=s.length>0?s.parent().nextAll("li:has(a)").eq(0).find("a"):i.find("ul").find("a").eq(0)).length>0&&(l.addClass(o.settings.classFocus).focus(),t("#sbSelector_"+r).text(l.text()));break;case 13:s.length>0&&c._changeSelectbox(a,s.attr("rel"),s.text()),c._closeSelectbox(a);break;case 9:if(a)(o=c._getInst(a))&&(s.length>0&&c._changeSelectbox(a,s.attr("rel"),s.text()),c._closeSelectbox(a));var u=parseInt(i.attr("tabindex"),10);e.shiftKey?u--:u++,t("*[tabindex='"+u+"']").focus();break;case 27:c._closeSelectbox(a)}return e.stopPropagation(),!1}).delegate("a","mouseover",function(e){t(this).addClass(u.settings.classFocus)}).delegate("a","mouseout",function(e){t(this).removeClass(u.settings.classFocus)}),o.appendTo(r),s.appendTo(r),r.insertAfter(l),t("html").on("mousedown",function(e){e.stopPropagation(),t("select").selectbox("close")}),t([".",u.settings.classHolder,", .",u.settings.classSelector].join("")).mousedown(function(t){t.stopPropagation()})},_detachSelectbox:function(e){var n=this._getInst(e);if(!n)return!1;t("#sbHolder_"+n.uid).remove(),t.data(e,"selectbox",null),t(e).show()},_changeSelectbox:function(e,i,r){var o,a=this._getInst(e);a&&(o=this._get(a,"onChange"),t("#sbSelector_"+a.uid).text(r)),i=i.replace(/\'/g,"\\'"),t(e).find("option[value='"+i+"']").attr("selected",n),a&&o?o.apply(a.input?a.input[0]:null,[i,a]):a&&a.input&&a.input.trigger("change")},_enableSelectbox:function(e){var n=this._getInst(e);if(!n||!n.isDisabled)return!1;t("#sbHolder_"+n.uid).removeClass(n.settings.classHolderDisabled),n.isDisabled=!1,t.data(e,"selectbox",n)},_disableSelectbox:function(e){var i=this._getInst(e);if(!i||i.isDisabled)return!1;t("#sbHolder_"+i.uid).addClass(i.settings.classHolderDisabled),i.isDisabled=n,t.data(e,"selectbox",i)},_optionSelectbox:function(e,n,i){var r=this._getInst(e);if(!r)return!1;r[n]=i,t.data(e,"selectbox",r)},_openSelectbox:function(e){var i=this._getInst(e);if(i&&!i.isOpen&&!i.isDisabled){var r=t("#sbOptions_"+i.uid),o=parseInt(t(window).height(),10),a=t("#sbHolder_"+i.uid).offset(),s=t(window).scrollTop(),l=r.prev().height(),c=o-(a.top-s)-l/2,u=this._get(i,"onOpen");r.css({top:l+"px",maxHeight:c-l+"px"}),"fade"===i.settings.effect?r.fadeIn(i.settings.speed):r.slideDown(i.settings.speed),t("#sbToggle_"+i.uid).addClass(i.settings.classToggleOpen),this._state[i.uid]=n,i.isOpen=n,u&&u.apply(i.input?i.input[0]:null,[i]),t.data(e,"selectbox",i)}},_closeSelectbox:function(e){var n=this._getInst(e);if(n&&n.isOpen){var i=this._get(n,"onClose");"fade"===n.settings.effect?t("#sbOptions_"+n.uid).fadeOut(n.settings.speed):t("#sbOptions_"+n.uid).slideUp(n.settings.speed),t("#sbToggle_"+n.uid).removeClass(n.settings.classToggleOpen),this._state[n.uid]=!1,n.isOpen=!1,i&&i.apply(n.input?n.input[0]:null,[n]),t.data(e,"selectbox",n)}},_newInst:function(t){return{id:t[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:t,uid:Math.floor(99999999*Math.random()),isOpen:!1,isDisabled:!1,settings:{}}},_getInst:function(e){try{return t.data(e,"selectbox")}catch(t){throw"Missing instance data for this selectbox"}},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]}}),t.fn.selectbox=function(e){var n=Array.prototype.slice.call(arguments,1);return"string"==typeof e&&"isDisabled"==e?t.selectbox["_"+e+"Selectbox"].apply(t.selectbox,[this[0]].concat(n)):"option"==e&&2==arguments.length&&"string"==typeof arguments[1]?t.selectbox["_"+e+"Selectbox"].apply(t.selectbox,[this[0]].concat(n)):this.each(function(){"string"==typeof e?t.selectbox["_"+e+"Selectbox"].apply(t.selectbox,[this].concat(n)):t.selectbox._attachSelectbox(this,e)})},t.selectbox=new i,t.selectbox.version="0.2"}(jQuery),function(t,e,n){function i(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)}function r(t){if("keypress"==t.type){var e=String.fromCharCode(t.which);return t.shiftKey||(e=e.toLowerCase()),e}return c[t.which]?c[t.which]:u[t.which]?u[t.which]:String.fromCharCode(t.which).toLowerCase()}function o(t){return"shift"==t||"ctrl"==t||"alt"==t||"meta"==t}function a(t,e){var n,i,r,a=[];for("+"===(n=t)?n=["+"]:n=(n=n.replace(/\+{2}/g,"+plus")).split("+"),r=0;rs||c.hasOwnProperty(s)&&(l[c[s]]=s);r=l[n]?"keydown":"keypress"}return"keypress"==r&&a.length&&(r="keydown"),{key:i,modifiers:a,action:r}}function s(t){function n(t){t=t||{};var e,n=!1;for(e in g)t[e]?n=!0:g[e]=0;n||(v=!1)}function l(t,e,n,i,r,a){var s,l,c=[],u=n.type;if(!d._callbacks[t])return[];for("keyup"==u&&o(t)&&(e=[t]),s=0;s":".","?":"/","|":"\\"},p={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"};for(n=1;20>n;++n)c[111+n]="f"+n;for(n=0;9>=n;++n)c[n+96]=n;s.prototype.bind=function(t,e,n){return t=t instanceof Array?t:[t],this._bindMultiple.call(this,t,e,n),this},s.prototype.unbind=function(t,e){return this.bind.call(this,t,function(){},e)},s.prototype.trigger=function(t,e){return this._directMap[t+":"+e]&&this._directMap[t+":"+e]({},t),this},s.prototype.reset=function(){return this._callbacks={},this._directMap={},this},s.prototype.stopCallback=function(t,n){return!(-1<(" "+n.className+" ").indexOf(" mousetrap ")||function t(n,i){return null!==n&&n!==e&&(n===i||t(n.parentNode,i))}(n,this.target))&&("INPUT"==n.tagName||"SELECT"==n.tagName||"TEXTAREA"==n.tagName||n.isContentEditable)},s.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},s.init=function(){var t,n=s(e);for(t in n)"_"!==t.charAt(0)&&(s[t]=function(t){return function(){return n[t].apply(n,arguments)}}(t))},s.init(),t.Mousetrap=s,"undefined"!=typeof module&&module.exports&&(module.exports=s),"function"==typeof define&&define.amd&&define(function(){return s})}(window,document),function(t){t.fn.extend({Segment:function(){t(this).each(function(){var e=t(this),n=e.attr("onchange"),i=t("
      ",{class:"ui-segment"});t(this).find("option").each(function(){var e=t("",{class:"option",onclick:n,text:t(this).text(),value:t(this).val()});t(this).is(":selected")&&e.addClass("active"),i.append(e)}),i.find("span.option").click(function(){i.find("span.option").removeClass("active"),t(this).addClass("active"),e.val(t(this).attr("value"))}),t(this).after(i),t(this).hide()})}})}(jQuery),function(){"use strict";function t(t,e,n){var i=e.x,r=e.y,o=n.x-i,a=n.y-r;if(0!==o||0!==a){var s=((t.x-i)*o+(t.y-r)*a)/(o*o+a*a);s>1?(i=n.x,r=n.y):s>0&&(i+=o*s,r+=a*s)}return(o=t.x-i)*o+(a=t.y-r)*a}function e(e,n){var i=e.length-1,r=[e[0]];return function e(n,i,r,o,a){for(var s,l=o,c=i+1;cl&&(s=c,l=u)}l>o&&(s-i>1&&e(n,i,s,o,a),a.push(n[s]),r-s>1&&e(n,s,r,o,a))}(e,0,i,n,r),r.push(e[i]),r}function n(t,n,i){if(t.length<=2)return t;var r=void 0!==n?n*n:1;return t=e(t=i?t:function(t,e){for(var n,i,r,o,a,s=t[0],l=[s],c=1,u=t.length;ce&&(l.push(n),s=n);return s!==n&&l.push(n),l}(t,r),r)}"function"==typeof define&&define.amd?define(function(){return n}):"undefined"!=typeof module?module.exports=n:"undefined"!=typeof self?self.simplify=n:window.simplify=n}(),function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"object"==typeof module?module.exports=t:t(jQuery)}(function(t,e){"use strict";var n={beforeShow:u,move:u,change:u,show:u,hide:u,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,offset:null},i=[],r=!!/msie/i.exec(window.navigator.userAgent),o=function(){function t(t,e){return!!~(""+t).indexOf(e)}var e=document.createElement("div").style;return e.cssText="background-color:rgba(0,0,0,.5)",t(e.backgroundColor,"rgba")||t(e.backgroundColor,"hsla")}(),a=["
      ","
      ","
      ","
      "].join(""),s=function(){var t="";if(r)for(var e=1;e<=6;e++)t+="
      ";return["
      "].join("")}();function l(e,n,i,r){for(var a=[],s=0;s')}else{a.push(t("
      ").append(t('').attr("title",r.noColorSelectedText)).html())}}return"
      "+a.join("")+"
      "}function c(c,u){var g,m,y,v,C=function(e,i){var r=t.extend({},n,e);return r.callbacks={move:p(r.move,i),change:p(r.change,i),show:p(r.show,i),hide:p(r.hide,i),beforeShow:p(r.beforeShow,i)},r}(u,c),b=C.flat,x=C.showSelectionPalette,L=C.localStorageKey,k=C.theme,w=C.callbacks,_=(g=Ht,m=10,function(){var t=this,e=arguments;y&&clearTimeout(v),!y&&v||(v=setTimeout(function(){v=null,g.apply(t,e)},m))}),S=!1,M=!1,F=0,E=0,P=0,T=0,A=0,z=0,B=0,N=0,D=0,$=0,O=1,U=[],I=[],R={},Y=C.selectionPalette.slice(0),Z=C.maxSelectionSize,H="sp-dragging",q=null,j=c.ownerDocument,K=(j.body,t(c)),V=!1,W=t(s,j).addClass(k),X=W.find(".sp-picker-container"),G=W.find(".sp-color"),Q=W.find(".sp-dragger"),J=W.find(".sp-hue"),tt=W.find(".sp-slider"),et=W.find(".sp-alpha-inner"),nt=W.find(".sp-alpha"),it=W.find(".sp-alpha-handle"),rt=W.find(".sp-input"),ot=W.find(".sp-palette"),at=W.find(".sp-initial"),st=W.find(".sp-cancel"),lt=W.find(".sp-clear"),ct=W.find(".sp-choose"),ut=W.find(".sp-palette-toggle"),ht=K.is("input"),pt=ht&&"color"===K.attr("type")&&f(),dt=ht&&!b,ft=dt?t(a).addClass(k).addClass(C.className).addClass(C.replacerClassName):t([]),gt=dt?ft:K,mt=ft.find(".sp-preview-inner"),yt=C.color||ht&&K.val(),vt=!1,Ct=C.preferredFormat,bt=Ct,xt=!C.showButtons||C.clickoutFiresChange,Lt=!yt,kt=C.allowEmpty&&!pt;function wt(){if(C.showPaletteOnly&&(C.showPalette=!0),ut.text(C.showPaletteOnly?C.togglePaletteMoreText:C.togglePaletteLessText),C.palette){U=C.palette.slice(0),I=t.isArray(U[0])?U:[U],R={};for(var e=0;e1&&(delete window.localStorage[L],t.each(e,function(t,e){St(e)}))}catch(t){}try{Y=window.localStorage[L].split(";")}catch(t){}}}function St(e){if(x){var n=tinycolor(e).toRgbString();if(!R[n]&&-1===t.inArray(n,Y))for(Y.push(n);Y.length>Z;)Y.shift();if(L&&window.localStorage)try{window.localStorage[L]=Y.join(";")}catch(t){}}}function Mt(){var e=Ut(),n=t.map(I,function(t,n){return l(t,e,"sp-palette-row sp-palette-row-"+n,C)});_t(),Y&&n.push(l(function(){var t=[];if(C.showPalette)for(var e=0;el&&l>i?Math.abs(u.left+i-l):0),u.top-=Math.min(u.top,u.top+r>c&&c>r?Math.abs(r+o-0):0),u))),Yt(),C.showPalette&&Mt(),K.trigger("reflow.spectrum")}function qt(){Dt(),V=!0,K.attr("disabled",!0),gt.addClass("sp-disabled")}!function(){if(r&&W.find("*:not(input)").attr("unselectable","on"),wt(),dt&&K.after(ft).hide(),kt||lt.hide(),b)K.after(W).hide();else{var e="parent"===C.appendTo?K.parent():t(C.appendTo);1!==e.length&&(e=t("body")),e.append(W)}function n(e){return e.data&&e.data.ignore?(Ot(t(e.target).closest(".sp-thumb-el").data("color")),It()):(Ot(t(e.target).closest(".sp-thumb-el").data("color")),It(),Zt(!0),C.hideAfterPaletteSelect&&Dt()),!1}_t(),gt.bind("click.spectrum touchstart.spectrum",function(e){V||At(),e.stopPropagation(),t(e.target).is("input")||e.preventDefault()}),(K.is(":disabled")||!0===C.disabled)&&qt(),W.click(h),rt.change(Tt),rt.bind("paste",function(){setTimeout(Tt,1)}),rt.keydown(function(t){13==t.keyCode&&Tt()}),st.text(C.cancelText),st.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),$t(),Dt()}),lt.attr("title",C.clearText),lt.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),Lt=!0,It(),b&&Zt(!0)}),ct.text(C.chooseText),ct.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),r&&rt.is(":focus")&&rt.trigger("change"),rt.hasClass("sp-validation-error")||(Zt(!0),Dt())}),ut.text(C.showPaletteOnly?C.togglePaletteMoreText:C.togglePaletteLessText),ut.bind("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),C.showPaletteOnly=!C.showPaletteOnly,C.showPaletteOnly||b||W.css("left","-="+(X.outerWidth(!0)+5)),wt()}),d(nt,function(t,e,n){O=t/A,Lt=!1,n.shiftKey&&(O=Math.round(10*O)/10),It()},Et,Pt),d(J,function(t,e){N=parseFloat(e/T),Lt=!1,C.showAlpha||(O=1),It()},Et,Pt),d(G,function(t,e,n){if(n.shiftKey){if(!q){var i=D*F,r=E-$*E,o=Math.abs(t-i)>Math.abs(e-r);q=o?"x":"y"}}else q=null;var a=!q||"y"===q;(!q||"x"===q)&&(D=parseFloat(t/F)),a&&($=parseFloat((E-e)/E)),Lt=!1,C.showAlpha||(O=1),It()},Et,Pt),yt?(Ot(yt),Rt(),bt=Ct||tinycolor(yt).format,St(yt)):Rt(),b&&zt();var i=r?"mousedown.spectrum":"click.spectrum touchstart.spectrum";ot.delegate(".sp-thumb-el",i,n),at.delegate(".sp-thumb-el:nth-child(1)",i,{ignore:!0},n)}();var jt={show:zt,hide:Dt,toggle:At,reflow:Ht,option:function(n,i){return n===e?t.extend({},C):i===e?C[n]:(C[n]=i,void wt())},enable:function(){V=!1,K.attr("disabled",!1),gt.removeClass("sp-disabled")},disable:qt,offset:function(t){C.offset=t,Ht()},set:function(t){Ot(t),Zt()},get:Ut,destroy:function(){K.show(),gt.unbind("click.spectrum touchstart.spectrum"),W.remove(),ft.remove(),i[jt.id]=null},container:W};return jt.id=i.push(jt)-1,jt}function u(){}function h(t){t.stopPropagation()}function p(t,e){var n=Array.prototype.slice,i=n.call(arguments,2);return function(){return t.apply(e,i.concat(n.call(arguments)))}}function d(e,n,i,o){n=n||function(){},i=i||function(){},o=o||function(){};var a=document,s=!1,l={},c=0,u=0,h="ontouchstart"in window,p={};function d(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}function f(t){if(s){if(r&&a.documentMode<9&&!t.button)return g();var i=t.originalEvent&&t.originalEvent.touches&&t.originalEvent.touches[0],o=i&&i.pageX||t.pageX,p=i&&i.pageY||t.pageY,f=Math.max(0,Math.min(o-l.left,u)),m=Math.max(0,Math.min(p-l.top,c));h&&d(t),n.apply(e,[f,m,t])}}function g(){s&&(t(a).unbind(p),t(a.body).removeClass("sp-dragging"),setTimeout(function(){o.apply(e,arguments)},0)),s=!1}p.selectstart=d,p.dragstart=d,p["touchmove mousemove"]=f,p["touchend mouseup"]=g,t(e).bind("touchstart mousedown",function(n){(n.which?3==n.which:2==n.button)||s||!1!==i.apply(e,arguments)&&(s=!0,c=t(e).height(),u=t(e).width(),l=t(e).offset(),t(a).bind(p),t(a.body).addClass("sp-dragging"),f(n),d(n))})}function f(){return t.fn.spectrum.inputTypeColorSupport()}t.fn.spectrum=function(e,n){if("string"==typeof e){var r=this,o=Array.prototype.slice.call(arguments,1);return this.each(function(){var n=i[t(this).data("spectrum.id")];if(n){var a=n[e];if(!a)throw new Error("Spectrum: no such method: '"+e+"'");"get"==e?r=n.get():"container"==e?r=n.container:"option"==e?r=n.option.apply(n,o):"destroy"==e?(n.destroy(),t(this).removeData("spectrum.id")):a.apply(n,o)}}),r}return this.spectrum("destroy").each(function(){var n=c(this,t.extend({},e,t(this).data()));t(this).data("spectrum.id",n.id)})},t.fn.spectrum.load=!0,t.fn.spectrum.loadOpts={},t.fn.spectrum.draggable=d,t.fn.spectrum.defaults=n,t.fn.spectrum.inputTypeColorSupport=function e(){if(void 0===e._cachedResult){var n=t("")[0];e._cachedResult="color"===n.type&&""!==n.value}return e._cachedResult},t.spectrum={},t.spectrum.localization={},t.spectrum.palettes={},t.fn.spectrum.processNativeColorInputs=function(){var e=t("input[type=color]");e.length&&!f()&&e.spectrum({preferredFormat:"hex6"})},function(){var t=/^[\s,#]+/,e=/\s+$/,n=0,i=Math,r=i.round,o=i.min,a=i.max,s=i.random,l=function(s,c){if(s=s||"",c=c||{},s instanceof l)return s;if(!(this instanceof l))return new l(s,c);var u=function(n){var r={r:0,g:0,b:0},s=1,l=!1,c=!1;"string"==typeof n&&(n=function(n){n=n.replace(t,"").replace(e,"").toLowerCase();var i,r=!1;if(S[n])n=S[n],r=!0;else if("transparent"==n)return{r:0,g:0,b:0,a:0,format:"name"};if(i=$.rgb.exec(n))return{r:i[1],g:i[2],b:i[3]};if(i=$.rgba.exec(n))return{r:i[1],g:i[2],b:i[3],a:i[4]};if(i=$.hsl.exec(n))return{h:i[1],s:i[2],l:i[3]};if(i=$.hsla.exec(n))return{h:i[1],s:i[2],l:i[3],a:i[4]};if(i=$.hsv.exec(n))return{h:i[1],s:i[2],v:i[3]};if(i=$.hsva.exec(n))return{h:i[1],s:i[2],v:i[3],a:i[4]};if(i=$.hex8.exec(n))return{a:(o=i[1],T(o)/255),r:T(i[2]),g:T(i[3]),b:T(i[4]),format:r?"name":"hex8"};var o;if(i=$.hex6.exec(n))return{r:T(i[1]),g:T(i[2]),b:T(i[3]),format:r?"name":"hex"};if(i=$.hex3.exec(n))return{r:T(i[1]+""+i[1]),g:T(i[2]+""+i[2]),b:T(i[3]+""+i[3]),format:r?"name":"hex"};return!1}(n));"object"==typeof n&&(n.hasOwnProperty("r")&&n.hasOwnProperty("g")&&n.hasOwnProperty("b")?(u=n.r,h=n.g,p=n.b,r={r:255*E(u,255),g:255*E(h,255),b:255*E(p,255)},l=!0,c="%"===String(n.r).substr(-1)?"prgb":"rgb"):n.hasOwnProperty("h")&&n.hasOwnProperty("s")&&n.hasOwnProperty("v")?(n.s=z(n.s),n.v=z(n.v),r=function(t,e,n){t=6*E(t,360),e=E(e,100),n=E(n,100);var r=i.floor(t),o=t-r,a=n*(1-e),s=n*(1-o*e),l=n*(1-(1-o)*e),c=r%6;return{r:255*[n,s,a,a,l,n][c],g:255*[l,n,n,s,a,a][c],b:255*[a,a,l,n,n,s][c]}}(n.h,n.s,n.v),l=!0,c="hsv"):n.hasOwnProperty("h")&&n.hasOwnProperty("s")&&n.hasOwnProperty("l")&&(n.s=z(n.s),n.l=z(n.l),r=function(t,e,n){var i,r,o;function a(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}if(t=E(t,360),e=E(e,100),n=E(n,100),0===e)i=r=o=n;else{var s=n<.5?n*(1+e):n+e-n*e,l=2*n-s;i=a(l,s,t+1/3),r=a(l,s,t),o=a(l,s,t-1/3)}return{r:255*i,g:255*r,b:255*o}}(n.h,n.s,n.l),l=!0,c="hsl"),n.hasOwnProperty("a")&&(s=n.a));var u,h,p;return s=F(s),{ok:l,format:n.format||c,r:o(255,a(r.r,0)),g:o(255,a(r.g,0)),b:o(255,a(r.b,0)),a:s}}(s);this._originalInput=s,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=r(100*this._a)/100,this._format=c.format||u.format,this._gradientType=c.gradientType,this._r<1&&(this._r=r(this._r)),this._g<1&&(this._g=r(this._g)),this._b<1&&(this._b=r(this._b)),this._ok=u.ok,this._tc_id=n++};function c(t,e,n){t=E(t,255),e=E(e,255),n=E(n,255);var i,r,s=a(t,e,n),l=o(t,e,n),c=(s+l)/2;if(s==l)i=r=0;else{var u=s-l;switch(r=c>.5?u/(2-s-l):u/(s+l),s){case t:i=(e-n)/u+(e>1)+720)%360;--e;)i.h=(i.h+r)%360,o.push(l(i));return o}function _(t,e){e=e||6;for(var n=l(t).toHsv(),i=n.h,r=n.s,o=n.v,a=[],s=1/e;e--;)a.push(l({h:i,s:r,v:o})),o=(o+s)%1;return a}l.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},setAlpha:function(t){return this._a=F(t),this._roundA=r(100*this._a)/100,this},toHsv:function(){var t=u(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=u(this._r,this._g,this._b),e=r(360*t.h),n=r(100*t.s),i=r(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+i+"%)":"hsva("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=c(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=c(this._r,this._g,this._b),e=r(360*t.h),n=r(100*t.s),i=r(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+i+"%)":"hsla("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return h(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return p(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:r(this._r),g:r(this._g),b:r(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+r(this._r)+", "+r(this._g)+", "+r(this._b)+")":"rgba("+r(this._r)+", "+r(this._g)+", "+r(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:r(100*E(this._r,255))+"%",g:r(100*E(this._g,255))+"%",b:r(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+r(100*E(this._r,255))+"%, "+r(100*E(this._g,255))+"%, "+r(100*E(this._b,255))+"%)":"rgba("+r(100*E(this._r,255))+"%, "+r(100*E(this._g,255))+"%, "+r(100*E(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(M[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+p(this._r,this._g,this._b,this._a),n=e,i=this._gradientType?"GradientType = 1, ":"";t&&(n=l(t).toHex8String());return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,i=this._a<1&&this._a>=0;return e||!i||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"name"!==t?("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(f,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(C,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(_,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(x,arguments)},tetrad:function(){return this._applyCombination(L,arguments)}},l.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&(n[i]="a"===i?t[i]:z(t[i]));t=n}return l(t,e)},l.equals=function(t,e){return!(!t||!e)&&l(t).toRgbString()==l(e).toRgbString()},l.random=function(){return l.fromRatio({r:s(),g:s(),b:s()})},l.mix=function(t,e,n){n=0===n?0:n||50;var i,r=l(t).toRgb(),o=l(e).toRgb(),a=n/100,s=2*a-1,c=o.a-r.a,u=1-(i=((i=s*c==-1?s:(s+c)/(1+s*c))+1)/2),h={r:o.r*i+r.r*u,g:o.g*i+r.g*u,b:o.b*i+r.b*u,a:o.a*a+r.a*(1-a)};return l(h)},l.readability=function(t,e){var n=l(t),i=l(e),r=n.toRgb(),o=i.toRgb(),a=n.getBrightness(),s=i.getBrightness(),c=Math.max(r.r,o.r)-Math.min(r.r,o.r)+Math.max(r.g,o.g)-Math.min(r.g,o.g)+Math.max(r.b,o.b)-Math.min(r.b,o.b);return{brightness:Math.abs(a-s),color:c}},l.isReadable=function(t,e){var n=l.readability(t,e);return n.brightness>125&&n.color>500},l.mostReadable=function(t,e){for(var n=null,i=0,r=!1,o=0;o125&&a.color>500,c=a.brightness/125*3+a.color/500;(s&&!r||s&&r&&c>i||!s&&!r&&c>i)&&(r=s,i=c,n=l(e[o]))}return n};var S=l.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},M=l.hexNames=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(S);function F(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var n=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=o(e,a(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),i.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function P(t){return o(1,a(0,t))}function T(t){return parseInt(t,16)}function A(t){return 1==t.length?"0"+t:""+t}function z(t){return t<=1&&(t=100*t+"%"),t}var B,N,D,$=(N="[\\s|\\(]+("+(B="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+B+")[,|\\s]+("+B+")\\s*\\)?",D="[\\s|\\(]+("+B+")[,|\\s]+("+B+")[,|\\s]+("+B+")[,|\\s]+("+B+")\\s*\\)?",{rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+D),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+D),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+D),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});window.tinycolor=l}(),t(function(){t.fn.spectrum.load&&t.fn.spectrum.processNativeColorInputs()})});var YCEllipse=function(t){"use strict";var e=0,n=function(t){this.x=0,this.y=0,this.rx=void 0!==t.rx?t.rx:100,this.ry=void 0!==t.ry?t.ry:100,this.translate=[t.x,t.y],this.rotate=0,this.scale=1,this.editor=null,this.figure=null,this.selectionShape=null,this.backSelectionShape=null,this.id="ellipse"+e++,this.handles=[],this.actions=["point_move"],this.line=d3.svg.line(),this.elementType="ellipse",this.prop_color="#000000",this.prop_color2="#000000",this.prop_lineStyle="solid",this.prop_stroke=2,this.prop_opacity=1,this.prop_bgOpacity=.25,void 0!==t.rotate&&(this.rotate=t.rotate),void 0!==t.scale&&(this.scale=t.scale),void 0!==t.translate&&(this.translate=t.translate),void 0!==t.rx&&(this.rx=t.rx),void 0!==t.ry&&(this.ry=t.ry),void 0!==t.color&&(this.prop_color=t.color),void 0!==t.color2&&(this.prop_color2=t.color2),void 0!==t.lineStyle&&(this.prop_lineStyle=t.lineStyle),void 0!==t.stroke&&(this.prop_stroke=t.stroke),void 0!==t.opacity&&(this.prop_opacity=t.opacity),void 0!==t.bgOpacity&&(this.prop_bgOpacity=t.bgOpacity),this.keyFrames={},void 0!==t.keyFrames?this.keyFrames=t.keyFrames:this.storeKeyFrame(0)};return n.prototype.elementProperties=function(){return["color","color2","opacity","bgOpacity","stroke","lineStyle"]},n.prototype.toModel=function(){var t=this.editor.toModelHelper(this);t.type=this.elementType;for(var e=["rx","ry","rotate","scale"],n=0;ne&&(e=n);var i=this.keyFrames[e],r=i.x-this.translate[0],o=i.y-this.translate[1];i.rotate,this.rotate;this.move(r,o,!1,0,!1),this.rotate=i.rotate,this.figure.attr("transform",this.getTransformation()),this.ellipseDeform(i.rx,i.ry,!1,!1),this.updateSelectionShape()},n.prototype.storeKeyFrame=function(t){void 0===t&&(t=this.editor.timeline.currentKeyFrameTime),this.keyFrames.hasOwnProperty(t)||(void 0!==this.editor&&null!=this.editor&&this.editor.addKeyframe(),this.keyFrames[t]={x:0,y:0,scale:1}),this.keyFrames[t].x=this.translate[0],this.keyFrames[t].y=this.translate[1],this.keyFrames[t].rx=this.rx,this.keyFrames[t].ry=this.ry,this.keyFrames[t].scale=this.scale,this.keyFrames[t].rotate=this.rotate},n.prototype.animate=function(t,e,n){var i=this.editor.calculateTransformation(e),r=this.editor.calculateTransformation(n),o=this.figure,a=this.figure.selectAll("ellipse.ellipse_line");this.editor.timeline.animatedDataFrames.push(o),this.editor.timeline.animatedDataFrames.push(a),o.attr("transform",i).transition().duration(t).ease("linear").attr("transform",r),a.attr("rx",e.rx).attr("rx",e.rx).attr("ry",e.ry).transition().duration(t).ease("linear").attr("rx",n.rx).attr("ry",n.ry)},n}(jQuery),YCFigure=function(t){"use strict";var e=0,n=function(n){this.x=0,this.y=0,this.width=n.width,this.height=n.height,this.fillImage=void 0===n.fillImage?null:n.fillImage,this.svg=n.svg,this.editor=null,this.figure=null,this.selectionShape=null,this.id="figure"+e++,this.translate=[n.x,n.y],this.rotate=0;var i="figure";void 0===n.elementType?("undefined"!==n.svg&&-1!=n.svg.indexOf("materials")&&(i="materials"),this.elementType=i):this.elementType=n.elementType,this.scale=1,this.originaleScale=1,this.handles=[],this.actions=["rotate","move","resize"],this.mainFigureContainer,this.mainFigureContainerTransformation,this.mainFigureContainerTransformationScale=1,void 0!==n.rotate&&(this.rotate=n.rotate),void 0!==n.scale&&(this.scale=n.scale,this.originaleScale=n.scale),void 0!==n.translate&&(this.translate=n.translate),this.prop_color=null,void 0!==n.color&&(this.prop_color=n.color),this.prop_color2=null,void 0!==n.color2&&(this.prop_color2=n.color2),this.prop_uniform={type:"f",c1:this.prop_color,c2:this.prop_color2,c3:this.prop_color2,c4:this.prop_color2},void 0!==n.uniform&&(this.prop_uniform=t.extend({},this.prop_uniform,n.uniform)),this.prop_opacity=1,void 0!==n.opacity&&(this.prop_opacity=n.opacity),this.prop_flip=0,void 0!==n.flip&&(this.prop_flip=parseFloat(n.flip)),this.prop_skin="#D3AB9B",void 0!==n.skin&&(this.prop_skin=n.skin),this.prop_hair="#000000",void 0!==n.hair&&(this.prop_hair=n.hair),this.keyFrames={},void 0!==n.keyFrames?this.keyFrames=n.keyFrames:this.storeKeyFrame(0)};return n.prototype.toModel=function(){for(var t=this.editor.toModelHelper(this),e=["width","height","svg","elementType"],n=0;ne&&(e=n);var i=this.keyFrames[e];this.scale=i.scale,this.rotate=i.rotate,this.translate[0]=i.x,this.translate[1]=i.y,this.prop_opacity=i.prop_opacity,this.figure.attr("opacity",this.prop_opacity).attr("transform",this.getTransformation(!0))},n.prototype.animate=function(t,e,n){var i=this.editor.calculateTransformation(e),r=this.editor.calculateTransformation(n),o=this.figure;this.editor.timeline.animatedDataFrames.push(o),o.attr("transform",i).attr("opacity",e.prop_opacity).transition().ease("linear").duration(t).attr("transform",r).attr("opacity",n.prop_opacity)},n}(jQuery),YCDisc=function(t,e){"use strict";var n=function(t){e.call(this,t),this.number=t.number,this.elementType="discs",this.prop_textlabel=void 0===t.textlabel?"":t.textlabel};return(n.prototype=Object.create(e.prototype,{})).create=function(t){e.prototype.create.apply(this,[t])},n.prototype.creationCallback=function(){t(".disc_text",this.figure.node()).text(this.prop_textlabel),t(".yc-color-1",this.figure.node()).attr("fill",this.prop_color),t(".yc-color-2",this.figure.node()).attr("fill",this.prop_color2)},n.prototype.toModel=function(t){var n=e.prototype.toModel.apply(this,[]);return n.type="disc",n},n.prototype.elementProperties=function(){return["color","color2","opacity","textlabel"]},n.prototype.elementProperty=function(n,i){if(void 0===i)return"textlabel"==n?this.prop_textlabel:e.prototype.elementProperty.apply(this,[n]);"textlabel"==n?(this.prop_textlabel=i,t(".disc_text",this.figure.node()).text(this.prop_textlabel)):e.prototype.elementProperty.apply(this,[n,i])},n.prototype.constructor=n,n}(jQuery,YCFigure),YCHandle=function(t){"use strict";var e=function(t){this.x=t.x,this.y=t.y,this.editor=null,this.group=t.group,this.command=t.command,this.figure=null,this.parentElement=t.parentElement,this.id=t.id,this.translate=[0,0],this.rotate=0,this.scale=1,this.parentFigureCenter=[0,0],this.shape=void 0!==t.shape?t.shape:"",this.undoOperation=[]};return e.prototype.create=function(e){var n=this;this.editor=e;var i=parseFloat(this.x),r=parseFloat(this.y);if("resize-se"===this.command||"resize-ne"===this.command||"resize-sw"===this.command||"resize-nw"===this.command||"move_point"===this.command&&"square"===this.shape){var o=10/this.editor.zoom/this.parentElement.scale;this.figure=this.group.append("rect").attr("id",this.id).attr("x",i-o/2).attr("y",r-o/2).attr("width",o).attr("height",o).attr("fill","#1388d8").attr("stroke-width",2/this.editor.zoom/this.parentElement.scale).attr("stroke","#ffffff").attr("class",this.getCursorClass()+" "+this.command+" editor-handler")}else this.figure=this.group.append("circle").attr("cx",i).attr("cy",r).attr("id",this.id).attr("r",5/this.editor.zoom/this.parentElement.scale).attr("fill","#1388d8").attr("stroke-width",2/this.editor.zoom/this.parentElement.scale).attr("stroke","#ffffff").attr("class",this.getCursorClass()+" "+this.command+" editor-handler");t(this.figure[0]).data("handle-elemet",n),t(this.figure[0]).on("mousedown touchstart",function(t){n.editor.mouseDown(t,n)})},e.prototype.getTransformation=function(){var t="";return 0==this.translate[0]&&0==this.translate[1]||(t+="translate("+this.translate[0]+","+this.translate[1]+") "),t},e.prototype.handleMove=function(e){var n=this;e.figureCenter=this.parentFigureCenter,t.each(this.editor.currentSelection,function(t){this.handleMove(n,e)}),this.updateHandle()},e.prototype.updateHandle=function(t){void 0===t&&(t=!1),this.r=5/this.editor.zoom/this.parentElement.scale,"resize-se"===this.command||"resize-ne"===this.command||"resize-sw"===this.command||"resize-nw"===this.command||"move_point"===this.command&&"square"===this.shape?this.figure.attr("width",2*this.r).attr("height",2*this.r).attr("x",this.x-this.r).attr("y",this.y-this.r):(this.r=5/this.editor.zoom/this.parentElement.scale,this.figure.attr("r",this.r),t?this.figure.transition().attr("cx",this.x).attr("cy",this.y):this.figure.attr("cx",this.x).attr("cy",this.y)),this.figure.attr("stroke-width",2/this.editor.zoom/this.parentElement.scale).attr("transform",this.getTransformation())},e.prototype.select=function(){return null},e.prototype.unselect=function(){},e.prototype.getCursorClass=function(){return"cursor-"+this.command},e.prototype.startMove=function(e,n){var i=this;this.undoOperation={command:this.command,elements:[],elementsNew:[]},t.each(this.editor.currentSelection,function(t){var e={id:this.id,rotate:this.rotate,scale:this.scale,fontSize:this.elementProperty("fontSize"),newRotate:this.rotate,newScale:this.scale,newFontSize:this.elementProperty("fontSize"),x:i.x,y:i.y,shift:n.originalEvent.shiftKey};if("ellipse"===this.elementType)e.rx=this.rx,e.ry=this.ry;else if("polygon"===this.elementType){e.points=[];for(t=0;tn&&(n=i);var r=this.keyFrames[n];this.points=t.extend(!0,[],r.points),this.redraw(!1),this.updateSelectionShape(!1)},n.prototype.redraw=function(e){var n=this,i=this.figure.selectAll("path.arrow_line").data([this.points]);i.enter().append("path").attr("class","arrow_line"),i.attr("fill","none"),"normal"===this.prop_lineType?this.applyLineStyle(i):i.attr("stroke-opacity",0);var r=i.attr("d");i.attr("d",this.line),this.drawLine(i,e,r);var o=[];this.arrowSize=Math.max(10,"double"===this.prop_lineType?this.prop_linesOffset/2:10),"arrow-right"!=this.prop_arrowStyle&&"arrow-left-right"!=this.prop_arrowStyle||o.push(this.trianglePath(this.points[this.points.length-2],this.points[this.points.length-1],this.arrowSize)),"arrow-left"!=this.prop_arrowStyle&&"arrow-left-right"!=this.prop_arrowStyle||o.push(this.trianglePath(this.points[1],this.points[0],this.arrowSize));var a=this.figure.selectAll("path.arrow_triangle").data(o);a.enter().append("path").attr("class","arrow_triangle editor-handler"),a.attr("fill",this.prop_color).attr("stroke","none").call(function(e){t(e).each(function(){t(this).data("handle-elemet",n)})}),e?a.transition().attr("d",this.controlLine):a.attr("d",this.controlLine),a.exit().remove()},n.prototype.applyLineStyle=function(t){t.attr("stroke-width",this.prop_stroke).attr("stroke",this.prop_color).attr("fill","none"),"solid"==this.prop_lineStyle?t.attr("stroke-dasharray",null):"dotted"==this.prop_lineStyle?t.attr("stroke-dasharray",this.prop_stroke+","+this.prop_stroke):"dashed"==this.prop_lineStyle?t.attr("stroke-dasharray",3*this.prop_stroke+","+3*this.prop_stroke):"doubled"==this.prop_lineStyle&&t.attr("stroke-dasharray",null)},n.prototype.drawLine=function(t,e,n){"waves"===this.prop_lineType?this.drawWaves(t,this.prop_waveAmplitude,this.prop_waveFrequency):"double"===this.prop_lineType?this.drawOffset3(t,this.prop_linesOffset,e):e&&(t.attr("d",function(t){return n}),t.transition().attr("d",this.line))},n.prototype.drawWaves=function(t,e,n){e<10&&(e=null);for(var i=t.node(),r=i.getTotalLength(),o=i.getPointAtLength(r),a=parseInt(r/n,10),s=r/a,l=(d3.svg.line(),d3.svg.line().interpolate("basis"),[]),c=0;c<=a;++c){var u=i.getPointAtLength(c*s);l.push(u)}var h=[];for(c=0;c=e.length?"#FF00FF":"#FF0000"}),m.exit().remove();var y=this.figure.selectAll("path.shifted_control_lines").data([e,n]);y.enter().append("path").attr("class","shifted_control_lines"),y.attr("d",i).attr("fill","none").attr("stroke",function(t,e){return e>0?"#FF00FF":"#FF0000"}),y.exit().remove();var v=this.figure.selectAll("path.shifted_control_splines").data([e,n]);v.enter().append("path").attr("class","shifted_control_splines"),v.attr("d",r).attr("fill","none").attr("stroke",function(t,e){return e>0?"#FF00FF":"#FF0000"}),v.exit().remove()},n.prototype.drawOffset2=function(t,e){for(var n=t.node(),i=n.getTotalLength(),r=(d3.svg.line(),d3.svg.line().interpolate("basis"),parseInt(i/.5,10)),o=i/r,a=[],s=0;s<=r;++s){var l=n.getPointAtLength(s*o);a.push(l)}var c=[];for(s=0;s1){var d=p[n?2:1],f=o[o.length-1],g=o[o.length-2];this.vectorAngle(this.mkp(d),this.mkp(f),this.mkp(g))*(180/Math.PI)>179?(o.splice(s.length-1,1),a=2):a=.1}o.push(p[n?2:1])}var m="M "+o[0][0]+","+o[0][1];for(h=1;h2&&(0==a&&(this.points[1][0]+=t*r,this.points[1][1]+=e*o),a==this.points.length-1&&(this.points[this.points.length-2][0]+=t*r,this.points[this.points.length-2][1]+=e*o)),this.redraw(i);break}this.storeKeyFrame(),this.updateSelectionShape(i)},n.prototype.handleMove=function(t,e){this.movePoint(e.dx,e.dy,t.id,!1)},n.prototype.select=function(){var e=this;if(null===this.selectionShape){this.selectionShape=this.editor.selectionLayer.append("g").attr("id",this.id+"_sel").attr("transform",this.getTransformation()),this.backSelectionShape=this.editor.backSelectionLayer.append("g").attr("id",this.id+"_sel_back").attr("transform",this.getTransformation());var n=5/this.editor.zoom/this.scale,i=this.backSelectionShape.append("path").datum(this.points).attr("id",this.id+"_sel_path").attr("stroke-width",this.prop_stroke+4/this.editor.zoom).attr("stroke",e.editor.getSelectionShapeStrokeColor()).attr("stroke-opacity","0.5").attr("fill","none").attr("d",this.line);this.points.length>2&&(this.selectionShape.append("path").attr("id",this.id+"_sel_control_line_1").attr("stroke-width",2/this.editor.zoom/this.scale).attr("stroke","#666").attr("stroke-dasharray",n+","+n).attr("d",this.controlLine([this.points[0],this.points[1]])),this.selectionShape.append("path").attr("id",this.id+"_sel_control_line_2").attr("stroke-width",2/this.editor.zoom/this.scale).attr("stroke","#666").attr("stroke-dasharray",n+","+n).attr("d",this.controlLine([this.points[this.points.length-2],this.points[this.points.length-1]])));for(var r=[],o=0;o2&&(this.selectionShape.selectAll("#"+this.id+"_sel_control_line_1").transition().attr("d",this.controlLine([this.points[0],this.points[1]])),this.selectionShape.selectAll("#"+this.id+"_sel_control_line_2").transition().attr("d",this.controlLine([this.points[this.points.length-2],this.points[this.points.length-1]])))):(this.backSelectionShape.selectAll("#"+this.id+"_sel_path").attr("d",this.line(this.points)),this.points.length>2&&(this.selectionShape.selectAll("#"+this.id+"_sel_control_line_1").attr("d",this.controlLine([this.points[0],this.points[1]])),this.selectionShape.selectAll("#"+this.id+"_sel_control_line_2").attr("d",this.controlLine([this.points[this.points.length-2],this.points[this.points.length-1]]))));this.figure.node().getBBox();for(var n=0;ne&&(e=n);var i=this.keyFrames[e],r=i.x-this.translate[0],o=i.y-this.translate[1];this.move(r,o,!1,0,!1),this.rotate=i.rotate,this.scale=i.scale,this.figure.attr("transform",this.getTransformation()),this.prop_opacity=i.prop_opacity,this.redraw(),this.updateSelectionShape()},n.prototype.storeKeyFrame=function(t){void 0===t&&(t=this.editor.timeline.currentKeyFrameTime),this.keyFrames.hasOwnProperty(t)||(void 0!==this.editor&&null!=this.editor&&this.editor.addKeyframe(),this.keyFrames[t]={x:0,y:0,scale:1}),this.keyFrames[t].x=this.translate[0],this.keyFrames[t].y=this.translate[1],this.keyFrames[t].scale=this.scale,this.keyFrames[t].rotate=this.rotate,this.keyFrames[t].prop_opacity=this.prop_opacity},n.prototype.animate=function(t,e,n){var i=this,r=i.editor.calculateTransformation(e),o=i.editor.calculateTransformation(n),a=d3.select(e),s=this.figure;this.editor.timeline.animatedDataFrames.push(a),this.editor.timeline.animatedDataFrames.push(s),a.transition().duration(t).tween("attr:transform",function(){var t=d3.interpolateString(r,o);return function(e){i.figure.attr("transform",t(e))}}),s.attr("opacity",e.prop_opacity).transition().ease("linear").duration(t).attr("opacity",n.prop_opacity)},n}(jQuery),YCPolygon=function(t){"use strict";var e=0,n=function(t){this.points=t.points,this.x=t.x,this.y=t.y,this.translate=[0,0],this.rotate=0,this.scale=1,this.editor=null,this.figure=null,this.selectionShape=null,this.backSelectionShape=null,this.id="polygon"+e++,this.handles=[],this.actions=["point_move"],this.line=d3.svg.line(),this.elementType="polygon",this.prop_color="#000000",this.prop_color2="#000000",this.prop_lineStyle="solid",this.prop_stroke=2,this.prop_opacity=1,this.prop_bgOpacity=.25,void 0!==t.rotate&&(this.rotate=t.color),void 0!==t.scale&&(this.scale=t.scale),void 0!==t.translate&&(this.translate=t.translate),void 0!==t.color&&(this.prop_color=t.color),void 0!==t.color2&&(this.prop_color2=t.color2),void 0!==t.lineStyle&&(this.prop_lineStyle=t.lineStyle),void 0!==t.stroke&&(this.prop_stroke=t.stroke),void 0!==t.opacity&&(this.prop_opacity=t.opacity),void 0!==t.bgOpacity&&(this.prop_bgOpacity=t.bgOpacity),this.keyFrames={},void 0!==t.keyFrames?this.keyFrames=t.keyFrames:this.storeKeyFrame(0)};return n.prototype.toModel=function(){var e=this.editor.toModelHelper(this);return e.points=t.extend(!0,[],this.keyFrames[0].points),e.x=this.translate[0],e.y=this.translate[1],e},n.prototype.elementProperties=function(){return["color","color2","opacity","bgOpacity","stroke","lineStyle"]},n.prototype.elementProperty=function(t,e){if(void 0===e)return"color"===t?this.prop_color:"color2"===t?this.prop_color2:"lineStyle"===t?this.prop_lineStyle:"stroke"===t?this.prop_stroke:"opacity"===t?this.prop_opacity:"bgOpacity"===t?this.prop_bgOpacity:null;"color"===t?this.prop_color=e:"color2"===t?this.prop_color2=e:"opacity"===t?this.prop_opacity=parseFloat(e):"bgOpacity"===t?this.prop_bgOpacity=parseFloat(e):"stroke"===t?this.prop_stroke=parseFloat(e):"lineStyle"===t&&(this.prop_lineStyle=e),this.redraw(),this.updateSelectionShape()},n.prototype.create=function(e){var n=this;this.editor=e,this.figure=this.editor.elementsLayer.append("g").attr("id",this.id),this.redraw(),t(this.figure[0]).on("mousedown touchstart",function(t){n.editor.mouseDown(t,n)})},n.prototype.getTransformation=function(t){return""},n.prototype.polygonDeform=function(t,e,n){void 0===e&&(e=!0),void 0===n&&(n=!0),this.points=t.slice(0),n&&this.storeKeyFrame(),this.redraw(e),this.updateSelectionShape(e)},n.prototype.redraw=function(t){var e=this,n=this.figure.selectAll("path.polygon_line").data([this.points]);n.enter().append("path").attr("class","polygon_line"),n.attr("stroke",this.prop_color).attr("stroke-width",this.prop_stroke).attr("stroke-opacity",this.prop_opacity).attr("fill",this.prop_color2).attr("fill-opacity",this.prop_bgOpacity),"solid"==this.prop_lineStyle?n.attr("stroke-dasharray",null):"dotted"==this.prop_lineStyle?n.attr("stroke-dasharray",this.prop_stroke+","+this.prop_stroke):"dashed"==this.prop_lineStyle?n.attr("stroke-dasharray",3*this.prop_stroke+","+3*this.prop_stroke):"doubled"==this.prop_lineStyle&&n.attr("stroke-dasharray",null),t?n.transition().attr("d",function(t){return e.line(t)+"Z"}):n.attr("d",function(t){return e.line(t)+"Z"}),n.exit().remove()},n.prototype.move=function(t,e,n,i){void 0===n&&(n=!1),void 0===i&&(i=!0);for(var r=0;ry-5||v<5){f=Math.round(f/y)*y;var C=[[[o.figureCenter.x,o.figureCenter.y+g],[o.figureCenter.x,o.figureCenter.y-g]],[[o.figureCenter.x-g,o.figureCenter.y],[o.figureCenter.x+g,o.figureCenter.y]]],b=this.editor.feedbackLayer.selectAll("path.SpecialEffectAlignment").data(C);b.enter().append("path").attr("class","SpecialEffectAlignment"),b.attr("stroke-width",1*s).attr("stroke-dasharray","5, 5, 1, 5").attr("stroke","#FF0000").attr("opacity",1).attr("d",this.line),b.transition().attr("opacity",0)}}var x=f;for(u=0;un&&(n=i);var r=this.keyFrames[n],o=r.x-this.translate[0],a=r.y-this.translate[1],s=r.scale-this.scale,l=r.rotate-this.rotate;this.move(o,a,!1,0,!1),this.scaleOf(s,!1,!1),this.rotateOf(l,!1,!1),this.polygonDeform(t.extend(!0,[],r.points),!1,!1)},n.prototype.storeKeyFrame=function(e){void 0===e&&(e=this.editor.timeline.currentKeyFrameTime),this.keyFrames.hasOwnProperty(e)||(void 0!==this.editor&&null!=this.editor&&this.editor.addKeyframe(),this.keyFrames[e]={x:0,y:0,scale:1}),this.keyFrames[e].x=this.translate[0],this.keyFrames[e].y=this.translate[1],this.keyFrames[e].scale=this.scale,this.keyFrames[e].rotate=this.rotate,this.keyFrames[e].points=t.extend(!0,[],this.points)},n.prototype.animate=function(t,e,n){var i=this.figure.selectAll("path.polygon_line");this.editor.timeline.animatedDataFrames.push(i),i.attr("d",this.line(e.points)+"Z").transition().duration(t).ease("linear").attr("d",this.line(n.points)+"Z")},n}(jQuery),YCTeamPlayer=function(t){"use strict";var e=0,n=function(n){this.x=0,this.y=0,this.translate=[n.x,n.y],this.rotate=0,this.scale=1,this.editor=null,this.figure=null,this.selectionShape=null,this.backSelectionShape=null,this.id="teamPlayer"+e++,this.handles=[],this.actions=["point_move"],this.line=d3.svg.line(),this.elementType="team_player",this.prop_color="#000000",this.prop_color2="#FFFFFF",this.prop_opacity=1,this.playerName=n.playerName,this.playerDisplayName=t("").html(n.playerDisplayName).text(),this.playerImage=n.playerImage,this.playerUniform=n.playerUniform,this.playerNumber=n.playerNumber,this.patternId=null,this.svgContent=void 0!==n.svgContent&&""!=n.svgContent?n.svgContent:null,void 0!==n.rotate&&(this.rotate=n.rotate),void 0!==n.scale&&(this.scale=n.scale),void 0!==n.translate&&(this.translate=n.translate),void 0!==n.color&&(this.prop_color=n.color),void 0!==n.color2&&(this.prop_color2=n.color2),void 0!==n.opacity&&(this.prop_opacity=n.opacity),this.keyFrames={},void 0!==n.keyFrames?this.keyFrames=n.keyFrames:this.storeKeyFrame(0)};return n.prototype.elementProperties=function(){return["color","color2","opacity"]},n.prototype.toModel=function(){var t=this.editor.toModelHelper(this);t.type=this.elementType;for(var e=["scale"],n=0;n").html(this.playerName).text().toUpperCase().split(" "),a=0;ae&&(e=n);var i=this.keyFrames[e],r=i.x-this.translate[0],o=i.y-this.translate[1];i.rotate,this.rotate;this.move(r,o,!1,0,!1),this.rotate=i.rotate,this.figure.attr("transform",this.getTransformation()),this.updateSelectionShape()},n.prototype.storeKeyFrame=function(t){void 0===t&&(t=this.editor.timeline.currentKeyFrameTime),this.keyFrames.hasOwnProperty(t)||(void 0!==this.editor&&null!=this.editor&&this.editor.addKeyframe(),this.keyFrames[t]={x:0,y:0,scale:1}),this.keyFrames[t].x=this.translate[0],this.keyFrames[t].y=this.translate[1],this.keyFrames[t].scale=this.scale,this.keyFrames[t].rotate=this.rotate},n.prototype.animate=function(t,e,n){var i=this.editor.calculateTransformation(e),r=this.editor.calculateTransformation(n),o=this.figure,a=this.figure.selectAll("ellipse.ellipse_line");this.editor.timeline.animatedDataFrames.push(o),this.editor.timeline.animatedDataFrames.push(a),o.attr("transform",i).transition().duration(t).ease("linear").attr("transform",r)},n}(jQuery),YCText=function(t){"use strict";var e=0,n=function(t){this.x=0,this.y=0,this.d=t.d,this.editor=null,this.figure=null,this.selectionShape=null,this.id="text"+e++,this.elementType="text",this.translate=[t.x,t.y],this.rotate=0,this.scale=1,this.handles=[],this.actions=["rotate","move","resize"],this.line_spacing=1.1,this.prop_color="#000000",this.prop_color2="#000000",this.prop_opacity=1,this.prop_bgOpacity=.25,this.prop_text="Text",this.prop_fontSize="24",void 0!==t.rotate&&(this.rotate=t.rotate),void 0!==t.scale&&(this.scale=t.scale),void 0!==t.color&&(this.prop_color=t.color),void 0!==t.color2&&(this.prop_color2=t.color2),void 0!==t.opacity&&(this.prop_opacity=t.opacity),void 0!==t.bgOpacity&&(this.prop_bgOpacity=t.bgOpacity),void 0!==t.text&&(this.prop_text=t.text),void 0!==t.fontSize&&(this.prop_fontSize=t.fontSize),this.keyFrames={},void 0!==t.keyFrames?this.keyFrames=t.keyFrames:this.storeKeyFrame(0)};return n.prototype.toModel=function(){return this.editor.toModelHelper(this)},n.prototype.elementProperties=function(){return["color","color2","opacity","bgOpacity","text","fontSize"]},n.prototype.elementProperty=function(e,n,i){if(void 0===i&&(i=!1),void 0===n)return"color"==e?this.prop_color:"color2"==e?this.prop_color2:"opacity"==e?this.prop_opacity:"bgOpacity"==e?this.prop_bgOpacity:"text"==e?this.prop_text:"fontSize"==e?this.prop_fontSize:null;"color"==e&&(this.prop_color=n),"color2"==e&&(this.prop_color2=n),"opacity"==e&&(this.prop_opacity=n),"bgOpacity"==e&&(this.prop_bgOpacity=n),"text"==e&&(this.prop_text=n),"fontSize"==e&&(this.prop_fontSize=n),t.inArray(e),this.storeKeyFrame(),this.redraw(i)},n.prototype.redraw=function(t){void 0===t&&(t=!1);var e=this,n=this.figure.selectAll("rect").data([this.prop_text]);n.enter().append("rect");var i=this.figure.selectAll("text").data([this.prop_text]);i.enter().append("text"),this.figure.attr("opacity",this.prop_opacity),i.attr("fill",this.prop_color).attr("class","yc-text-label").attr("font-family","'Helvetica Neue', Helvetica, Arial, sans-serif");var r=parseFloat(i.attr("font-size"));i.attr("font-size",this.prop_fontSize).attr("text-anchor","middle").attr("alignment-baseline","middle").attr("dominant-baseline","central");var o=this.prop_text.split("\n");0==o.length&&o.push("");var a=parseFloat(e.prop_fontSize)+parseFloat(e.prop_fontSize)*e.line_spacing*(o.length-1),s=parseFloat(e.prop_fontSize)/2-a/2,l=function(t,n){return 0===n?s:e.prop_fontSize*e.line_spacing},c=r+r*e.line_spacing*(o.length-1),u=r/2-c/2,h=function(t,n){return 0==n?u:r*e.line_spacing},p=i.selectAll("tspan").data(o);p.enter().append("tspan"),p.text(function(t){return t}).attr("x",0).attr("dy",l),p.exit().remove(),n.attr("fill",e.prop_color2).attr("opacity",e.prop_bgOpacity).attr("rx",5).attr("ry",5);var d=i.node().getBBox();i.exit(),t?(p.attr("dy",h),i.attr("font-size",r),p.transition().attrTween("dy",function(t,e){return d3.interpolate(h(0,e),l(0,e))}),i.transition().attrTween("font-size",function(t,n){return d3.interpolate(r,parseFloat(e.prop_fontSize))}),n.transition().attrTween("x",function(t,e){return d3.interpolate(n.attr("x"),d.x-4)}).attrTween("y",function(t,e){return d3.interpolate(n.attr("y"),d.y)}).attrTween("width",function(t,e){return d3.interpolate(n.attr("width"),d.width+8)}).attrTween("height",function(t,e){return d3.interpolate(n.attr("height"),d.height)}).each("end",function(){e.updateSelectionShape()})):(n.attr("x",d.x-4).attr("y",d.y).attr("width",d.width+8).attr("height",d.height),e.updateSelectionShape())},n.prototype.create=function(e){var n=this;this.editor=e,this.figure=this.editor.elementsLayer.append("g").attr("id",this.id).attr("transform",this.getTransformation()),this.redraw(),t(this.figure[0]).on("mousedown touchstart",function(t){n.editor.mouseDown(t,n)})},n.prototype.getTransformation=function(t){var e="";void 0===t&&(t=!1);var n=this.translate[0],i=this.translate[1];this.x,this.translate[0],this.y,this.translate[1];return e+="translate("+n+","+i+") ",e+="rotate("+this.rotate+") ",1!=this.scale||t?e+="scale("+this.scale+") ":e+="scale(1) ",e},n.prototype.move=function(t,e,n,i){void 0===n&&(n=!1),void 0===i&&(i=!0);var r=this.getTransformation();this.translate[0]+=t,this.translate[1]+=e,i&&this.storeKeyFrame();var o=this.getTransformation();function a(t,e,n){return d3.interpolateString(r,o)}if(n?this.figure.transition().duration(500).attrTween("transform",a):this.figure.attr("transform",this.getTransformation()),null!==this.selectionShape){this.figure.node().getBBox();n?this.selectionShape.transition().duration(500).attrTween("transform",a):this.selectionShape.attr("transform",this.getTransformation(!1))}},n.prototype.rotateOf=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!0);var i=this.getTransformation();this.rotate+=t,n&&this.storeKeyFrame();var r=this.getTransformation();function o(t,e,n){return d3.interpolateString(i,r)}if(e?this.figure.transition().duration(500).attrTween("transform",o):this.figure.attr("transform",this.getTransformation()),null!==this.selectionShape){this.figure.node().getBBox();e?this.selectionShape.transition().duration(500).attrTween("transform",o):this.selectionShape.attr("transform",this.getTransformation())}},n.prototype.scaleOf=function(t,e){},n.prototype.position=function(t,e){if(void 0===t&&void 0===e)return{x:this.translate[0],y:this.translate[1]};this.move(t-this.translate[0],e-this.translate[1])},n.prototype.handleMove=function(t,e){var n=1/this.editor.zoom;this.editor.zoom;if("resize-se"===t.command||"resize-ne"===t.command||"resize-sw"===t.command||"resize-nw"===t.command){"resize-sw"!==t.command&&"resize-nw"!==t.command||(n*=-1);var i=((r=this.figure.node().getBBox()).width/2*this.scale+e.dx*n)/(r.width/2);if(this.prop_fontSize*i>200&&(e.dx=0),this.prop_fontSize*i<5&&(e.dx=0),0===e.dx)return;this.prop_fontSize=this.prop_fontSize*i,this.redraw(!1)}else if("rotate"===t.command){var r,o=(r=this.figure.select("text").node().getBBox()).x+r.width/2+this.translate[0],a=r.y+r.height/2+this.translate[1],s=e.x,l=e.y,c=e.x-e.dx*this.editor.zoom,u=e.y-e.dy*this.editor.zoom;s/=this.editor.zoom,l/=this.editor.zoom,c/=this.editor.zoom;u/=this.editor.zoom;var h=Math.atan2(a-l,s-o)*(180/Math.PI)-Math.atan2(a-u,c-o)*(180/Math.PI);this.rotate-=h,this.figure.attr("transform",this.getTransformation())}this.storeKeyFrame(),this.updateSelectionShape()},n.prototype.select=function(){var e=this,n=this.figure.node().getBBox();if(null===this.selectionShape){this.selectionShape=this.editor.selectionLayer.append("g").attr("id",this.id+"_sel").attr("transform",this.getTransformation());for(var i=this.selectionShape.append("rect").attr("id",this.id+"_sel_rect").attr("x",n.x).attr("y",n.y).attr("width",n.width).attr("height",n.height).attr("stroke-width",1/this.editor.zoom/this.scale).attr("fill","rgba(0,0,0,0)").attr("stroke",e.editor.getSelectionShapeStrokeColor()),r=[[n.x,n.y+n.height],[n.x+n.width,n.y+n.height],[n.x+n.width,n.y],[n.x,n.y]],o=["resize-sw","resize-se","rotate","resize-nw"],a=0;a<4;++a){var s=new YCHandle({id:this.id+"_sel_handle_"+a,group:this.selectionShape,x:r[a][0],y:r[a][1],parentElement:this,command:o[a]});s.create(this.editor),this.handles[a]=s}t(i[0]).on("mousedown touchstart",function(t){e.editor.mouseDown(t,e)})}return this.selectionShape},n.prototype.unselect=function(){null!==this.selectionShape&&(this.selectionShape.remove(),this.selectionShape=null)},n.prototype.updateSelectionShape=function(){if(null!=this.selectionShape){this.selectionShape.attr("transform",this.getTransformation(!1)),this.selectionShape.selectAll("rect").attr("stroke-width",1/this.editor.zoom/this.scale);var t=this.figure.node().getBBox();this.selectionShape.selectAll("#"+this.id+"_sel_rect").attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height);for(var e=[[t.x,t.y+t.height],[t.x+t.width,t.y+t.height],[t.x+t.width,t.y],[t.x,t.y]],n=0;n<4;++n)this.handles[n].x=e[n][0],this.handles[n].y=e[n][1],this.handles[n].updateHandle()}},n.prototype.setCurrentFrame=function(t){var e=0;for(var n in this.keyFrames)n<=t&&parseInt(n)>e&&(e=n);var i=this.keyFrames[e],r=i.x-this.translate[0],o=i.y-this.translate[1];i.rotate,this.rotate;this.move(r,o,!1,0,!1),this.rotate=i.rotate,this.figure.attr("transform",this.getTransformation()),this.prop_fontSize=i.prop_fontSize,this.prop_bgOpacity=i.prop_bgOpacity,this.prop_opacity=i.prop_opacity,this.redraw(!1),this.updateSelectionShape()},n.prototype.storeKeyFrame=function(t){void 0===t&&(t=this.editor.timeline.currentKeyFrameTime),this.keyFrames.hasOwnProperty(t)||(void 0!==this.editor&&null!=this.editor&&this.editor.addKeyframe(),this.keyFrames[t]={x:0,y:0,scale:1}),this.keyFrames[t].x=this.translate[0],this.keyFrames[t].y=this.translate[1],this.keyFrames[t].scale=this.scale,this.keyFrames[t].rotate=this.rotate,this.keyFrames[t].prop_fontSize=this.prop_fontSize,this.keyFrames[t].prop_bgOpacity=this.prop_bgOpacity,this.keyFrames[t].prop_opacity=this.prop_opacity},n.prototype.animate=function(t,e,n){var i=this,r=i.editor.calculateTransformation(e),o=i.editor.calculateTransformation(n),a=d3.select(e);this.editor.timeline.animatedDataFrames.push(a),a.transition().duration(t).tween("customTween",function(){var t=d3.interpolateString(r,o),a=d3.interpolate(e.prop_fontSize,n.prop_fontSize),s=d3.interpolate(e.prop_opacity,n.prop_opacity),l=d3.interpolate(e.prop_bgOpacity,n.prop_bgOpacity);return function(e){i.figure.attr("transform",t(e)),i.prop_fontSize=a(e),i.prop_opacity=s(e),i.prop_bgOpacity=l(e),i.redraw()}})},n}(jQuery),YCEditorArrowAction=function(t){this.editor=t,this.currentOperation=null,this.startx=0,this.starty=0,this.lastx=0,this.lasty=0,this.figure=null,this.points=null,this.sidebar=null;var e=this;this.toolbar=this.editor.toolbar,this.toolbar.find(".arrow-tool").on("click touchstart touchend",function(t){e.toolbar.find(".designer-tool").removeClass("selected"),e.editor.selectedTool===e?e.editor.setSelectedTool(null,"",".selection-tool"):e.editor.setSelectedTool(e,"crosshair",".arrow-tool"),t.stopPropagation()}),this.line=d3.svg.line();var n=new YCLine({points:[[0,0],[0,0]],lineInterpolation:"basis",stroke:4});this.trianglePath=n.trianglePath};YCEditorArrowAction.prototype.startMove=function(t){this.startx=0,this.starty=0},YCEditorArrowAction.prototype.handleMove=function(t){var e=1/this.editor.zoom,n=1/this.editor.zoom;null==this.figure&&(this.figure=this.editor.feedbackLayer.append("g"),this.startx=t.x*e,this.starty=t.y*n,this.lastx=this.startx,this.lasty=this.starty),this.lastx+=t.dx*e,this.lasty+=t.dy*n;var i=[[this.startx,this.starty],[this.lastx,this.lasty]],r=this.figure.selectAll("path.arrow_line").data([i]);r.enter().append("path").attr("class","arrow_line");var o=this.editor.getLastUsedColorsForFigure("arrow")[0];r.attr("stroke",o).attr("fill","none").attr("stroke-width",4/this.editor.zoom).attr("d",this.line);var a=this.figure.selectAll("path.arrow_triangle").data([this.trianglePath(i[0],i[1],10)]);a.enter().append("path").attr("class","arrow_triangle"),a.attr("fill",o).attr("stroke","none").attr("d",this.line)},YCEditorArrowAction.prototype.endMove=function(t){if(null!==this.figure){this.editor.feedbackLayer.selectAll("*").remove(),this.figure=null;var e=[];e.push([this.startx,this.starty]);var n=0,i=0,r=0,o=0;this.startx<=this.lastx&&(n=this.startx+(this.lastx-this.startx)/3,i=this.startx+2*(this.lastx-this.startx)/3),this.startx>this.lastx&&(i=this.lastx+(this.startx-this.lastx)/3,n=this.lastx+2*(this.startx-this.lastx)/3),this.starty<=this.lasty&&(r=this.starty+(this.lasty-this.starty)/3,o=this.starty+2*(this.lasty-this.starty)/3),this.starty>this.lasty&&(o=this.lasty+(this.starty-this.lasty)/3,r=this.lasty+2*(this.starty-this.lasty)/3),e.push([n,r]),e.push([i,o]),e.push([this.lastx,this.lasty]);var a=new YCLine({points:e,lineInterpolation:"basis",lineType:"normal",color:this.editor.getLastUsedColorsForFigure("arrow")[0],stroke:4});a.create(this.editor),this.editor.addElement(a),this.editor.setSelectedTool(null);var s=this;this.editor.appendUndo({undo:function(){s.editor.removeElement(a)},redo:function(){s.editor.addElement(a)},name:function(){return"New Arrow"}})}else this.editor.setSelectedTool(null)};var YCEditorMoveAction=function(t){this.editor=t,this.currentOperation=null,this.alignToPivots=[],this.dx=0,this.dy=0,this.bbox=null,this.originalPositions=[]};YCEditorMoveAction.prototype.startMove=function(t){var e=this;this.currentOperation=null,this.pivot=null,this.alignToPivots=[],this.originalPositions=[],this.dx=0,this.dy=0,this.bbox=null,e.bbox=this.editor.transformedBoundingBox(t.figure.node());var n=[];$.each(this.editor.currentSelection,function(t){n.push(this.id);var i=this.position();e.originalPositions.push({id:this.id,x:i.x,y:i.y})}),$.each(this.editor.elements,function(t){if(this.editor.currentSelection.indexOf(this)<0){var n=e.editor.transformedBoundingBox(this.figure.node());e.alignToPivots.push([n.x+n.width/2,n.y+n.height/2])}}),this.currentOperation={op:"move",elements:n,dx:0,dy:0}},YCEditorMoveAction.prototype.handleMove=function(t){var e=this,n=1/this.editor.zoom,i=1/this.editor.zoom;this.dx+=t.dx*n,this.dy+=t.dy*i,this.editor.feedbackLayer.selectAll("*").remove();var r=e.bbox.x+this.dx,o=e.bbox.y+this.dy,a=null,s=null;t.mouseEvent.shiftKey&&$.each(this.alignToPivots,function(t){if(null===a||null===s){null===a&&Math.abs(r+e.bbox.width/2-this[0])<10/e.editor.zoom&&(r=this[0]-e.bbox.width/2,a={x:this[0],y:this[1]}),null===s&&Math.abs(o+e.bbox.height/2-this[1])<10/e.editor.zoom&&(o=this[1]-e.bbox.height/2,s={x:this[0],y:this[1]})}}),null!==a&&e.editor.feedbackLayer.append("path").attr("d","M"+a.x+","+(o+e.bbox.height/2)+"L"+a.x+","+a.y).attr("id","x-guide-line").attr("stroke",3).attr("opacity",.8).attr("stroke",e.editor.getSelectionShapeStrokeColor()),null!==s&&e.editor.feedbackLayer.append("path").attr("d","M"+(r+e.bbox.width/2)+","+s.y+"L"+s.x+","+s.y).attr("id","x-guide-line").attr("stroke",3).attr("opacity",.8).attr("stroke",e.editor.getSelectionShapeStrokeColor()),this.currentOperation.dx=r-this.bbox.x,this.currentOperation.dy=o-this.bbox.y,$.each(this.originalPositions,function(t){var n=e.editor.findElement(this.id);n.position(this.x+e.currentOperation.dx,this.y+e.currentOperation.dy);var i=n.elementProperty("opacity");null==i&&(i=1),n.figure.transition().duration(50).attr("opacity",Math.min(.6,i))})},YCEditorMoveAction.prototype.endMove=function(t){if($.each(this.editor.currentSelection,function(t){var e=this.elementProperty("opacity");null==e&&(e=1),this.figure.transition().duration(50).attr("opacity",e)}),null!==this.currentOperation&&(0!==this.currentOperation.dx||0!==this.currentOperation.dy)){var e=this.currentOperation,n=this;this.editor.appendUndo({undo:function(){$.each(e.elements,function(t){n.editor.findElement(this).move(-e.dx,-e.dy,!0)})},redo:function(){$.each(e.elements,function(t){n.editor.findElement(this).move(e.dx,e.dy,!0)})},name:function(){return"Move"}})}this.editor.feedbackLayer.selectAll("*").remove()};var YCEditorMoveBackgroundAction=function(t){this.editor=t,this.currentOperation=null,this.alignToPivots=[],this.dx=0,this.dy=0,this.bbox=null,this.originalPositions=[];var e=this;this.editor.$mainElement.find(".background-move-tool").on("click touchstart",function(){e.editor.$mainElement.find(".designer-tool").removeClass("selected"),e.editor.selectedTool===e?e.editor.setSelectedTool(null,"",".selection-tool"):e.editor.setSelectedTool(e,"move",".background-move-tool")})};YCEditorMoveBackgroundAction.prototype.startMove=function(t){this.currentOperation=null,this.pivot=null,this.alignToPivots=[],this.originalPositions=[],this.dx=0,this.dy=0,this.bbox=null,this.currentOperation={op:"move_background",original_x:this.editor.selectedBackgroundPosition[0],original_y:this.editor.selectedBackgroundPosition[1],dx:0,dy:0}},YCEditorMoveBackgroundAction.prototype.handleMove=function(t){var e=1/this.editor.zoom,n=1/this.editor.zoom;this.dx+=t.dx*e,this.dy+=t.dy*n,this.currentOperation.dx=this.dx,this.currentOperation.dy=this.dy,this.editor.selectedBackgroundPosition[0]=this.currentOperation.dx+this.currentOperation.original_x,this.editor.selectedBackgroundPosition[1]=this.currentOperation.dy+this.currentOperation.original_y,this.editor.updateBackground()},YCEditorMoveBackgroundAction.prototype.endMove=function(t){if(null!==this.currentOperation&&(0!==this.currentOperation.dx||0!==this.currentOperation.dy)){var e=this.currentOperation,n=this;this.editor.appendUndo({undo:function(){n.editor.selectedBackgroundPosition[0]=e.original_x,n.editor.selectedBackgroundPosition[1]=e.original_y,n.editor.updateBackground()},redo:function(){n.editor.selectedBackgroundPosition[0]=e.original_x+e.dx,n.editor.selectedBackgroundPosition[1]=e.original_y+e.dy,n.editor.updateBackground()},name:function(){return"Move Background"}})}this.editor.setSelectedTool(null)};var YCEditorPenAction=function(t){this.editor=t,this.currentOperation=null,this.startx=0,this.starty=0,this.lastx=0,this.lasty=0,this.figure=null,this.points=null,this.sidebar=null;var e=this;this.toolbar=this.editor.toolbar,this.toolbar.find(".pen-tool").on("click touchstart",function(){e.toolbar.find(".designer-tool").removeClass("selected"),e.editor.selectedTool===e?e.editor.setSelectedTool(null,"",".selection-tool"):e.editor.setSelectedTool(e,"crosshair",".pen-tool")})};YCEditorPenAction.prototype.startMove=function(t){this.startx=0,this.starty=0,this.points=null},YCEditorPenAction.prototype.handleMove=function(t){var e=1/this.editor.zoom,n=1/this.editor.zoom;null==this.points&&(this.points=[],this.startx=t.x*e,this.starty=t.y*n,this.lastx=this.startx,this.lasty=this.starty,this.figure=this.editor.feedbackLayer.append("path").attr("id","selection-action").attr("d",this.buildPath()).attr("stroke-width",2).attr("stroke-opacity",1).attr("fill-opacity",0).attr("stroke",this.editor.getLastUsedColorsForFigure("pen")[0])),this.lastx+=t.dx*e,this.lasty+=t.dy*n,this.points.push({x:this.lastx,y:this.lasty}),this.figure.attr("d",this.buildPath())},YCEditorPenAction.prototype.endMove=function(t){if(null!==this.figure){var e=this.figure.node().getBBox();this.editor.feedbackLayer.selectAll("*").remove(),this.figure=null;simplify(this.points,1,!0);for(var n=0;n1)for(var t=this.points,e="M"+t[0].x+" "+t[0].y,n=1;n=i.x+i.width&&n.y+n.height>=i.y+i.height&&e.editor.addSelection(this)}),this.editor.$element.css("cursor","")},YCEditorSelectionAction.prototype.getSelectionRectangle=function(){var t={x:0,y:0,w:0,h:0};return this.width>0?(t.x=this.startx,t.width=this.width):(t.x=this.startx+this.width,t.width=-this.width),this.height>0?(t.y=this.starty,t.height=this.height):(t.y=this.starty+this.height,t.height=-this.height),t},function(t){var e=function(t,e){this.skinValue="#f4e3d7",this.hairValue="#B17F48",this.init(t,e)};e.prototype.skins=[{hair:"#B17F48",skin:"#f4e3d7"},{hair:"#191315",skin:"#684d41"},{hair:"#574037",skin:"#b67d5e"},{hair:"#83452e",skin:"#E7B398"},{hair:"#dbd188",skin:"#edd2a8"},{hair:"#3d3537",skin:"#fde9cb"},{hair:"#000000",skin:"#d3ab9b"},{hair:"#673B15",skin:"#EDC9B9"}],e.prototype.skinColors=["#f4e3d7","#EDC9B9","#d3ab9b","#fde9cb","#edd2a8","#f0bc91","#d58f63","#b67d5e","#b36135","#684d41"],e.prototype.hairColors=["#000000","#191315","#3d3537","#B17F48","#83452e","#673B15","#FFE869","#dbd188","#bf0020","#008aff"],e.prototype.init=function(e,n){var i=this;this.settings=t.extend({},this.defaults,n),this.$el=t(e),this.el=e,this.$button=t(this.generateButton()),this.$el.after(this.$button).hide(),this.$el.hide(),this.panel=t('
      '),this.panel.append(this.generatePanelContent()),t(this.el.ownerDocument.body).append(this.panel),this.$button.off("click touchstart").on("click",function(){if(t(i.panel).hasClass("ycse-panel-open"))return i.hide(),!1;var e=i.getOffset(t(i.panel),t(i.$button));return i.panel.css(e),i.settings.beforeShow.call(this),t(i.panel).addClass("ycse-panel-open").show(),i.settings.afterShow.call(this),!1}),t(document).on("click touchstart",function(e){var n=t(e.target);t.contains(i.panel[0],n[0])||i.hide()}),this.settings.afterLoad.call(this)},e.prototype.getOffset=function(e,n){var i=e.outerWidth(),r=e.outerHeight(),o=n.outerHeight(),a=e[0].ownerDocument,s=a.documentElement,l=s.clientWidth+t(a).scrollLeft(),c=s.clientHeight+t(a).scrollTop(),u=n.offset();return u.top+=o,u.left-=Math.min(u.left,u.left+i>l&&l>i?Math.abs(u.left+i-l):0),u.top-=Math.min(u.top,u.top+r>c&&c>r?Math.abs(r+o-0):0),u},e.prototype.container=function(){return t(this.panel)},e.prototype.hide=function(){t(this.panel).hasClass("ycse-panel-open")&&(this.settings.beforeHide.call(this,{hair:this.hairValue,skin:this.skinValue}),t(".ycse-panel-open").removeClass("ycse-panel-open").hide(),this.settings.afterHide.call(this,{hair:this.hairValue,skin:this.skinValue}))},e.prototype.generateButton=function(){var t="";return t+='
      ',t+='
      ',t+='
      ',t+=this.generatePreview(40,40),t+="
      ",t+="
      ",t+='
      ',t+="
      "},e.prototype.generatePreview=function(t,e){var n="";return n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=' ',n+=" ",n+=' ',n+=' ',n+=' ',n+=' ',n+=" ",n+=" ",n+=" "},e.prototype.generatePanelContent=function(e){var n=this;void 0===e&&(e=!1);var i=t("
      ");if(e){for(var r=t("
        ").addClass("ycse-hair-buttons"),o=0;o
      • ").css({"background-color":this.hairColors[o]});this.hairColors[o].toUpperCase()===this.hairValue.toUpperCase()&&a.addClass("selected"),r.append(a)}i.append(r),(g=t("
        ").addClass("ycse-preview-face")).append(this.generatePreview(60,60)),i.append(g);var s=t("
          ").addClass("ycse-skin-buttons");for(o=0;o").css({"background-color":this.skinColors[o]});this.skinColors[o].toUpperCase()===this.skinValue.toUpperCase()&&l.addClass("selected"),s.append(l)}g.find(".yc-hair").attr("fill",this.hairValue).attr("stroke",this.hairValue),g.find(".yc-skin").attr("fill",this.skinValue),i.append(s);var c=t("
          ").addClass("ycse-less-options");c.html('◀ Less options'),i.append(c),t(".ycse-less-options-link",i).on("click touchstart",function(e){return e.preventDefault(),t(".ycse-panel").html(n.generatePanelContent(!1)),!1}),t(".ycse-hair-buttons li",i).on("click touchstart",function(e){e.preventDefault(),t(".ycse-hair-buttons li").removeClass("selected"),t(this).addClass("selected");var i=n.rgb2hex(t(this).css("background-color"));n.hairValue=i,n.updateButtonPreview(),n.updateAdvancedPreview(),n.fireChange()}),t(".ycse-skin-buttons li",i).on("click touchstart",function(e){e.preventDefault(),t(".ycse-skin-buttons li").removeClass("selected"),t(this).addClass("selected");var i=n.rgb2hex(t(this).css("background-color"));n.skinValue=i,n.updateButtonPreview(),n.updateAdvancedPreview(),n.fireChange()})}else{for(var u=Math.floor(this.skins.length/2),h=!1,p=0;p<2;++p){var d=t("
          ");for(o=p*u;o
        ").addClass("ycse-face").attr("face",o);7==o&&g.addClass("ycse-custom-face"),g.append(this.generatePreview(40,40)),g.find(".yc-hair").attr("fill",f.hair).attr("stroke",f.hair),g.find(".yc-skin").attr("fill",f.skin),h||this.hairValue.toUpperCase()!==f.hair.toUpperCase()||this.skinValue.toUpperCase()!==f.skin.toUpperCase()||(t(".ycse-panel .ycse-face").removeClass("selected"),h=!0,g.addClass("selected")),d.append(g),g.on("click touchstart",function(){n.skinValue=n.rgb2hex(t(this).find(".yc-skin").attr("fill")),n.hairValue=n.rgb2hex(t(this).find(".yc-hair").attr("fill")),t(".ycse-panel .ycse-face").removeClass("selected"),t(this).addClass("selected"),n.updateButtonPreview(),n.fireChange()})}i.append(d)}h||(t(".ycse-custom-face").find(".yc-skin").attr("fill",this.skinValue),t(".ycse-custom-face").find(".yc-hair").attr("fill",this.hairValue).attr("stroke",this.hairValue),t(".ycse-custom-face").addClass("selected")),(e=t("
        ").addClass("ycse-more-options")).html('More options ►'),i.append(e),t(".ycse-more-options-link",i).on("click touchstart",function(e){return e.preventDefault(),t(".ycse-panel").html(n.generatePanelContent(!0)),!1})}return i},e.prototype.rgb2hex=function(t){if(void 0===t)return null;if("#"===t.substring(0,1))return t;var e=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");function n(t){return isNaN(t)?"00":e[(t-t%16)/16]+e[t%16]}return"#"+n((t=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))[1])+n(t[2])+n(t[3])},e.prototype.updateButtonPreview=function(){t(".yc-hair",this.$button).attr("fill",this.hairValue).attr("stroke",this.hairValue),this.$button.find(".yc-skin").attr("fill",this.skinValue),this.skins[7].skin=this.skinValue,this.skins[7].hair=this.hairValue},e.prototype.updateAdvancedPreview=function(){t(".ycse-preview-face",this.$panel).find(".yc-hair").attr("fill",this.hairValue).attr("stroke",this.hairValue),t(".ycse-preview-face",this.$panel).find(".yc-skin").attr("fill",this.skinValue)},e.prototype.fireChange=function(){this.settings.change({hair:this.hairValue,skin:this.skinValue})},e.prototype.setValue=function(t){this.skinValue=t.skin,this.hairValue=t.hair,this.updateSelectedColors()},e.prototype.updateSelectedColors=function(){this.updateButtonPreview(),this.panel.html(this.generatePanelContent(0===t(this.panel).find(".ycse-more-options-link").length))},e.prototype.defaults={afterLoad:function(){},beforeShow:function(){},afterShow:function(){},beforeHide:function(){},afterHide:function(t){},change:function(t){}},e.prototype.settings={};var n=t.fn.YCSkinChooser;t.fn.YCSkinChooser=function(n,i){var r=null,o=this.each(function(){var o=t(this),a=o.data("YCSkinChooser"),s="object"==typeof n&&n;a||o.data("YCSkinChooser",a=new e(this,s)),"string"==typeof n&&(r=a[n].apply(a,i))});return null!=r?r:o},t.fn.YCSkinChooser.Constructor=e,t.fn.YCSkinChooser.noConflict=function(){return t.fn.YCSkinChooser=n,this}}(jQuery),function(t){var e=function(t,e){this.init(t,e)};e.prototype.uniformConfigLabels={full:{c1:"T-Shirt",c3:"Stripes",c2:"Shorts",c4:"Socks"},bicolor:{c1:"T-Shirt and socks",c2:"Shorts"}},e.prototype.tshirtsColors={c1:"#FFFFFF",c3:"#000000",c2:"#FFFFFF",c4:"#FFFFFF"},e.prototype.init=function(e,n){var i=this;this.settings=t.extend({},this.defaults,n),this.uniformConfigLabels.full.c1=this.settings.locale["T-Shirt"],this.uniformConfigLabels.full.c3=this.settings.locale.Stripes,this.uniformConfigLabels.full.c2=this.settings.locale.Shorts,this.uniformConfigLabels.full.c4=this.settings.locale.Socks,this.$el=t(e),this.el=e,this.$button=t(this.generateButton()),this.$el.after(this.$button).hide(),this.$el.hide(),this.presets=[],this.panel=t('
        '),this.panel.append(this.generatePanelContent()),t(this.el.ownerDocument.body).append(this.panel),this.$button.off("click touchstart").on("click",function(){if(t(i.panel).hasClass("ycue-panel-open"))return!(t(".ycuc-sp-container:not(.sp-hidden)").size()>0)&&(i.hide(),!1);var e=i.getOffset(t(i.panel),t(i.$button));return i.panel.css(e),i.settings.beforeShow.call(this),t(i.panel).addClass("ycue-panel-open").show(),i.settings.afterShow.call(this),!1}),t(document).on("click touchstart",function(e){var n=t(e.target);t.contains(i.panel[0],n[0])||i.hide()}),this.setPreview(this.settings.config),this.settings.afterLoad.call(this)},e.prototype.getOffset=function(e,n){var i=e.outerWidth(),r=e.outerHeight(),o=n.outerHeight(),a=e[0].ownerDocument,s=a.documentElement,l=s.clientWidth+t(a).scrollLeft(),c=s.clientHeight+t(a).scrollTop(),u=n.offset();return u.top+=o,u.left-=Math.min(u.left,u.left+i>l&&l>i?Math.abs(u.left+i-l):0),u.top-=Math.min(u.top,u.top+r>c&&c>r?Math.abs(r+o-0):0),u},e.prototype.container=function(){return t(this.panel)},e.prototype.hide=function(){t(this.panel).hasClass("ycue-panel-open")&&(t(".ycuc-color-button input",this.panel).each(function(){t(this).spectrum("container").hasClass("sp-hidden")||t(this).spectrum("hide")}),this.settings.beforeHide.call(this,t.extend({},this.settings.config)),t(".ycue-panel-open").removeClass("ycue-panel-open").hide(),this.settings.afterHide.call(this,t.extend({},this.settings.config)))},e.prototype.generateButton=function(){var t="";return t+='
        ',t+='
        ',t+='
        ',t+=this.generatePreview(20,20,!0),t+="
        ",t+="
        ",t+='
        ',t+="
        "},e.prototype.generatePreviewTShirt=function(t,e){return'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '},e.prototype.generatePreview=function(t,e,n){void 0===n&&(n=!1);var i='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ';return n&&(i+='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '),i+=""},e.prototype.generatePanelContent=function(){var e=this,n=t('
        '),i=t('
        ');i.append(this.generatePreview(40,100,!0)),n.append(i);var r=t("
        "),o=["f","v","h","q"];if("bicolor"!=this.settings.mode){for(var a=t('
        '),s=0;s
        ").addClass("ycue-shirt").attr("tshirt-type",l);c.append(this.generatePreviewTShirt(40,40));var u=t.extend({},this.tshirtsColors,{type:l});this.setPreview(u,c),u.type==this.settings.config.type&&(t(".ycue-panel .ycue-shirt").removeClass("selected"),c.addClass("selected")),a.append(c),c.on("click touchstart",function(){e.settings.config.type="bicolor"!=e.settings.mode?t(this).attr("tshirt-type"):"f",e.setPreview(e.settings.config),e.fireChange()})}r.append(a)}var h=t('
        '),p=0,d=t('
        ');for(var f in h.append(d),this.uniformConfigLabels[this.settings.mode]){3==++p&&(d=t('
        '),h.append(d));var g=t('
        '),m=t('');g.append(m);var y=t("
      • ");t(l).addClass("figure-preview"),t(l).addClass("palette-preview"),t(l).addClass("category-"+s),t(l).css("background-image","url(' "+this.options.baseUrl+"images/optimized/"+s+"/"+i+h+"_mini.png')");var c={category:s,name:i+h};"discs"===s&&(c.textlabel=""+h,c.width=40),t.merge({},c),t(l).data("yc.editor.figure",c),t("ul.figures",this.$mainElement).append(l),t(l).draggable({appendTo:"body",helper:"clone",revert:"invalid",scroll:!1})}}else{t("ul.figures",this.$mainElement).addClass("groups");var u=this.figures_groups[s];this.setDirectionSelectorVisible(u.length>1);for(var h=0;h0){var g=p.direction;("side"!==g||"right"!==n&&"left"!==n)&&g!==n&&"all"!==g||(g=n,this.createPaletteGroup(this.t(f.gesture),f.figures,s,i,"right"===g?1:0))}}}},e.prototype.setDirectionSelectorVisible=function(e){e?t(".direction-selector",this.$mainElement).is(":visible")||(t(".direction-selector",this.$mainElement).show(),this.recalculateDesignArea(!1)):t(".direction-selector",this.$mainElement).is(":visible")&&(t(".direction-selector",this.$mainElement).hide(),this.recalculateDesignArea(!1))},e.prototype.createPaletteGroup=function(e,n,i,r,o){void 0===o&&(o=0);var a=t("
      • ");t(a).addClass("figures-group-wrapper");var s=t("").html(e);t(s).addClass("figure-group-label"),t(a).append(s);var l=t("
          ");t(l).addClass("figures-group");for(var c=0;c");t(h).addClass("figure-preview"),t(h).addClass("palette-preview"),t(h).addClass("category-"+i),t(h).css("background-image","url(' "+this.options.baseUrl+"images/optimized/"+i+"/"+r+u+(1===o?"r":"")+"_mini.png')");var p={category:i,name:r+u,flip:""+o};"discs"===i&&(p.textlabel=""+u,p.width=40),t.merge({},p),t(h).data("yc.editor.figure",p),t(h).draggable({appendTo:"body",helper:"clone",revert:"invalid",scroll:!1}),t(l).append(h)}t(a).append(l),t("ul.figures",this.$mainElement).append(a),s.css("top",s.width()+2)},e.prototype.loadPaletteFields=function(e){var n=this.palette_fields;if(void 0!==n[e])for(var i=n[e],r=0;r");t(a).addClass("fields-preview"),t(a).addClass("palette-preview"),t(a).css("background-image","url(' "+this.options.baseUrl+"images/optimized/fields/"+e+"/"+o.index+"_mini.png')"),t(a).data("yc.editor.field",{url:"images/optimized/fields/"+e+"/"+o.index+".svg",color:o.color,scale:o.scale}),t("ul.figures",this.$mainElement).append(a),t(a).draggable({appendTo:"body",helper:"clone",revert:"invalid",scroll:!1})}},e.prototype.loadPaletteShapes=function(){for(var e=[{name:"triangle",vertices:"3",category:"polygon"},{name:"rectangle",vertices:"4",category:"polygon"},{name:"pentagon",vertices:"5",category:"polygon"},{name:"ellipse",vertices:"5",category:"ellipse"},{name:"linear_normal",vertices:"2",category:"line",lineType:"normal",lineInterpolation:"basis"},{name:"quadratic_normal",vertices:"3",category:"line",lineType:"normal",lineInterpolation:"basis"},{name:"cubic_normal",vertices:"4",category:"line",lineType:"normal",lineInterpolation:"basis"},{name:"linear_waves",vertices:"2",category:"line",lineType:"waves",lineInterpolation:"basis"},{name:"quadratic_waves",vertices:"3",category:"line",lineType:"waves",lineInterpolation:"basis"},{name:"cubic_waves",vertices:"4",category:"line",lineType:"waves",lineInterpolation:"basis"},{name:"linear_double",vertices:"2",category:"line",lineType:"double",lineInterpolation:"basis"},{name:"quadratic_double",vertices:"3",category:"line",lineType:"double",lineInterpolation:"basis"},{name:"cubic_double",vertices:"4",category:"line",lineType:"double",lineInterpolation:"basis"}],n=0;n");t(r).addClass("figure-preview"),t(r).addClass("palette-preview"),t(r).addClass("category-polygon"),t(r).css("background-image","url(' "+this.options.baseUrl+"images/optimized/polygons/"+i.name+"_mini.png')"),t(r).data("yc.editor.figure",i),t("ul.figures",this.$mainElement).append(r),t(r).draggable({appendTo:"body",helper:"clone",revert:"invalid",scroll:!1})}},e.prototype.setTeamPlayers=function(e){this.options.team_players=e,"team_players"==t(".palette_content_select",this.$mainElement).val()&&(t("ul.figures",this.$mainElement).html(""),this.loadPaletteTeamPlayers())},e.prototype.loadPaletteTeamPlayers=function(){for(var e=0;e"),r=t("
          ");r.addClass("team-player-palette-item");var o=t('
          ');if(void 0!==n.image&&null!==n.image){var a=t("");a.attr("src",n.image),o.append(a)}r.append(o);var s=t("
          ");s.addClass("team-player-palette-item-name"),s.append(t("").html(n.name)),void 0!==n.role&&s.append(t("").text(n.role)),r.append(s),i.append(r),t(i).addClass("figure-preview"),t(i).addClass("palette-preview"),t(i).addClass("category-team-player"),t(i).data("yc.editor.figure",{category:"team_players",playerName:n.name,playerDisplayName:void 0!==n.displayName?n.displayName:n.name,playerNumber:n.number,playerImage:void 0===n.image?null:n.image,playerUniform:void 0===n.uniform?null:n.uniform,name:"team_player"}),t("ul.figures",this.$mainElement).append(i),t(i).draggable({appendTo:"body",helper:"clone",revert:"invalid",scroll:!1})}},e.prototype.setupPalette=function(){var e=this;t(".palette_content_select",this.$mainElement).selectbox({onChange:function(n,i){t(".palette_content_select").val(n),e.loadPalette(n)}}),t(".direction-selector select",this.$mainElement).Segment(),t(".direction-selector",this.$mainElement).find('[value="left"]').addClass("direction-left"),t(".direction-selector",this.$mainElement).find('[value="up"]').addClass("direction-up"),t(".direction-selector",this.$mainElement).find('[value="down"]').addClass("direction-down"),t(".direction-selector",this.$mainElement).find('[value="right"]').addClass("direction-right"),t(".direction-selector span",this.$mainElement).on("click",function(){e.loadPalette(t(".palette_content_select",this.$mainElement).val(),t(".direction-selector select",this.$mainElement).val())}),this.palette_categories.length>0&&this.palette_categories[0].options.length>0&&this.loadPalette(this.palette_categories[0].options[0].name),this.$element.droppable({accept:".palette-preview",drop:function(n,i){var r=e.$element.offset(),o=n.pageX-r.left,a=n.pageY-r.top,s=t(i.draggable).data("yc.editor.figure"),l=t(i.draggable).data("yc.editor.field");if(void 0!==s)if("team_players"===s.category){var c=e.getLastUsedColorsForFigure(s.category),u={type:"team_player",x:o/e.zoom,y:a/e.zoom,width:0,height:0,playerName:s.playerName,playerDisplayName:s.playerDisplayName,playerNumber:s.playerNumber,playerImage:s.playerImage,playerUniform:s.playerUniform,elementType:s.category,color:c[0]},h=e.loadShape(u),p=e.addElement(h);e.appendUndo({undo:function(){e.removeElement(h)},redo:function(){e.addElementAt(h,p)},name:function(){return"Add player"}})}else if("text"===s.category){c=e.getLastUsedColorsForFigure(s.category),u={type:"text",x:o/e.zoom,y:a/e.zoom,width:0,height:0,text:"Text",elementType:s.category,color:c[0],color2:c[1]},h=e.loadShape(u),p=e.addElement(h);e.appendUndo({undo:function(){e.removeElement(h)},redo:function(){e.addElementAt(h,p)},name:function(){return"Add element"}})}else if("ellipse"===s.category){c=e.getLastUsedColorsForFigure(s.category),u={type:"ellipse",x:o/e.zoom,y:a/e.zoom,rx:100,ry:100,width:0,height:0,points:y,elementType:s.category,color:c[0],color2:c[1]},h=e.loadShape(u),p=e.addElement(h);e.appendUndo({undo:function(){e.removeElement(h)},redo:function(){e.addElementAt(h,p)},name:function(){return"Add element"}})}else if("line"===s.category){var d=parseFloat(s.vertices),f=(c=e.getLastUsedColorsForFigure(s.category),o/e.zoom),g=a/e.zoom,m=100,y=[];if((w=[0,0])[0]=f-100,w[1]=g,y.push(w),4==d){(C=[0,0])[0]=f-50,C[1]=g,y.push(C);var v=[0,0];v[0]=f+50,v[1]=g,y.push(v)}else if(3==d){var C;(C=[0,0])[0]=f,C[1]=g,y.push(C)}var b=[0,0];b[0]=f+100,b[1]=g,y.push(b);u={type:"line",points:y,lineType:s.lineType,lineInterpolation:s.lineInterpolation,elementType:s.category,stroke:4,color:e.getLastUsedColorsForFigure("line")[0]},h=e.loadShape(u),p=e.addElement(h);e.appendUndo({undo:function(){e.removeElement(h)},redo:function(){e.addElementAt(h,p)},name:function(){return"Add element"}})}else if("polygon"===s.category){d=parseFloat(s.vertices),c=e.getLastUsedColorsForFigure(s.category),f=o/e.zoom,g=a/e.zoom,m=100,y=[];var x=0;4!==d&&(x=-90),4===d&&(x=-45);for(var L=x,k=0;kr?(r=n*r/i,i=n):(i=n*i/r,r=n);var l=e.getLastUsedColorsForFigure(s.category),c=e.getLastUsedUniformForFigure(s.category),u="figure";"discs"==s.category&&(u="disc");var h={type:u,x:o/e.zoom,y:a/e.zoom,width:i/e.zoom,height:r/e.zoom,svg:"images/optimized/"+s.category+"/"+s.name+".svg",elementType:s.category,color:l[0],color2:l[1],uniform:c};"string"==typeof l[2]&&(h.skin=l[2]),"string"==typeof l[3]&&(h.hair=l[3]),"materials"==s.category&&t.inArray(parseInt(s.name,10),[10,11,12,13,14,15,16,67,68,69,70])>=0&&(h.width*=.25,h.height*=.25),1!==e.selectedBackgroundFigureScale&&(h.scale=parseFloat(e.selectedBackgroundFigureScale)*(e.selectedBackgroundScale/e.selectedBackgroundBaseScale)),"discs"==s.category&&(h.textlabel=s.textlabel),void 0!==s.flip&&(h.flip=s.flip);var p=e.loadShape(h),d=e.addElement(p);e.appendUndo({undo:function(){e.removeElement(p)},redo:function(){e.addElementAt(p,d)},name:function(){return"Add element"}})},_.src=e.options.baseUrl+"images/optimized/"+s.category+"/"+s.name+".svg"}else if(void 0!==l){var S=e.selectedBackgroundSvg,M=l.url,F=e.selectedBackgroundColor,E=l.color,P=e.selectedBackgroundFigureScale,T=l.scale,A=e.selectedBackgroundScale,z=e.selectedBackgroundPosition;e.setBackgroundSvg(l.url,l.color,T,void 0,void 0,e.selectedColorField,e.selectedColorFieldAreas,e.selectedColorFieldBorder);var B=e.selectedBackgroundScale,N=e.selectedBackgroundPosition;e.appendUndo({oldBackgroundSvg:S,newBackgroundSvg:M,oldBackgroundColor:F,newBackgroundColor:E,oldBackgroundFigureScale:P,newBackgroundFigureScale:T,oldBackgroundScale:A,newBackgroundScale:B,oldBackgroundPosition:z,newBackgroundPosition:N,undo:function(){e.setBackgroundSvg(this.oldBackgroundSvg,this.oldBackgroundColor,this.oldBackgroundFigureScale,this.oldBackgroundPosition,this.oldBackgroundScale)},redo:function(){e.setBackgroundSvg(this.newBackgroundSvg,this.newBackgroundColor,this.newBackgroundFigureScale,this.newBackgroundPosition,this.newBackgroundScale)},name:function(){return"Change Background"}})}}})}}(jQuery,YCEditor),function(t,e){"use strict";e.prototype.updatingProperties=!1,e.prototype.commonProperties=[{name:"bgTitleProperty",type:"title",label:"Background Properties"},{name:"color",type:"color",label:""},{name:"color2",type:"color",label:""},{name:"uniform",type:"uniform",label:""},{name:"skin",type:"skin",label:""},{name:"hair",type:"skin",label:""},{name:"opacity",type:"range",label:"Opacity"},{name:"bgOpacity",type:"range",label:"Background Opacity"},{name:"stroke",type:"segment",label:"Stroke",options:[1,2,4,8]},{name:"lineStyle",type:"segment",label:"Line Style",options:["dotted","dashed","solid"]},{name:"arrowStyle",type:"segment",label:"Arrow Style",options:["arrow-left","arrow-left-right","arrow-none","arrow-right"]},{name:"flip",type:"segment",label:"Flip",options:[0,1]},{name:"textlabel",type:"input",label:"Label"},{name:"text",type:"text",label:"Text"},{name:"fontSize",type:"range",label:"Font Size"},{name:"waveFrequency",type:"range",label:"Wave Frequency"},{name:"waveAmplitude",type:"range",label:"Wave Amplitude"},{name:"linesOffset",type:"range",label:"Lines Offset"},{name:"relativeScale",type:"range",label:"Scale"},{name:"bgColor",type:"bgColor",label:"Solid Background"},{name:"colorField",type:"bgColor",label:"Field"},{name:"colorFieldAreas",type:"bgColor",label:"Areas"},{name:"colorFieldBorder",type:"bgColor",label:"Border"},{name:"logoPosition",type:"segment",label:"Logo Position",options:["center","top_left","top_right","bottom_left","bottom_right"]}],e.prototype.colorPalette=[["#000000","#ffffff","#a7194b"],["#fe2712","#fd5308","#fb9902"],["#f9bc02","#fffe32","#d0e92b"],["#66b132","#0291cd","#fbfa25"],["#3e01a4","#8601b0","#666666"],["#77b55f","#E02831","#0060A9"]],e.prototype.elementProperties=function(){return void 0!==this.selectedBackgroundSvg&&this.selectedBackgroundSvg.indexOf("futsal")>0?["bgTitleProperty","bgColor","relativeScale","colorField","colorFieldAreas","colorFieldBorder","logoPosition"]:["bgTitleProperty","bgColor","relativeScale","logoPosition"]},e.prototype.elementProperty=function(t,e){return"titleProperty"==t?null:void 0===e?"bgColor"==t?this.selectedBackgroundColor:"relativeScale"==t?this.selectedBackgroundScale:"colorField"==t?this.selectedColorField:"colorFieldAreas"==t?this.selectedColorFieldAreas:"colorFieldBorder"==t?this.selectedColorFieldBorder:"logoPosition"==t?this.selectedLogoPosition:null:("bgColor"==t&&(this.selectedBackgroundColor=e,this.updateBackground()),"relativeScale"==t&&(this.selectedBackgroundScale=parseFloat(e),this.updateBackground()),"colorField"==t&&(this.selectedColorField=e,this.updateBackground()),"colorFieldAreas"==t&&(this.selectedColorFieldAreas=e,this.updateBackground()),"colorFieldBorder"==t&&(this.selectedColorFieldBorder=e,this.updateBackground()),void("logoPosition"==t&&(this.selectedLogoPosition=e,this.updateLogoPosition())))},e.prototype.setBackgroundEditingMode=function(t){t!==this.editingBackground&&(this.editingBackground=t,this.currentSelection.length>0?this.setSelection([]):this.selectionChanged())},e.prototype.lastUsedColorsForFigure={arrow:["#000000"],players:["#FF0000","#000000","#D3AB9B","#000000"],players_female:["#0A71B4","#B3B3B3","#EDC9B9","#B17F48"],goalkeepers:["#FF0000","#000000","#D3AB9B","#000000"],goalkeepers_female:["#FF0000","#000000","#D3AB9B","#000000"],children:["#F29400","#B3B3B3","#EDC9B9","#000000"],players_top:["#BE0926","#741321","#D3AB9B","#000000"],futsal:["#93117E","#4D4D4D","#D3AB9B","#000000"],preparation:["#FF0000","#000000","#EDC9B9","#000000"],preparation_female:["#0A71B4","#B3B3B3","#EDC9B9","#B17F48"],referees:["#FFED00","#555555","#EDC9B9","#000000"],coaches:["#00632F","#00632F","#D3AB9B","#673B15"],discs:["#ffffff","#369cdb"],pen:["#000000"],polygon:["#000000","#FFFFFF"],materials:["#FFED00","#FFFFFF"]},e.prototype.getDefaultUniformForFigure=function(t){if(void 0!==this.lastUsedColorsForFigure[t]){var e=this.lastUsedColorsForFigure[t];return{type:"f",c1:e[0],c3:"#000000",c2:e[1],c4:e[0]}}return{type:"f",c1:"#FF0000",c3:"#FFFFFF",c2:"#000000",c4:"#FF0000"}},e.prototype.lastUsedUniform={},e.prototype.getLastUsedColorsForFigure=function(t){return void 0!==this.lastUsedColorsForFigure[t]?this.lastUsedColorsForFigure[t]:["#000000","#FFFFFF","#D3AB9B","#000000"]},e.prototype.setLastUsedColorsForFigure=function(t,e){this.lastUsedColorsForFigure[t]=e},e.prototype.getLastUsedUniformForFigure=function(e){return void 0!==this.lastUsedUniform[e]&&this.lastUsedUniform[e].length>0?t.extend({},this.getDefaultUniformForFigure(e),this.lastUsedUniform[e][this.lastUsedUniform[e].length-1]):t.extend({},this.getDefaultUniformForFigure(e))},e.prototype.getLastUsedUniformsForFigure=function(){var t=[];for(var e in this.lastUsedUniform)for(var n=0;n0&&a.appendUndo({undo:function(){t.each(s,function(t){a.findElement(this.ele_id).elementProperty(this.propertyName,this.oldProperty,!0),a.updatePropertiesPanel()})},redo:function(){t.each(s,function(t){a.findElement(this.ele_id).elementProperty(this.propertyName,this.newProperty,!0),a.updatePropertiesPanel()})},name:function(){return i}})},e.prototype.isEquivalent=function(t,e){var n=Object.getOwnPropertyNames(t),i=Object.getOwnPropertyNames(e);if(n.length!=i.length)return!1;for(var r=0;r
          ").addClass("segment-select-stroke").addClass("stroke-"+n));t(this).append(i)}),i.find(".property-stroke span").on("click",function(){var t=i.find(".property-stroke select").val();n.setElementProperty("stroke",t,"Stroke")}),t(".property-lineStyle .option",i).each(function(e){var n=t(this).attr("value"),i=(t(this).height(),t("
          ").addClass("segment-select-lineStyle").addClass("line-"+n));t(this).append(i)}),i.find(".property-lineStyle span").on("click",function(){var t=i.find(".property-lineStyle select").val();n.setElementProperty("lineStyle",t,"Line Style")}),t(".property-logoPosition .option",i).each(function(e){var n=t(this).attr("value"),i=(t(this).height(),t("
          ").addClass("segment-select-logoPosition").addClass("position-"+n));t(this).append(i)}),i.find(".property-logoPosition span").on("click",function(){var t=i.find(".property-logoPosition select").val();n.setElementProperty("logoPosition",t,"Logo Position")}),t(".property-arrowStyle .option",i).each(function(e){var n=t(this).attr("value"),i=(t(this).height(),t("
          ").addClass("segment-select-arrowStyle").addClass(n));t(this).append(i)}),i.find(".property-arrowStyle span").on("click",function(){var t=i.find(".property-arrowStyle select").val();n.setElementProperty("arrowStyle",t,"Arrow Style")}),t(".property-flip .option",i).each(function(e){var n=t(this).attr("value"),i=(t(this).height(),t("
          ").addClass("segment-select-flip").addClass("flip-"+n));t(this).append(i)}),i.find(".property-flip span").on("click",function(){var t=i.find(".property-flip select").val();n.setElementProperty("flip",t,"Flip")});var r={};i.find(".property-color input").spectrum({flat:!1,clickoutFiresChange:!0,showInput:!0,showPalette:!0,showSelectionPalette:!0,palette:e.prototype.colorPalette,localStorageKey:"youcoach.drilleditor",maxSelectionSize:3,showInitial:!0,showButtons:!1,preferredFormat:"hex",show:function(){r=n.getSelectedElementsPropertyValue("color")},move:function(t){n.setElementProperty("color",t.toHexString(),"Color",!1),n.updateLastUsedColorsForFigure()},hide:function(t){n.lastSelectedColor=t.toHexString(),n.setElementProperty("color",t.toHexString(),"Color",!0,r),r={},n.updateLastUsedColorsForFigure()}});var o={};i.find(".property-color2 input").spectrum({flat:!1,clickoutFiresChange:!0,showInput:!0,showPalette:!0,showSelectionPalette:!0,palette:e.prototype.colorPalette,localStorageKey:"youcoach.drilleditor-color2",maxSelectionSize:3,showInitial:!0,showButtons:!1,preferredFormat:"hex",show:function(){o=n.getSelectedElementsPropertyValue("color2")},move:function(t){n.setElementProperty("color2",t.toHexString(),"Color 2",!1),n.updateLastUsedColorsForFigure()},hide:function(t){n.setElementProperty("color2",t.toHexString(),"Color 2",!0,o),o={},n.updateLastUsedColorsForFigure()}});var a={},s={};i.find(".property-skin input").YCSkinChooser({beforeShow:function(){a=n.getSelectedElementsPropertyValue("skin"),s=n.getSelectedElementsPropertyValue("hair")},change:function(t){n.setElementProperties(["skin","hair"],[t.skin,t.hair],"Skin and hair color",!1),n.updateLastUsedColorsForFigure()},beforeHide:function(t){n.setElementProperties(["skin","hair"],[t.skin,t.hair],"Skin and hair color",!0,[a,s]),a={},s={},n.updateLastUsedColorsForFigure()}});var l={};i.find(".property-uniform input").YCUniformChooser({beforeShow:function(){l=n.getSelectedElementsPropertyValue("uniform")},change:function(t){n.setElementProperties(["uniform"],[t],"Uniform",!1)},beforeHide:function(t){n.setElementProperties(["uniform"],[t],"Uniform",!0,[l]),l={},n.updateLastUsedUniformForFigure()},locale:{"T-Shirt":n.t("T-Shirt"),Shorts:n.t("Shorts"),Socks:n.t("Socks"),Stripes:n.t("Stripes")}});var c={};i.find(".property-bgColor input").spectrum({flat:!1,clickoutFiresChange:!0,showInput:!0,showInitial:!0,showButtons:!1,allowEmpty:!0,preferredFormat:"hex",showPalette:!0,palette:["#a6c58b","#3389e0","#9f9f9f","#77b55f"],showSelectionPalette:!0,maxSelectionSize:3,show:function(){c=n.getSelectedElementsPropertyValue("bgColor")},move:function(t){n.setElementProperty("bgColor",null!=t?t.toHexString():null,"Background Color",!1)},hide:function(t){n.setElementProperty("bgColor",null!=t?t.toHexString():null,"Background Color",!0,c),c={}}});var u={};i.find(".property-colorField input").spectrum({flat:!1,clickoutFiresChange:!0,showInput:!0,showInitial:!0,showButtons:!1,allowEmpty:!0,preferredFormat:"hex",showPalette:!0,palette:["#a6c58b","#3389e0","#9f9f9f","#77b55f","#FF0000","#3B9CCC","#277EA0","#FF9F48"],showSelectionPalette:!0,maxSelectionSize:3,show:function(){u=n.getSelectedElementsPropertyValue("colorField")},move:function(t){n.setElementProperty("colorField",null!=t?t.toHexString():null,"Field",!1)},hide:function(t){n.setElementProperty("colorField",null!=t?t.toHexString():null,"Field",!0,u),u={}}});var h={};i.find(".property-colorFieldAreas input").spectrum({flat:!1,clickoutFiresChange:!0,showInput:!0,showInitial:!0,showButtons:!1,allowEmpty:!0,preferredFormat:"hex",showPalette:!0,palette:["#a6c58b","#3389e0","#9f9f9f","#77b55f","#FF0000","#3B9CCC","#277EA0","#FF9F48"],showSelectionPalette:!0,maxSelectionSize:3,show:function(){h=n.getSelectedElementsPropertyValue("colorFieldAreas")},move:function(t){n.setElementProperty("colorFieldAreas",null!=t?t.toHexString():null,"Areas",!1)},hide:function(t){n.setElementProperty("colorFieldAreas",null!=t?t.toHexString():null,"Areas",!0,h),h={}}});var p={};i.find(".property-colorFieldBorder input").spectrum({flat:!1,clickoutFiresChange:!0,showInput:!0,showInitial:!0,showButtons:!1,allowEmpty:!0,preferredFormat:"hex",showPalette:!0,palette:["#a6c58b","#3389e0","#9f9f9f","#77b55f","#FF0000","#3B9CCC","#277EA0","#FF9F48"],showSelectionPalette:!0,maxSelectionSize:3,show:function(){p=n.getSelectedElementsPropertyValue("colorFieldBorder")},move:function(t){n.setElementProperty("colorFieldBorder",null!=t?t.toHexString():null,"Border",!1)},hide:function(t){n.setElementProperty("colorFieldBorder",null!=t?t.toHexString():null,"Border",!0,p),p={}}});var d={};i.find(".property-opacity input").jRange({from:0,to:100,step:5,scale:[0,25,50,75,100],format:"%s",width:150,showLabels:!1,onstatechange:function(){if(!n.updatingProperties){var e=t(".property-opacity input",i).val();n.setElementProperty("opacity",e/100,"Opacity",!1)}},ondragstart:function(){d=n.getSelectedElementsPropertyValue("opacity")},ondragend:function(){var e=t(".property-opacity input",i).val();n.setElementProperty("opacity",e/100,"Opacity",!0,d),d={}}});var f={};i.find(".property-bgOpacity input").jRange({from:0,to:100,step:5,scale:[0,25,50,75,100],format:"%s",width:150,showLabels:!1,onstatechange:function(){if(!n.updatingProperties){var e=t(".property-bgOpacity input",i).val();n.setElementProperty("bgOpacity",e/100,"Background Opacity",!1)}},ondragstart:function(){f=n.getSelectedElementsPropertyValue("bgOpacity")},ondragend:function(){var e=t(".property-bgOpacity input",i).val();n.setElementProperty("bgOpacity",e/100,"Background Opacity",!0,f),f={}}});var g={};i.find(".property-textlabel input").on("focus",function(){g=n.getSelectedElementsPropertyValue("textlabel")}),i.find(".property-textlabel input").on("keyup",function(e){13==e.which&&t(this).blur()}),i.find(".property-textlabel input").on("blur",function(){var t=i.find(".property-textlabel input").val();n.setElementProperty("textlabel",t,"Label",!0,g),g={}});var m={};i.find(".property-text textarea").on("focus",function(){m=n.getSelectedElementsPropertyValue("text")}),i.find(".property-text textarea").on("keyup",function(e){9==e.which&&t(this).blur()}),i.find(".property-text textarea").on("blur",function(){var t=i.find(".property-text textarea").val();n.setElementProperty("text",t,"Text",!0,m),m={}});var y={};i.find(".property-fontSize input").jRange({from:4,to:200,step:2,scale:[2,12,24,75,100],format:"%s",width:150,showLabels:!1,onstatechange:function(){if(!n.updatingProperties){var e=t(".property-fontSize input",i).val();n.setElementProperty("fontSize",e,"Font Size",!1)}},ondragstart:function(){y=n.getSelectedElementsPropertyValue("fontSize")},ondragend:function(){var e=t(".property-fontSize input",i).val();n.setElementProperty("fontSize",e,"Font Size",!0,y),y={}}});var v={};i.find(".property-waveFrequency input").jRange({from:80,to:5,step:2,scale:["Low","Height"],format:"%s",width:150,showLabels:!1,onstatechange:function(){if(!n.updatingProperties){var e=t(".property-waveFrequency input",i).val();n.setElementProperty("waveFrequency",e,"Wave Frequency",!1)}},ondragstart:function(){v=n.getSelectedElementsPropertyValue("waveFrequency")},ondragend:function(){var e=t(".property-waveFrequency input",i).val();n.setElementProperty("waveFrequency",e,"Wave Frequency",!0,v),v={}}});var C={};i.find(".property-waveAmplitude input").jRange({from:0,to:100,step:2,scale:["Auto",25,50,100],format:"%s",width:150,showLabels:!1,onstatechange:function(){if(!n.updatingProperties){var e=t(".property-waveAmplitude input",i).val();e<10&&(e=-1),n.setElementProperty("waveAmplitude",e,"Wave Amplitude",!1)}},ondragstart:function(){C=n.getSelectedElementsPropertyValue("waveAmplitude")},ondragend:function(){var e=t(".property-waveAmplitude input",i).val();n.setElementProperty("waveAmplitude",e,"Wave Amplitude",!0,C),C={}}});var b={};i.find(".property-linesOffset input").jRange({from:10,to:100,step:2,scale:[1,25,50,75,100],format:"%s",width:150,showLabels:!1,onstatechange:function(){if(!n.updatingProperties){var e=t(".property-linesOffset input",i).val();n.setElementProperty("linesOffset",e,"Lines Offset",!1)}},ondragstart:function(){b=n.getSelectedElementsPropertyValue("linesOffset")},ondragend:function(){var e=t(".property-linesOffset input",i).val();n.setElementProperty("linesOffset",e,"Lines Offset",!0,b),b={}}});var x={};i.find(".property-relativeScale input").jRange({from:.2,to:5,step:.05,scale:["Small","Big"],format:function(t){return parseFloat(t).toFixed(2)},width:150,showLabels:!1,onstatechange:function(){if(!n.updatingProperties){var e=t(".property-relativeScale input",i).val();n.setElementProperty("relativeScale",e,"Scale",!1)}},ondragstart:function(){x=n.getSelectedElementsPropertyValue("relativeScale")},ondragend:function(){var e=t(".property-relativeScale input",i).val();n.setElementProperty("relativeScale",e,"Scale",!0,x),x={}}}),this.updatePropertiesPanel()},e.prototype.updatePropertiesPanel=function(){this.updatingProperties=!0;for(var e=this.$mainElement,n=[],i=0;i .edit-property").css({"margin-top":null}),e.find(".properties > .edit-property:visible:first").css({"margin-top":"0px"}),e.find(".properties").css({padding:0===e.find(".properties > .edit-property:not(.properties-container):visible").size()?"0px":"10px"}),this.updatingProperties=!1}}(jQuery,YCEditor),function(t,e){"use strict";e.prototype.timelineVisible=!0,e.prototype.initAnimator=function(){this.timeline={max_duration:120,selectedKeyFrameTime:0,currentKeyFrameTime:0,tick_size:25,time_left:10,keyframes:[],total_duration:10,animatedDataFrames:[],animating:!1},this.timeline.totalWidth=this.timeline.max_duration*this.timeline.tick_size+20},e.prototype.createMainUITimeline=function(){var e=this,n=t("
          ").addClass("timeline-wrapper"),i=t('
          ');n.append(i);var r=t("
          ").addClass("timeline-container"),o=t('
          ');r.append(o),n.append(r),this.$mainElement.append(n),t(".animator-tool",this.$mainElement).on("click",function(){e.toggleTimeline()}),e.toggleTimeline(),e.initTimeline(),t(".yceditor-play",this.$mainElement).on("click",function(){e.playAnimation()}),t(".yceditor-pause",this.$mainElement).on("click",function(t){e.stopAnimation()})},e.prototype.toggleTimeline=function(){this.timelineVisible?(t(".timeline-wrapper",this.$mainElement).slideUp(),this.timelineVisible=!1):(t(".timeline-wrapper",this.$mainElement).slideDown(),this.timelineVisible=!0),this.recalculateDesignArea()},e.prototype.initTimeline=function(){for(var e=this,n=0;n<=this.timeline.max_duration;++n){var i=t('
          '+n+"
          ");i.css("left",n*this.timeline.tick_size+10),t(".timeline .time-axis",this.$mainElement).append(i)}t(".timeline",this.$mainElement).css("left",0),t(".timeline",this.$mainElement).css("width",this.timeline.totalWidth),t(".timeline",this.$mainElement).on("click",function(){e.timeline.animating&&e.stopAnimation()}),t(".timeline",this.$mainElement).draggable({addClasses:!1,axis:"x",drag:function(n,i){var r=-(e.timeline.totalWidth-t(".timeline-container",e.$mainElement).width());i.position.left>0?i.position.left=0:i.position.lefto&&(i.position.left=o),t(".key-frames",e.$mainElement).width(i.position.left-10),t(".key-frames-background",e.$mainElement).width(i.position.left-10),t(".current-frame",e.$mainElement).position().left>i.position.left&&t(".current-frame",e.$mainElement).css("left",i.position.left),e.timeline.currentKeyFrameTime=Math.floor((t(".current-frame",e.$mainElement).position().left-e.timeline.time_left)/e.timeline.tick_size),e.updateSelectedFrame(),e.timeline.total_duration=(i.position.left-10)/e.timeline.tick_size}}),t(".current-frame",this.$mainElement).draggable({addClasses:!1,axis:"x",grid:[25,0],drag:function(n,i){var r=e.timeline.time_left,o=t(".anim-end",e.$mainElement).position().left;i.position.lefto&&(i.position.left=o);var a=(i.position.left-e.timeline.time_left)/e.timeline.tick_size;e.timeline.currentKeyFrameTime!==a&&(e.timeline.currentKeyFrameTime=a,e.updateSelectedFrame(),e.updateScene(e.timeline.currentKeyFrameTime))}}),this.addKeyframe(0),this.updateSelectedFrame(!0)},e.prototype.updateScene=function(t){for(var e=0;e');if(r.css("left",e*n.timeline.tick_size),t(".key-frames",this.$mainElement).append(r),i)r.addClass("first-frame");else{var o=0;r.draggable({addClasses:!1,grid:[25,1],start:function(e,i){o=t(this).position().left/n.timeline.tick_size},stop:function(e,i){var r=t(this).position().left/n.timeline.tick_size;i.position.top<-n.timeline.time_left||i.position.top>40?(n.removeKeyFrameAtTime(r),n.updateSelectedFrame(),n.updateScene(n.timeline.currentKeyFrameTime)):(t(this).css("top",14),r<0&&t(this).css("left",o*n.timeline.tick_size),r>n.timeline.total_duration&&n.setAnimationTotalDuration(r),n.moveKeyFrameFromTimeTo(o,r),n.updateSelectedFrame(),n.updateScene(n.timeline.currentKeyFrameTime))}})}r.on("click",function(){var e=t(this).position().left/n.timeline.tick_size;n.setCurrentKeyFrameTime(e)}),n.timeline.keyframes.push({time:e,element:r[0]}),n.timeline.keyframes.sort(function(t,e){return parseFloat(t.time)-parseFloat(e.time)}),n.updateSelectedFrame()}},e.prototype.setCurrentKeyFrameTime=function(e){this.timeline.currentKeyFrameTime!==e&&(t(".current-frame",this.$mainElement).css("left",e*this.timeline.tick_size+this.timeline.time_left),this.timeline.currentKeyFrameTime=e,this.updateSelectedFrame(),this.updateScene(this.timeline.currentKeyFrameTime))},e.prototype.getTimelineKeyFrameAt=function(t){for(var e=0;e-1&&this.timeline.keyframes.splice(i,1);for(var r=this.currentSelection,o=0;o-1&&this.timeline.keyframes.splice(l,1)}else i.time=n;a.keyFrames[n]=s}}this.timeline.keyframes.sort(function(t,e){return parseFloat(t.time)-parseFloat(e.time)})}},e.prototype.updateSelectedFrame=function(e){void 0===e&&(e=!1);for(var n=this.timeline.currentKeyFrameTime,i=this.timeline.keyframes.length-1;i>=0;--i)if(this.timeline.keyframes[i].time<=n){(this.timeline.keyframes[i].time!=this.timeline.selectedKeyFrameTime||e)&&(t(".key-frame.current",this.$mainElement).removeClass("current"),t(this.timeline.keyframes[i].element).addClass("current"),this.timeline.selectedKeyFrameTime=this.timeline.keyframes[i].time);break}},e.prototype.playAnimation=function(e){this.stopAnimation(),void 0===e&&(e=!1);var n=this;t(".yceditor-play",this.$mainElement).addClass("active-button"),this.timeline.animating=!0,this.setSelection([]);var i=t(".current-frame",this.$mainElement);i.css("left",this.timeline.time_left);var r=n.timeline.total_duration,o=this.timeline.time_left+r*this.timeline.tick_size;this.timeline.animatedDataFrames=[],i.animate({left:o},{duration:1e3*r*this.options.slowMotion,fail:function(t){},easing:"linear",progress:function(){var t=Math.floor((i.position().left-n.timeline.time_left)/n.timeline.tick_size);n.timeline.currentKeyFrameTime!==t&&(n.timeline.currentKeyFrameTime=t,n.updateSelectedFrame())},complete:function(){n.stopAnimation()}});for(var a=0;a0){var n=t[0];t=t.slice(1),void 0!==n.element.animate&&n.element.animate(n.duration,n.previousFrameData,n.frameData),setTimeout(function(){e.processAnimation(t)},n.duration)}},e.prototype.updateTimeline=function(){t(".key-frame").remove(),this.timeline.keyframes=[],this.addKeyframe(0);for(var e=this.currentSelection,n=0;n'))},e.prototype.createMainUIDesignArea=function(){var e=t("
          ").addClass("designer");this.$element=t("
          ").addClass("designer-area"),e.append(this.$element),this.$mainElement.append(e)},e.prototype.createMainUIToolbar=function(){this.toolbar=t("
          ").addClass("toolbar");var e=t("
            ").addClass("toolbar-group"),n=t("
          • ").addClass("designer-tool").addClass("selection-tool").addClass("selected").attr("title",this.t("Selection Tool"));e.append(n);var i=t("
          • ").addClass("designer-tool").addClass("pen-tool").attr("title",this.t("Free Pen Tool"));e.append(i);var r=t("
          • ").addClass("designer-tool").addClass("arrow-tool").attr("title",this.t("Arrow Tool"));e.append(r);var o=t("
          • ").addClass("separator");e.append(o);var a=t("
          • ").addClass("designer-tool").addClass("move-up-tool").addClass("disabled").attr("title",this.t("Move Up"));e.append(a);var s=t("
          • ").addClass("designer-tool").addClass("move-down-tool").addClass("disabled").attr("title",this.t("Move Down"));e.append(s),o=t("
          • ").addClass("separator"),e.append(o),e.append(t("
          • ").addClass("designer-tool").addClass("editor-cut").addClass("disabled").attr("title",this.t("Cut"))),e.append(t("
          • ").addClass("designer-tool").addClass("editor-copy").addClass("disabled").attr("title",this.t("Copy"))),e.append(t("
          • ").addClass("designer-tool").addClass("editor-paste").addClass("disabled").attr("title",this.t("Paste"))),o=t("
          • ").addClass("separator"),e.append(o),e.append(t("
          • ").addClass("designer-tool").addClass("trash-tool").addClass("disabled").attr("title",this.t("Delete selected element(s)"))),o=t("
          • ").addClass("separator"),e.append(o),e.append(t("
          • ").addClass("designer-tool").addClass("animator-tool").addClass("enabled").attr("title",this.t("Animator"))),this.toolbar.append(e);var l=t("
            ").addClass("toolbar-group-2"),c=t("").addClass("editor-fullscreen").attr("title",this.t("Enter/Exit Full Screen"));l.append(c),this.toolbar.append(l);var u=t("
            ").addClass("toolbar-group-1"),h=t("").addClass("editorUndo").addClass("disabled");u.append(h);var p=t("").addClass("editorRedo").addClass("disabled");u.append(p),this.toolbar.append(u),this.$mainElement.append(this.toolbar)},e.prototype.createMainUISidebar=function(){for(var e=t("
            ").addClass("sidebar"),n=t("").attr("name","palette_content_select").addClass("palette_content_select").attr("tabindex","1"),i=this.palette_categories,r=0;r").attr("label",this.t(o.label)),s=0,l=0;l=0)){var u=t("").attr("value",c.name).html(this.t(c.label));a.append(u),s++}}s>0&&n.append(a)}e.append(n);for(var h=t("
            ").addClass("palette"),p=t("
            ").addClass("direction-selector"),d=t("").addClass("segment-select").addClass("direction-selector-select"),f=["left","down","up","right"],g=0;g'));p.append(d);var m=t("
              ").addClass("figures");h.append(m),e.append(p),e.append(h),this.createMainUIProperties(e),this.$mainElement.append(e)},e.prototype.createMainUIProperties=function(e){for(var n=t("
              ").addClass("properties"),i=0;i").addClass("edit-property");if("color2"!==o&&("skin"!==o&&"hair"!==o)){if("color"===o?a.addClass("property-colors"):"uniform"===o?a.addClass("property-uniform-and-skin").addClass("properties-container"):a.addClass("property-"+o),""!==r.label){var s=t("").addClass("property-label").html(this.t(r.label));a.append(s)}if("uniform"===r.type){var l=t("
              ").addClass("property-uniform").css("float","left"),c=t("").addClass("property-skin").css("float","left"),h=t("").addClass("property-color").css("float","left"),d=t("").addClass("property-color2").css("float","left"),g=t("").addClass("segment-select");for(var y=0;y'));a.append(m)}else if("title"===r.type){var v=t("
                ").addClass("toolbar-group"),C=t('
              • '+this.t("Edit Field Position")+''+this.t("Editing...")+"
              • ").addClass("designer-tool").addClass("background-move-tool").attr("title",this.t("Click to edit the field position"));v.append(C),a.append(v)}else if("input"===r.type){m=t("\n \n ',t.figc={},t.figc.updateLogo=n;var i=e.prototype.calculateLogoPosition;e.prototype.calculateLogoPosition=function(e){if(!t.useFigcLogo)return i.apply(t,[e]);switch(e){case"top_left":return"translate(20,30) scale(0.2)";case"top_right":return"translate(620,30) scale(0.2)";case"bottom_left":return"translate(20,520) scale(0.2)";case"bottom_right":return"translate(620,520) scale(0.2)";default:return"translate(200,250) scale(0.5)"}}},r=function(t){return{initEditor:function(t){i(t)},initViewer:function(t){i(t)},onLoadModel:function(t,e){void 0!==e.useFigcLogo&&!0===e.useFigcLogo&&(t.useFigcLogo=!0,n(t))}}};e.prototype.plugins.push(r),e.prototype.viewerPlugins.push(r)}(jQuery,YCEditor),function(t,e){"use strict";var n=function(e){var n=250;"viewer"===e.options.mode&&(n=0,e.updateLogoPosition(!1)),e.useInterLogo?(d3.select(".logo-layer",e.logoLayer).attr("opacity",.1),d3.selectAll("#yceditor_yclogo, .special_logo_svg",e.logoLayer).transition().duration(n).ease("cubic-in-out").attr("opacity",0),0==d3.select("#inter_logo_svg",e.logoLayer).size()&&(e.interLogoWrapper=e.logoLayer.append("g").attr("transform","translate(0, -160)").attr("id","inter_logo_svg").attr("class","special_logo_svg"),t(e.interLogoWrapper.node()).prepend(t(e.logoINTER)),d3.select("#inter_logo_svg",e.logoLayer).attr("opacity",0)),d3.select("#inter_logo_svg",e.logoLayer).transition().duration(n).ease("cubic-in-out").attr("opacity",1)):(d3.select("#yceditor_yclogo",e.logoLayer).transition().duration(n).ease("cubic-in-out").attr("opacity",1),d3.selectAll(".special_logo_svg",e.logoLayer).transition().duration(n).ease("cubic-in-out").attr("opacity",0))},i=function(t){t.logoINTER='',t.inter={},t.inter.updateLogo=n;var i=e.prototype.calculateLogoPosition;e.prototype.calculateLogoPosition=function(e){if(!t.useInterLogo)return i.apply(t,[e]);switch(e){case"top_left":return"translate(-15,50) scale(0.25)";case"top_right":return"translate(600,50) scale(0.25)";case"bottom_left":return"translate(-15,470) scale(0.25)";case"bottom_right":return"translate(600,470) scale(0.25)";default:return"translate(200,250) scale(0.5)"}}},r=function(t){return{initEditor:function(t){i(t)},initViewer:function(t){i(t)},onLoadModel:function(t,e){void 0!==e.useInterLogo&&!0===e.useInterLogo&&(t.useInterLogo=!0,n(t))}}};e.prototype.plugins.push(r),e.prototype.viewerPlugins.push(r)}(jQuery,YCEditor);