diff --git a/data/index.js b/data/index.js index 666b770..41d05a0 100644 --- a/data/index.js +++ b/data/index.js @@ -38,17 +38,17 @@ const exampleIndex = [ { "ac": "EBI-25816865", "name": "EBI-25816865", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-25816865", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-25816865", }, { "ac": "EBI-25570228", "name": "EBI-25570228", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-25570228", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-25570228", }, { "ac": "~EBI-6884640", "name": "~EBI-6884640", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-6884640", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-6884640", }, { "ac": "CPX-1920", @@ -58,7 +58,7 @@ const exampleIndex = [ { "ac": "EBI-9008420", "name": "Hemoglobin HbA complex", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-9008420", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-9008420", }, { "ac": "EBI-4371590", @@ -121,37 +121,37 @@ const exampleIndex = [ { "ac": "EBI-1202920", "name": "PCNA homotrimer", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-1202920", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-1202920", }, { "ac": "EBI-6554207", "name": "DnaB helicase complex", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-6554207", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-6554207", }, { "ac": "EBI-8869931", "name": "IscS-TusA complex", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-8869931", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-8869931", }, { "ac": "EBI-9008283", "name": "Chaperonin-containing T-complex", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-9008283", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-9008283", }, { "ac": "EBI-9696567", "name": "Core mediator complex", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-9696567", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-9696567", }, { "ac": "EBI-9997373", "name": "Telomerase holoenzyme complex", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-9997373", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-9997373", }, { "ac": "EBI-10828997", "name": "GLI3-SUFU complex", - "url": "http://www.ebi.ac.uk/intact/complex/details/EBI-10828997", + "url": "https://www.ebi.ac.uk/intact/complex/details/EBI-10828997", }, { "ac": "CPX-1599", diff --git a/dist/complexviewer.js b/dist/complexviewer.js index 1be2c70..90617ed 100644 --- a/dist/complexviewer.js +++ b/dist/complexviewer.js @@ -1 +1,25 @@ -!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.complexviewer=n():t.complexviewer=n()}(window,(function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(n){return t[n]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=10)}([function(t,n,e){var r,i;!function(){var o={version:"3.5.17"},a=[].slice,s=function(t){return a.call(t)},u=this.document;function c(t){return t&&(t.ownerDocument||t.document||t).documentElement}function l(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(u)try{s(u.documentElement.childNodes)[0].nodeType}catch(t){s=function(t){for(var n=t.length,e=new Array(n);n--;)e[n]=t[n];return e}}if(Date.now||(Date.now=function(){return+new Date}),u)try{u.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var f=this.Element.prototype,h=f.setAttribute,p=f.setAttributeNS,y=this.CSSStyleDeclaration.prototype,d=y.setProperty;f.setAttribute=function(t,n){h.call(this,t,n+"")},f.setAttributeNS=function(t,n,e){p.call(this,t,n,e+"")},y.setProperty=function(t,n,e){d.call(this,t,n+"",e)}}function v(t,n){return tn?1:t>=n?0:NaN}function g(t){return null===t?NaN:+t}function x(t){return!isNaN(t)}function m(t){return{left:function(n,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=n.length);r>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=n.length);r>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}o.ascending=v,o.descending=function(t,n){return nt?1:n>=t?0:NaN},o.min=function(t,n){var e,r,i=-1,o=t.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ir&&(e=r)}else{for(;++i=r){e=r;break}for(;++ir&&(e=r)}return e},o.max=function(t,n){var e,r,i=-1,o=t.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ie&&(e=r)}else{for(;++i=r){e=r;break}for(;++ie&&(e=r)}return e},o.extent=function(t,n){var e,r,i,o=-1,a=t.length;if(1===arguments.length){for(;++o=r){e=i=r;break}for(;++or&&(e=r),i=r){e=i=r;break}for(;++or&&(e=r),i1)return a/(u-1)},o.deviation=function(){var t=o.variance.apply(this,arguments);return t?Math.sqrt(t):t};var b=m(v);function w(t){return t.length}o.bisectLeft=b.left,o.bisect=o.bisectRight=b.right,o.bisector=function(t){return m(1===t.length?function(n,e){return v(t(n),e)}:t)},o.shuffle=function(t,n,e){(o=arguments.length)<3&&(e=t.length,o<2&&(n=0));for(var r,i,o=e-n;o;)i=Math.random()*o--|0,r=t[o+n],t[o+n]=t[i+n],t[i+n]=r;return t},o.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},o.pairs=function(t){for(var n=0,e=t.length-1,r=t[0],i=new Array(e<0?0:e);n=0;)for(n=(r=t[i]).length;--n>=0;)e[--a]=r[n];return e};var k=Math.abs;function _(t){for(var n=1;t*n%1;)n*=10;return n}function S(t,n){for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}function M(){this._=Object.create(null)}o.range=function(t,n,e){if(arguments.length<3&&(e=1,arguments.length<2&&(n=t,t=0)),(n-t)/e==1/0)throw new Error("infinite range");var r,i=[],o=_(k(e)),a=-1;if(t*=o,n*=o,(e*=o)<0)for(;(r=t+e*++a)>n;)i.push(r/o);else for(;(r=t+e*++a)=r.length)return n?n.call(e,o):t?o.sort(t):o;for(var u,c,l,f,h=-1,p=o.length,y=r[s++],d=new M;++h=r.length)return n;var o=[],a=i[e++];return n.forEach((function(n,r){o.push({key:n,values:t(r,e)})})),a?o.sort((function(t,n){return a(t.key,n.key)})):o}(a(o.map,t,0),0)},e.key=function(t){return r.push(t),e},e.sortKeys=function(t){return i[r.length-1]=t,e},e.sortValues=function(n){return t=n,e},e.rollup=function(t){return n=t,e},e},o.set=function(t){var n=new T;if(t)for(var e=0,r=t.length;e=0&&(r=t.slice(e+1),t=t.slice(0,e)),t)return arguments.length<2?this[t].on(r):this[t].on(r,n);if(2===arguments.length){if(null==n)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},o.event=null,o.requote=function(t){return t.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,H={}.__proto__?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)t[e]=n[e]};function X(t){return H(t,K),t}var Y=function(t,n){return n.querySelector(t)},Z=function(t,n){return n.querySelectorAll(t)},W=function(t,n){var e=t.matches||t[z(t,"matchesSelector")];return(W=function(t,n){return e.call(t,n)})(t,n)};"function"==typeof Sizzle&&(Y=function(t,n){return Sizzle(t,n)[0]||null},Z=Sizzle,W=Sizzle.matchesSelector),o.selection=function(){return o.select(u.documentElement)};var K=o.selection.prototype=[];function $(t){return"function"==typeof t?t:function(){return Y(t,this)}}function J(t){return"function"==typeof t?t:function(){return Z(t,this)}}K.select=function(t){var n,e,r,i,o=[];t=$(t);for(var a=-1,s=this.length;++a=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),tt.hasOwnProperty(e)?{space:tt[e],local:t}:t}},K.attr=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node();return(t=o.ns.qualify(t)).local?e.getAttributeNS(t.space,t.local):e.getAttribute(t)}for(n in t)this.each(nt(n,t[n]));return this}return this.each(nt(t,n))},K.classed=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node(),r=(t=it(t)).length,i=-1;if(n=e.classList){for(;++i=0;)(e=r[i])&&(o&&o!==e.nextSibling&&o.parentNode.insertBefore(e,o),o=e);return this},K.sort=function(t){t=pt.apply(this,arguments);for(var n=-1,e=this.length;++n=n&&(n=i+1);!(a=s[n])&&++n0&&(t=t.slice(0,i));var u=mt.get(t);function c(){var n=this[r];n&&(this.removeEventListener(t,n,n.$),delete this[r])}return u&&(t=u,a=wt),i?n?function(){var i=a(n,s(arguments));c.call(this),this.addEventListener(t,this[r]=i,i.$=e),i._=n}:c:n?j:function(){var n,e=new RegExp("^__on([^.]+)"+o.requote(t)+"$");for(var r in this)if(n=r.match(e)){var i=this[r];this.removeEventListener(n[1],i,i.$),delete this[r]}}}o.selection.enter=dt,o.selection.enter.prototype=vt,vt.append=K.append,vt.empty=K.empty,vt.node=K.node,vt.call=K.call,vt.size=K.size,vt.select=function(t){for(var n,e,r,i,o,a=[],s=-1,u=this.length;++s0?1:t<0?-1:0}function Rt(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function jt(t){return t>1?0:t<-1?Nt:Math.acos(t)}function qt(t){return t>1?Tt:t<-1?-Tt:Math.asin(t)}function Gt(t){return((t=Math.exp(t))+1/t)/2}function Bt(t){return(t=Math.sin(t/2))*t}var Vt=Math.SQRT2;o.interpolateZoom=function(t,n){var e,r,i=t[0],o=t[1],a=t[2],s=n[0],u=n[1],c=n[2],l=s-i,f=u-o,h=l*l+f*f;if(h0&&(t=t.transition().duration(d)),t.call(k.event)}function A(){s&&s.domain(a.range().map((function(t){return(t-h.x)/h.k})).map(a.invert)),f&&f.domain(c.range().map((function(t){return(t-h.y)/h.k})).map(c.invert))}function L(t){v++||t({type:"zoomstart"})}function P(t){A(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function N(t){--v||(t({type:"zoomend"}),n=null)}function C(){var t=this,n=w.of(t,arguments),e=0,r=o.select(l(t)).on(x,s).on(m,u),i=_(o.mouse(t)),a=St(t);function s(){e=1,M(o.mouse(t),i),P(n)}function u(){r.on(x,null).on(m,null),a(e),N(n)}ws.call(t),L(n)}function O(){var t,n=this,e=w.of(n,arguments),r={},a=0,s=".zoom-"+o.event.changedTouches[0].identifier,u="touchmove"+s,c="touchend"+s,l=[],f=o.select(n),p=St(n);function y(){var e=o.touches(n);return t=h.k,e.forEach((function(t){t.identifier in r&&(r[t.identifier]=_(t))})),e}function d(){var t=o.event.target;o.select(t).on(u,v).on(c,x),l.push(t);for(var e=o.event.changedTouches,s=0,f=e.length;s1){g=p[0];var m=p[1],b=g[0]-m[0],w=g[1]-m[1];a=b*b+w*w}}function v(){var s,u,c,l,f=o.touches(n);ws.call(n);for(var h=0,p=f.length;h360?t-=360:t<0&&(t+=360),t<60?r+(i-r)*t/60:t<180?i:t<240?r+(i-r)*(240-t)/60:r}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,n=isNaN(n)||n<0?0:n>1?1:n,r=2*(e=e<0?0:e>1?1:e)-(i=e<=.5?e*(1+n):e+n-e*n),new un(o(t+120),o(t),o(t-120))}function Kt(t,n,e){return this instanceof Kt?(this.h=+t,this.c=+n,void(this.l=+e)):arguments.length<2?t instanceof Kt?new Kt(t.h,t.c,t.l):rn(t instanceof Qt?t.l:(t=dn((t=o.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Kt(t,n,e)}Zt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Yt(this.h,this.s,this.l/t)},Zt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Yt(this.h,this.s,t*this.l)},Zt.rgb=function(){return Wt(this.h,this.s,this.l)},o.hcl=Kt;var $t=Kt.prototype=new Xt;function Jt(t,n,e){return isNaN(t)&&(t=0),isNaN(n)&&(n=0),new Qt(e,Math.cos(t*=It)*n,Math.sin(t)*n)}function Qt(t,n,e){return this instanceof Qt?(this.l=+t,this.a=+n,void(this.b=+e)):arguments.length<2?t instanceof Qt?new Qt(t.l,t.a,t.b):t instanceof Kt?Jt(t.h,t.c,t.l):dn((t=un(t)).r,t.g,t.b):new Qt(t,n,e)}$t.brighter=function(t){return new Kt(this.h,this.c,Math.min(100,this.l+tn*(arguments.length?t:1)))},$t.darker=function(t){return new Kt(this.h,this.c,Math.max(0,this.l-tn*(arguments.length?t:1)))},$t.rgb=function(){return Jt(this.h,this.c,this.l).rgb()},o.lab=Qt;var tn=18,nn=Qt.prototype=new Xt;function en(t,n,e){var r=(t+16)/116,i=r+n/500,o=r-e/200;return new un(sn(3.2404542*(i=.95047*on(i))-1.5371385*(r=1*on(r))-.4985314*(o=1.08883*on(o))),sn(-.969266*i+1.8760108*r+.041556*o),sn(.0556434*i-.2040259*r+1.0572252*o))}function rn(t,n,e){return t>0?new Kt(Math.atan2(e,n)*Dt,Math.sqrt(n*n+e*e),t):new Kt(NaN,NaN,t)}function on(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function an(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function sn(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function un(t,n,e){return this instanceof un?(this.r=~~t,this.g=~~n,void(this.b=~~e)):arguments.length<2?t instanceof un?new un(t.r,t.g,t.b):pn(""+t,un,Wt):new un(t,n,e)}function cn(t){return new un(t>>16,t>>8&255,255&t)}function ln(t){return cn(t)+""}nn.brighter=function(t){return new Qt(Math.min(100,this.l+tn*(arguments.length?t:1)),this.a,this.b)},nn.darker=function(t){return new Qt(Math.max(0,this.l-tn*(arguments.length?t:1)),this.a,this.b)},nn.rgb=function(){return en(this.l,this.a,this.b)},o.rgb=un;var fn=un.prototype=new Xt;function hn(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function pn(t,n,e){var r,i,o,a=0,s=0,u=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return n(gn(i[0]),gn(i[1]),gn(i[2]))}return(o=xn.get(t))?n(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,u=15&o,u|=u<<4):7===t.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,u=255&o)),n(a,s,u))}function yn(t,n,e){var r,i,o=Math.min(t/=255,n/=255,e/=255),a=Math.max(t,n,e),s=a-o,u=(a+o)/2;return s?(i=u<.5?s/(a+o):s/(2-a-o),r=t==a?(n-e)/s+(n0&&u<1?0:r),new Yt(r,i,u)}function dn(t,n,e){var r=an((.4124564*(t=vn(t))+.3575761*(n=vn(n))+.1804375*(e=vn(e)))/.95047),i=an((.2126729*t+.7151522*n+.072175*e)/1);return Qt(116*i-16,500*(r-i),200*(i-an((.0193339*t+.119192*n+.9503041*e)/1.08883)))}function vn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function gn(t){var n=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*n):n}fn.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var n=this.r,e=this.g,r=this.b,i=30;return n||e||r?(n&&n=200&&n<300||304===n){try{t=e.call(i,c)}catch(t){return void a.error.call(i,t)}a.load.call(i,t)}else a.error.call(i,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(t){var n=o.event;o.event=t;try{a.progress.call(i,c)}finally{o.event=n}},i.header=function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?u[t]:(null==n?delete u[t]:u[t]=n+"",i)},i.mimeType=function(t){return arguments.length?(n=null==t?null:t+"",i):n},i.responseType=function(t){return arguments.length?(l=t,i):l},i.response=function(t){return e=t,i},["get","post"].forEach((function(t){i[t]=function(){return i.send.apply(i,[t].concat(s(arguments)))}})),i.send=function(e,r,o){if(2===arguments.length&&"function"==typeof r&&(o=r,r=null),c.open(e,t,!0),null==n||"accept"in u||(u.accept=n+",*/*"),c.setRequestHeader)for(var s in u)c.setRequestHeader(s,u[s]);return null!=n&&c.overrideMimeType&&c.overrideMimeType(n),null!=l&&(c.responseType=l),null!=o&&i.on("error",o).on("load",(function(t){o(null,t)})),a.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},o.rebind(i,a,"on"),null==r?i:i.get(function(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}(r))}xn.forEach((function(t,n){xn.set(t,cn(n))})),o.functor=mn,o.xhr=bn(I),o.dsv=function(t,n){var e=new RegExp('["'+t+"\n]"),r=t.charCodeAt(0);function i(t,e,r){arguments.length<3&&(r=e,e=null);var i=wn(t,n,null==e?o:a(e),r);return i.row=function(t){return arguments.length?i.response(null==(e=t)?o:a(t)):e},i}function o(t){return i.parse(t.responseText)}function a(t){return function(n){return i.parse(n.responseText,t)}}function s(n){return n.map(u).join(t)}function u(t){return e.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return i.parse=function(t,n){var e;return i.parseRows(t,(function(t,r){if(e)return e(t,r-1);var i=new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+"]"})).join(",")+"}");e=n?function(t,e){return n(i(t),e)}:i}))},i.parseRows=function(t,n){var e,i,o={},a={},s=[],u=t.length,c=0,l=0;function f(){if(c>=u)return a;if(i)return i=!1,o;var n=c;if(34===t.charCodeAt(n)){for(var e=n;e++24?(isFinite(n)&&(clearTimeout(Mn),Mn=setTimeout(Ln,n)),Sn=0):(Sn=1,En(Ln))}function Pn(){for(var t=Date.now(),n=kn;n;)t>=n.t&&n.c(t-n.t)&&(n.c=null),n=n.n;return t}function Nn(){for(var t,n=kn,e=1/0;n;)n.c?(n.t8?function(t){return t/e}:function(t){return t*e},symbol:t}}));function Tn(t){var n=t.decimal,e=t.thousands,r=t.grouping,i=t.currency,a=r&&e?function(t,n){for(var i=t.length,o=[],a=0,s=r[0],u=0;i>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>n));)s=r[a=(a+1)%r.length];return o.reverse().join(e)}:I;return function(t){var e=In.exec(t),r=e[1]||" ",s=e[2]||">",u=e[3]||"-",c=e[4]||"",l=e[5],f=+e[6],h=e[7],p=e[8],y=e[9],d=1,v="",g="",x=!1,m=!0;switch(p&&(p=+p.substring(1)),(l||"0"===r&&"="===s)&&(l=r="0",s="="),y){case"n":h=!0,y="g";break;case"%":d=100,g="%",y="f";break;case"p":d=100,g="%",y="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+y.toLowerCase());case"c":m=!1;case"d":x=!0,p=0;break;case"s":d=-1,y="r"}"$"===c&&(v=i[0],g=i[1]),"r"!=y||p||(y="g"),null!=p&&("g"==y?p=Math.max(1,Math.min(21,p)):"e"!=y&&"f"!=y||(p=Math.max(0,Math.min(20,p)))),y=Dn.get(y)||zn;var b=l&&h;return function(t){var e=g;if(x&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===u?"":u;if(d<0){var c=o.formatPrefix(t,p);t=c.scale(t),e=c.symbol+g}else t*=d;var w,k,_=(t=y(t,p)).lastIndexOf(".");if(_<0){var S=m?t.lastIndexOf("e"):-1;S<0?(w=t,k=""):(w=t.substring(0,S),k=t.substring(S))}else w=t.substring(0,_),k=n+t.substring(_+1);!l&&h&&(w=a(w,1/0));var M=v.length+w.length+k.length+(b?0:i.length),E=M"===s?E+i+t:"^"===s?E.substring(0,M>>=1)+i+t+E.substring(M):i+(b?t:E+t))+e}}}o.formatPrefix=function(t,n){var e=0;return(t=+t)&&(t<0&&(t*=-1),n&&(t=o.round(t,Cn(t,n))),e=1+Math.floor(1e-12+Math.log(t)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),On[8+e/3]};var In=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Dn=o.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,n){return t.toPrecision(n)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},r:function(t,n){return(t=o.round(t,Cn(t,n))).toFixed(Math.max(0,Math.min(20,Cn(t*(1+1e-15),n))))}});function zn(t){return t+""}var Rn=o.time={},jn=Date;function qn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}qn.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(){Gn.setUTCDate.apply(this._,arguments)},setDay:function(){Gn.setUTCDay.apply(this._,arguments)},setFullYear:function(){Gn.setUTCFullYear.apply(this._,arguments)},setHours:function(){Gn.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Gn.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Gn.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Gn.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Gn.setUTCSeconds.apply(this._,arguments)},setTime:function(){Gn.setTime.apply(this._,arguments)}};var Gn=Date.prototype;function Bn(t,n,e){function r(n){var e=t(n),r=o(e,1);return n-e1)for(;a=c)return-1;if(37===(i=n.charCodeAt(s++))){if(a=n.charAt(s++),!(o=k[a in Un?n.charAt(s++):a])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}l.utc=function(t){var n=l(t);function e(t){try{var e=new(jn=qn);return e._=t,n(e)}finally{jn=Date}}return e.parse=function(t){try{jn=qn;var e=n.parse(t);return e&&e._}finally{jn=Date}},e.toString=n.toString,e},l.multi=l.utc.multi=fe;var h=o.map(),p=Zn(a),y=Wn(a),d=Zn(s),v=Wn(s),g=Zn(u),x=Wn(u),m=Zn(c),b=Wn(c);i.forEach((function(t,n){h.set(t.toLowerCase(),n)}));var w={a:function(t){return s[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:l(n),d:function(t,n){return Yn(t.getDate(),n,2)},e:function(t,n){return Yn(t.getDate(),n,2)},H:function(t,n){return Yn(t.getHours(),n,2)},I:function(t,n){return Yn(t.getHours()%12||12,n,2)},j:function(t,n){return Yn(1+Rn.dayOfYear(t),n,3)},L:function(t,n){return Yn(t.getMilliseconds(),n,3)},m:function(t,n){return Yn(t.getMonth()+1,n,2)},M:function(t,n){return Yn(t.getMinutes(),n,2)},p:function(t){return i[+(t.getHours()>=12)]},S:function(t,n){return Yn(t.getSeconds(),n,2)},U:function(t,n){return Yn(Rn.sundayOfYear(t),n,2)},w:function(t){return t.getDay()},W:function(t,n){return Yn(Rn.mondayOfYear(t),n,2)},x:l(e),X:l(r),y:function(t,n){return Yn(t.getFullYear()%100,n,2)},Y:function(t,n){return Yn(t.getFullYear()%1e4,n,4)},Z:ce,"%":function(){return"%"}},k={a:function(t,n,e){d.lastIndex=0;var r=d.exec(n.slice(e));return r?(t.w=v.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){p.lastIndex=0;var r=p.exec(n.slice(e));return r?(t.w=y.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){m.lastIndex=0;var r=m.exec(n.slice(e));return r?(t.m=b.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){g.lastIndex=0;var r=g.exec(n.slice(e));return r?(t.m=x.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,n,e){return f(t,w.c.toString(),n,e)},d:re,e:re,H:oe,I:oe,j:ie,L:ue,m:ee,M:ae,p:function(t,n,e){var r=h.get(n.slice(e,e+=2).toLowerCase());return null==r?-1:(t.p=r,e)},S:se,U:$n,w:Kn,W:Jn,x:function(t,n,e){return f(t,w.x.toString(),n,e)},X:function(t,n,e){return f(t,w.X.toString(),n,e)},y:te,Y:Qn,Z:ne,"%":le};return l}Rn.year=Bn((function(t){return(t=Rn.day(t)).setMonth(0,1),t}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t){return t.getFullYear()})),Rn.years=Rn.year.range,Rn.years.utc=Rn.year.utc.range,Rn.day=Bn((function(t){var n=new jn(2e3,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t){return t.getDate()-1})),Rn.days=Rn.day.range,Rn.days.utc=Rn.day.utc.range,Rn.dayOfYear=function(t){var n=Rn.year(t);return Math.floor((t-n-6e4*(t.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,n){n=7-n;var e=Rn[t]=Bn((function(t){return(t=Rn.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t}),(function(t,n){t.setDate(t.getDate()+7*Math.floor(n))}),(function(t){var e=Rn.year(t).getDay();return Math.floor((Rn.dayOfYear(t)+(e+n)%7)/7)-(e!==n)}));Rn[t+"s"]=e.range,Rn[t+"s"].utc=e.utc.range,Rn[t+"OfYear"]=function(t){var e=Rn.year(t).getDay();return Math.floor((Rn.dayOfYear(t)+(e+n)%7)/7)}})),Rn.week=Rn.sunday,Rn.weeks=Rn.sunday.range,Rn.weeks.utc=Rn.sunday.utc.range,Rn.weekOfYear=Rn.sundayOfYear;var Un={"-":"",_:" ",0:"0"},Hn=/^\s*\d+/,Xn=/^%/;function Yn(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o68?1900:2e3),e+i[0].length):-1}function ne(t,n,e){return/^[+-]\d{4}$/.test(n=n.slice(e,e+5))?(t.Z=-n,e+5):-1}function ee(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function re(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function ie(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+3));return r?(t.j=+r[0],e+r[0].length):-1}function oe(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ae(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function se(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function ue(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function ce(t){var n=t.getTimezoneOffset(),e=n>0?"-":"+",r=k(n)/60|0,i=k(n)%60;return e+Yn(r,"0",2)+Yn(i,"0",2)}function le(t,n,e){Xn.lastIndex=0;var r=Xn.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function fe(t){for(var n=t.length,e=-1;++e=0?1:-1,s=a*o,u=Math.cos(n),c=Math.sin(n),l=i*c,f=r*u+l*Math.cos(s),h=l*a*Math.sin(s);Te.add(Math.atan2(h,f)),e=t,r=u,i=c}Ie.point=function(a,s){Ie.point=o,e=(t=a)*It,r=Math.cos(s=(n=s)*It/2+Nt/4),i=Math.sin(s)},Ie.lineEnd=function(){o(t,n)}}function ze(t){var n=t[0],e=t[1],r=Math.cos(e);return[r*Math.cos(n),r*Math.sin(n),Math.sin(e)]}function Re(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function je(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function qe(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Ge(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Be(t){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function Ve(t){return[Math.atan2(t[1],t[0]),qt(t[2])]}function Fe(t,n){return k(t[0]-n[0])Lt?r=90:c<-Lt&&(n=-90),f[0]=t,f[1]=e}};function p(i,o){l.push(f=[t=i,e=i]),or&&(r=o)}function y(o,a){var s=ze([o*It,a*It]);if(u){var c=je(u,s),l=je([c[1],-c[0],0],c);Be(l),l=Ve(l);var f=o-i,h=f>0?1:-1,y=l[0]*Dt*h,d=k(f)>180;if(d^(h*ir&&(r=v);else if(d^(h*i<(y=(y+360)%360-180)&&yr&&(r=a);d?ob(t,e)&&(e=o):b(o,e)>b(t,e)&&(t=o):e>=t?(oe&&(e=o)):o>i?b(t,o)>b(t,e)&&(e=o):b(o,e)>b(t,e)&&(t=o)}else p(o,a);u=s,i=o}function d(){h.point=y}function v(){f[0]=t,f[1]=e,h.point=p,u=null}function g(t,n){if(u){var e=t-i;c+=k(e)>180?e+(e>0?360:-360):e}else a=t,s=n;Ie.point(t,n),y(t,n)}function x(){Ie.lineStart()}function m(){g(a,s),Ie.lineEnd(),k(c)>Lt&&(t=-(e=180)),f[0]=t,f[1]=e,u=null}function b(t,n){return(n-=t)<0?n+360:n}function w(t,n){return t[0]-n[0]}function _(t,n){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:tb(d[0],d[1])&&(d[1]=p[1]),b(p[0],d[1])>b(d[0],d[1])&&(d[0]=p[0])):s.push(d=p);for(var u,c,p,y=-1/0,d=(a=0,s[c=s.length-1]);a<=c;d=p,++a)p=s[a],(u=b(d[1],p[0]))>y&&(y=u,t=p[0],e=d[1])}return l=f=null,t===1/0||n===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,n],[e,r]]}}(),o.geo.centroid=function(t){ke=_e=Se=Me=Ee=Ae=Le=Pe=Ne=Ce=Oe=0,o.geo.stream(t,Ue);var n=Ne,e=Ce,r=Oe,i=n*n+e*e+r*r;return i=0;--s)i.point((f=l[s])[0],f[1]);else r(p.x,p.p.x,-1,i);p=p.p}l=(p=p.o).z,y=!y}while(!p.v);i.lineEnd()}}}function Qe(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r=0?1:-1,_=k*w,S=_>Nt,M=y*m;if(Te.add(Math.atan2(M*k*Math.sin(_),d*b+M*Math.cos(_))),o+=S?w+k*Ct:w,S^h>=e^g>=e){var E=je(ze(f),ze(t));Be(E);var A=je(i,E);Be(A);var L=(S^w>=0?-1:1)*qt(A[2]);(r>L||r===L&&(E[0]||E[1]))&&(a+=S^w>=0?1:-1)}if(!v++)break;h=g,y=m,d=b,f=t}}return(o<-Lt||o0){for(m||(a.polygonStart(),m=!0),a.lineStart();++o1&&2&n&&e.push(e.pop().concat(e.shift())),s.push(e.filter(er))}return l}}function er(t){return t.length>1}function rr(){var t,n=[];return{lineStart:function(){n.push(t=[])},point:function(n,e){t.push([n,e])},lineEnd:j,buffer:function(){var e=n;return n=[],t=null,e},rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))}}}function ir(t,n){return((t=t.x)[0]<0?t[1]-Tt-Lt:Tt-t[1])-((n=n.x)[0]<0?n[1]-Tt-Lt:Tt-n[1])}var or=nr($e,(function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var s=o>0?Nt:-Nt,u=k(o-e);k(u-Nt)0?Tt:-Tt),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),n=0):i!==s&&u>=Nt&&(k(e-i)Lt?Math.atan((Math.sin(n)*(o=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(n))*Math.sin(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),n=0),t.point(e=o,r=a),i=s},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var i;if(null==t)i=e*Tt,r.point(-Nt,i),r.point(0,i),r.point(Nt,i),r.point(Nt,0),r.point(Nt,-i),r.point(0,-i),r.point(-Nt,-i),r.point(-Nt,0),r.point(-Nt,i);else if(k(t[0]-n[0])>Lt){var o=t[0]0,r=k(n)>Lt;return nr(i,(function(t){var n,s,u,c,l;return{lineStart:function(){c=u=!1,l=1},point:function(f,h){var p,y=[f,h],d=i(f,h),v=e?d?0:a(f,h):d?a(f+(f<0?Nt:-Nt),h):0;if(!n&&(c=u=d)&&t.lineStart(),d!==u&&(p=o(n,y),(Fe(n,p)||Fe(y,p))&&(y[0]+=Lt,y[1]+=Lt,d=i(y[0],y[1]))),d!==u)l=0,d?(t.lineStart(),p=o(y,n),t.point(p[0],p[1])):(p=o(n,y),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(r&&n&&e^d){var g;v&s||!(g=o(y,n,!0))||(l=0,e?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1])))}!d||n&&Fe(n,y)||t.point(y[0],y[1]),n=y,u=d,s=v},lineEnd:function(){u&&t.lineEnd(),n=null},clean:function(){return l|(c&&u)<<1}}}),Vr(t,6*It),e?[0,-t]:[-Nt,t-Nt]);function i(t,e){return Math.cos(t)*Math.cos(e)>n}function o(t,e,r){var i=[1,0,0],o=je(ze(t),ze(e)),a=Re(o,o),s=o[0],u=a-s*s;if(!u)return!r&&t;var c=n*a/u,l=-n*s/u,f=je(i,o),h=Ge(i,c);qe(h,Ge(o,l));var p=f,y=Re(h,p),d=Re(p,p),v=y*y-d*(Re(h,h)-1);if(!(v<0)){var g=Math.sqrt(v),x=Ge(p,(-y-g)/d);if(qe(x,h),x=Ve(x),!r)return x;var m,b=t[0],w=e[0],_=t[1],S=e[1];w0^x[1]<(k(x[0]-b)Nt^(b<=x[0]&&x[0]<=w)){var A=Ge(p,(-y+g)/d);return qe(A,h),[x,Ve(A)]}}}function a(n,r){var i=e?t:Nt-t,o=0;return n<-i?o|=1:n>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}}function sr(t,n,e,r){return function(i){var o,a=i.a,s=i.b,u=a.x,c=a.y,l=0,f=1,h=s.x-u,p=s.y-c;if(o=t-u,h||!(o>0)){if(o/=h,h<0){if(o0){if(o>f)return;o>l&&(l=o)}if(o=e-u,h||!(o<0)){if(o/=h,h<0){if(o>f)return;o>l&&(l=o)}else if(h>0){if(o0)){if(o/=p,p<0){if(o0){if(o>f)return;o>l&&(l=o)}if(o=r-c,p||!(o<0)){if(o/=p,p<0){if(o>f)return;o>l&&(l=o)}else if(p>0){if(o0&&(i.a={x:u+l*h,y:c+l*p}),f<1&&(i.b={x:u+f*h,y:c+f*p}),i}}}}}}function ur(t,n,e,r){return function(u){var c,l,f,h,p,y,d,v,g,x,m,b=u,w=rr(),k=sr(t,n,e,r),_={point:E,lineStart:function(){_.point=A,l&&l.push(f=[]);x=!0,g=!1,d=v=NaN},lineEnd:function(){c&&(A(h,p),y&&g&&w.rejoin(),c.push(w.buffer()));_.point=E,g&&u.lineEnd()},polygonStart:function(){u=w,c=[],l=[],m=!0},polygonEnd:function(){u=b,c=o.merge(c);var n=function(t){for(var n=0,e=l.length,r=t[1],i=0;ir&&Rt(c,o,t)>0&&++n:o[1]<=r&&Rt(c,o,t)<0&&--n,c=o;return 0!==n}([t,r]),e=m&&n,i=c.length;(e||i)&&(u.polygonStart(),e&&(u.lineStart(),S(null,null,1,u),u.lineEnd()),i&&Je(c,a,n,S,u),u.polygonEnd()),c=l=f=null}};function S(o,a,u,c){var l=0,f=0;if(null==o||(l=i(o,u))!==(f=i(a,u))||s(o,a)<0^u>0)do{c.point(0===l||3===l?t:e,l>1?r:n)}while((l=(l+u+4)%4)!==f);else c.point(a[0],a[1])}function M(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function E(t,n){M(t,n)&&u.point(t,n)}function A(t,n){var e=M(t=Math.max(-1e9,Math.min(1e9,t)),n=Math.max(-1e9,Math.min(1e9,n)));if(l&&f.push([t,n]),x)h=t,p=n,y=e,x=!1,e&&(u.lineStart(),u.point(t,n));else if(e&&g)u.point(t,n);else{var r={a:{x:d,y:v},b:{x:t,y:n}};k(r)?(g||(u.lineStart(),u.point(r.a.x,r.a.y)),u.point(r.b.x,r.b.y),e||u.lineEnd(),m=!1):e&&(u.lineStart(),u.point(t,n),m=!1)}d=t,v=n,g=e}return _};function i(r,i){return k(r[0]-t)0?0:3:k(r[0]-e)0?2:1:k(r[1]-n)0?1:0:i>0?3:2}function a(t,n){return s(t.x,n.x)}function s(t,n){var e=i(t,1),r=i(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}}function cr(t){var n=0,e=Nt/3,r=Ir(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*Nt/180,e=t[1]*Nt/180):[n/Nt*180,e/Nt*180]},i}function lr(t,n){var e=Math.sin(t),r=(e+Math.sin(n))/2,i=1+e*(2*r-e),o=Math.sqrt(i)/r;function a(t,n){var e=Math.sqrt(i-2*r*Math.sin(n))/r;return[e*Math.sin(t*=r),o-e*Math.cos(t)]}return a.invert=function(t,n){var e=o-n;return[Math.atan2(t,e)/r,qt((i-(t*t+e*e)*r*r)/(2*r))]},a}o.geo.clipExtent=function(){var t,n,e,r,i,o,a={stream:function(t){return i&&(i.valid=!1),(i=o(t)).valid=!0,i},extent:function(s){return arguments.length?(o=ur(t=+s[0][0],n=+s[0][1],e=+s[1][0],r=+s[1][1]),i&&(i.valid=!1,i=null),a):[[t,n],[e,r]]}};return a.extent([[0,0],[960,500]])},(o.geo.conicEqualArea=function(){return cr(lr)}).raw=lr,o.geo.albers=function(){return o.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},o.geo.albersUsa=function(){var t,n,e,r,i=o.geo.albers(),a=o.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=o.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(n,e){t=[n,e]}};function c(i){var o=i[0],a=i[1];return t=null,n(o,a),t||(e(o,a),t)||r(o,a),t}return c.invert=function(t){var n=i.scale(),e=i.translate(),r=(t[0]-e[0])/n,o=(t[1]-e[1])/n;return(o>=.12&&o<.234&&r>=-.425&&r<-.214?a:o>=.166&&o<.234&&r>=-.214&&r<-.115?s:i).invert(t)},c.stream=function(t){var n=i.stream(t),e=a.stream(t),r=s.stream(t);return{point:function(t,i){n.point(t,i),e.point(t,i),r.point(t,i)},sphere:function(){n.sphere(),e.sphere(),r.sphere()},lineStart:function(){n.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){n.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){n.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){n.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},c.precision=function(t){return arguments.length?(i.precision(t),a.precision(t),s.precision(t),c):i.precision()},c.scale=function(t){return arguments.length?(i.scale(t),a.scale(.35*t),s.scale(t),c.translate(i.translate())):i.scale()},c.translate=function(t){if(!arguments.length)return i.translate();var o=i.scale(),l=+t[0],f=+t[1];return n=i.translate(t).clipExtent([[l-.455*o,f-.238*o],[l+.455*o,f+.238*o]]).stream(u).point,e=a.translate([l-.307*o,f+.201*o]).clipExtent([[l-.425*o+Lt,f+.12*o+Lt],[l-.214*o-Lt,f+.234*o-Lt]]).stream(u).point,r=s.translate([l-.205*o,f+.212*o]).clipExtent([[l-.214*o+Lt,f+.166*o+Lt],[l-.115*o-Lt,f+.234*o-Lt]]).stream(u).point,c},c.scale(1070)};var fr,hr,pr,yr,dr,vr,gr={point:j,lineStart:j,lineEnd:j,polygonStart:function(){hr=0,gr.lineStart=xr},polygonEnd:function(){gr.lineStart=gr.lineEnd=gr.point=j,fr+=k(hr/2)}};function xr(){var t,n,e,r;function i(t,n){hr+=r*t-e*n,e=t,r=n}gr.point=function(o,a){gr.point=i,t=e=o,n=r=a},gr.lineEnd=function(){i(t,n)}}var mr={point:function(t,n){tdr&&(dr=t);nvr&&(vr=n)},lineStart:j,lineEnd:j,polygonStart:j,polygonEnd:j};function br(){var t=wr(4.5),n=[],e={point:r,lineStart:function(){e.point=i},lineEnd:a,polygonStart:function(){e.lineEnd=s},polygonEnd:function(){e.lineEnd=a,e.point=r},pointRadius:function(n){return t=wr(n),e},result:function(){if(n.length){var t=n.join("");return n=[],t}}};function r(e,r){n.push("M",e,",",r,t)}function i(t,r){n.push("M",t,",",r),e.point=o}function o(t,e){n.push("L",t,",",e)}function a(){e.point=r}function s(){n.push("Z")}return e}function wr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var kr,_r={point:Sr,lineStart:Mr,lineEnd:Er,polygonStart:function(){_r.lineStart=Ar},polygonEnd:function(){_r.point=Sr,_r.lineStart=Mr,_r.lineEnd=Er}};function Sr(t,n){Se+=t,Me+=n,++Ee}function Mr(){var t,n;function e(e,r){var i=e-t,o=r-n,a=Math.sqrt(i*i+o*o);Ae+=a*(t+e)/2,Le+=a*(n+r)/2,Pe+=a,Sr(t=e,n=r)}_r.point=function(r,i){_r.point=e,Sr(t=r,n=i)}}function Er(){_r.point=Sr}function Ar(){var t,n,e,r;function i(t,n){var i=t-e,o=n-r,a=Math.sqrt(i*i+o*o);Ae+=a*(e+t)/2,Le+=a*(r+n)/2,Pe+=a,Ne+=(a=r*t-e*n)*(e+t),Ce+=a*(r+n),Oe+=3*a,Sr(e=t,r=n)}_r.point=function(o,a){_r.point=i,Sr(t=e=o,n=r=a)},_r.lineEnd=function(){i(t,n)}}function Lr(t){var n=4.5,e={point:r,lineStart:function(){e.point=i},lineEnd:a,polygonStart:function(){e.lineEnd=s},polygonEnd:function(){e.lineEnd=a,e.point=r},pointRadius:function(t){return n=t,e},result:j};function r(e,r){t.moveTo(e+n,r),t.arc(e,r,n,0,Ct)}function i(n,r){t.moveTo(n,r),e.point=o}function o(n,e){t.lineTo(n,e)}function a(){e.point=r}function s(){t.closePath()}return e}function Pr(t){var n=.5,e=Math.cos(30*It),r=16;function i(t){return(r?a:o)(t)}function o(n){return Or(n,(function(e,r){e=t(e,r),n.point(e[0],e[1])}))}function a(n){var e,i,o,a,u,c,l,f,h,p,y,d,v={point:g,lineStart:x,lineEnd:b,polygonStart:function(){n.polygonStart(),v.lineStart=w},polygonEnd:function(){n.polygonEnd(),v.lineStart=x}};function g(e,r){e=t(e,r),n.point(e[0],e[1])}function x(){f=NaN,v.point=m,n.lineStart()}function m(e,i){var o=ze([e,i]),a=t(e,i);s(f,h,l,p,y,d,f=a[0],h=a[1],l=e,p=o[0],y=o[1],d=o[2],r,n),n.point(f,h)}function b(){v.point=g,n.lineEnd()}function w(){x(),v.point=k,v.lineEnd=_}function k(t,n){m(e=t,n),i=f,o=h,a=p,u=y,c=d,v.point=m}function _(){s(f,h,l,p,y,d,i,o,e,a,u,c,r,n),v.lineEnd=b,b()}return v}function s(r,i,o,a,u,c,l,f,h,p,y,d,v,g){var x=l-r,m=f-i,b=x*x+m*m;if(b>4*n&&v--){var w=a+p,_=u+y,S=c+d,M=Math.sqrt(w*w+_*_+S*S),E=Math.asin(S/=M),A=k(k(S)-1)n||k((x*C+m*O)/b-.5)>.3||a*p+u*y+c*d0&&16,i):Math.sqrt(n)},i}function Nr(t){var n=Pr((function(n,e){return t([n*Dt,e*Dt])}));return function(t){return Dr(n(t))}}function Cr(t){this.stream=t}function Or(t,n){return{point:n,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Tr(t){return Ir((function(){return t}))()}function Ir(t){var n,e,r,i,a,s,u=Pr((function(t,e){return[(t=n(t,e))[0]*c+i,a-t[1]*c]})),c=150,l=480,f=250,h=0,p=0,y=0,d=0,v=0,g=or,x=I,m=null,b=null;function w(t){return[(t=r(t[0]*It,t[1]*It))[0]*c+i,a-t[1]*c]}function k(t){return(t=r.invert((t[0]-i)/c,(a-t[1])/c))&&[t[0]*Dt,t[1]*Dt]}function _(){r=Ke(e=jr(y,d,v),n);var t=n(h,p);return i=l-t[0]*c,a=f+t[1]*c,S()}function S(){return s&&(s.valid=!1,s=null),w}return w.stream=function(t){return s&&(s.valid=!1),(s=Dr(g(e,u(x(t))))).valid=!0,s},w.clipAngle=function(t){return arguments.length?(g=null==t?(m=t,or):ar((m=+t)*It),S()):m},w.clipExtent=function(t){return arguments.length?(b=t,x=t?ur(t[0][0],t[0][1],t[1][0],t[1][1]):I,S()):b},w.scale=function(t){return arguments.length?(c=+t,_()):c},w.translate=function(t){return arguments.length?(l=+t[0],f=+t[1],_()):[l,f]},w.center=function(t){return arguments.length?(h=t[0]%360*It,p=t[1]%360*It,_()):[h*Dt,p*Dt]},w.rotate=function(t){return arguments.length?(y=t[0]%360*It,d=t[1]%360*It,v=t.length>2?t[2]%360*It:0,_()):[y*Dt,d*Dt,v*Dt]},o.rebind(w,u,"precision"),function(){return n=t.apply(this,arguments),w.invert=n.invert&&k,_()}}function Dr(t){return Or(t,(function(n,e){t.point(n*It,e*It)}))}function zr(t,n){return[t,n]}function Rr(t,n){return[t>Nt?t-Ct:t<-Nt?t+Ct:t,n]}function jr(t,n,e){return t?n||e?Ke(Gr(t),Br(n,e)):Gr(t):n||e?Br(n,e):Rr}function qr(t){return function(n,e){return[(n+=t)>Nt?n-Ct:n<-Nt?n+Ct:n,e]}}function Gr(t){var n=qr(t);return n.invert=qr(-t),n}function Br(t,n){var e=Math.cos(t),r=Math.sin(t),i=Math.cos(n),o=Math.sin(n);function a(t,n){var a=Math.cos(n),s=Math.cos(t)*a,u=Math.sin(t)*a,c=Math.sin(n),l=c*e+s*r;return[Math.atan2(u*i-l*o,s*e-c*r),qt(l*i+u*o)]}return a.invert=function(t,n){var a=Math.cos(n),s=Math.cos(t)*a,u=Math.sin(t)*a,c=Math.sin(n),l=c*i-u*o;return[Math.atan2(u*i+c*o,s*e+l*r),qt(l*e-s*r)]},a}function Vr(t,n){var e=Math.cos(t),r=Math.sin(t);return function(i,o,a,s){var u=a*n;null!=i?(i=Fr(e,i),o=Fr(e,o),(a>0?io)&&(i+=a*Ct)):(i=t+a*Ct,o=t-.5*u);for(var c,l=i;a>0?l>o:l2?t[2]*It:0),n.invert=function(n){return(n=t.invert(n[0]*It,n[1]*It))[0]*=Dt,n[1]*=Dt,n},n},Rr.invert=zr,o.geo.circle=function(){var t,n,e=[0,0],r=6;function i(){var t="function"==typeof e?e.apply(this,arguments):e,r=jr(-t[0]*It,-t[1]*It,0).invert,i=[];return n(null,null,1,{point:function(t,n){i.push(t=r(t,n)),t[0]*=Dt,t[1]*=Dt}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(e=t,i):e},i.angle=function(e){return arguments.length?(n=Vr((t=+e)*It,r*It),i):t},i.precision=function(e){return arguments.length?(n=Vr(t*It,(r=+e)*It),i):r},i.angle(90)},o.geo.distance=function(t,n){var e,r=(n[0]-t[0])*It,i=t[1]*It,o=n[1]*It,a=Math.sin(r),s=Math.cos(r),u=Math.sin(i),c=Math.cos(i),l=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((e=f*a)*e+(e=c*l-u*f*s)*e),u*l+c*f*s)},o.geo.graticule=function(){var t,n,e,r,i,a,s,u,c,l,f,h,p=10,y=p,d=90,v=360,g=2.5;function x(){return{type:"MultiLineString",coordinates:m()}}function m(){return o.range(Math.ceil(r/d)*d,e,d).map(f).concat(o.range(Math.ceil(u/v)*v,s,v).map(h)).concat(o.range(Math.ceil(n/p)*p,t,p).filter((function(t){return k(t%d)>Lt})).map(c)).concat(o.range(Math.ceil(a/y)*y,i,y).filter((function(t){return k(t%v)>Lt})).map(l))}return x.lines=function(){return m().map((function(t){return{type:"LineString",coordinates:t}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(r).concat(h(s).slice(1),f(e).reverse().slice(1),h(u).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.majorExtent(t).minorExtent(t):x.minorExtent()},x.majorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],u=+t[0][1],s=+t[1][1],r>e&&(t=r,r=e,e=t),u>s&&(t=u,u=s,s=t),x.precision(g)):[[r,u],[e,s]]},x.minorExtent=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],a=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),a>i&&(e=a,a=i,i=e),x.precision(g)):[[n,a],[t,i]]},x.step=function(t){return arguments.length?x.majorStep(t).minorStep(t):x.minorStep()},x.majorStep=function(t){return arguments.length?(d=+t[0],v=+t[1],x):[d,v]},x.minorStep=function(t){return arguments.length?(p=+t[0],y=+t[1],x):[p,y]},x.precision=function(o){return arguments.length?(g=+o,c=Ur(a,i,90),l=Hr(n,t,g),f=Ur(u,s,90),h=Hr(r,e,g),x):g},x.majorExtent([[-180,-90+Lt],[180,90-Lt]]).minorExtent([[-180,-80-Lt],[180,80+Lt]])},o.geo.greatArc=function(){var t,n,e=Xr,r=Yr;function i(){return{type:"LineString",coordinates:[t||e.apply(this,arguments),n||r.apply(this,arguments)]}}return i.distance=function(){return o.geo.distance(t||e.apply(this,arguments),n||r.apply(this,arguments))},i.source=function(n){return arguments.length?(e=n,t="function"==typeof n?null:n,i):e},i.target=function(t){return arguments.length?(r=t,n="function"==typeof t?null:t,i):r},i.precision=function(){return arguments.length?i:0},i},o.geo.interpolate=function(t,n){return e=t[0]*It,r=t[1]*It,i=n[0]*It,o=n[1]*It,a=Math.cos(r),s=Math.sin(r),u=Math.cos(o),c=Math.sin(o),l=a*Math.cos(e),f=a*Math.sin(e),h=u*Math.cos(i),p=u*Math.sin(i),y=2*Math.asin(Math.sqrt(Bt(o-r)+a*u*Bt(i-e))),d=1/Math.sin(y),(v=y?function(t){var n=Math.sin(t*=y)*d,e=Math.sin(y-t)*d,r=e*l+n*h,i=e*f+n*p,o=e*s+n*c;return[Math.atan2(i,r)*Dt,Math.atan2(o,Math.sqrt(r*r+i*i))*Dt]}:function(){return[e*Dt,r*Dt]}).distance=y,v;var e,r,i,o,a,s,u,c,l,f,h,p,y,d,v},o.geo.length=function(t){return kr=0,o.geo.stream(t,Zr),kr};var Zr={sphere:j,point:j,lineStart:function(){var t,n,e;function r(r,i){var o=Math.sin(i*=It),a=Math.cos(i),s=k((r*=It)-t),u=Math.cos(s);kr+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=e*o-n*a*u)*s),n*o+e*a*u),t=r,n=o,e=a}Zr.point=function(i,o){t=i*It,n=Math.sin(o*=It),e=Math.cos(o),Zr.point=r},Zr.lineEnd=function(){Zr.point=Zr.lineEnd=j}},lineEnd:j,polygonStart:j,polygonEnd:j};function Wr(t,n){function e(n,e){var r=Math.cos(n),i=Math.cos(e),o=t(r*i);return[o*i*Math.sin(n),o*Math.sin(e)]}return e.invert=function(t,e){var r=Math.sqrt(t*t+e*e),i=n(r),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,r*a),Math.asin(r&&e*o/r)]},e}var Kr=Wr((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(o.geo.azimuthalEqualArea=function(){return Tr(Kr)}).raw=Kr;var $r=Wr((function(t){var n=Math.acos(t);return n&&n/Math.sin(n)}),I);function Jr(t,n){var e=Math.cos(t),r=function(t){return Math.tan(Nt/4+t/2)},i=t===n?Math.sin(t):Math.log(e/Math.cos(n))/Math.log(r(n)/r(t)),o=e*Math.pow(r(t),i)/i;if(!i)return ni;function a(t,n){o>0?n<-Tt+Lt&&(n=-Tt+Lt):n>Tt-Lt&&(n=Tt-Lt);var e=o/Math.pow(r(n),i);return[e*Math.sin(i*t),o-e*Math.cos(i*t)]}return a.invert=function(t,n){var e=o-n,r=zt(i)*Math.sqrt(t*t+e*e);return[Math.atan2(t,e)/i,2*Math.atan(Math.pow(o/r,1/i))-Tt]},a}function Qr(t,n){var e=Math.cos(t),r=t===n?Math.sin(t):(e-Math.cos(n))/(n-t),i=e/r+t;if(k(r)1&&Rt(t[e[r-2]],t[e[r-1]],t[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function ci(t,n){return t[0]-n[0]||t[1]-n[1]}(o.geo.stereographic=function(){return Tr(ii)}).raw=ii,oi.invert=function(t,n){return[-n,2*Math.atan(Math.exp(t))-Tt]},(o.geo.transverseMercator=function(){var t=ei(oi),n=t.center,e=t.rotate;return t.center=function(t){return t?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return t?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90])}).raw=oi,o.geom={},o.geom.hull=function(t){var n=ai,e=si;if(arguments.length)return r(t);function r(t){if(t.length<3)return[];var r,i=mn(n),o=mn(e),a=t.length,s=[],u=[];for(r=0;r=0;--r)p.push(t[s[c[r]][2]]);for(r=+f;rLt)s=s.L;else{if(!((i=o-Ai(s,a))>Lt)){r>-Lt?(n=s.P,e=s):i>-Lt?(n=s,e=s.N):n=e=s;break}if(!s.R){n=s;break}s=s.R}var u=ki(t);if(vi.insert(n,u),n||e){if(n===e)return Oi(n),e=ki(n.site),vi.insert(u,e),u.edge=e.edge=Di(n.site,u.site),Ci(n),void Ci(e);if(e){Oi(n),Oi(e);var c=n.site,l=c.x,f=c.y,h=t.x-l,p=t.y-f,y=e.site,d=y.x-l,v=y.y-f,g=2*(h*v-p*d),x=h*h+p*p,m=d*d+v*v,b={x:(v*x-p*m)/g+l,y:(h*m-d*x)/g+f};Ri(e.edge,c,y,b),u.edge=Di(c,t,null,b),e.edge=Di(t,y,null,b),Ci(n),Ci(e)}else u.edge=Di(n.site,u.site)}}function Ei(t,n){var e=t.site,r=e.x,i=e.y,o=i-n;if(!o)return r;var a=t.P;if(!a)return-1/0;var s=(e=a.site).x,u=e.y,c=u-n;if(!c)return s;var l=s-r,f=1/o-1/c,h=l/c;return f?(-h+Math.sqrt(h*h-2*f*(l*l/(-2*c)-u+c/2+i-o/2)))/f+r:(r+s)/2}function Ai(t,n){var e=t.N;if(e)return Ei(e,n);var r=t.site;return r.y===n?r.x:1/0}function Li(t){this.site=t,this.edges=[]}function Pi(t,n){return n.angle-t.angle}function Ni(){Gi(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ci(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,i=t.site,o=e.site;if(r!==o){var a=i.x,s=i.y,u=r.x-a,c=r.y-s,l=o.x-a,f=2*(u*(v=o.y-s)-c*l);if(!(f>=-Pt)){var h=u*u+c*c,p=l*l+v*v,y=(v*h-c*p)/f,d=(u*p-l*h)/f,v=d+s,g=bi.pop()||new Ni;g.arc=t,g.site=i,g.x=y+a,g.y=v+Math.sqrt(y*y+d*d),g.cy=v,t.circle=g;for(var x=null,m=xi._;m;)if(g.y=s)return;if(h>y){if(o){if(o.y>=c)return}else o={x:v,y:u};e={x:v,y:c}}else{if(o){if(o.y1)if(h>y){if(o){if(o.y>=c)return}else o={x:(u-i)/r,y:u};e={x:(c-i)/r,y:c}}else{if(o){if(o.y=s)return}else o={x:a,y:r*a+i};e={x:s,y:r*s+i}}else{if(o){if(o.xLt||k(i-e)>Lt)&&(s.splice(a,0,new ji(zi(o.site,l,k(r-f)Lt?{x:f,y:k(n-f)Lt?{x:k(e-y)Lt?{x:h,y:k(n-h)Lt?{x:k(e-p)=e&&c.x<=i&&c.y>=r&&c.y<=a?[[e,a],[i,a],[i,r],[e,r]]:[]).point=t[s]})),n}function s(t){return t.map((function(t,n){return{x:Math.round(r(t,n)/Lt)*Lt,y:Math.round(i(t,n)/Lt)*Lt,i:n}}))}return a.links=function(t){return Ui(s(t)).edges.filter((function(t){return t.l&&t.r})).map((function(n){return{source:t[n.l.i],target:t[n.r.i]}}))},a.triangles=function(t){var n=[];return Ui(s(t)).cells.forEach((function(e,r){for(var i,o,a,s,u=e.site,c=e.edges.sort(Pi),l=-1,f=c.length,h=c[f-1].edge,p=h.l===u?h.r:h.l;++lo||f>a||h=w)<<1|n>=b,_=k+4;k<_;++k)if(c=m[3&k])switch(3&k){case 0:t(c,l,f,b,w);break;case 1:t(c,b,f,h,w);break;case 2:t(c,l,w,b,p);break;case 3:t(c,b,w,h,p)}}}(t,r,i,o,a),s}function $i(t,n){t=o.rgb(t),n=o.rgb(n);var e=t.r,r=t.g,i=t.b,a=n.r-e,s=n.g-r,u=n.b-i;return function(t){return"#"+hn(Math.round(e+a*t))+hn(Math.round(r+s*t))+hn(Math.round(i+u*t))}}function Ji(t,n){var e,r={},i={};for(e in t)e in n?r[e]=ro(t[e],n[e]):i[e]=t[e];for(e in n)e in t||(i[e]=n[e]);return function(t){for(e in r)i[e]=r[e](t);return i}}function Qi(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function to(t,n){var e,r,i,o=no.lastIndex=eo.lastIndex=0,a=-1,s=[],u=[];for(t+="",n+="";(e=no.exec(t))&&(r=eo.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(e=e[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:Qi(e,r)})),o=eo.lastIndex;return od&&(d=u.x),u.y>v&&(v=u.y),c.push(u.x),l.push(u.y);else for(f=0;fd&&(d=m),b>v&&(v=b),c.push(m),l.push(b)}var w=d-p,_=v-y;function S(t,n,e,r,i,o,a,s){if(!isNaN(e)&&!isNaN(r))if(t.leaf){var u=t.x,c=t.y;if(null!=u)if(k(u-e)+k(c-r)<.01)M(t,n,e,r,i,o,a,s);else{var l=t.point;t.x=t.y=t.point=null,M(t,l,u,c,i,o,a,s),M(t,n,e,r,i,o,a,s)}else t.x=e,t.y=r,t.point=n}else M(t,n,e,r,i,o,a,s)}function M(t,n,e,r,i,o,a,s){var u=.5*(i+a),c=.5*(o+s),l=e>=u,f=r>=c,h=f<<1|l;t.leaf=!1,l?i=u:a=u,f?o=c:s=c,S(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),n,e,r,i,o,a,s)}w>_?v=y+w:d=p+_;var E={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){S(E,t,+g(t,++f),+x(t,f),p,y,d,v)},visit:function(t){Wi(t,E,p,y,d,v)},find:function(t){return Ki(E,t[0],t[1],p,y,d,v)}};if(f=-1,null==n){for(;++f=0&&!(e=o.interpolators[r](t,n)););return e}function io(t,n){var e,r=[],i=[],o=t.length,a=n.length,s=Math.min(t.length,n.length);for(e=0;e=1?1:t(n)}}function co(t){return function(n){return 1-t(1-n)}}function lo(t){return function(n){return.5*(n<.5?t(2*n):2-t(2-2*n))}}function fo(t){return t*t}function ho(t){return t*t*t}function po(t){if(t<=0)return 0;if(t>=1)return 1;var n=t*t,e=n*t;return 4*(t<.5?e:3*(t-n)+e-.75)}function yo(t){return 1-Math.cos(t*Tt)}function vo(t){return Math.pow(2,10*(t-1))}function go(t){return 1-Math.sqrt(1-t*t)}function xo(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function mo(t,n){return n-=t,function(e){return Math.round(t+n*e)}}function bo(t){var n,e,r,i=[t.a,t.b],o=[t.c,t.d],a=ko(i),s=wo(i,o),u=ko(((n=o)[0]+=(r=-s)*(e=i)[0],n[1]+=r*e[1],n))||0;i[0]*o[1]=0?t.slice(0,n):t,r=n>=0?t.slice(n+1):"in";return e=ao.get(e)||oo,uo((r=so.get(r)||I)(e.apply(null,a.call(arguments,1))))},o.interpolateHcl=function(t,n){t=o.hcl(t),n=o.hcl(n);var e=t.h,r=t.c,i=t.l,a=n.h-e,s=n.c-r,u=n.l-i;isNaN(s)&&(s=0,r=isNaN(r)?n.c:r);isNaN(a)?(a=0,e=isNaN(e)?n.h:e):a>180?a-=360:a<-180&&(a+=360);return function(t){return Jt(e+a*t,r+s*t,i+u*t)+""}},o.interpolateHsl=function(t,n){t=o.hsl(t),n=o.hsl(n);var e=t.h,r=t.s,i=t.l,a=n.h-e,s=n.s-r,u=n.l-i;isNaN(s)&&(s=0,r=isNaN(r)?n.s:r);isNaN(a)?(a=0,e=isNaN(e)?n.h:e):a>180?a-=360:a<-180&&(a+=360);return function(t){return Wt(e+a*t,r+s*t,i+u*t)+""}},o.interpolateLab=function(t,n){t=o.lab(t),n=o.lab(n);var e=t.l,r=t.a,i=t.b,a=n.l-e,s=n.a-r,u=n.b-i;return function(t){return en(e+a*t,r+s*t,i+u*t)+""}},o.interpolateRound=mo,o.transform=function(t){var n=u.createElementNS(o.ns.prefix.svg,"g");return(o.transform=function(t){if(null!=t){n.setAttribute("transform",t);var e=n.transform.baseVal.consolidate()}return new bo(e?e.matrix:_o)})(t)},bo.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var _o={a:1,b:0,c:0,d:1,e:0,f:0};function So(t){return t.length?t.pop()+",":""}function Mo(t,n){var e=[],r=[];return t=o.transform(t),n=o.transform(n),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var i=e.push("translate(",null,",",null,")");r.push({i:i-4,x:Qi(t[0],n[0])},{i:i-2,x:Qi(t[1],n[1])})}else(n[0]||n[1])&&e.push("translate("+n+")")}(t.translate,n.translate,e,r),function(t,n,e,r){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),r.push({i:e.push(So(e)+"rotate(",null,")")-2,x:Qi(t,n)})):n&&e.push(So(e)+"rotate("+n+")")}(t.rotate,n.rotate,e,r),function(t,n,e,r){t!==n?r.push({i:e.push(So(e)+"skewX(",null,")")-2,x:Qi(t,n)}):n&&e.push(So(e)+"skewX("+n+")")}(t.skew,n.skew,e,r),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var i=e.push(So(e)+"scale(",null,",",null,")");r.push({i:i-4,x:Qi(t[0],n[0])},{i:i-2,x:Qi(t[1],n[1])})}else 1===n[0]&&1===n[1]||e.push(So(e)+"scale("+n+")")}(t.scale,n.scale,e,r),t=n=null,function(t){for(var n,i=-1,o=r.length;++i0?e=n:(t.c=null,t.t=NaN,t=null,u.end({type:"end",alpha:e=0})):n>0&&(u.start({type:"start",alpha:e=n}),t=An(s.tick)),s):e},s.start=function(){var t,n,e,o=g.length,u=x.length,l=c[0],y=c[1];for(t=0;t=0;)e.push(i[r])}function qo(t,n){for(var e=[t],r=[];null!=(t=e.pop());)if(r.push(t),(o=t.children)&&(i=o.length))for(var i,o,a=-1;++a=0;)a.push(l=c[u]),l.parent=o,l.depth=o.depth+1;e&&(o.value=0),o.children=c}else e&&(o.value=+e.call(r,o,o.depth)||0),delete o.children;return qo(i,(function(n){var r,i;t&&(r=n.children)&&r.sort(t),e&&(i=n.parent)&&(i.value+=n.value)})),s}return r.sort=function(n){return arguments.length?(t=n,r):t},r.children=function(t){return arguments.length?(n=t,r):n},r.value=function(t){return arguments.length?(e=t,r):e},r.revalue=function(t){return e&&(jo(t,(function(t){t.children&&(t.value=0)})),qo(t,(function(t){var n;t.children||(t.value=+e.call(r,t,t.depth)||0),(n=t.parent)&&(n.value+=t.value)}))),t},r},o.layout.partition=function(){var t=o.layout.hierarchy(),n=[1,1];function e(e,r){var i=t.call(this,e,r);return function t(n,e,r,i){var o=n.children;if(n.x=e,n.y=n.depth*i,n.dx=r,n.dy=i,o&&(a=o.length)){var a,s,u,c=-1;for(r=n.value?r/n.value:0;++cs&&(s=r),a.push(r)}for(e=0;ei&&(r=e,i=n);return r}function Qo(t){return t.reduce(ta,0)}function ta(t,n){return t+n[1]}function na(t,n){return ea(t,Math.ceil(Math.log(n.length)/Math.LN2+1))}function ea(t,n){for(var e=-1,r=+t[0],i=(t[1]-r)/n,o=[];++e<=n;)o[e]=i*e+r;return o}function ra(t){return[o.min(t),o.max(t)]}function ia(t,n){return t.value-n.value}function oa(t,n){var e=t._pack_next;t._pack_next=n,n._pack_prev=t,n._pack_next=e,e._pack_prev=n}function aa(t,n){t._pack_next=n,n._pack_prev=t}function sa(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r+n.r;return.999*i*i>e*e+r*r}function ua(t){if((n=t.children)&&(u=n.length)){var n,e,r,i,o,a,s,u,c=1/0,l=-1/0,f=1/0,h=-1/0;if(n.forEach(ca),(e=n[0]).x=-e.r,e.y=0,m(e),u>1&&((r=n[1]).x=r.r,r.y=0,m(r),u>2))for(fa(e,r,i=n[2]),m(i),oa(e,i),e._pack_prev=i,oa(i,r),r=e._pack_next,o=3;o0)for(a=-1;++a=f[0]&&u<=f[1]&&((s=c[o.bisect(h,u,1,y)-1]).y+=d,s.push(i[a]));return c}return i.value=function(t){return arguments.length?(n=t,i):n},i.range=function(t){return arguments.length?(e=mn(t),i):e},i.bins=function(t){return arguments.length?(r="number"==typeof t?function(n){return ea(n,t)}:mn(t),i):r},i.frequency=function(n){return arguments.length?(t=!!n,i):t},i},o.layout.pack=function(){var t,n=o.layout.hierarchy().sort(ia),e=0,r=[1,1];function i(i,o){var a=n.call(this,i,o),s=a[0],u=r[0],c=r[1],l=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(s.x=s.y=0,qo(s,(function(t){t.r=+l(t.value)})),qo(s,ua),e){var f=e*(t?1:Math.max(2*s.r/u,2*s.r/c))/2;qo(s,(function(t){t.r+=f})),qo(s,ua),qo(s,(function(t){t.r-=f}))}return function t(n,e,r,i){var o=n.children;if(n.x=e+=i*n.x,n.y=r+=i*n.y,n.r*=i,o)for(var a=-1,s=o.length;++ap.x&&(p=t),t.depth>y.depth&&(y=t)}));var d=n(h,p)/2-h.x,v=e[0]/(p.x+n(p,h)/2+d),g=e[1]/(y.depth||1);jo(l,(function(t){t.x=(t.x+d)*v,t.y=t.depth*g}))}return c}function a(t){var e=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(e.length){!function(t){var n,e=0,r=0,i=t.children,o=i.length;for(;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(t);var o=(e[0].z+e[e.length-1].z)/2;i?(t.z=i.z+n(t._,i._),t.m=t.z-o):t.z=o}else i&&(t.z=i.z+n(t._,i._));t.parent.A=function(t,e,r){if(e){for(var i,o=t,a=t,s=e,u=o.parent.children[0],c=o.m,l=a.m,f=s.m,h=u.m;s=ya(s),o=pa(o),s&&o;)u=pa(u),(a=ya(a)).a=t,(i=s.z+f-o.z-c+n(s._,o._))>0&&(da(va(s,t,r),t,i),c+=i,l+=i),f+=s.m,c+=o.m,h+=u.m,l+=a.m;s&&!ya(a)&&(a.t=s,a.m+=f-l),o&&!pa(u)&&(u.t=o,u.m+=c-h,r=t)}return r}(t,i,t.parent.A||r[0])}function s(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=e[0],t.y=t.depth*e[1]}return i.separation=function(t){return arguments.length?(n=t,i):n},i.size=function(t){return arguments.length?(r=null==(e=t)?u:null,i):r?null:e},i.nodeSize=function(t){return arguments.length?(r=null==(e=t)?null:u,i):r?e:null},Ro(i,t)},o.layout.cluster=function(){var t=o.layout.hierarchy().sort(null).value(null),n=ha,e=[1,1],r=!1;function i(i,a){var s,u=t.call(this,i,a),c=u[0],l=0;qo(c,(function(t){var e=t.children;e&&e.length?(t.x=function(t){return t.reduce((function(t,n){return t+n.x}),0)/t.length}(e),t.y=function(t){return 1+o.max(t,(function(t){return t.y}))}(e)):(t.x=s?l+=n(t,s):0,t.y=0,s=t)}));var f=function t(n){var e=n.children;return e&&e.length?t(e[0]):n}(c),h=function t(n){var e,r=n.children;return r&&(e=r.length)?t(r[e-1]):n}(c),p=f.x-n(f,h)/2,y=h.x+n(h,f)/2;return qo(c,r?function(t){t.x=(t.x-c.x)*e[0],t.y=(c.y-t.y)*e[1]}:function(t){t.x=(t.x-p)/(y-p)*e[0],t.y=(1-(c.y?t.y/c.y:1))*e[1]}),u}return i.separation=function(t){return arguments.length?(n=t,i):n},i.size=function(t){return arguments.length?(r=null==(e=t),i):r?null:e},i.nodeSize=function(t){return arguments.length?(r=null!=(e=t),i):r?e:null},Ro(i,t)},o.layout.treemap=function(){var t,n=o.layout.hierarchy(),e=Math.round,r=[1,1],i=null,a=ga,s=!1,u="squarify",c=.5*(1+Math.sqrt(5));function l(t,n){for(var e,r,i=-1,o=t.length;++i0;)s.push(e=c[i-1]),s.area+=e.area,"squarify"!==u||(r=p(s,d))<=h?(c.pop(),h=r):(s.area-=s.pop().area,y(s,d,o,!1),d=Math.min(o.dx,o.dy),s.length=s.area=0,h=1/0);s.length&&(y(s,d,o,!0),s.length=s.area=0),n.forEach(f)}}function h(t){var n=t.children;if(n&&n.length){var e,r=a(t),i=n.slice(),o=[];for(l(i,r.dx*r.dy/t.value),o.area=0;e=i.pop();)o.push(e),o.area+=e.area,null!=e.z&&(y(o,e.z?r.dx:r.dy,r,!i.length),o.length=o.area=0);n.forEach(h)}}function p(t,n){for(var e,r=t.area,i=0,o=1/0,a=-1,s=t.length;++ai&&(i=e));return n*=n,(r*=r)?Math.max(n*i*c/r,r/(n*o*c)):1/0}function y(t,n,r,i){var o,a=-1,s=t.length,u=r.x,c=r.y,l=n?e(t.area/n):0;if(n==r.dx){for((i||l>r.dy)&&(l=r.dy);++ar.dx)&&(l=r.dx);++a1);return t+n*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=o.random.normal.apply(o,arguments);return function(){return Math.exp(t())}},bates:function(t){var n=o.random.irwinHall(t);return function(){return n()/t}},irwinHall:function(t){return function(){for(var n=0,e=0;e2?Ma:wa,s=i?Ao:Eo;return o=t(n,e,s,r),a=t(e,n,s,ro),u}function u(t){return o(t)}return u.invert=function(t){return a(t)},u.domain=function(t){return arguments.length?(n=t.map(Number),s()):n},u.range=function(t){return arguments.length?(e=t,s()):e},u.rangeRound=function(t){return u.range(t).interpolate(mo)},u.clamp=function(t){return arguments.length?(i=t,s()):i},u.interpolate=function(t){return arguments.length?(r=t,s()):r},u.ticks=function(t){return Pa(n,t)},u.tickFormat=function(t,e){return Na(n,t,e)},u.nice=function(t){return Aa(n,t),s()},u.copy=function(){return t(n,e,r,i)},s()}([0,1],[0,1],ro,!1)};var Ca={s:1,g:1,p:1,r:1,e:1};function Oa(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}o.scale.log=function(){return function t(n,e,r,i){function a(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function s(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function u(t){return n(a(t))}return u.invert=function(t){return s(n.invert(t))},u.domain=function(t){return arguments.length?(r=t[0]>=0,n.domain((i=t.map(Number)).map(a)),u):i},u.base=function(t){return arguments.length?(e=+t,n.domain(i.map(a)),u):e},u.nice=function(){var t=ka(i.map(a),r?Math:Ia);return n.domain(t),i=t.map(s),u},u.ticks=function(){var t=ma(i),n=[],o=t[0],u=t[1],c=Math.floor(a(o)),l=Math.ceil(a(u)),f=e%1?2:e;if(isFinite(l-c)){if(r){for(;c0;h--)n.push(s(c)*h);for(c=0;n[c]u;l--);n=n.slice(c,l)}return n},u.tickFormat=function(t,n){if(!arguments.length)return Ta;arguments.length<2?n=Ta:"function"!=typeof n&&(n=o.format(n));var r=Math.max(1,e*t/u.ticks().length);return function(t){var i=t/s(Math.round(a(t)));return i*e0?r[t-1]:n[0],tf?0:1;if(c=Ot)return u(c,p)+(s?u(s,1-p):"")+"Z";var y,d,v,g,x,m,b,w,k,_,S,M,E=0,A=0,L=[];if((g=(+a.apply(this,arguments)||0)/2)&&(v=r===Ba?Math.sqrt(s*s+c*c):+r.apply(this,arguments),p||(A*=-1),c&&(A=qt(v/c*Math.sin(g))),s&&(E=qt(v/s*Math.sin(g)))),c){x=c*Math.cos(l+A),m=c*Math.sin(l+A),b=c*Math.cos(f-A),w=c*Math.sin(f-A);var P=Math.abs(f-l-2*A)<=Nt?0:1;if(A&&Ya(x,m,b,w)===p^P){var N=(l+f)/2;x=c*Math.cos(N),m=c*Math.sin(N),b=w=null}}else x=m=0;if(s){k=s*Math.cos(f-E),_=s*Math.sin(f-E),S=s*Math.cos(l+E),M=s*Math.sin(l+E);var C=Math.abs(l-f+2*E)<=Nt?0:1;if(E&&Ya(k,_,S,M)===1-p^C){var O=(l+f)/2;k=s*Math.cos(O),_=s*Math.sin(O),S=M=null}}else k=_=0;if(h>Lt&&(y=Math.min(Math.abs(c-s)/2,+e.apply(this,arguments)))>.001){d=s0?0:1}function Za(t,n,e,r,i){var o=t[0]-n[0],a=t[1]-n[1],s=(i?r:-r)/Math.sqrt(o*o+a*a),u=s*a,c=-s*o,l=t[0]+u,f=t[1]+c,h=n[0]+u,p=n[1]+c,y=(l+h)/2,d=(f+p)/2,v=h-l,g=p-f,x=v*v+g*g,m=e-r,b=l*p-h*f,w=(g<0?-1:1)*Math.sqrt(Math.max(0,m*m*x-b*b)),k=(b*g-v*w)/x,_=(-b*v-g*w)/x,S=(b*g+v*w)/x,M=(-b*v+g*w)/x,E=k-y,A=_-d,L=S-y,P=M-d;return E*E+A*A>L*L+P*P&&(k=S,_=M),[[k-u,_-c],[k*e/m,_*e/m]]}function Wa(t){var n=ai,e=si,r=$e,i=$a,o=i.key,a=.7;function s(o){var s,u=[],c=[],l=-1,f=o.length,h=mn(n),p=mn(e);function y(){u.push("M",i(t(c),a))}for(;++l1&&i.push("H",r[0]);return i.join("")},"step-before":Qa,"step-after":ts,basis:rs,"basis-open":function(t){if(t.length<4)return $a(t);var n,e=[],r=-1,i=t.length,o=[0],a=[0];for(;++r<3;)n=t[r],o.push(n[0]),a.push(n[1]);e.push(is(ss,o)+","+is(ss,a)),--r;for(;++r9&&(i=3*n/Math.sqrt(i),a[s]=i*e,a[s+1]=i*r));s=-1;for(;++s<=u;)i=(t[Math.min(u,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}(t))}});function $a(t){return t.length>1?t.join("L"):t+"Z"}function Ja(t){return t.join("L")+"Z"}function Qa(t){for(var n=0,e=t.length,r=t[0],i=[r[0],",",r[1]];++n1){s=n[1],o=t[u],u++,r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var c=2;cNt)+",1 "+n}function u(t,n,e,r){return"Q 0,0 "+r}return o.radius=function(t){return arguments.length?(e=mn(t),o):e},o.source=function(n){return arguments.length?(t=mn(n),o):t},o.target=function(t){return arguments.length?(n=mn(t),o):n},o.startAngle=function(t){return arguments.length?(r=mn(t),o):r},o.endAngle=function(t){return arguments.length?(i=mn(t),o):i},o},o.svg.diagonal=function(){var t=Xr,n=Yr,e=ps;function r(r,i){var o=t.call(this,r,i),a=n.call(this,r,i),s=(o.y+a.y)/2,u=[o,{x:o.x,y:s},{x:a.x,y:s},a];return"M"+(u=u.map(e))[0]+"C"+u[1]+" "+u[2]+" "+u[3]}return r.source=function(n){return arguments.length?(t=mn(n),r):t},r.target=function(t){return arguments.length?(n=mn(t),r):n},r.projection=function(t){return arguments.length?(e=t,r):e},r},o.svg.diagonal.radial=function(){var t=o.svg.diagonal(),n=ps,e=t.projection;return t.projection=function(t){return arguments.length?e(ys(n=t)):n},t},o.svg.symbol=function(){var t=vs,n=ds;function e(e,r){return(xs.get(t.call(this,e,r))||gs)(n.call(this,e,r))}return e.type=function(n){return arguments.length?(t=mn(n),e):t},e.size=function(t){return arguments.length?(n=mn(t),e):n},e};var xs=o.map({circle:gs,cross:function(t){var n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t){var n=Math.sqrt(t/(2*bs)),e=n*bs;return"M0,"+-n+"L"+e+",0 0,"+n+" "+-e+",0Z"},square:function(t){var n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t){var n=Math.sqrt(t/ms),e=n*ms/2;return"M0,"+e+"L"+n+","+-e+" "+-n+","+-e+"Z"},"triangle-up":function(t){var n=Math.sqrt(t/ms),e=n*ms/2;return"M0,"+-e+"L"+n+","+e+" "+-n+","+e+"Z"}});o.svg.symbolTypes=xs.keys();var ms=Math.sqrt(3),bs=Math.tan(30*It);K.transition=function(t){for(var n,e,r=Ss||++As,i=Ns(t),o=[],a=Ms||{time:Date.now(),ease:po,delay:0,duration:250},s=-1,u=this.length;++s0;)c[--h].call(t,a);if(o>=1)return f.event&&f.event.end.call(t,t.__data__,n),--l.count?delete l[r]:delete t[e],1}f||(o=i.time,a=An((function(t){var n=f.delay;if(a.t=n+o,n<=t)return h(t-n);a.c=h}),0,o),f=l[r]={tween:new M,time:o,timer:a,delay:i.delay,duration:i.duration,ease:i.ease,index:n},i=null,++l.count)}Es.call=K.call,Es.empty=K.empty,Es.node=K.node,Es.size=K.size,o.transition=function(t,n){return t&&t.transition?Ss?t.transition(n):t:o.selection().transition(t)},o.transition.prototype=Es,Es.select=function(t){var n,e,r,i=this.id,o=this.namespace,a=[];t=$(t);for(var s=-1,u=this.length;++srect,.s>rect").attr("width",a[1]-a[0])}function d(t){t.select(".extent").attr("y",s[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function v(){var f,v,g=this,x=o.select(o.event.target),m=e.of(g,arguments),b=o.select(g),w=x.datum(),k=!/^(n|s)$/.test(w)&&r,_=!/^(e|w)$/.test(w)&&i,S=x.classed("extent"),M=St(g),E=o.mouse(g),A=o.select(l(g)).on("keydown.brush",N).on("keyup.brush",C);if(o.event.changedTouches?A.on("touchmove.brush",O).on("touchend.brush",I):A.on("mousemove.brush",O).on("mouseup.brush",I),b.interrupt().selectAll("*").interrupt(),S)E[0]=a[0]-E[0],E[1]=s[0]-E[1];else if(w){var L=+/w$/.test(w),P=+/^n/.test(w);v=[a[1-L]-E[0],s[1-P]-E[1]],E[0]=a[L],E[1]=s[P]}else o.event.altKey&&(f=E.slice());function N(){32==o.event.keyCode&&(S||(f=null,E[0]-=a[1],E[1]-=s[1],S=2),B())}function C(){32==o.event.keyCode&&2==S&&(E[0]+=a[1],E[1]+=s[1],S=0,B())}function O(){var t=o.mouse(g),n=!1;v&&(t[0]+=v[0],t[1]+=v[1]),S||(o.event.altKey?(f||(f=[(a[0]+a[1])/2,(s[0]+s[1])/2]),E[0]=a[+(t[0]1?{floor:function(n){for(;s(n=t.floor(n));)n=Fs(n-1);return n},ceil:function(n){for(;s(n=t.ceil(n));)n=Fs(+n+1);return n}}:t))},r.ticks=function(t,n){var e=ma(r.domain()),o=null==t?i(e,10):"number"==typeof t?i(e,t):!t.range&&[{range:t},n];return o&&(t=o[0],n=o[1]),t.range(e[0],Fs(+e[1]+1),n<1?1:n)},r.tickFormat=function(){return e},r.copy=function(){return Vs(t.copy(),n,e)},Ea(r,t)}function Fs(t){return new Date(t)}js.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Bs:Gs,Bs.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},Bs.toString=Gs.toString,Rn.second=Bn((function(t){return new jn(1e3*Math.floor(t/1e3))}),(function(t,n){t.setTime(t.getTime()+1e3*Math.floor(n))}),(function(t){return t.getSeconds()})),Rn.seconds=Rn.second.range,Rn.seconds.utc=Rn.second.utc.range,Rn.minute=Bn((function(t){return new jn(6e4*Math.floor(t/6e4))}),(function(t,n){t.setTime(t.getTime()+6e4*Math.floor(n))}),(function(t){return t.getMinutes()})),Rn.minutes=Rn.minute.range,Rn.minutes.utc=Rn.minute.utc.range,Rn.hour=Bn((function(t){var n=t.getTimezoneOffset()/60;return new jn(36e5*(Math.floor(t/36e5-n)+n))}),(function(t,n){t.setTime(t.getTime()+36e5*Math.floor(n))}),(function(t){return t.getHours()})),Rn.hours=Rn.hour.range,Rn.hours.utc=Rn.hour.utc.range,Rn.month=Bn((function(t){return(t=Rn.day(t)).setDate(1),t}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t){return t.getMonth()})),Rn.months=Rn.month.range,Rn.months.utc=Rn.month.utc.range;var Us=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Hs=[[Rn.second,1],[Rn.second,5],[Rn.second,15],[Rn.second,30],[Rn.minute,1],[Rn.minute,5],[Rn.minute,15],[Rn.minute,30],[Rn.hour,1],[Rn.hour,3],[Rn.hour,6],[Rn.hour,12],[Rn.day,1],[Rn.day,2],[Rn.week,1],[Rn.month,1],[Rn.month,3],[Rn.year,1]],Xs=js.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",$e]]),Ys={range:function(t,n,e){return o.range(Math.ceil(t/e)*e,+n,e).map(Fs)},floor:I,ceil:I};Hs.year=Rn.year,Rn.scale=function(){return Vs(o.scale.linear(),Hs,Xs)};var Zs=Hs.map((function(t){return[t[0].utc,t[1]]})),Ws=qs.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",$e]]);function Ks(t){return JSON.parse(t.responseText)}function $s(t){var n=u.createRange();return n.selectNode(u.body),n.createContextualFragment(t.responseText)}Zs.year=Rn.year.utc,Rn.scale.utc=function(){return Vs(o.scale.linear(),Zs,Ws)},o.text=bn((function(t){return t.responseText})),o.json=function(t,n){return wn(t,"application/json",Ks,n)},o.html=function(t,n){return wn(t,"text/html",$s,n)},o.xml=bn((function(t){return t.responseXML})),this.d3=o,void 0===(i="function"==typeof(r=o)?r.call(n,e,n,t):r)||(t.exports=i)}()},function(t,n){function e(t,n){this.x=t||0,this.y=n||0,Object.freeze(this)}e.prototype.distance=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},e.prototype.manhattanDistance=function(t){var n=this.sub(t).abs();return n.x+n.y},e.prototype.abs=function(){return new e(Math.abs(this.x),Math.abs(this.y))},e.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.sub=function(t){return new e(this.x-t.x,this.y-t.y)},t.exports=e},function(t,n,e){var r=e(1);function i(t){arguments.length>0&&this.init(t)}i.prototype.init=function(t){this.status=t,this.points=new Array},i.prototype.appendPoint=function(t){this.points.push(t)},i.prototype.appendPoints=function(t){this.points=this.points.concat(t)},i.intersectShapes=function(t,n){var e,r=t.getIntersectionParams(),o=n.getIntersectionParams();if(null!=r&&null!=o)if("Path"==r.name)e=i.intersectPathShape(t,n);else if("Path"==o.name)e=i.intersectPathShape(n,t);else{var a,s;if(r.name0&&P.length>0){t:for(var N=0;N0&&(g.status="Intersection"),g},i.intersectBezier2Bezier3=function(t,n,e,o,a,s,u){var c,l,f,h,p,y,d,v,g,x,m,b=new i("No Intersection");c=n.multiply(-2),p=t.add(c.add(e)),c=t.multiply(-2),l=n.multiply(2),y=c.add(l),d=new r(t.x,t.y),c=o.multiply(-1),l=a.multiply(3),f=s.multiply(-3),h=c.add(l.add(f.add(u))),v=new Vector2D(h.x,h.y),c=o.multiply(3),l=a.multiply(-6),f=s.multiply(3),h=c.add(l.add(f)),g=new Vector2D(h.x,h.y),c=o.multiply(-3),l=a.multiply(3),f=c.add(l),x=new Vector2D(f.x,f.y),m=new Vector2D(o.x,o.y);for(var w=d.x*d.x,k=d.y*d.y,_=y.x*y.x,S=y.y*y.y,M=p.x*p.x,E=p.y*p.y,A=m.x*m.x,L=m.y*m.y,P=x.x*x.x,N=x.y*x.y,C=g.x*g.x,O=g.y*g.y,T=v.x*v.x,I=v.y*v.y,D=new Polynomial(-2*p.x*p.y*v.x*v.y+M*I+E*T,-2*p.x*p.y*g.x*v.y-2*p.x*p.y*g.y*v.x+2*E*g.x*v.x+2*M*g.y*v.y,-2*p.x*x.x*p.y*v.y-2*p.x*p.y*x.y*v.x-2*p.x*p.y*g.x*g.y+2*x.x*E*v.x+E*C+M*(2*x.y*v.y+O),2*d.x*p.x*p.y*v.y+2*d.y*p.x*p.y*v.x+y.x*y.y*p.x*v.y+y.x*y.y*p.y*v.x-2*m.x*p.x*p.y*v.y-2*p.x*m.y*p.y*v.x-2*p.x*x.x*p.y*g.y-2*p.x*p.y*x.y*g.x-2*d.x*E*v.x-2*d.y*M*v.y+2*m.x*E*v.x+2*x.x*E*g.x-S*p.x*v.x-_*p.y*v.y+M*(2*m.y*v.y+2*x.y*g.y),2*d.x*p.x*p.y*g.y+2*d.y*p.x*p.y*g.x+y.x*y.y*p.x*g.y+y.x*y.y*p.y*g.x-2*m.x*p.x*p.y*g.y-2*p.x*m.y*p.y*g.x-2*p.x*x.x*p.y*x.y-2*d.x*E*g.x-2*d.y*M*g.y+2*m.x*E*g.x-S*p.x*g.x-_*p.y*g.y+P*E+M*(2*m.y*g.y+N),2*d.x*p.x*p.y*x.y+2*d.y*p.x*x.x*p.y+y.x*y.y*p.x*x.y+y.x*y.y*x.x*p.y-2*m.x*p.x*p.y*x.y-2*p.x*m.y*x.x*p.y-2*d.x*x.x*E-2*d.y*M*x.y+2*m.x*x.x*E-S*p.x*x.x-_*p.y*x.y+2*M*m.y*x.y,-2*d.x*d.y*p.x*p.y-d.x*y.x*y.y*p.y-d.y*y.x*y.y*p.x+2*d.x*p.x*m.y*p.y+2*d.y*m.x*p.x*p.y+y.x*m.x*y.y*p.y+y.x*y.y*p.x*m.y-2*m.x*p.x*m.y*p.y-2*d.x*m.x*E+d.x*S*p.x+d.y*_*p.y-2*d.y*M*m.y-m.x*S*p.x-_*m.y*p.y+w*E+k*M+A*E+M*L).getRootsInInterval(0,1),z=0;z0&&q.length>0){t:for(var G=0;G0&&(b.status="Intersection"),b},i.intersectBezier2Circle=function(t,n,e,r,o){return i.intersectBezier2Ellipse(t,n,e,r,o,o)},i.intersectBezier2Ellipse=function(t,n,e,o,a,s){var u,c,l,f,h,p=new i("No Intersection");u=n.multiply(-2),l=t.add(u.add(e)),u=t.multiply(-2),c=n.multiply(2),f=u.add(c),h=new r(t.x,t.y);for(var y=a*a,d=s*s,v=new Polynomial(d*l.x*l.x+y*l.y*l.y,2*(d*l.x*f.x+y*l.y*f.y),d*(2*l.x*h.x+f.x*f.x)+y*(2*l.y*h.y+f.y*f.y)-2*(d*o.x*l.x+y*o.y*l.y),2*(d*f.x*(h.x-o.x)+y*f.y*(h.y-o.y)),d*(h.x*h.x+o.x*o.x)+y*(h.y*h.y+o.y*o.y)-2*(d*o.x*h.x+y*o.y*h.y)-y*d).getRoots(),g=0;g0&&(p.status="Intersection"),p},i.intersectBezier2Line=function(t,n,e,o,a){var s,u,c,l,f,h,p,y=o.min(a),d=o.max(a),v=new i("No Intersection");s=n.multiply(-2),c=t.add(s.add(e)),s=t.multiply(-2),u=n.multiply(2),l=s.add(u),f=new r(t.x,t.y),p=new Vector2D(o.y-a.y,a.x-o.x),h=o.x*a.y-a.x*o.y,roots=new Polynomial(p.dot(c),p.dot(l),p.dot(f)+h).getRoots();for(var g=0;g0&&(o.status="Intersection"),o},i.intersectBezier2Rectangle=function(t,n,e,o,a){var s=o.min(a),u=o.max(a),c=new r(u.x,s.y),l=new r(s.x,u.y),f=i.intersectBezier2Line(t,n,e,s,c),h=i.intersectBezier2Line(t,n,e,c,u),p=i.intersectBezier2Line(t,n,e,u,l),y=i.intersectBezier2Line(t,n,e,l,s),d=new i("No Intersection");return d.appendPoints(f.points),d.appendPoints(h.points),d.appendPoints(p.points),d.appendPoints(y.points),d.points.length>0&&(d.status="Intersection"),d},i.intersectBezier3Bezier3=function(t,n,e,r,o,a,s,u){var c,l,f,h,p,y,d,v,g,x,m,b,w=new i("No Intersection");c=t.multiply(-1),l=n.multiply(3),f=e.multiply(-3),h=c.add(l.add(f.add(r))),p=new Vector2D(h.x,h.y),c=t.multiply(3),l=n.multiply(-6),f=e.multiply(3),h=c.add(l.add(f)),y=new Vector2D(h.x,h.y),c=t.multiply(-3),l=n.multiply(3),f=c.add(l),d=new Vector2D(f.x,f.y),v=new Vector2D(t.x,t.y),c=o.multiply(-1),l=a.multiply(3),f=s.multiply(-3),h=c.add(l.add(f.add(u))),g=new Vector2D(h.x,h.y),c=o.multiply(3),l=a.multiply(-6),f=s.multiply(3),h=c.add(l.add(f)),x=new Vector2D(h.x,h.y),c=o.multiply(-3),l=a.multiply(3),f=c.add(l),m=new Vector2D(f.x,f.y),b=new Vector2D(o.x,o.y);for(var k=v.x*v.x,_=v.x*v.x*v.x,S=v.y*v.y,M=v.y*v.y*v.y,E=d.x*d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2*E*d.y*b.y*p.x*p.y+E*y.x*b.y*y.y*p.y-3*j*d.y*y.y*p.x*p.y-_*R+M*D+q*R-B*D-3*v.x*j*R-v.x*P*I+3*k*b.x*R+v.y*A*z+3*v.y*G*D+b.x*P*I+k*T*p.x-3*S*b.y*D-S*C*p.y+j*T*p.x-A*b.y*z-C*G*p.y-v.x*E*d.y*z+v.y*d.x*L*I-3*v.x*S*I*p.y-v.x*L*N*p.y+v.y*E*O*p.x-d.x*L*b.y*I+3*k*v.y*p.x*z+k*d.x*y.y*z+2*k*d.y*y.x*z-2*S*d.x*y.y*I-S*d.y*y.x*I+E*b.x*d.y*z-3*v.x*G*I*p.y+3*v.y*j*p.x*z+d.x*j*y.y*z-2*d.x*G*y.y*I+b.x*L*N*p.y-d.y*y.x*G*I-k*y.x*O*p.y-3*k*b.y*p.x*z+3*S*b.x*I*p.y+S*N*y.y*p.x-E*b.y*O*p.x+2*j*d.y*y.x*z+3*b.x*G*I*p.y-j*y.x*O*p.y-3*j*b.y*p.x*z+N*G*y.y*p.x).getRootsInInterval(0,1),Q=0;Q0&&et.length>0){t:for(var rt=0;rt0&&(w.status="Intersection"),w},i.intersectBezier3Circle=function(t,n,e,r,o,a){return i.intersectBezier3Ellipse(t,n,e,r,o,a,a)},i.intersectBezier3Ellipse=function(t,n,e,r,o,a,s){var u,c,l,f,h,p,y,d,v=new i("No Intersection");u=t.multiply(-1),c=n.multiply(3),l=e.multiply(-3),f=u.add(c.add(l.add(r))),h=new Vector2D(f.x,f.y),u=t.multiply(3),c=n.multiply(-6),l=e.multiply(3),f=u.add(c.add(l)),p=new Vector2D(f.x,f.y),u=t.multiply(-3),c=n.multiply(3),l=u.add(c),y=new Vector2D(l.x,l.y),d=new Vector2D(t.x,t.y);for(var g=a*a,x=s*s,m=new Polynomial(h.x*h.x*x+h.y*h.y*g,2*(h.x*p.x*x+h.y*p.y*g),2*(h.x*y.x*x+h.y*y.y*g)+p.x*p.x*x+p.y*p.y*g,2*h.x*x*(d.x-o.x)+2*h.y*g*(d.y-o.y)+2*(p.x*y.x*x+p.y*y.y*g),2*p.x*x*(d.x-o.x)+2*p.y*g*(d.y-o.y)+y.x*y.x*x+y.y*y.y*g,2*y.x*x*(d.x-o.x)+2*y.y*g*(d.y-o.y),d.x*d.x*x-2*d.y*o.y*g-2*d.x*o.x*x+d.y*d.y*g+o.x*o.x*x+o.y*o.y*g-g*x).getRootsInInterval(0,1),b=0;b0&&(v.status="Intersection"),v},i.intersectBezier3Line=function(t,n,e,r,o,a){var s,u,c,l,f,h,p,y,d,v,g=o.min(a),x=o.max(a),m=new i("No Intersection");s=t.multiply(-1),u=n.multiply(3),c=e.multiply(-3),l=s.add(u.add(c.add(r))),f=new Vector2D(l.x,l.y),s=t.multiply(3),u=n.multiply(-6),c=e.multiply(3),l=s.add(u.add(c)),h=new Vector2D(l.x,l.y),s=t.multiply(-3),u=n.multiply(3),c=s.add(u),p=new Vector2D(c.x,c.y),y=new Vector2D(t.x,t.y),v=new Vector2D(o.y-a.y,a.x-o.x),d=o.x*a.y-a.x*o.y,roots=new Polynomial(v.dot(f),v.dot(h),v.dot(p),v.dot(y)+d).getRoots();for(var b=0;b0&&(a.status="Intersection"),a},i.intersectBezier3Rectangle=function(t,n,e,o,a,s){var u=a.min(s),c=a.max(s),l=new r(c.x,u.y),f=new r(u.x,c.y),h=i.intersectBezier3Line(t,n,e,o,u,l),p=i.intersectBezier3Line(t,n,e,o,l,c),y=i.intersectBezier3Line(t,n,e,o,c,f),d=i.intersectBezier3Line(t,n,e,o,f,u),v=new i("No Intersection");return v.appendPoints(h.points),v.appendPoints(p.points),v.appendPoints(y.points),v.appendPoints(d.points),v.points.length>0&&(v.status="Intersection"),v},i.intersectCircleCircle=function(t,n,e,o){var a,s=n+o,u=Math.abs(n-o),c=t.distanceFrom(e);if(c>s)a=new i("Outside");else if(c1)&&(f<0||f>1)?o=new i(l<0&&f<0||l>1&&f>1?"Outside":"Inside"):(o=new i("Intersection"),0<=l&&l<=1&&o.points.push(e.lerp(r,l)),0<=f&&f<=1&&o.points.push(e.lerp(r,f)))}return o},i.intersectCirclePolygon=function(t,n,e){for(var r,o=new i("No Intersection"),a=e.length,s=0;s0?o.status="Intersection":o.status=r.status,o},i.intersectCircleRectangle=function(t,n,e,o){var a=e.min(o),s=e.max(o),u=new r(s.x,a.y),c=new r(a.x,s.y),l=i.intersectCircleLine(t,n,a,u),f=i.intersectCircleLine(t,n,u,s),h=i.intersectCircleLine(t,n,s,c),p=i.intersectCircleLine(t,n,c,a),y=new i("No Intersection");return y.appendPoints(l.points),y.appendPoints(f.points),y.appendPoints(h.points),y.appendPoints(p.points),y.points.length>0?y.status="Intersection":y.status=l.status,y},i.intersectEllipseEllipse=function(t,n,e,o,a,s){for(var u=[e*e,0,n*n,-2*e*e*t.x,-2*n*n*t.y,e*e*t.x*t.x+n*n*t.y*t.y-n*n*e*e],c=[s*s,0,a*a,-2*s*s*o.x,-2*a*a*o.y,s*s*o.x*o.x+a*a*o.y*o.y-a*a*s*s],l=i.bezout(u,c).getRoots(),f=.001*(u[0]*u[0]+2*u[1]*u[1]+u[2]*u[2]),h=.001*(c[0]*c[0]+2*c[1]*c[1]+c[2]*c[2]),p=new i("No Intersection"),y=0;y0&&(p.status="Intersection"),p},i.intersectEllipseLine=function(t,n,e,r,o){var a,s=new Vector2D(r.x,r.y),u=Vector2D.fromPoints(r,o),c=new Vector2D(t.x,t.y),l=s.subtract(c),f=new Vector2D(u.x/(n*n),u.y/(e*e)),h=new Vector2D(l.x/(n*n),l.y/(e*e)),p=u.dot(f),y=u.dot(h),d=y*y-p*(t=l.dot(h)-1);if(d<0)a=new i("Outside");else if(d>0){var v=Math.sqrt(d),g=(-y-v)/p,x=(-y+v)/p;(g<0||11&&x>1?"Outside":"Inside"):(a=new i("Intersection"),0<=g&&g<=1&&a.appendPoint(r.lerp(o,g)),0<=x&&x<=1&&a.appendPoint(r.lerp(o,x)))}else{var m=-y/p;0<=m&&m<=1?(a=new i("Intersection")).appendPoint(r.lerp(o,m)):a=new i("Outside")}return a},i.intersectEllipsePolygon=function(t,n,e,r){for(var o=new i("No Intersection"),a=r.length,s=0;s0&&(o.status="Intersection"),o},i.intersectEllipseRectangle=function(t,n,e,o,a){var s=o.min(a),u=o.max(a),c=new r(u.x,s.y),l=new r(s.x,u.y),f=i.intersectEllipseLine(t,n,e,s,c),h=i.intersectEllipseLine(t,n,e,c,u),p=i.intersectEllipseLine(t,n,e,u,l),y=i.intersectEllipseLine(t,n,e,l,s),d=new i("No Intersection");return d.appendPoints(f.points),d.appendPoints(h.points),d.appendPoints(p.points),d.appendPoints(y.points),d.points.length>0&&(d.status="Intersection"),d},i.intersectLineLine=function(t,n,e,o){var a,s=(o.x-e.x)*(t.y-e.y)-(o.y-e.y)*(t.x-e.x),u=(n.x-t.x)*(t.y-e.y)-(n.y-t.y)*(t.x-e.x),c=(o.y-e.y)*(n.x-t.x)-(o.x-e.x)*(n.y-t.y);if(0!=c){var l=s/c,f=u/c;0<=l&&l<=1&&0<=f&&f<=1?(a=new i("Intersection")).points.push(new r(t.x+l*(n.x-t.x),t.y+l*(n.y-t.y))):a=new i("No Intersection")}else a=new i(0==s||0==u?"Coincident":"Parallel");return a},i.intersectLinePolygon=function(t,n,e){for(var r=new i("No Intersection"),o=e.length,a=0;a0&&(r.status="Intersection"),r},i.intersectLineRectangle=function(t,n,e,o){var a=e.min(o),s=e.max(o),u=new r(s.x,a.y),c=new r(a.x,s.y),l=i.intersectLineLine(a,u,t,n),f=i.intersectLineLine(u,s,t,n),h=i.intersectLineLine(s,c,t,n),p=i.intersectLineLine(c,a,t,n),y=new i("No Intersection");return y.appendPoints(l.points),y.appendPoints(f.points),y.appendPoints(h.points),y.appendPoints(p.points),y.points.length>0&&(y.status="Intersection"),y},i.intersectPolygonPolygon=function(t,n){for(var e=new i("No Intersection"),r=t.length,o=0;o0&&(e.status="Intersection"),e},i.intersectPolygonRectangle=function(t,n,e){var o=n.min(e),a=n.max(e),s=new r(a.x,o.y),u=new r(o.x,a.y),c=i.intersectLinePolygon(o,s,t),l=i.intersectLinePolygon(s,a,t),f=i.intersectLinePolygon(a,u,t),h=i.intersectLinePolygon(u,o,t),p=new i("No Intersection");return p.appendPoints(c.points),p.appendPoints(l.points),p.appendPoints(f.points),p.appendPoints(h.points),p.points.length>0&&(p.status="Intersection"),p},i.intersectRayRay=function(t,n,e,o){var a,s=(o.x-e.x)*(t.y-e.y)-(o.y-e.y)*(t.x-e.x),u=(n.x-t.x)*(t.y-e.y)-(n.y-t.y)*(t.x-e.x),c=(o.y-e.y)*(n.x-t.x)-(o.x-e.x)*(n.y-t.y);if(0!=c){var l=s/c;(a=new i("Intersection")).points.push(new r(t.x+l*(n.x-t.x),t.y+l*(n.y-t.y)))}else a=new i(0==s||0==u?"Coincident":"Parallel");return a},i.intersectRectangleRectangle=function(t,n,e,o){var a=t.min(n),s=t.max(n),u=new r(s.x,a.y),c=new r(a.x,s.y),l=i.intersectLineRectangle(a,u,e,o),f=i.intersectLineRectangle(u,s,e,o),h=i.intersectLineRectangle(s,c,e,o),p=i.intersectLineRectangle(c,a,e,o),y=new i("No Intersection");return y.appendPoints(l.points),y.appendPoints(f.points),y.appendPoints(h.points),y.appendPoints(p.points),y.points.length>0&&(y.status="Intersection"),y},i.bezout=function(t,n){var e=t[0]*n[1]-n[0]*t[1],r=t[0]*n[2]-n[0]*t[2],i=t[0]*n[3]-n[0]*t[3],o=t[0]*n[4]-n[0]*t[4],a=t[0]*n[5]-n[0]*t[5],s=t[1]*n[2]-n[1]*t[2],u=t[1]*n[4]-n[1]*t[4],c=t[1]*n[5]-n[1]*t[5],l=t[2]*n[3]-n[2]*t[3],f=t[3]*n[4]-n[3]*t[4],h=t[3]*n[5]-n[3]*t[5],p=c+f,y=u-l;return new Polynomial(e*s-r*r,e*y+i*s-2*r*o,e*p+i*y-o*o-2*r*a,e*h+i*p-2*o*a,i*h-a*a)},t.exports=i},function(t,n,e){t.exports=function(){"use strict";var t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},n=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],e=function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,n){var e=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(e.push(a.value),!n||e.length!==n);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return e}(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")},r=function(){function t(t,n){for(var e=0;e255&&(this.r=255),this.g<0||Number.isNaN(this.g)||void 0===this.g?this.g=0:this.g>255&&(this.g=255),this.b<0||Number.isNaN(this.b)||void 0===this.b?this.b=0:this.b>255&&(this.b=255)}}return r(i,[{key:"isValid",value:function(){return this.ok}},{key:"rgb",value:function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"}},{key:"hex",value:function(){var t=this.r.toString(16),n=this.g.toString(16),e=this.b.toString(16);return 1===t.length&&(t="0"+t),1===n.length&&(n="0"+n),1===e.length&&(e="0"+e),"#"+t+n+e}},{key:"channels",value:function(){return{r:this.r,g:this.g,b:this.b}}}]),i}();return function(t){return new i(t)}}()},function(t,n,e){"use strict";t.exports=function(t){var n=[];return n.toString=function(){return this.map((function(n){var e=t(n);return n[2]?"@media ".concat(n[2]," {").concat(e,"}"):e})).join("")},n.i=function(t,e,r){"string"==typeof t&&(t=[[null,t,""]]);var i={};if(r)for(var o=0;os;){var u=n[s][a];u>0&&u1e-9)break;var p=this.offsetDir();for(r=0;r1&&y>d||!isFinite(d))for(r=0;r1&&(v=1);var g=d*d,x=2*v*(y-d)/(g*y),m=f*y,b=2*-v/(g*m);for(isFinite(x)||console.log(x),r=0;r0?E-(P+1)*k:E-(P-1)*k;-w0;)for(var i=n;i-- >0;)e(r,i)},t.prototype.matrixApply=function(n){t.mApply(this.k,this.n,n)},t.prototype.computeNextPosition=function(t,n){var e=this;this.computeDerivatives(t);var r=this.computeStepSize(this.g);if(this.stepAndProject(t,n,this.g,r),this.project){this.matrixApply((function(r,i){return e.e[r][i]=t[r][i]-n[r][i]}));var i=this.computeStepSize(this.e);i=Math.max(.2,Math.min(i,1)),this.stepAndProject(t,n,this.e,i)}},t.prototype.run=function(t){for(var n=Number.MAX_VALUE,e=!1;!e&&t-- >0;){var r=this.rungeKutta();e=Math.abs(n/r-1)>16)/this.range},t.prototype.getNextBetween=function(t,n){return t+this.getNext()*(n-t)},t}();e.PseudoRandom=o},{}],8:[function(t,n,e){"use strict";var r,i=this&&this.__extends||(r=function(t,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)},function(t,n){function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)});Object.defineProperty(e,"__esModule",{value:!0});var o=t("./rectangle"),a=function(){};e.Point=a;var s=function(t,n,e,r){this.x1=t,this.y1=n,this.x2=e,this.y2=r};e.LineSegment=s;var u=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return i(n,t),n}(a);function c(t,n,e){return(n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y)}function l(t,n,e){return c(t,n,e)>0}function f(t,n,e){return c(t,n,e)<0}function h(t,n){var e,r,i,o,a=n.length-1;if(f(t,n[1],n[0])&&!l(t,n[a-1],n[0]))return 0;for(e=0,r=a;;){if(r-e==1)return l(t,n[e],n[r])?e:r;if((o=f(t,n[(i=Math.floor((e+r)/2))+1],n[i]))&&!l(t,n[i-1],n[i]))return i;l(t,n[e+1],n[e])?o||l(t,n[e],n[i])?r=i:e=i:o&&f(t,n[e],n[i])?r=i:e=i}}function p(t,n){var e,r,i,o,a=n.length-1;if(l(t,n[a-1],n[0])&&!f(t,n[1],n[0]))return 0;for(e=0,r=a;;){if(r-e==1)return f(t,n[e],n[r])?e:r;if(o=f(t,n[(i=Math.floor((e+r)/2))+1],n[i]),l(t,n[i-1],n[i])&&!o)return i;f(t,n[e+1],n[e])?o?f(t,n[e],n[i])?r=i:e=i:r=i:o?e=i:l(t,n[e],n[i])?r=i:e=i}}function y(t,n,e,r,i,o){var a,s;s=r(t[a=e(n[0],t)],n);for(var u=!1;!u;){for(u=!0;a===t.length-1&&(a=0),!i(n[s],t[a],t[a+1]);)++a;for(;0===s&&(s=n.length-1),!o(t[a],n[s],n[s-1]);)--s,u=!1}return{t1:a,t2:s}}function d(t,n){return y(t,n,h,p,l,f)}e.PolyPoint=u,e.isLeft=c,e.ConvexHull=function(t){var n,e=t.slice(0).sort((function(t,n){return t.x!==n.x?n.x-t.x:n.y-t.y})),r=t.length,i=e[0].x;for(n=1;n=0&&e[n].x===l;n--);for(s=n+1,n=o;++n<=s;)if(!(c(e[0],e[s],e[n])>=0&&n1&&!(c(a[a.length-2],a[a.length-1],e[n])>0);)a.length-=1;0!=n&&a.push(e[n])}u!=s&&a.push(e[u]);var f=a.length;for(n=s;--n>=o;)if(!(c(e[u],e[o],e[n])>=0&&n>o)){for(;a.length>f&&!(c(a[a.length-2],a[a.length-1],e[n])>0);)a.length-=1;0!=n&&a.push(e[n])}}return a},e.clockwiseRadialSweep=function(t,n,e){n.slice(0).sort((function(n,e){return Math.atan2(n.y-t.y,n.x-t.x)-Math.atan2(e.y-t.y,e.x-t.x)})).forEach(e)},e.tangent_PolyPolyC=y,e.LRtangent_PolyPolyC=function(t,n){var e=d(n,t);return{t1:e.t2,t2:e.t1}},e.RLtangent_PolyPolyC=d,e.LLtangent_PolyPolyC=function(t,n){return y(t,n,p,p,f,f)},e.RRtangent_PolyPolyC=function(t,n){return y(t,n,h,h,l,l)};var v=function(t,n){this.t1=t,this.t2=n};e.BiTangent=v;var g=function(){};e.BiTangents=g;var x=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return i(n,t),n}(a);e.TVGPoint=x;var m=function(t,n,e,r){this.id=t,this.polyid=n,this.polyvertid=e,this.p=r,r.vv=this};e.VisibilityVertex=m;var b=function(){function t(t,n){this.source=t,this.target=n}return t.prototype.length=function(){var t=this.source.p.x-this.target.p.x,n=this.source.p.y-this.target.p.y;return Math.sqrt(t*t+n*n)},t}();e.VisibilityEdge=b;var w=function(){function t(t,n){if(this.P=t,this.V=[],this.E=[],n)this.V=n.V.slice(0),this.E=n.E.slice(0);else{for(var e=t.length,r=0;r0&&this.E.push(new b(i[o-1].vv,s))}i.length>1&&this.E.push(new b(i[0].vv,i[i.length-1].vv))}for(r=0;r0)return!0;return!1},t}();function k(t,n){for(var e=[],r=1,i=n.length;r=0&&d>=0&&x<0&&m>=0&&b>=0&&w<0?i.ll=new v(o,a):y<=0&&d<=0&&x>0&&m<=0&&b<=0&&w>0?i.rr=new v(o,a):y<=0&&d>0&&x<=0&&m>=0&&b<0&&w>=0?i.rl=new v(o,a):y>=0&&d<0&&x>=0&&m<=0&&b>0&&w<=0&&(i.lr=new v(o,a))}return i}function S(t,n){return!t.every((function(t){return!function(t,n){for(var e=1,r=n.length;e0)return!0}return!1}},{"./rectangle":17}],9:[function(t,n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t("./rectangle"),i=t("./vpsc"),o=t("./shortestpaths"),a=function(t,n,e){this.id=t,this.rect=n,this.children=e,this.leaf=void 0===e||0===e.length};e.NodeWrapper=a;var s=function(t,n,e,r,i){void 0===r&&(r=null),void 0===i&&(i=null),this.id=t,this.x=n,this.y=e,this.node=r,this.line=i};e.Vert=s;var u=function(){function t(n,e){this.s=n,this.t=e;var r=t.findMatch(n,e),i=e.slice(0).reverse(),o=t.findMatch(n,i);r.length>=o.length?(this.length=r.length,this.si=r.si,this.ti=r.ti,this.reversed=!1):(this.length=o.length,this.si=o.si,this.ti=e.length-o.ti-o.length,this.reversed=!0)}return t.findMatch=function(t,n){for(var e=t.length,r=n.length,i={length:0,si:-1,ti:-1},o=new Array(e),a=0;ai.length&&(i.length=u,i.si=a-u+1,i.ti=s-u+1)}else o[a][s]=0}return i},t.prototype.getSequence=function(){return this.length>=0?this.s.slice(this.si,this.si+this.length):[]},t}();e.LongestCommonSubsequence=u;var c=function(){function t(t,n,e){var i=this;void 0===e&&(e=12),this.originalnodes=t,this.groupPadding=e,this.leaves=null,this.nodes=t.map((function(t,e){return new a(e,n.getBounds(t),n.getChildren(t))})),this.leaves=this.nodes.filter((function(t){return t.leaf})),this.groups=this.nodes.filter((function(t){return!t.leaf})),this.cols=this.getGridLines("x"),this.rows=this.getGridLines("y"),this.groups.forEach((function(t){return t.children.forEach((function(n){return i.nodes[n].parent=t}))})),this.root={children:[]},this.nodes.forEach((function(t){void 0===t.parent&&(t.parent=i.root,i.root.children.push(t.id)),t.ports=[]})),this.backToFront=this.nodes.slice(0),this.backToFront.sort((function(t,n){return i.getDepth(t)-i.getDepth(n)})),this.backToFront.slice(0).reverse().filter((function(t){return!t.leaf})).forEach((function(t){var n=r.Rectangle.empty();t.children.forEach((function(t){return n=n.union(i.nodes[t].rect)})),t.rect=n.inflate(i.groupPadding)}));var o=this.midPoints(this.cols.map((function(t){return t.pos}))),u=this.midPoints(this.rows.map((function(t){return t.pos}))),c=o[0],l=o[o.length-1],f=u[0],h=u[u.length-1],p=this.rows.map((function(t){return{x1:c,x2:l,y1:t.pos,y2:t.pos}})).concat(u.map((function(t){return{x1:c,x2:l,y1:t,y2:t}}))),y=this.cols.map((function(t){return{x1:t.pos,x2:t.pos,y1:f,y2:h}})).concat(o.map((function(t){return{x1:t,x2:t,y1:f,y2:h}}))),d=p.concat(y);d.forEach((function(t){return t.verts=[]})),this.verts=[],this.edges=[],p.forEach((function(t){return y.forEach((function(n){var e=new s(i.verts.length,n.x1,t.y1);t.verts.push(e),n.verts.push(e),i.verts.push(e);for(var r=i.backToFront.length;r-- >0;){var o=i.backToFront[r],a=o.rect,u=Math.abs(e.x-a.cx()),c=Math.abs(e.y-a.cy());if(u0;){var r=e.filter((function(n){return n.rect["overlap"+t.toUpperCase()](e[0].rect)})),i={nodes:r,pos:this.avg(r.map((function(n){return n.rect["c"+t]()})))};n.push(i),i.nodes.forEach((function(t){return e.splice(e.indexOf(t),1)}))}return n.sort((function(t,n){return t.pos-n.pos})),n},t.prototype.getDepth=function(t){for(var n=0;t.parent!==this.root;)n++,t=t.parent;return n},t.prototype.midPoints=function(t){for(var n=t[1]-t[0],e=[t[0]-n/2],r=1;r.1)&&(c={pos:f[0][n],segments:[]},u.push(c)),c.segments.push(f)}return u},t.nudgeSegs=function(t,n,e,r,o,a){var s=r.length;if(!(s<=1)){for(var u=r.map((function(n){return new i.Variable(n[0][t])})),c=[],l=0;l=0&&c.push(new i.Constraint(u[v],u[g],a))}new i.Solver(u,c).solve(),u.forEach((function(n,i){var o=r[i],a=n.position();o[0][t]=o[1][t]=a;var s=e[o.edgeid];o.i>0&&(s[o.i-1][1][t]=a),o.iMath.PI||i<-Math.PI)&&(i=r-e),i},t.isLeft=function(t,n,e){return(n.x-t.x)*(e.y-t.y)-(n.y-t.y)*(e.x-t.x)<=0},t.getOrder=function(t){for(var n={},e=0;e=c.length||f.ti+f.length>=l.length)?e.push({l:r,r:i}):(f.si+f.length>=c.length||f.ti+f.length>=l.length?(o=c[f.si+1],s=c[f.si-1],a=l[f.ti-1]):(o=c[f.si+f.length-2],a=c[f.si+f.length],s=l[f.ti+f.length]),t.isLeft(o,a,s)?e.push({l:i,r:r}):e.push({l:r,r:i})))}return t.getOrder(e)},t.makeSegments=function(t){function n(t){return{x:t.x,y:t.y}}for(var e=function(t,n,e){return Math.abs((n.x-t.x)*(e.y-t.y)-(n.y-t.y)*(e.x-t.x))<.001},r=[],i=n(t[0]),o=1;o1&&l>1?1e3:0})).reverse().map((function(t){return e.verts[t]}));return l.push(this.nodes[i.id].ports[0]),l.filter((function(t,n){return!(n0&&t.node===i&&l[n-1].node===i)}))},t.getRoutePath=function(n,e,r,i){var o,a,s,u={routepath:"M "+n[0][0].x+" "+n[0][0].y+" ",arrowpath:""};if(n.length>1)for(var c=0;c0?l-=h/Math.abs(h)*e:f-=p/Math.abs(p)*e,u.routepath+="L "+l+" "+f+" ";var y=n[c+1],d=y[0].x,v=y[0].y;h=y[1].x-d,p=y[1].y-v;var g,x,m=t.angleBetween2Lines(o,y)<0?1:0;Math.abs(h)>0?(g=d+h/Math.abs(h)*e,x=v):(g=d,x=v+p/Math.abs(p)*e);var b=Math.abs(g-l),w=Math.abs(x-f);u.routepath+="A "+b+" "+w+" 0 0 "+m+" "+g+" "+x+" "}else{var k=[l,f];Math.abs(h)>0?(a=[l-=h/Math.abs(h)*i,f+r],s=[l,f-r]):(a=[l+r,f-=p/Math.abs(p)*i],s=[l-r,f]),u.routepath+="L "+l+" "+f+" ",i>0&&(u.arrowpath="M "+k[0]+" "+k[1]+" L "+a[0]+" "+a[1]+" L "+s[0]+" "+s[1])}}else l=(o=n[0])[1].x,f=o[1].y,h=l-o[0].x,p=f-o[0].y,k=[l,f],Math.abs(h)>0?(a=[l-=h/Math.abs(h)*i,f+r],s=[l,f-r]):(a=[l+r,f-=p/Math.abs(p)*i],s=[l-r,f]),u.routepath+="L "+l+" "+f+" ",i>0&&(u.arrowpath="M "+k[0]+" "+k[1]+" L "+a[0]+" "+a[1]+" L "+s[0]+" "+s[1]);return u},t}();e.GridRouter=c},{"./rectangle":17,"./shortestpaths":18,"./vpsc":19}],10:[function(t,n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=10,i=(1+Math.sqrt(5))/2,o=1e-4;e.applyPacking=function(t,n,e,a,s,u){void 0===s&&(s=1),void 0===u&&(u=!0);var c=n,l=e,f=(s=void 0!==s?s:1,a=void 0!==a?a:0,0),h=0,p=0,y=0,d=[];function v(t,n){d=[],f=0,h=0,y=0;for(var e=0;e=t.height&&d[i].x+d[i].width+t.width+r-n<=o){e=d[i];break}d.push(t),void 0!==e?(t.x=e.x+e.width+r,t.y=e.bottom,t.space_left=t.height,t.bottom=t.y,e.space_left-=t.height+r,e.bottom+=t.height+r):(t.y=y,y+=t.height+r,t.x=0,t.bottom=t.y,t.space_left=t.height),t.y+t.height-h>-o&&(h=t.y+t.height-0),t.x+t.width-f>-o&&(f=t.x+t.width-0)}0!=t.length&&(function(t){t.forEach((function(t){var n,e,r,i,o;n=t,e=Number.MAX_VALUE,r=Number.MAX_VALUE,i=0,o=0,n.array.forEach((function(t){var n=void 0!==t.width?t.width:a,s=void 0!==t.height?t.height:a;n/=2,s/=2,i=Math.max(t.x+n,i),e=Math.min(t.x-n,e),o=Math.max(t.y+s,o),r=Math.min(t.y-s,r)})),n.width=i-e,n.height=o-r}))}(t),function(t,n){var e=Number.POSITIVE_INFINITY,a=0;t.sort((function(t,n){return n.height-t.height})),p=t.reduce((function(t,n){return t.widthp||d>o;){if(1!=h){var g=u-(u-s)/i;l=v(t,g)}if(0!=h){var x=s+(u-s)/i;f=v(t,x)}if(y=Math.abs(g-x),d=Math.abs(l-f),lf?(s=g,g=x,l=f,h=1):(u=x,x=g,f=l,h=0),c++>100)break}v(t,a)}(t),u&&function(t){t.forEach((function(t){var n={x:0,y:0};t.array.forEach((function(t){n.x+=t.x,n.y+=t.y})),n.x/=t.array.length,n.y/=t.array.length;var e=n.x-t.width/2,r=n.y-t.height/2,i=t.x-e+c/2-f/2,o=t.y-r+l/2-h/2;t.array.forEach((function(t){t.x+=i,t.y+=o}))}))}(t))},e.separateGraphs=function(t,n){for(var e={},r={},i=[],o=0,a=0;a0){var n=0;this._links.forEach((function(t){n=Math.max(n,t.source,t.target)})),this._nodes=new Array(++n);for(var e=0;e0?t:0:t>0&&(this._running||(this._running=!0,this.trigger({type:r.start,alpha:this._alpha=t}),this.kick())),this):this._alpha},t.prototype.getLinkLength=function(t){return"function"==typeof this._linkDistance?+this._linkDistance(t):this._linkDistance},t.setLinkLength=function(t,n){t.length=n},t.prototype.getLinkType=function(t){return"function"==typeof this._linkType?this._linkType(t):0},t.prototype.symmetricDiffLinkLengths=function(t,n){var e=this;return void 0===n&&(n=1),this.linkDistance((function(n){return t*n.length})),this._linkLengthCalculator=function(){return o.symmetricDiffLinkLengths(e._links,e.linkAccessor,n)},this},t.prototype.jaccardLinkLengths=function(t,n){var e=this;return void 0===n&&(n=1),this.linkDistance((function(n){return t*n.length})),this._linkLengthCalculator=function(){return o.jaccardLinkLengths(e._links,e.linkAccessor,n)},this},t.prototype.start=function(n,e,r,i,c,l){var f=this;void 0===n&&(n=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===c&&(c=!0),void 0===l&&(l=!0);var h,p=this.nodes().length,y=p+2*this._groups.length,d=(this._links.length,this._canvasSize[0]),v=this._canvasSize[1],g=new Array(y),x=new Array(y),m=null,b=this._avoidOverlaps;this._nodes.forEach((function(t,n){t.index=n,void 0===t.x&&(t.x=d/2,t.y=v/2),g[n]=t.x,x[n]=t.y})),this._linkLengthCalculator&&this._linkLengthCalculator(),this._distanceMatrix?h=this._distanceMatrix:(h=new u.Calculator(y,this._links,t.getSourceIndex,t.getTargetIndex,(function(t){return f.getLinkLength(t)})).DistanceMatrix(),m=a.Descent.createSquareMatrix(y,(function(){return 2})),this._links.forEach((function(t){"number"==typeof t.source&&(t.source=f._nodes[t.source]),"number"==typeof t.target&&(t.target=f._nodes[t.target])})),this._links.forEach((function(n){var e=t.getSourceIndex(n),r=t.getTargetIndex(n);m[e][r]=m[r][e]=n.weight||1})));var w=a.Descent.createSquareMatrix(y,(function(t,n){return h[t][n]}));if(this._rootGroup&&void 0!==this._rootGroup.groups){var k=p;this._groups.forEach((function(t){!function(t,n,e,r){m[t][n]=m[n][t]=e,w[t][n]=w[n][t]=r}(k,k+1,f._groupCompactness,.1),void 0===t.bounds?(g[k]=d/2,x[k++]=v/2,g[k]=d/2,x[k++]=v/2):(g[k]=t.bounds.x,x[k++]=t.bounds.y,g[k]=t.bounds.X,x[k++]=t.bounds.Y)}))}else this._rootGroup={leaves:this._nodes,groups:[]};var _=this._constraints||[];for(this._directedLinkConstraints&&(this.linkAccessor.getMinSeparation=this._directedLinkConstraints.getMinSeparation,_=_.concat(o.generateDirectedEdgeConstraints(p,this._links,this._directedLinkConstraints.axis,this.linkAccessor))),this.avoidOverlaps(!1),this._descent=new a.Descent([g,x],w),this._descent.locks.clear(),k=0;k0&&(this._descent.project=new s.Projection(this._nodes,this._groups,this._rootGroup,_).projectFunctions()),this._descent.run(e),this.separateOverlappingComponents(d,v,l),this.avoidOverlaps(b),b&&(this._nodes.forEach((function(t,n){t.x=g[n],t.y=x[n]})),this._descent.project=new s.Projection(this._nodes,this._groups,this._rootGroup,_,!0).projectFunctions(),this._nodes.forEach((function(t,n){g[n]=t.x,x[n]=t.y}))),this._descent.G=m,this._descent.run(r),i){this._descent.snapStrength=1e3,this._descent.snapGridSize=this._nodes[0].width,this._descent.numGridSnapNodes=p,this._descent.scaleSnapByMaxH=p!=y;var E=a.Descent.createSquareMatrix(y,(function(t,n){return t>=p||n>=p?m[t][n]:0}));this._descent.G=E,this._descent.run(i)}return this.updateNodePositions(),this.separateOverlappingComponents(d,v,l),c?this.resume():this},t.prototype.initialLayout=function(n,e,r){if(this._groups.length>0&&n>0){var i=this._nodes.length,o=this._links.map((function(t){return{source:t.source.index,target:t.target.index}})),a=this._nodes.map((function(t){return{index:t.index}}));this._groups.forEach((function(t,n){a.push({index:t.index=i+n})})),this._groups.forEach((function(t,n){void 0!==t.leaves&&t.leaves.forEach((function(n){return o.push({source:t.index,target:n.index})})),void 0!==t.groups&&t.groups.forEach((function(n){return o.push({source:t.index,target:n.index})}))})),(new t).size(this.size()).nodes(a).links(o).avoidOverlaps(!1).linkDistance(this.linkDistance()).symmetricDiffLinkLengths(5).convergenceThreshold(1e-4).start(n,0,0,0,!1),this._nodes.forEach((function(t){e[t.index]=a[t.index].x,r[t.index]=a[t.index].y}))}else this._descent.run(n)},t.prototype.separateOverlappingComponents=function(t,n,e){var r=this;if(void 0===e&&(e=!0),!this._distanceMatrix&&this._handleDisconnected){var i=this._descent.x[0],o=this._descent.x[1];this._nodes.forEach((function(t,n){t.x=i[n],t.y=o[n]}));var a=l.separateGraphs(this._nodes,this._links);l.applyPacking(a,t,n,this._defaultNodeSize,n/t,e),this._nodes.forEach((function(t,n){r._descent.x[0][n]=t.x,r._descent.x[1][n]=t.y,t.bounds&&(t.bounds.setXCentre(t.x),t.bounds.setYCentre(t.y))}))}},t.prototype.resume=function(){return this.alpha(.1)},t.prototype.stop=function(){return this.alpha(0)},t.prototype.prepareEdgeRouting=function(t){void 0===t&&(t=0),this._visibilityGraph=new c.TangentVisibilityGraph(this._nodes.map((function(n){return n.bounds.inflate(-t).vertices()})))},t.prototype.routeEdge=function(t,n,e){void 0===n&&(n=5);var r=[],i=new c.TangentVisibilityGraph(this._visibilityGraph.P,{V:this._visibilityGraph.V,E:this._visibilityGraph.E}),o={x:t.source.x,y:t.source.y},a={x:t.target.x,y:t.target.y},l=i.addPoint(o,t.source.index),f=i.addPoint(a,t.target.index);i.addEdgeIfVisible(o,a,t.source.index,t.target.index),void 0!==e&&e(i);var h=new u.Calculator(i.V.length,i.E,(function(t){return t.source.id}),(function(t){return t.target.id}),(function(t){return t.length()})).PathFromNodeToNode(l.id,f.id);if(1===h.length||h.length===i.V.length){var p=s.makeEdgeBetween(t.source.innerBounds,t.target.innerBounds,n);r=[p.sourceIntersection,p.arrowStart]}else{for(var y=h.length-2,d=i.V[h[y]].p,v=i.V[h[0]].p,g=(r=[t.source.innerBounds.rayIntersection(d.x,d.y)],y);g>=0;--g)r.push(i.V[h[g]].p);r.push(s.makeEdgeTo(v,t.target.innerBounds,n))}return r},t.getSourceIndex=function(t){return"number"==typeof t.source?t.source:t.source.index},t.getTargetIndex=function(t){return"number"==typeof t.target?t.target:t.target.index},t.linkId=function(n){return t.getSourceIndex(n)+"-"+t.getTargetIndex(n)},t.dragStart=function(n){f(n)?t.storeOffset(n,t.dragOrigin(n)):(t.stopNode(n),n.fixed|=2)},t.stopNode=function(t){t.px=t.x,t.py=t.y},t.storeOffset=function(n,e){void 0!==n.leaves&&n.leaves.forEach((function(n){n.fixed|=2,t.stopNode(n),n._dragGroupOffsetX=n.x-e.x,n._dragGroupOffsetY=n.y-e.y})),void 0!==n.groups&&n.groups.forEach((function(n){return t.storeOffset(n,e)}))},t.dragOrigin=function(t){return f(t)?{x:t.bounds.cx(),y:t.bounds.cy()}:t},t.drag=function(n,e){f(n)?(void 0!==n.leaves&&n.leaves.forEach((function(t){n.bounds.setXCentre(e.x),n.bounds.setYCentre(e.y),t.px=t._dragGroupOffsetX+e.x,t.py=t._dragGroupOffsetY+e.y})),void 0!==n.groups&&n.groups.forEach((function(n){return t.drag(n,e)}))):(n.px=e.x,n.py=e.y)},t.dragEnd=function(n){f(n)?(void 0!==n.leaves&&n.leaves.forEach((function(n){t.dragEnd(n),delete n._dragGroupOffsetX,delete n._dragGroupOffsetY})),void 0!==n.groups&&n.groups.forEach(t.dragEnd)):n.fixed&=-7},t.mouseOver=function(t){t.fixed|=4,t.px=t.x,t.py=t.y},t.mouseOut=function(t){t.fixed&=-5},t}();e.Layout=h},{"./descent":7,"./geom":8,"./handledisconnected":10,"./linklengths":13,"./powergraph":14,"./rectangle":17,"./shortestpaths":18}],12:[function(t,n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t("./shortestpaths"),i=t("./descent"),o=t("./rectangle"),a=t("./linklengths"),s=function(){function t(t,n){this.source=t,this.target=n}return t.prototype.actualLength=function(t){var n=this;return Math.sqrt(t.reduce((function(t,e){var r=e[n.target]-e[n.source];return t+r*r}),0))},t}();e.Link3D=s;var u=function(t,n,e){void 0===t&&(t=0),void 0===n&&(n=0),void 0===e&&(e=0),this.x=t,this.y=n,this.z=e};e.Node3D=u;var c=function(){function t(n,e,r){var i=this;void 0===r&&(r=1),this.nodes=n,this.links=e,this.idealLinkLength=r,this.constraints=null,this.useJaccardLinkLengths=!0,this.result=new Array(t.k);for(var o=0;o=this.R))return this.merge(n.a,n.b,t),!0}},t.prototype.nEdges=function(t,n){var e=t.incoming.intersection(n.incoming),r=t.outgoing.intersection(n.outgoing);return this.R-e.count()-r.count()},t.prototype.getGroupHierarchy=function(t){var n=this,e=[];return function t(n,e,r){n.forAll((function(n){if(n.isLeaf())e.leaves||(e.leaves=[]),e.leaves.push(n.id);else{var i=e;if(n.gid=r.length,!n.isIsland()||n.isPredefined()){if(i={id:n.gid},n.isPredefined())for(var o in n.definition)i[o]=n.definition[o];e.groups||(e.groups=[]),e.groups.push(n.gid),r.push(i)}t(n.children,i,r)}}))}(this.roots[0],{},e),this.allEdges().forEach((function(i){var o=n.modules[i.source],a=n.modules[i.target];t.push(new r(void 0===o.gid?i.source:e[o.gid],void 0===a.gid?i.target:e[a.gid],i.type))})),e},t.prototype.allEdges=function(){var n=[];return t.getEdges(this.roots[0],n),n},t.getEdges=function(n,e){n.forAll((function(n){n.getEdges(e),t.getEdges(n.children,e)}))},t}();e.Configuration=i;var o=function(){function t(t,n,e,r,i){void 0===n&&(n=new u),void 0===e&&(e=new u),void 0===r&&(r=new s),this.id=t,this.outgoing=n,this.incoming=e,this.children=r,this.definition=i}return t.prototype.getEdges=function(t){var n=this;this.outgoing.forAll((function(e,i){e.forAll((function(e){t.push(new r(n.id,e.id,i))}))}))},t.prototype.isLeaf=function(){return 0===this.children.count()},t.prototype.isIsland=function(){return 0===this.outgoing.count()&&0===this.incoming.count()},t.prototype.isPredefined=function(){return void 0!==this.definition},t}();function a(t,n){var e={};for(var r in t)r in n&&(e[r]=t[r]);return e}e.Module=o;var s=function(){function t(){this.table={}}return t.prototype.count=function(){return Object.keys(this.table).length},t.prototype.intersection=function(n){var e=new t;return e.table=a(this.table,n.table),e},t.prototype.intersectionCount=function(t){return this.intersection(t).count()},t.prototype.contains=function(t){return t in this.table},t.prototype.add=function(t){this.table[t.id]=t},t.prototype.remove=function(t){delete this.table[t.id]},t.prototype.forAll=function(t){for(var n in this.table)t(this.table[n])},t.prototype.modules=function(){var t=[];return this.forAll((function(n){n.isPredefined()||t.push(n)})),t},t}();e.ModuleSet=s;var u=function(){function t(){this.sets={},this.n=0}return t.prototype.count=function(){return this.n},t.prototype.contains=function(t){var n=!1;return this.forAllModules((function(e){n||e.id!=t||(n=!0)})),n},t.prototype.add=function(t,n){(t in this.sets?this.sets[t]:this.sets[t]=new s).add(n),++this.n},t.prototype.remove=function(t,n){var e=this.sets[t];e.remove(n),0===e.count()&&delete this.sets[t],--this.n},t.prototype.forAll=function(t){for(var n in this.sets)t(this.sets[n],Number(n))},t.prototype.forAllModules=function(t){this.forAll((function(n,e){return n.forAll(t)}))},t.prototype.intersection=function(n){var e=new t;return this.forAll((function(t,r){if(r in n.sets){var i=t.intersection(n.sets[r]),o=i.count();o>0&&(e.sets[r]=i,e.n+=o)}})),e},t}();e.LinkSets=u,e.getGroups=function(t,n,e,r){for(var o=t.length,a=new i(o,n,e,r);a.greedyMerge(););var s=[],u=a.getGroupHierarchy(s);return s.forEach((function(n){var e=function(e){var r=n[e];"number"==typeof r&&(n[e]=t[r])};e("source"),e("target")})),{groups:u,powerEdges:s}}},{}],15:[function(t,n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.elem=t,this.subheaps=[]}return t.prototype.toString=function(t){for(var n="",e=!1,r=0;r0)}return null}}return t.prototype.clear=function(){this._root=null,this.size=0},t.prototype.find=function(t){for(var n=this._root;null!==n;){var e=this._comparator(t,n.data);if(0===e)return n.data;n=n.get_child(e>0)}return null},t.prototype.lowerBound=function(t){return this._bound(t,this._comparator)},t.prototype.upperBound=function(t){var n=this._comparator;return this._bound(t,(function(t,e){return n(e,t)}))},t.prototype.min=function(){var t=this._root;if(null===t)return null;for(;null!==t.left;)t=t.left;return t.data},t.prototype.max=function(){var t=this._root;if(null===t)return null;for(;null!==t.right;)t=t.right;return t.data},t.prototype.iterator=function(){return new a(this)},t.prototype.each=function(t){for(var n,e=this.iterator();null!==(n=e.next());)t(n)},t.prototype.reach=function(t){for(var n,e=this.iterator();null!==(n=e.prev());)t(n)},t.prototype._bound=function(t,n){for(var e=this._root,r=this.iterator();null!==e;){var i=this._comparator(t,e.data);if(0===i)return r._cursor=e,r;r._ancestors.push(e),e=e.get_child(i>0)}for(var o=r._ancestors.length-1;o>=0;--o)if(n(t,(e=r._ancestors[o]).data)>0)return r._cursor=e,r._ancestors.length=o,r;return r._ancestors.length=0,r},t}();e.TreeBase=o;var a=function(){function t(t){this._tree=t,this._ancestors=[],this._cursor=null}return t.prototype.data=function(){return null!==this._cursor?this._cursor.data:null},t.prototype.next=function(){if(null===this._cursor){var t=this._tree._root;null!==t&&this._minNode(t)}else{var n;if(null===this._cursor.right)do{if(n=this._cursor,!this._ancestors.length){this._cursor=null;break}this._cursor=this._ancestors.pop()}while(this._cursor.right===n);else this._ancestors.push(this._cursor),this._minNode(this._cursor.right)}return null!==this._cursor?this._cursor.data:null},t.prototype.prev=function(){if(null===this._cursor){var t=this._tree._root;null!==t&&this._maxNode(t)}else{var n;if(null===this._cursor.left)do{if(n=this._cursor,!this._ancestors.length){this._cursor=null;break}this._cursor=this._ancestors.pop()}while(this._cursor.left===n);else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left)}return null!==this._cursor?this._cursor.data:null},t.prototype._minNode=function(t){for(;null!==t.left;)this._ancestors.push(t),t=t.left;this._cursor=t},t.prototype._maxNode=function(t){for(;null!==t.right;)this._ancestors.push(t),t=t.right;this._cursor=t},t}();e.Iterator=a;var s=function(){function t(t){this.data=t,this.left=null,this.right=null,this.red=!0}return t.prototype.get_child=function(t){return t?this.right:this.left},t.prototype.set_child=function(t,n){t?this.right=n:this.left=n},t}(),u=function(t){function n(n){var e=t.call(this)||this;return e._root=null,e._comparator=n,e.size=0,e}return i(n,t),n.prototype.insert=function(t){var e=!1;if(null===this._root)this._root=new s(t),e=!0,this.size++;else{var r=new s(void 0),i=!1,o=!1,a=null,u=r,c=null,l=this._root;for(u.right=this._root;;){if(null===l?(l=new s(t),c.set_child(i,l),e=!0,this.size++):n.is_red(l.left)&&n.is_red(l.right)&&(l.red=!0,l.left.red=!1,l.right.red=!1),n.is_red(l)&&n.is_red(c)){var f=u.right===a;l===c.get_child(o)?u.set_child(f,n.single_rotate(a,!o)):u.set_child(f,n.double_rotate(a,!o))}var h=this._comparator(l.data,t);if(0===h)break;o=i,i=h<0,null!==a&&(u=a),a=c,c=l,l=l.get_child(i)}this._root=r.right}return this._root.red=!1,e},n.prototype.remove=function(t){if(null===this._root)return!1;var e=new s(void 0),r=e;r.right=this._root;for(var i=null,o=null,a=null,u=!0;null!==r.get_child(u);){var c=u;o=i,i=r,r=r.get_child(u);var l=this._comparator(t,r.data);if(u=l>0,0===l&&(a=r),!n.is_red(r)&&!n.is_red(r.get_child(u)))if(n.is_red(r.get_child(!u))){var f=n.single_rotate(r,u);i.set_child(c,f),i=f}else if(!n.is_red(r.get_child(!u))){var h=i.get_child(!c);if(null!==h)if(n.is_red(h.get_child(!c))||n.is_red(h.get_child(c))){var p=o.right===i;n.is_red(h.get_child(c))?o.set_child(p,n.double_rotate(i,c)):n.is_red(h.get_child(!c))&&o.set_child(p,n.single_rotate(i,c));var y=o.get_child(p);y.red=!0,r.red=!0,y.left.red=!1,y.right.red=!1}else i.red=!1,h.red=!0,r.red=!0}}return null!==a&&(a.data=r.data,i.set_child(i.right===r,r.get_child(null===r.left)),this.size--),this._root=e.right,null!==this._root&&(this._root.red=!1),null!==a},n.is_red=function(t){return null!==t&&t.red},n.single_rotate=function(t,n){var e=t.get_child(!n);return t.set_child(!n,e.get_child(n)),e.set_child(n,t),t.red=!0,e.red=!1,e},n.double_rotate=function(t,e){return t.set_child(!e,n.single_rotate(t.get_child(!e),!e)),n.single_rotate(t,e)},n}(o);e.RBTree=u},{}],17:[function(t,n,e){"use strict";var r,i=this&&this.__extends||(r=function(t,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)},function(t,n){function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)});Object.defineProperty(e,"__esModule",{value:!0});var o=t("./vpsc"),a=t("./rbtree");function s(t){return t.bounds=void 0!==t.leaves?t.leaves.reduce((function(t,n){return n.bounds.union(t)}),u.empty()):u.empty(),void 0!==t.groups&&(t.bounds=t.groups.reduce((function(t,n){return s(n).union(t)}),t.bounds)),t.bounds=t.bounds.inflate(t.padding),t.bounds}e.computeGroupBounds=s;var u=function(){function t(t,n,e,r){this.x=t,this.X=n,this.y=e,this.Y=r}return t.empty=function(){return new t(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)},t.prototype.cx=function(){return(this.x+this.X)/2},t.prototype.cy=function(){return(this.y+this.Y)/2},t.prototype.overlapX=function(t){var n=this.cx(),e=t.cx();return n<=e&&t.x0?e[0]:null},t.prototype.vertices=function(){return[{x:this.x,y:this.y},{x:this.X,y:this.y},{x:this.X,y:this.Y},{x:this.x,y:this.Y}]},t.lineIntersection=function(t,n,e,r,i,o,a,s){var u=e-t,c=a-i,l=r-n,f=s-o,h=f*u-c*l;if(0==h)return null;var p=t-i,y=n-o,d=(c*y-f*p)/h,v=(u*y-l*p)/h;return d>=0&&d<=1&&v>=0&&v<=1?{x:t+d*u,y:n+d*l}:null},t.prototype.inflate=function(n){return new t(this.x-n,this.X+n,this.y-n,this.Y+n)},t}();e.Rectangle=u,e.makeEdgeBetween=function(t,n,e){var r=t.rayIntersection(n.cx(),n.cy())||{x:t.cx(),y:t.cy()},i=n.rayIntersection(t.cx(),t.cy())||{x:n.cx(),y:n.cy()},o=i.x-r.x,a=i.y-r.y,s=Math.sqrt(o*o+a*a),u=s-e;return{sourceIntersection:r,targetIntersection:i,arrowStart:{x:r.x+u*o/s,y:r.y+u*a/s}}},e.makeEdgeTo=function(t,n,e){var r=n.rayIntersection(t.x,t.y);r||(r={x:n.cx(),y:n.cy()});var i=r.x-t.x,o=r.y-t.y,a=Math.sqrt(i*i+o*o);return{x:r.x-e*i/a,y:r.y-e*o/a}};var c=function(t,n,e){this.v=t,this.r=n,this.pos=e,this.prev=h(),this.next=h()},l=function(t,n,e){this.isOpen=t,this.v=n,this.pos=e};function f(t,n){return t.pos>n.pos?1:t.pos0&&(t[e].insert(i),i[r].insert(t))};e("next","prev"),e("prev","next")}};function d(t,n,e,r){void 0===r&&(r=!1);var i=t.padding,o=void 0!==t.groups?t.groups.length:0,a=void 0!==t.leaves?t.leaves.length:0,s=o?t.groups.reduce((function(t,r){return t.concat(d(r,n,e,!0))}),[]):[],u=(r?2:0)+a+o,c=new Array(u),l=new Array(u),f=0,h=function(t,n){l[f]=t,c[f++]=n};if(r){var p=t.bounds,y=n.getCentre(p),g=n.getSize(p)/2,x=n.getOpen(p),m=n.getClose(p),b=y-g+i/2,w=y+g-i/2;t.minVar.desiredPosition=b,h(n.makeRect(x,m,b,i),t.minVar),t.maxVar.desiredPosition=w,h(n.makeRect(x,m,w,i),t.maxVar)}a&&t.leaves.forEach((function(t){return h(t.bounds,t.variable)})),o&&t.groups.forEach((function(t){var e=t.bounds;h(n.makeRect(n.getOpen(e),n.getClose(e),n.getCentre(e),n.getSize(e)),t.minVar)}));var k=v(l,c,n,e);return o&&(c.forEach((function(t){t.cOut=[],t.cIn=[]})),k.forEach((function(t){t.left.cOut.push(t),t.right.cIn.push(t)})),t.groups.forEach((function(t){var e=(t.padding-n.getSize(t.bounds))/2;t.minVar.cIn.forEach((function(t){return t.gap+=e})),t.minVar.cOut.forEach((function(n){n.left=t.maxVar,n.gap+=e}))}))),s.concat(k)}function v(t,n,e,r){var i,a=t.length,s=2*a;console.assert(n.length>=a);var u=new Array(s);for(i=0;it[e]&&(t[e]=n)}o=t}))}},t.prototype.createAlignment=function(t){var n=this,e=this.nodes[t.offsets[0].node].variable;this.makeFeasible(t);var r="x"===t.axis?this.xConstraints:this.yConstraints;t.offsets.slice(1).forEach((function(t){var i=n.nodes[t.node].variable;r.push(new o.Constraint(e,i,t.offset,!0))}))},t.prototype.createConstraints=function(t){var n=this,e=function(t){return void 0===t.type||"separation"===t.type};this.xConstraints=t.filter((function(t){return"x"===t.axis&&e(t)})).map((function(t){return n.createSeparation(t)})),this.yConstraints=t.filter((function(t){return"y"===t.axis&&e(t)})).map((function(t){return n.createSeparation(t)})),t.filter((function(t){return"alignment"===t.type})).forEach((function(t){return n.createAlignment(t)}))},t.prototype.setupVariablesAndBounds=function(t,n,e,r){this.nodes.forEach((function(i,o){i.fixed?(i.variable.weight=i.fixedWeight?i.fixedWeight:1e3,e[o]=r(i)):i.variable.weight=1;var a=(i.width||0)/2,s=(i.height||0)/2,c=t[o],l=n[o];i.bounds=new u(c-a,c+a,l-s,l+s)}))},t.prototype.xProject=function(t,n,e){(this.rootGroup||this.avoidOverlaps||this.xConstraints)&&this.project(t,n,t,e,(function(t){return t.px}),this.xConstraints,m,(function(t){return t.bounds.setXCentre(e[t.variable.index]=t.variable.position())}),(function(t){var n=e[t.minVar.index]=t.minVar.position(),r=e[t.maxVar.index]=t.maxVar.position(),i=t.padding/2;t.bounds.x=n-i,t.bounds.X=r+i}))},t.prototype.yProject=function(t,n,e){(this.rootGroup||this.yConstraints)&&this.project(t,n,n,e,(function(t){return t.py}),this.yConstraints,b,(function(t){return t.bounds.setYCentre(e[t.variable.index]=t.variable.position())}),(function(t){var n=e[t.minVar.index]=t.minVar.position(),r=e[t.maxVar.index]=t.maxVar.position(),i=t.padding/2;t.bounds.y=n-i,t.bounds.Y=r+i}))},t.prototype.projectFunctions=function(){var t=this;return[function(n,e,r){return t.xProject(n,e,r)},function(n,e,r){return t.yProject(n,e,r)}]},t.prototype.project=function(t,n,e,r,i,o,a,u,c){this.setupVariablesAndBounds(t,n,r,i),this.rootGroup&&this.avoidOverlaps&&(s(this.rootGroup),o=o.concat(a(this.rootGroup))),this.solve(this.variables,o,e,r),this.nodes.forEach(u),this.rootGroup&&this.avoidOverlaps&&(this.groups.forEach(c),s(this.rootGroup))},t.prototype.solve=function(t,n,e,r){var i=new o.Solver(t,n);i.setStartingPositions(e),i.setDesiredPositions(r),i.solve()},t}();e.Projection=k},{"./rbtree":16,"./vpsc":19}],18:[function(t,n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t("./pqueue"),i=function(t,n){this.id=t,this.distance=n},o=function(t){this.id=t,this.neighbours=[]},a=function(t,n,e){this.node=t,this.prev=n,this.d=e},s=function(){function t(t,n,e,r,a){this.n=t,this.es=n,this.neighbours=new Array(this.n);for(var s=this.n;s--;)this.neighbours[s]=new o(s);for(s=this.es.length;s--;){var u=this.es[s],c=e(u),l=r(u),f=a(u);this.neighbours[c].neighbours.push(new i(l,f)),this.neighbours[l].neighbours.push(new i(c,f))}}return t.prototype.DistanceMatrix=function(){for(var t=new Array(this.n),n=0;nf&&(c.d=f,c.prev=s,e.reduceKey(c.q,c,(function(t,n){return t.q=n})))}}return o},t}();e.Calculator=s},{"./pqueue":15}],19:[function(t,n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t){this.scale=t,this.AB=0,this.AD=0,this.A2=0}return t.prototype.addVariable=function(t){var n=this.scale/t.scale,e=t.offset/t.scale,r=t.weight;this.AB+=r*n*e,this.AD+=r*n*t.desiredPosition,this.A2+=r*n*n},t.prototype.getPosn=function(){return(this.AD-this.AB)/this.A2},t}();e.PositionStats=r;var i=function(){function t(t,n,e,r){void 0===r&&(r=!1),this.left=t,this.right=n,this.gap=e,this.equality=r,this.active=!1,this.unsatisfiable=!1,this.left=t,this.right=n,this.gap=e,this.equality=r}return t.prototype.slack=function(){return this.unsatisfiable?Number.MAX_VALUE:this.right.scale*this.right.position()-this.gap-this.left.scale*this.left.position()},t}();e.Constraint=i;var o=function(){function t(t,n,e){void 0===n&&(n=1),void 0===e&&(e=1),this.desiredPosition=t,this.weight=n,this.scale=e,this.offset=0}return t.prototype.dfdv=function(){return 2*this.weight*(this.position()-this.desiredPosition)},t.prototype.position=function(){return(this.block.ps.scale*this.block.posn+this.offset)/this.scale},t.prototype.visitNeighbours=function(t,n){var e=function(e,r){return e.active&&t!==r&&n(e,r)};this.cOut.forEach((function(t){return e(t,t.right)})),this.cIn.forEach((function(t){return e(t,t.left)}))},t}();e.Variable=o;var a=function(){function t(t){this.vars=[],t.offset=0,this.ps=new r(t.scale),this.addVariable(t)}return t.prototype.addVariable=function(t){t.block=this,this.vars.push(t),this.ps.addVariable(t),this.posn=this.ps.getPosn()},t.prototype.updateWeightedPosition=function(){this.ps.AB=this.ps.AD=this.ps.A2=0;for(var t=0,n=this.vars.length;t=0?this.inactive.push(n):this.bs.merge(n)}}},t.prototype.solve=function(){this.satisfy();for(var t=Number.MAX_VALUE,n=this.bs.cost();Math.abs(t-n)>1e-4;)this.satisfy(),t=n,n=this.bs.cost();return n},t.LAGRANGIAN_TOLERANCE=-1e-4,t.ZERO_UPPERBOUND=-1e-10,t}();e.Solver=u,e.removeOverlapInOneDimension=function(t,n,e){for(var r=t.map((function(t){return new o(t.desiredCenter)})),a=[],s=t.length,c=0;c=0;)l.pruneInvisibleSubtrees(i[a],o[a])}}},parentChain:function(t,n){for(var e=t.ownerDocument||document,r=[];t.parentNode!==e&&null!==t.parentNode;)t=t.parentNode,r.push({id:t.id,class:t.getAttribute("class")||""});return r.forEach((function(t){var e={id:!1,class:!1},r=t.class.split(" ").filter((function(t){return t.length>0}));n.forEach((function(n){for(var i=0;i=0){e.class=!0;break}t.id&&n.indexOf("#"+t.id)>=0&&(e.id=!0)})),Object.keys(e).forEach((function(n){e[n]||(t[n]=void 0)}))})),r},usedStyles:function(t,n,e){for(var r,i=[],o=(t.ownerDocument||document).styleSheets,a=0;a0),n&&!e||(u|=t.matches(r.selectorText))}catch(t){console.warn("CSS selector error: "+r.selectorText+". Often angular issue.",t)}u&&i.push(r.cssText)}}return i},makeXMLStr:function(t,n){var e=t.serializeToString(n);return e=e.split('xmlns="http://www.w3.org/1999/xhtml"').join("")}};function f(t,n){for(var e=0;e=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}function v(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e25&&(this.labelText=this.labelText.substr(0,16)+"..."),this.labelText=this.name,this.labelTextNode=document.createTextNode(this.labelText),this.labelSVG.appendChild(this.labelTextNode),this.labelSVG.setAttribute("transform","translate( -"+this.getSymbolRadius()+" "+this.labelY+")"),this.upperGroup.appendChild(this.labelSVG)}},{key:"initOutline",value:function(){this.outline.classList.add("outline"),this.upperGroup.appendChild(this.outline)}},{key:"initListeners",value:function(){var t=this;this.upperGroup.onmousedown=function(n){t.mouseDown(n)},this.upperGroup.onmouseenter=function(n){t.mouseOver(n)},this.upperGroup.onmouseleave=function(n){t.mouseOut(n)},this.upperGroup.ontouchstart=function(n){t.touchStart(n)}}},{key:"addStoichiometryLabel",value:function(t){this.labelSVG&&(this.labelSVG.childNodes[0].data=this.labelSVG.childNodes[0].data+" ["+t+"]")}},{key:"mouseDown",value:function(t){return this.app.preventDefaultsAndStopPropagation(t),this.app.d3cola.stop(),this.app.dragElement=this,this.app.dragStart=t,!1}},{key:"touchStart",value:function(t){return this.app.preventDefaultsAndStopPropagation(t),this.app.d3cola.stop(),this.app.dragElement=this,this.app.dragStart=t,!1}},{key:"mouseOver",value:function(t){return this.app.preventDefaultsAndStopPropagation(t),this.showHighlight(!0),this.app.notifyHoverListeners([this.json]),!1}},{key:"mouseOut",value:function(t){return this.app.preventDefaultsAndStopPropagation(t),this.showHighlight(!1),this.app.hideTooltip(),this.app.notifyHoverListeners([]),!1}},{key:"getSymbolRadius",value:function(){return 15}},{key:"showHighlight",value:function(){}},{key:"getPosition",value:function(){return[this.ix,this.iy]}},{key:"setPosition",value:function(t,n){this.px=this.ix,this.py=this.iy;var e=this.width/2-this.getSymbolRadius();this.expanded&&(e-=this.size/2*this.stickZoom),this.ix=t+e,this.iy=n,this.upperGroup.setAttribute("transform","translate("+this.ix+" "+this.iy+")")}},{key:"changePosition",value:function(t,n){this.px=this.ix,this.py=this.iy,this.ix-=t,this.iy-=n,this.upperGroup.setAttribute("transform","translate("+this.ix+" "+this.iy+")")}},{key:"getAggregateSelfLinkPath",value:function(){var t=this.getSymbolRadius()+7,n=m(t,70),e=m(t,20),r=m(t,85),i=m(t,5);return"M 0,0 Q "+r.x+","+-r.y+" "+n.x+","+-n.y+" A "+t+" "+t+" 0 0 1 "+e.x+","+-e.y+" Q "+i.x+","+-i.y+" 0,0"}},{key:"checkLinks",value:function(){function t(t){var n,e=d(t.values());try{for(e.s();!(n=e.n()).done;)n.value.check()}catch(t){e.e(t)}finally{e.f()}}t(this.binaryLinks),t(this.sequenceLinks),this.selfLink&&this.selfLink.check()}},{key:"setAllLinkCoordinates",value:function(){var t,n=d(this.naryLinks.values());try{for(n.s();!(t=n.n()).done;)t.value.setLinkCoordinates()}catch(t){n.e(t)}finally{n.f()}var e,r=d(this.binaryLinks.values());try{for(r.s();!(e=r.n()).done;)e.value.setLinkCoordinates()}catch(t){r.e(t)}finally{r.f()}this.selfLink&&this.selfLink.setLinkCoordinates();var i,o=d(this.sequenceLinks.values());try{for(o.s();!(i=o.n()).done;)i.value.setLinkCoordinates()}catch(t){o.e(t)}finally{o.f()}}}])&&g(n.prototype,e),r&&g(n,r),t}();function m(t,n){var e=n/360*Math.PI*2;return{x:t*Math.cos(e),y:t*Math.sin(e)}}function b(t){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function w(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==e)return;var r,i,o=[],a=!0,s=!1;try{for(e=e.call(t);!(a=(r=e.next()).done)&&(o.push(r.value),!n||o.length!==n);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==e.return||e.return()}finally{if(s)throw i}}return o}(t,n)||_(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=_(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}function _(t,n){if(t){if("string"==typeof t)return S(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?S(t,n):void 0}}function S(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e0?25:10)),this.labelY);this.labelSVG.transform.baseVal.initialize(this.app.svgElement.createSVGTransformFromMatrix(e)),this.updateAnnotationRectanglesNoTransition(),i.select(this.background).attr("width",t).attr("x",this.getResXWithStickZoom(.5)),i.select(this.outline).attr("width",t).attr("x",this.getResXWithStickZoom(.5)),i.select(this.highlight).attr("width",t+5).attr("x",this.getResXWithStickZoom(.5)-2.5),this.setScaleGroup()}}},{key:"setScaleGroup",value:function(){this.upperGroup.appendChild(this.ticks),this.ticks.textContent="",this.scaleLabels=[];for(var t=-1,n=this.getResXWithStickZoom(this.size),e=1;e<=this.size;e++){if(1===e||e%100==0&&200*this.stickZoom>a.minXDist||e%10==0&&20*this.stickZoom>a.minXDist){var r=this.getResXWithStickZoom(e);(this.stickZoom>=8||1!==e)&&c(this,r),0==(t=(t+1)%2)&&r+a.minXDist=8){var i=document.createElementNS(y,"g");i.setAttribute("transform","translate("+this.getResXWithStickZoom(e)+" 0)");var o=document.createElementNS(y,"text");o.classList.add("label","sequence"),o.setAttribute("x","0"),o.setAttribute("y","3"),o.appendChild(document.createTextNode(this.sequence[e-1]));var s=document.createElementNS(y,"text");s.classList.add("label","sequence-outline"),s.setAttribute("x","0"),s.setAttribute("y","3"),s.appendChild(document.createTextNode(this.sequence[e-1])),i.appendChild(s),this.scaleLabels.push(s),i.appendChild(o),this.scaleLabels.push(o),this.ticks.appendChild(i)}}function u(t,n,e){var r=document.createElementNS(y,"g");r.setAttribute("transform","translate("+e+" 0)");var i=document.createElementNS(y,"text");i.classList.add("label","scale-label"),i.setAttribute("x","0"),i.setAttribute("y",a.STICKHEIGHT+4),i.appendChild(document.createTextNode(n)),r.appendChild(i),t.scaleLabels.push(i),t.ticks.appendChild(r)}function c(t,n){var e=document.createElementNS(y,"line");e.classList.add("tick"),e.setAttribute("x1",n),e.setAttribute("y1","5"),e.setAttribute("x2",n),e.setAttribute("y2","10"),t.ticks.appendChild(e)}u(this,this.size,n),this.stickZoom>=8&&c(this,n)}},{key:"setExpanded",value:function(t,n){!0!==this.busy&&(t?this.toStick(!0):this.toCircle(!0,n))}},{key:"toCircle",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1?arguments[1]:void 0,e=t?a.transitionTime:0;this.postAnimExpanded=!1,this.busy=!0;var r=this.getSymbolRadius();i.select(this.background).transition().attr("x",-r).attr("y",-r).attr("width",2*r).attr("height",2*r).attr("rx",r).attr("ry",r).duration(e),i.select(this.outline).transition().attr("x",-r).attr("y",-r).attr("width",2*r).attr("height",2*r).attr("rx",r).attr("ry",r).duration(e),i.select(this.highlight).transition().attr("width",2*r+5).attr("height",2*r+5).attr("x",-r-2.5).attr("y",-r-2.5).attr("rx",r+2.5).attr("ry",r+2.5).duration(e);var o=i.interpolate(this.stickZoom,0),s=i.transform(this.labelSVG.getAttribute("transform")),u=s.translate[0],c=i.interpolate(u,-(r+5)),l=null,f=null;null!=n&&(l=i.interpolate(this.ix,n.x),f=i.interpolate(this.iy,n.y));var h=this;i.select(this.ticks).transition().attr("opacity",0).duration(e/4).each("end",(function(){i.select(this).selectAll("*").remove()}));var p=this.stickZoom,y=this.rotation,d=i.ease("cubic-in-out");if(t){var v,g=k(this.annotationSets);try{for(g.s();!(v=g.n()).done;){var x=w(v.value,2),m=x[0],b=x[1];if(!0===this.app.annotationSetsShown.get(m)){var _,S=k(b);try{for(S.s();!(_=S.n()).done;){var M=_.value;if(M.fuzzyStart){var E=M.fuzzyStart;i.select(E).transition().attr("d",this.getAnnotationPieSlicePath(M.seqDatum.uncertainBegin,M.seqDatum.begin,M,!1)).duration(e)}if(M.certain){var A=M.certain;i.select(A).transition().attr("d",this.getAnnotationPieSlicePath(M.seqDatum.begin,M.seqDatum.end,M,!1)).duration(e)}if(M.fuzzyEnd){var L=M.fuzzyEnd;i.select(L).transition().attr("d",this.getAnnotationPieSlicePath(M.seqDatum.end,M.seqDatum.uncertainEnd,M,!1)).duration(e)}}}catch(t){S.e(t)}finally{S.f()}}}}catch(t){g.e(t)}finally{g.f()}i.timer((function(t){return P(t/e)}))}else P(1);function P(t){var n=i.transform(h.labelSVG.getAttribute("transform")),e=h.app.svgElement.createSVGMatrix().rotate(n.rotate).translate(c(d(t)),h.labelY);if(h.labelSVG.transform.baseVal.initialize(h.app.svgElement.createSVGTransformFromMatrix(e)),null!==l&&h.setPosition(l(d(t)),f(d(t))),h.stickZoom=o(d(t)),h.setAllLinkCoordinates(),1===t){h.expanded=!1,h.checkLinks();var r,a=k(h.annotationSets);try{for(a.s();!(r=a.n()).done;){var s=w(r.value,2),u=s[0],v=s[1];if(!0===h.app.annotationSetsShown.get(u)){var g,x=k(v);try{for(x.s();!(g=x.n()).done;){var m=g.value;if(m.fuzzyStart){var b=m.fuzzyStart;i.select(b).attr("d",h.getAnnotationPieSlicePath(m.seqDatum.uncertainBegin,m.seqDatum.begin,m))}if(m.certain){var _=m.certain;i.select(_).attr("d",h.getAnnotationPieSlicePath(m.seqDatum.begin,m.seqDatum.end,m))}if(m.fuzzyEnd){var S=m.fuzzyEnd;i.select(S).attr("d",h.getAnnotationPieSlicePath(m.seqDatum.end,m.seqDatum.uncertainEnd,m))}}}catch(t){x.e(t)}finally{x.f()}}}}catch(t){a.e(t)}finally{a.f()}return h.stickZoom=p,h.rotation=y,h.busy=!1,!0}return!!(t>1||isNaN(t))&&P(1)}}},{key:"toCircleNoTransition",value:function(){this.toCircle(!1)}},{key:"toStick",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=t?a.transitionTime:0;this.busy=!0,this.expanded=!0,this.postAnimExpanded=!0;var e=this.size*this.stickZoom,r=this.getSymbolRadius(),o=i.interpolate(2*r,e),s=i.interpolate(0,this.stickZoom),u=i.interpolate(-(r+5),-(this.size/2*this.stickZoom+(this.nTermFeatures.length>0?25:10))),c=this.stickZoom;this.stickZoom=0,this.checkLinks(),this.stickZoom=c,i.select(this.background).transition().attr("height",a.STICKHEIGHT).attr("y",-a.STICKHEIGHT/2).attr("rx",0).attr("ry",0).duration(n),i.select(this.outline).transition().attr("height",a.STICKHEIGHT).attr("y",-a.STICKHEIGHT/2).attr("rx",0).attr("ry",0).duration(n),i.select(this.highlight).transition().attr("width",e+5).attr("height",a.STICKHEIGHT+5).attr("x",this.getResXWithStickZoom(.5)-2.5).attr("y",-a.STICKHEIGHT/2-2.5).attr("rx",0).attr("ry",0).duration(n);var l=this,f=i.ease("cubic-in-out");if(t){var h,p=k(this.annotationSets);try{for(p.s();!(h=p.n()).done;){var y=w(h.value,2),d=y[0],v=y[1];if(!0===this.app.annotationSetsShown.get(d)){var g,x=k(v);try{for(x.s();!(g=x.n()).done;){var m=g.value;if(m.fuzzyStart){var b=m.fuzzyStart;b.setAttribute("d",this.getAnnotationPieSlicePath(m.seqDatum.uncertainBegin,m.seqDatum.begin,m,!1)),i.select(b).transition().attr("d",this.getAnnotationRectPath(m.seqDatum.uncertainBegin,m.seqDatum.begin,m)).duration(a.transitionTime)}if(m.certain){var _=m.certain,S=m.seqDatum.begin,M=m.seqDatum.end;m.seqDatum.uncertainBegin&&(S+=1),m.seqDatum.uncertainEnd&&(M-=1),_.setAttribute("d",this.getAnnotationPieSlicePath(S,M,m,!1)),i.select(_).transition().attr("d",this.getAnnotationRectPath(S,M,m)).duration(a.transitionTime)}if(m.fuzzyEnd){var E=m.fuzzyEnd;E.setAttribute("d",this.getAnnotationPieSlicePath(m.seqDatum.end,m.seqDatum.uncertainEnd,m,!1)),i.select(E).transition().attr("d",this.getAnnotationRectPath(m.seqDatum.end,m.seqDatum.uncertainEnd,m)).duration(a.transitionTime)}}}catch(t){x.e(t)}finally{x.f()}}}}catch(t){p.e(t)}finally{p.f()}i.timer((function(t){return A(t/n)}))}else A(1);function A(t){var n=i.transform(l.labelSVG.getAttribute("transform")),e=l.app.svgElement.createSVGMatrix().rotate(n.rotate).translate(u(f(t)),l.labelY);l.labelSVG.transform.baseVal.initialize(l.app.svgElement.createSVGTransformFromMatrix(e));var r=o(f(t));return i.select(l.highlight).attr("width",r).attr("x",-r/2+.5*l.stickZoom),i.select(l.outline).attr("width",r).attr("x",-r/2+.5*l.stickZoom),i.select(l.background).attr("width",r).attr("x",-r/2+.5*l.stickZoom),l.stickZoom=s(f(t)),l.setAllLinkCoordinates(),1===t?(l.updateAnnotationRectanglesNoTransition(),l.busy=!1,!0):!!(t>1||isNaN(t))&&A(1)}i.select(this.ticks).attr("opacity",0),this.setScaleGroup(),i.select(this.ticks).transition().attr("opacity",1).delay(.8*n).duration(n/2)}},{key:"toStickNoTransition",value:function(){this.toStick(!1)}},{key:"updateAnnotationRectanglesNoTransition",value:function(){var t,n=k(this.annotationSets);try{for(n.s();!(t=n.n()).done;){var e=w(t.value,2),r=e[0],o=e[1];if(!0===this.app.annotationSetsShown.get(r)){var a,s=k(o);try{for(s.s();!(a=s.n()).done;){var u=a.value;if(u.fuzzyStart){var c=u.fuzzyStart;i.select(c).attr("d",this.getAnnotationRectPath(u.seqDatum.uncertainBegin,u.seqDatum.begin,u))}if(u.certain){var l=u.seqDatum.begin,f=u.seqDatum.end;u.seqDatum.uncertainBegin&&(l+=1),u.seqDatum.uncertainEnd&&(f-=1),u.certain.setAttribute("d",this.getAnnotationRectPath(l,f,u))}if(u.fuzzyEnd){var h=u.fuzzyEnd;i.select(h).attr("d",this.getAnnotationRectPath(u.seqDatum.end,u.seqDatum.uncertainEnd,u))}}}catch(t){s.e(t)}finally{s.f()}}}}catch(t){n.e(t)}finally{n.f()}}},{key:"getResXWithStickZoom",value:function(t){return"n-n"===t?-this.size/2*this.stickZoom-20:"c-c"===t?this.size/2*this.stickZoom+20:(t-this.size/2)*this.stickZoom}},{key:"getResidueCoordinates",value:function(t,n){void 0===t&&console.error("ERROR: residue number is undefined");var e,r=this.getResXWithStickZoom(1*t);if(0!==r){var i=Math.abs(r),o=Math.acos(r/i),a=this.rotation/360*Math.PI*2;r=i*Math.cos(a+o),e=i*Math.sin(a+o),void 0!==n&&(r+=n*Math.cos(a+Math.PI/2),e+=n*Math.sin(a+Math.PI/2))}else e=n;return[r+=this.ix,e+=this.iy]}},{key:"clearPositionalFeatures",value:function(){this.annotations=[],this.annotationTypes=[],this.annotationsSvgGroup.textContent="",this.nTermFeatures=[],this.cTermFeatures=[]}},{key:"updatePositionalFeatures",value:function(){var t=this,n=function(n){var e=n.target.correspondingUseElement?n.target.correspondingUseElement:n.target;t.app.preventDefaultsAndStopPropagation(n),t.app.setTooltip(e.name,e.getAttribute("fill")),t.showHighlight(!0)},e=-1,r=[];function i(t,n){var e,r=k(t);try{for(r.s();!(e=r.n()).done;)if(e.value.seqDatum.overlaps(n.seqDatum))return!0}catch(t){r.e(t)}finally{r.f()}return!1}var o,a=k(this.annotationSets);try{for(a.s();!(o=a.n()).done;){var s=w(o.value,2),u=s[0],c=s[1];if(!0===this.app.annotationSetsShown.get(u)){c&&c.length>0&&(r[++e]=[]);var l,f=new Set,h=k(Array.from(c.values()).sort((function(t,n){var e=t.description,r=n.description;return er?1:0})));try{for(h.s();!(l=h.n()).done;){var p=l.value;if(!f.has(p.toString()))if(f.add(p.toString()),"n-n"===p.seqDatum.sequenceDatumString||"c-c"===p.seqDatum.sequenceDatumString)"n-n"===p.seqDatum.sequenceDatumString?(p.rung=this.nTermFeatures.length,this.nTermFeatures.push(p)):(p.rung=this.cTermFeatures.length,this.cTermFeatures.push(p));else{var d=r[e];i(d,p)&&(r[++e]=[],d=r[e]),p.rung=e,d.push(p)}}}catch(t){h.e(t)}finally{h.f()}}}}catch(t){a.e(t)}finally{a.f()}this.rungCount=e+1;var v,g=k(this.annotationSets);try{for(g.s();!(v=g.n()).done;){var x=w(v.value,2),m=x[0],b=x[1];if(!0===this.app.annotationSetsShown.get(m)){var _,S=new Set,M=k(b.values());try{for(M.s();!(_=M.n()).done;){var E=_.value;if(!S.has(E.toString())){S.add(E.toString());var A=E.toString();if(E.seqDatum.uncertainBegin&&(E.fuzzyStart=document.createElementNS(y,"path"),this.expanded?E.fuzzyStart.setAttribute("d",this.getAnnotationRectPath(E.seqDatum.uncertainBegin,E.seqDatum.begin,E)):E.fuzzyStart.setAttribute("d",this.getAnnotationPieSlicePath(E.seqDatum.uncertainBegin,E.seqDatum.begin,E)),E.fuzzyStart.setAttribute("stroke-width","1"),E.fuzzyStart.name=A,E.fuzzyStart.onmouseover=n,this.annotationsSvgGroup.appendChild(E.fuzzyStart)),E.seqDatum.begin&&E.seqDatum.end){E.certain=document.createElementNS(y,"path");var L=E.seqDatum.begin,P=E.seqDatum.end;E.seqDatum.uncertainBegin&&(L+=1),E.seqDatum.uncertainEnd&&(P-=1),this.expanded?E.certain.setAttribute("d",this.getAnnotationRectPath(L,P,E)):E.certain.setAttribute("d",this.getAnnotationPieSlicePath(L,P,E)),E.certain.setAttribute("stroke-width","1"),E.certain.name=A,E.certain.onmouseover=n,this.annotationsSvgGroup.appendChild(E.certain)}E.seqDatum.uncertainEnd&&(E.fuzzyEnd=document.createElementNS(y,"path"),this.expanded?E.fuzzyEnd.setAttribute("d",this.getAnnotationRectPath(E.seqDatum.end,E.seqDatum.uncertainEnd,E)):E.fuzzyEnd.setAttribute("d",this.getAnnotationPieSlicePath(E.seqDatum.end,E.seqDatum.uncertainEnd,E)),E.fuzzyEnd.setAttribute("stroke-width","1"),E.fuzzyEnd.name=A,E.fuzzyEnd.onmouseover=n,this.annotationsSvgGroup.appendChild(E.fuzzyEnd))}}}catch(t){M.e(t)}finally{M.f()}}}}catch(t){g.e(t)}finally{g.f()}this.scale()}},{key:"getAnnotationPieSlicePath",value:function(t,n,e){var r,i,o,s,u,c=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],l=this.getSymbolRadius(),f=e.rung;-1===f?(i=0,r=l):r=(i=f*(o=l/this.rungCount))+o,"n-n"===t?(s=-20,u=0):"c-c"===n?(s=0,u=20):(s=(t-1)/this.size*360,u=(n-1)/this.size*360);var h=0;(u-s>180||u===s)&&(h=1);var y=p([0,i],[0,0],s-180),d=p([0,r],[0,0],s-180),v=p([0,r],[0,0],u-180),g=p([0,i],[0,0],u-180),x="M"+y[0]+","+y[1]+" L"+d[0]+","+d[1];if(c)x+=" A"+r+","+r+" 0 "+h+" 1 "+v[0]+","+v[1];else for(var m=0;m<=a.stepsInArc;m++){var b=s+(u-s)/a.stepsInArc*m,w=p([0,r],[0,0],b-180);x+=" L"+w[0]+","+w[1]}if(c)x+=" L"+g[0]+","+g[1],x+=" A"+i+","+i+" 0 "+h+" 0 "+y[0]+","+y[1];else for(var k=a.stepsInArc;k>=0;k--){var _=s+(u-s)/a.stepsInArc*k,S=p([0,i],[0,0],_-180);x+=" L"+S[0]+","+S[1]}return x+=" Z"}},{key:"getAnnotationRectPath",value:function(t,n,e){var r,i,o;"n-n"===t?(r=this.getResXWithStickZoom(.5)-20,i=20,o=a.STICKHEIGHT/this.nTermFeatures.length):"c-c"===n?(r=this.getResXWithStickZoom(this.size+.5),i=20,o=a.STICKHEIGHT/this.cTermFeatures.length):(r=this.getResXWithStickZoom(t-.5),i=(n-t+1)*this.stickZoom,o=a.STICKHEIGHT/this.rungCount);for(var s=-a.STICKHEIGHT/2+e.rung*o,u=s+o,c="M"+r+","+u+" L"+r+","+s,l=0;l<=a.stepsInArc;l++)c+=" L "+(r+i*(l/a.stepsInArc))+","+s;for(var f=a.stepsInArc;f>=0;f--)c+=" L "+(r+i*(f/a.stepsInArc))+","+u;return c+=" Z"}}])&&M(n.prototype,e),r&&M(n,r),a}(x);function C(t,n){for(var e=0;e-1&&(this.uncertainBegin=0,this.begin=r(a.substring(1,a.length))),s.indexOf(">")>-1&&(this.end=r(s.substring(1,a.length)),this.uncertainEnd=n.size),a.indexOf(">")>-1&&s.indexOf("<")>-1&&(this.uncertainBegin=r(a.substring(1,a.length)),this.begin=r(s.substring(1,a.length)),this.end=null)}}var n,e,r;return n=t,(e=[{key:"toString",value:function(){return this.sequenceDatumString}},{key:"overlaps",value:function(t){if(this.participant===t.participant){var n=this.uncertainBegin||this.begin||this.end||this.uncertainEnd,e=this.uncertainEnd||this.end||this.begin||this.uncertainBegin,r=t.uncertainBegin||t.begin||t.end;if(n<=(t.uncertainEnd||t.end||t.begin)&&r<=e)return!0}return!1}}])&&C(n.prototype,e),r&&C(n,r),t}();function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function I(t,n){return(I=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function D(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=j(t);if(n){var i=j(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return z(this,e)}}function z(t,n){return!n||"object"!==T(n)&&"function"!=typeof n?R(t):n}function R(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function j(t){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var q=function(t){!function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&I(t,n)}(e,t);var n=D(e);function e(t,r,i,o,a){var s;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),(s=n.call(this)).init(t,r,i,o),s.type="protein",s.upperGroup=document.createElementNS(y,"g"),s.rotation=0,s.stickZoom=1,s.highlight=document.createElementNS(y,"rect"),s.highlight.classList.add("highlight","participant-highlight"),s.upperGroup.appendChild(s.highlight),s.background=document.createElementNS(y,"rect"),s.background.setAttribute("fill","#FFFFFF"),s.upperGroup.appendChild(s.background),s.initLabel(),s.ticks=document.createElementNS(y,"g"),s.annotationsSvgGroup=document.createElementNS(y,"g"),s.annotationsSvgGroup.setAttribute("opacity","1"),s.upperGroup.appendChild(s.annotationsSvgGroup),s.outline=document.createElementNS(y,"rect"),s.outline.setAttribute("stroke","black"),s.outline.setAttribute("stroke-width","1"),s.outline.setAttribute("fill","none"),s.upperGroup.appendChild(s.outline),s.scaleLabels=[];var u=s.getSymbolRadius();s.outline.setAttribute("x",-u),s.outline.setAttribute("y",-u),s.outline.setAttribute("width",2*u),s.outline.setAttribute("height",2*u),s.outline.setAttribute("rx",u),s.outline.setAttribute("ry",u),s.background.setAttribute("x",-u),s.background.setAttribute("y",-u),s.background.setAttribute("width",2*u),s.background.setAttribute("height",2*u),s.background.setAttribute("rx",u),s.background.setAttribute("ry",u),s.highlight.setAttribute("width",2*u+5),s.highlight.setAttribute("height",2*u+5),s.highlight.setAttribute("x",-u-2.5),s.highlight.setAttribute("y",-u-2.5),s.highlight.setAttribute("rx",u+2.5),s.highlight.setAttribute("ry",u+2.5),s.highlight.setAttribute("stroke-opacity","0"),s.labelSVG.setAttribute("transform","translate("+-(u+5)+",-5)"),s.initListeners();var c=R(s);return Object.defineProperty(R(s),"height",{get:function(){return c.expanded?120:40}}),s.showHighlight(!1),a||(a="SEQUENCEMISSING"),s.sequence=a.replace(/[^A-Z]/g,""),s.size=s.sequence.length,s.annotationSets.set("Interactor",[new h(s.json.label,new O(null,"1-"+s.size))]),s}return e}(N);function G(t){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function B(t,n){return(B=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function V(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=U(t);if(n){var i=U(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return F(this,e)}}function F(t,n){return!n||"object"!==G(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function U(t){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var H=function(t){!function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&B(t,n)}(e,t);var n=V(e);function e(t,r,i,o){var a;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),(a=n.call(this)).init(t,r,i,o),a.upperGroup=document.createElementNS(y,"g"),a.initLabel();return a.outline=document.createElementNS(y,"polygon"),a.outline.setAttribute("points","0, -10 8.66,5 -8.66,5"),a.initOutline(),a.initListeners(),a}return e}(x);function X(t){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Y(t,n){for(var e=0;e=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}function dt(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}function Rt(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e1&&void 0!==arguments[1]?arguments[1]:20,e=[],r=t.length,i=0;ir)&&(r=c)}if(!isNaN(parseFloat(a.uncertainEnd))&&isFinite(a.uncertainEnd)){var l=1*a.uncertainEnd;(null===r||l>r)&&(r=l)}}return n.getResidueCoordinates((e+r)/2,0)}var r,i,o=this.fromSequenceData[0].participant,a=this.toSequenceData[0].participant;o.expanded&&(r=e(this.fromSequenceData,o)),a.expanded&&(i=e(this.toSequenceData,a)),o.expanded||(r=o.getPosition(i)),a.expanded||(i=a.getPosition(r));var s=r,u=i,c=r[0]-i[0],l=r[1]-i[1],f=Math.atan2(l,c)/(2*Math.PI)*360;f<0&&(f+=360);var h=f-o.rotation;h<0&&(h+=360);var p=10;h<180&&(p=-10);var y=o.rotation/360*Math.PI*2;h>180&&(y-=Math.PI),(h=f-a.rotation)<0&&(h+=360);var d=10;h>180&&(d=-10);var v=a.rotation/360*Math.PI*2;h<180&&(v-=Math.PI);var g=[r[0]+30*Math.sin(y)*this.app.z,r[1]-30*Math.cos(y)*this.app.z];o.expanded||(g=r);var x=[i[0]+30*Math.sin(v)*this.app.z,i[1]-30*Math.cos(v)*this.app.z];a.expanded||(x=i);for(var m,b=[(g[0]+x[0])/2,(g[1]+x[1])/2],w=this.fromSequenceData.length,k=this.toSequenceData.length,_="M"+b[0]+","+b[1],S="M"+b[0]+","+b[1],M=0;M=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}function en(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e1)return t})).forEach((function(n){if(xn(e,"id",n.interactorRef))for(var r=function(e){var r=JSON.parse(JSON.stringify(n));r.id=r.id+"_"+e,r.cloneParentID=n.id,r.cloneIteration=e,n.cloned=!0,r.features&&r.features.forEach((function(t){t.clonedfrom=t.id,t.id=t.id+"_"+e,t.sequenceData.forEach((function(t){t.participantRef=r.id}))})),t.participants.push(r)},i=0;i-1){var i=JSON.parse(JSON.stringify(e));i.id=e.id+"_"+n.id,i.linkedFeatures=[],i.linkedFeatures.push(n.id),xn(t.participants,"id",i.parentParticipant).features.push(i)}}))}))})),n.forEach((function(t){t.participants.forEach((function(t){t.stoichiometry=null}))})),t}function xn(t,n,e){for(var r=0;r=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}function bn(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e1){r.interactorRef=r.interactorRef+"_"+o,r.features&&r.features.forEach((function(t){t.copiedfrom=t.id,t.sequenceData.forEach((function(t){t.participantRef=t.participantRef+"_"+o}))}));var a=JSON.parse(JSON.stringify(i));a.id=a.id+"_"+o,t.data.push(a);var s,u=mn(a.participants);try{var c=function(){var t=s.value;t.id=t.id+"_"+o,t.features&&t.features.forEach((function(n){n.id=n.id+"_"+o,n.sequenceData.forEach((function(n){n.participantRef=t.id}));for(var e=n.linkedFeatures.length,r=0;r=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}function _n(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e2&&void 0!==arguments[2])||arguments[2];(t="object"===Sn(t)?t:JSON.parse(t)).data=t.data.reverse(),n.features=new Map;var r=new Map;t=wn(t),n.proteinCount=0,n.interactors=new Map;var i,o=kn(t.data);try{for(o.s();!(i=o.n()).done;){var a=i.value;"interactor"===a.object&&(n.interactors.set(a.id,a),0===a.id.indexOf("uniprotkb_")&&n.proteinCount++)}}catch(t){o.e(t)}finally{o.f()}e?st():ft();var s,u=kn(t.data);try{for(u.s();!(s=u.n()).done;){var c=s.value;if("interaction"===c.object){var l,f=kn(c.participants);try{for(f.s();!(l=f.n()).done;){var p=l.value,y=new Array(0);p.features&&(y=p.features);var d,v=kn(y);try{for(v.s();!(d=v.n()).done;){var g=d.value,x=g.sequenceData;if(g.linkedFeatures)for(var m=g.linkedFeatures,b=m.length,w=0;wr&&(r=u.stoichiometry-0)}}catch(t){s.e(t)}finally{s.f()}}}}catch(t){i.e(t)}finally{i.f()}r<20&&(t=gn(t)),ct();var c,l=kn(t.data);try{for(l.s();!(c=l.n()).done;){var f=c.value;if("interaction"===f.object){var h=f.id||ht(f),p=n.allNaryLinks.get(h);void 0===p&&(p=new Xt(h,n),n.allNaryLinks.set(h,p),f.naryId=h);var y,d=kn(f.participants);try{for(d.s();!(y=d.n()).done;){var v=y.value,g=v.interactorRef,x=g+"("+v.id+")",m=n.participants.get(x);if(void 0===m)m=ut(n.interactors.get(g),x,g),n.participants.set(x,m);if(m.naryLinks.set(h,p),-1===p.participants.indexOf(m)&&p.participants.push(m),v.stoichiometry)n.participants.get(x).addStoichiometryLabel(v.stoichiometry)}}catch(t){d.e(t)}finally{d.f()}}}}catch(t){l.e(t)}finally{l.f()}}function ut(e,i,o){var a;if(void 0===e||"MI:1302"===e.type.id){var s,u=!1,c=kn(t.data);try{for(c.s();!(s=c.n()).done;){var l=s.value;if("interaction"===l.object&&l.id===o){u=!0;break}}}catch(t){c.e(t)}finally{c.f()}u?(a=new wt(i,n,o),r.set(i,a)):a=new Lt(i,n,o,e)}else"MI:1304"===e.type.id||"MI:1305"===e.type.id||"MI:1307"===e.type.id||"MI:1306"===e.type.id?a=new Dt(i,n,e,e.label):"MI:1100"===e.type.id||"MI:0904"===e.type.id||"MI:0328"===e.type.id||"MI:2258"===e.type.id?a=new H(i,n,e,e.label):"MI:0326"===e.type.id||"MI:0327"===e.type.id?a=new q(i,n,e,e.label,e.sequence):"MI:0250"===e.type.id?a=new J(i,n,e,e.label):"MI:0320"===e.type.id||"MI:0321"===e.type.id||"MI:0322"===e.type.id||"MI:0323"===e.type.id||"MI:2190"===e.type.id||"MI:0324"===e.type.id||"MI:0679"===e.type.id||"MI:0608"===e.type.id||"MI:0611"===e.type.id||"MI:0610"===e.type.id||"MI:0607"===e.type.id||"MI:0609"===e.type.id||"MI:0325"===e.type.id||"IA:2966"===e.type.id||"MI:2359"===e.type.id||"MI:0318"===e.type.id||"MI:2204"===e.type.id?a=new lt(i,n,e,e.label):"MI:0319"===e.type.id||"MI:0681"===e.type.id||"MI:0680"===e.type.id?a=new it(i,n,e,e.label):alert("Unrecognised type:"+e.type.name);return a}function ct(){var e,r=kn(t.data);try{for(r.s();!(e=r.n()).done;){var i=e.value;if("interaction"===i.object){var o,a=kn(i.participants);try{for(a.s();!(o=a.n()).done;){var s=o.value,u=new Array(0);s.features&&(u=s.features);for(var c=u.length,l=0;l<"+u:u+"><"+s;var c=n.allSequenceLinks.get(a);if(void 0===c){var l,f=[],h=kn(t);try{for(h.s();!(l=h.n()).done;){var p=l.value;f.push(new O(pt(p),p.pos))}}catch(t){h.e(t)}finally{h.f()}var y,d=[],v=kn(r);try{for(v.s();!(y=v.n()).done;){var g=y.value;d.push(new O(pt(g),g.pos))}}catch(t){v.e(t)}finally{v.f()}c=new Qt(a,f,d,n,i),n.allSequenceLinks.set(a,c)}var x=ht(i);return n.allNaryLinks.get(x).sequenceLinks.set(a,c),c}function dt(t,e){var r="-"+t.id+"-"+t.id,i=n.allUnaryLinks.get(r);void 0===i&&(i=new vn(r,n,t),n.allUnaryLinks.set(r,i),t.appLink=i);var o=ht(e);return n.allNaryLinks.get(o).unaryLinks.set(r,i),i}function vt(t,e,r){var i,o,a;t.id=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}function An(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw o}}}}function On(t,n){if(t){if("string"==typeof t)return Tn(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Tn(t,n):void 0}}function Tn(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e1&&void 0!==arguments[1]?arguments[1]:4;In(this,t),this.el=n,this.el.textContent="",this.maxCountInitiallyExpanded=e,this.d3cola=u.d3adaptor().groupCompactness(Number.MIN_VALUE).avoidOverlaps(!0);var o=i.select(this.el).append("div").classed("custom-menu-margin",!0).append("div").classed("custom-menu",!0).append("ul"),a=this,s=o.append("li").classed("collapse",!0);s.text("Collapse"),s[0][0].onclick=function(t){a.collapseProtein(t)};var c=o.append("li").text("Scale: "),l=c.selectAll("ul.custom-menu").data(t.barScales).enter().append("div").attr("class","bar-scale").append("label");l.append("span").text((function(t){return 8===t?"AA":t})),l.append("input").attr("class",(function(t){return"scaleButton scaleButton_"+100*t})).attr("name","scaleButtons").attr("type","radio").on("change",(function(t){a.preventDefaultsAndStopPropagation(t),a.contextMenuProt.setStickScale(t,a.contextMenuPoint)}));var f=i.select(".custom-menu-margin").node();f.onmouseout=function(t){var n=t.relatedTarget;do{if(n===this)return;n=n.parentNode}while(n);a.contextMenuProt=null,i.select(this).style("display","none")},this.svgElement=document.createElementNS(y,"svg"),this.svgElement.classList.add("complexViewerSVG"),this.svgElement.onmousedown=function(t){a.mouseDown(t)},this.svgElement.onmousemove=function(t){a.move(t)},this.svgElement.onmouseup=function(t){a.mouseUp(t)},this.svgElement.onmouseout=function(t){a.mouseOut(t)},this.svgElement.ontouchstart=function(t){a.touchStart(t)},this.svgElement.ontouchmove=function(t){a.move(t)},this.svgElement.ontouchend=function(t){a.mouseUp(t)},this.lastMouseUp=(new Date).getTime(),this.el.oncontextmenu=function(t){return t.preventDefault&&t.preventDefault(),t.returnValue=!1,!1};var h=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";document.attachEvent?this.svgElement.attachEvent("on"+h,(function(t){a.mouseWheel(t)})):document.addEventListener&&this.svgElement.addEventListener(h,(function(t){a.mouseWheel(t)}),!1),this.hoverListeners=new Set,this.expandListeners=new Set,this.el.appendChild(this.svgElement),this.container=document.createElementNS(y,"g"),this.container.setAttribute("id","container");var p=i.select(this.svgElement);this.defs=p.append("defs"),this.acknowledgement=document.createElementNS(y,"g");var d=document.createElementNS(y,"text");d.innerHTML="ComplexViewer "+r.a+"by Rappsilber Laboratory",this.acknowledgement.appendChild(d),d.setAttribute("font-size","8pt"),this.svgElement.appendChild(this.acknowledgement),this.naryLinks=document.createElementNS(y,"g"),this.naryLinks.setAttribute("id","naryLinks"),this.container.appendChild(this.naryLinks),this.p_pLinksWide=document.createElementNS(y,"g"),this.p_pLinksWide.setAttribute("id","p_pLinksWide"),this.container.appendChild(this.p_pLinksWide),this.highlights=document.createElementNS(y,"g"),this.highlights.setAttribute("class","highlights"),this.container.appendChild(this.highlights),this.res_resLinks=document.createElementNS(y,"g"),this.res_resLinks.setAttribute("id","res_resLinks"),this.container.appendChild(this.res_resLinks),this.p_pLinks=document.createElementNS(y,"g"),this.p_pLinks.setAttribute("id","p_pLinks"),this.container.appendChild(this.p_pLinks),this.proteinUpper=document.createElementNS(y,"g"),this.proteinUpper.setAttribute("id","proteinUpper"),this.container.appendChild(this.proteinUpper),this.selfRes_resLinks=document.createElementNS(y,"g"),this.selfRes_resLinks.setAttribute("id","res_resLinks"),this.container.appendChild(this.selfRes_resLinks),this.svgElement.appendChild(this.container),this.tooltip=document.createElementNS(y,"text"),this.tooltip.setAttribute("x","0"),this.tooltip.setAttribute("y","0");var v=document.createTextNode("tooltip");this.tooltip.classList.add("label","tooltip"),this.tooltip.appendChild(v),this.tooltip_bg=document.createElementNS(y,"rect"),this.tooltip_bg.classList.add("tooltip-background"),this.tooltip_subBg=document.createElementNS(y,"rect"),this.tooltip_subBg.classList.add("tooltip-sub-background"),this.svgElement.appendChild(this.tooltip_subBg),this.svgElement.appendChild(this.tooltip_bg),this.svgElement.appendChild(this.tooltip),this.annotationSetsShown=new Map,this.annotationSetsShown.set("Interactor",!1),this.annotationSetsShown.set("UniprotKB",!1),this.annotationSetsShown.set("Superfamily",!1),this.annotationSetsShown.set("MI Features",!0),this.clear()}var n,e,o;return n=t,(e=[{key:"clear",value:function(){this.d3cola.stop(),this.naryLinks.textContent="",this.p_pLinksWide.textContent="",this.highlights.textContent="",this.p_pLinks.textContent="",this.res_resLinks.textContent="",this.proteinUpper.textContent="",this.selfRes_resLinks.textContent="",this.dragElement=null,this.dragStart={},this.participants=new Map,this.allNaryLinks=new Map,this.allBinaryLinks=new Map,this.allUnaryLinks=new Map,this.allSequenceLinks=new Map,this.complexes=[];var n,e=[],r=Cn(a);try{for(r.s();!(n=r.n()).done;){var o=n.value,s=i.hsl(o);s.l=.9,e.push(s+"")}}catch(t){r.e(t)}finally{r.f()}Xt.naryColors=i.scale.ordinal().range(e),this.proteinCount=0,this.z=1,this.hideTooltip(),this.state=t.STATES.MOUSE_UP}},{key:"collapseProtein",value:function(){i.select(".custom-menu-margin").style("display","none"),this.contextMenuProt.setExpanded(!1,this.contextMenuPoint),this.contextMenuProt=null,this.notifyExpandListeners()}},{key:"init",value:function(){this.d3cola.stop();var n,e=0,r=Cn(this.participants.values());try{for(r.s();!(n=r.n()).done;){var o=n.value;o.size>e&&(e=o.size)}}catch(t){r.e(t)}finally{r.f()}var a,s,u,c=.8*this.svgElement.parentNode.clientWidth/e;this.defaultBarScale=(a=t.barScales,s=c,0===(u=(0,i.bisector((function(t){return t})).left)(a,s))||1===u?a[1]:u===a.length?a[a.length-1]:a[u-1]);var l,f=Cn(this.participants.values());try{for(f.s();!(l=f.n()).done;){var h=l.value;"complex"!==h.type&&(h.setPosition(-500,-500),this.proteinUpper.appendChild(h.upperGroup))}}catch(t){f.e(t)}finally{f.f()}var p,y=Cn(this.participants.values());try{for(y.s();!(p=y.n()).done;){var d=p.value;"protein"===d.type&&(d.stickZoom=this.defaultBarScale,this.participants.sizethis.z&&(o=this.z);var a=-e.x+20/o,s=-e.y+20/o;this.container.setAttribute("transform","scale("+o+") translate("+a+" "+s+") "),this.z=this.container.getCTM().inverse().a}else{var u=t-e.width,c=n-e.height,l=u/2-e.x,f=c/2-e.y;this.container.setAttribute("transform","scale(1) translate("+l+" "+f+")"),this.z=1}this.acknowledgement.setAttribute("transform","translate("+(t-150)+", "+(n-30)+")")}},{key:"autoLayout",value:function(){this.d3cola.stop();var t,n=[],e=[],r=this,i=Cn(this.participants.values());try{for(i.s();!(t=i.n()).done;){var o=t.value;"complex"!=o.type&&(e.push(o),o.binaryLinks.size>2&&n.push(o)),delete o.x,delete o.y,delete o.px,delete o.py,delete o.bounds,o.fixed=0}}catch(t){i.e(t)}finally{i.f()}var a=e.length<30?30:20,s=this.svgElement.parentNode.clientWidth,u=this.svgElement.parentNode.clientHeight;function c(t){var n,e=[],i={},o=0,a=Cn(t);try{for(a.s();!(n=a.n()).done;)i[n.value.id]=o,o++}catch(t){a.e(t)}finally{a.f()}var s,u=Cn(r.allBinaryLinks.values());try{for(u.s();!(s=u.n()).done;){var c=s.value,l=c.participants[0],f=c.participants[1];if(l!==f&&-1!==t.indexOf(l)&&-1!==t.indexOf(f)){var h={};h.source=i[l.id],h.target=i[f.id],h.id=c.id,e.push(h)}}}catch(t){u.e(t)}finally{u.f()}return e}this.d3cola.size([u-40,s-40]).symmetricDiffLinkLengths(a),f(n,c(n),!0);var l=c(e);function f(t,n,e){if(delete r.d3cola._lastStress,delete r.d3cola._alpha,delete r.d3cola._descent,delete r.d3cola._rootGroup,r.d3cola.nodes(t).links(n),e)r.d3cola.groups([]).start(23,10,0,0,!1);else{var i=[];if(r.complexes){var o,a=Cn(r.complexes);try{for(a.s();!(o=a.n()).done;){var s=o.value;s.leaves=[],s.groups=[];var u,c=Cn(s.naryLink.participants);try{for(c.s();!(u=c.n()).done;){var l=u.value;"complex"!==l.type&&s.leaves.push(t.indexOf(l))}}catch(t){c.e(t)}finally{c.f()}i.push(s)}}catch(t){a.e(t)}finally{a.f()}var f,h=Cn(r.complexes);try{for(h.s();!(f=h.n()).done;){var p,y=f.value,d=Cn(y.naryLink.participants);try{for(d.s();!(p=d.n()).done;){var v=p.value;"complex"===v.type&&y.groups.push(i.indexOf(v))}}catch(t){d.e(t)}finally{d.f()}}}catch(t){h.e(t)}finally{h.f()}}r.d3cola.groups(i).start(0,10,1,0,!0).on("tick",(function(){var t,n=Cn(r.d3cola.nodes());try{for(n.s();!(t=n.n()).done;){var e=t.value;e.setPosition(e.x,e.y)}}catch(t){n.e(t)}finally{n.f()}r.setAllLinkCoordinates(),r.zoomToExtent()}))}}f(e,l,!0),f(e,l,!1)}},{key:"getSVG",value:function(){var t=[i.select(this.el).selectAll("svg").node()],n=l.capture(t);return l.makeXMLStr(new XMLSerializer,n[0])}},{key:"readMIJSON",value:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Mn(t,this,n),this.init()}},{key:"checkLinks",value:function(){var t,n=Cn(this.allNaryLinks.values());try{for(n.s();!(t=n.n()).done;)t.value.check()}catch(t){n.e(t)}finally{n.f()}var e,r=Cn(this.allBinaryLinks.values());try{for(r.s();!(e=r.n()).done;)e.value.check()}catch(t){r.e(t)}finally{r.f()}var i,o=Cn(this.allUnaryLinks.values());try{for(o.s();!(i=o.n()).done;)i.value.check()}catch(t){o.e(t)}finally{o.f()}var a,s=Cn(this.allSequenceLinks.values());try{for(s.s();!(a=s.n()).done;)a.value.check()}catch(t){s.e(t)}finally{s.f()}}},{key:"setAllLinkCoordinates",value:function(){var t,n=Cn(this.allNaryLinks.values());try{for(n.s();!(t=n.n()).done;)t.value.setLinkCoordinates()}catch(t){n.e(t)}finally{n.f()}var e,r=Cn(this.allBinaryLinks.values());try{for(r.s();!(e=r.n()).done;)e.value.setLinkCoordinates()}catch(t){r.e(t)}finally{r.f()}var i,o=Cn(this.allUnaryLinks.values());try{for(o.s();!(i=o.n()).done;)i.value.setLinkCoordinates()}catch(t){o.e(t)}finally{o.f()}var a,s=Cn(this.allSequenceLinks.values());try{for(s.s();!(a=s.n()).done;)a.value.setLinkCoordinates()}catch(t){s.e(t)}finally{s.f()}}},{key:"showTooltip",value:function(t){var n,e,r=this.tooltip.getComputedTextLength()+16,i=this.svgElement.parentNode.clientWidth,o=this.svgElement.parentNode.clientHeight;n=t.x+20+r5*this.z&&(this.state=t.STATES.DRAGGING);else this.state===t.STATES.SELECT_PAN?(this.setCTM(this.container,this.container.getCTM().translate(r.x-i.x,r.y-i.y)),this.dragStart=n):this.showTooltip(e)}}}},{key:"mouseUp",value:function(n){this.preventDefaultsAndStopPropagation(n);var e=(new Date).getTime();if(e-this.lastMouseUp>150&&this.dragElement&&"protein"===this.dragElement.type&&this.state!==t.STATES.DRAGGING)if(this.dragElement.expanded){this.contextMenuProt=this.dragElement;var r=this.getEventPoint(n);isNaN(r.x)&&(r=this.getEventPoint(this.dragStart));var o=r.matrixTransform(this.container.getCTM().inverse());this.contextMenuPoint=o;var a,s,u=i.select(".custom-menu-margin");n.pageX?(a=n.pageX,s=n.pageY):(a=this.dragStart.touches[0].pageX,s=this.dragStart.touches[0].pageY),u.style("top",s-20+"px").style("left",a-20+"px").style("display","block"),i.select(".scaleButton_"+100*this.dragElement.stickZoom).property("checked",!0)}else this.dragElement.setExpanded(!0),this.notifyExpandListeners();return this.dragElement=null,this.dragStart={},this.state=t.STATES.MOUSE_UP,this.lastMouseUp=e,!1}},{key:"mouseWheel",value:function(t){this.preventDefaultsAndStopPropagation(t),this.d3cola.stop();var n=1+(t.wheelDelta?t.wheelDelta/3600:t.detail/-90),e=this.container,r=this.getEventPoint(t).matrixTransform(e.getCTM().inverse()),i=this.svgElement.createSVGMatrix().translate(r.x,r.y).scale(n).translate(-r.x,-r.y);return this.setCTM(e,e.getCTM().multiply(i)),!1}},{key:"mouseOut",value:function(t){this.hideTooltip()}},{key:"getEventPoint",value:function(t){var n,e,r=this.svgElement.createSVGPoint(),i=this.svgElement.parentNode,o=0,a=0;do{o+=i.offsetTop||0,a+=i.offsetLeft||0,i=i.offsetParent}while(i);return t.touches&&t.touches.length>0?(n=t.touches[0].pageX,e=t.touches[0].pageY):t.pageX&&(n=t.pageX,e=t.pageY),r.x=n-a,r.y=e-o,r}},{key:"preventDefaultsAndStopPropagation",value:function(t){t.stopPropagation&&t.stopPropagation(),null!=t.cancelBubble&&(t.cancelBubble=!0),t.preventDefault&&t.preventDefault()}},{key:"downloadSVG",value:function(t){t||(t="complexViewer");var n=this.getSVG(),e=function(t){var n,e=[];try{n=new TextEncoder("utf-8")}catch(t){n=void 0}if(n)e=n.encode(t);else for(var r=0;r>6,128|63&i):i<55296||i>=57344?e.push(224|i>>12,128|i>>6&63,128|63&i):(r++,i=65536+((1023&i)<<10|1023&t.charCodeAt(r)),e.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|63&i))}return new Blob([new Uint8Array(e)],{type:"image/svg+xml;charset=utf-8"})}(n);if(navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(e,t);else{var r=document.createElement("a");r.href=window.URL.createObjectURL(e),r.download=t,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(r.href)}e=null}}])&&Dn(n.prototype,e),o&&Dn(n,o),t}();zn.STATES={MOUSE_UP:0,SELECT_PAN:1,DRAGGING:2},zn.barScales=[.01,.015,.2,1,2,4,8]}])})); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.complexviewer=e():t.complexviewer=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(t,e,n){var r,i;!function(){var o={version:"3.5.17"},a=[].slice,s=function(t){return a.call(t)},u=this.document;function c(t){return t&&(t.ownerDocument||t.document||t).documentElement}function l(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(u)try{s(u.documentElement.childNodes)[0].nodeType}catch(t){s=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),u)try{u.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var f=this.Element.prototype,h=f.setAttribute,p=f.setAttributeNS,d=this.CSSStyleDeclaration.prototype,y=d.setProperty;f.setAttribute=function(t,e){h.call(this,t,e+"")},f.setAttributeNS=function(t,e,n){p.call(this,t,e,n+"")},d.setProperty=function(t,e,n){y.call(this,t,e+"",n)}}function g(t,e){return te?1:t>=e?0:NaN}function v(t){return null===t?NaN:+t}function x(t){return!isNaN(t)}function m(t){return{left:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);r>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);r>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}o.ascending=g,o.descending=function(t,e){return et?1:e>=t?0:NaN},o.min=function(t,e){var n,r,i=-1,o=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++ir&&(n=r)}else{for(;++i=r){n=r;break}for(;++ir&&(n=r)}return n},o.max=function(t,e){var n,r,i=-1,o=t.length;if(1===arguments.length){for(;++i=r){n=r;break}for(;++in&&(n=r)}else{for(;++i=r){n=r;break}for(;++in&&(n=r)}return n},o.extent=function(t,e){var n,r,i,o=-1,a=t.length;if(1===arguments.length){for(;++o=r){n=i=r;break}for(;++or&&(n=r),i=r){n=i=r;break}for(;++or&&(n=r),i1)return a/(u-1)},o.deviation=function(){var t=o.variance.apply(this,arguments);return t?Math.sqrt(t):t};var b=m(g);function w(t){return t.length}o.bisectLeft=b.left,o.bisect=o.bisectRight=b.right,o.bisector=function(t){return m(1===t.length?function(e,n){return g(t(e),n)}:t)},o.shuffle=function(t,e,n){(o=arguments.length)<3&&(n=t.length,o<2&&(e=0));for(var r,i,o=n-e;o;)i=Math.random()*o--|0,r=t[o+e],t[o+e]=t[i+e],t[i+e]=r;return t},o.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r},o.pairs=function(t){for(var e=0,n=t.length-1,r=t[0],i=new Array(n<0?0:n);e=0;)for(e=(r=t[i]).length;--e>=0;)n[--a]=r[e];return n};var k=Math.abs;function S(t){for(var e=1;t*e%1;)e*=10;return e}function _(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function M(){this._=Object.create(null)}o.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n==1/0)throw new Error("infinite range");var r,i=[],o=S(k(n)),a=-1;if(t*=o,e*=o,(n*=o)<0)for(;(r=t+n*++a)>e;)i.push(r/o);else for(;(r=t+n*++a)=r.length)return e?e.call(n,o):t?o.sort(t):o;for(var u,c,l,f,h=-1,p=o.length,d=r[s++],y=new M;++h=r.length)return e;var o=[],a=i[n++];return e.forEach((function(e,r){o.push({key:e,values:t(r,n)})})),a?o.sort((function(t,e){return a(t.key,e.key)})):o}(a(o.map,t,0),0)},n.key=function(t){return r.push(t),n},n.sortKeys=function(t){return i[r.length-1]=t,n},n.sortValues=function(e){return t=e,n},n.rollup=function(t){return e=t,n},n},o.set=function(t){var e=new O;if(t)for(var n=0,r=t.length;n=0&&(r=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},o.event=null,o.requote=function(t){return t.replace(F,"\\$&")};var F=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]};function X(t){return U(t,$),t}var W=function(t,e){return e.querySelector(t)},Y=function(t,e){return e.querySelectorAll(t)},Z=function(t,e){var n=t.matches||t[I(t,"matchesSelector")];return(Z=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(W=function(t,e){return Sizzle(t,e)[0]||null},Y=Sizzle,Z=Sizzle.matchesSelector),o.selection=function(){return o.select(u.documentElement)};var $=o.selection.prototype=[];function K(t){return"function"==typeof t?t:function(){return W(t,this)}}function J(t){return"function"==typeof t?t:function(){return Y(t,this)}}$.select=function(t){var e,n,r,i,o=[];t=K(t);for(var a=-1,s=this.length;++a=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),tt.hasOwnProperty(n)?{space:tt[n],local:t}:t}},$.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=o.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(et(e,t[e]));return this}return this.each(et(t,e))},$.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=it(t)).length,i=-1;if(e=n.classList){for(;++i=0;)(n=r[i])&&(o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o),o=n);return this},$.sort=function(t){t=pt.apply(this,arguments);for(var e=-1,n=this.length;++e=e&&(e=i+1);!(a=s[e])&&++e0&&(t=t.slice(0,i));var u=mt.get(t);function c(){var e=this[r];e&&(this.removeEventListener(t,e,e.$),delete this[r])}return u&&(t=u,a=wt),i?e?function(){var i=a(e,s(arguments));c.call(this),this.addEventListener(t,this[r]=i,i.$=n),i._=e}:c:e?q:function(){var e,n=new RegExp("^__on([^.]+)"+o.requote(t)+"$");for(var r in this)if(e=r.match(n)){var i=this[r];this.removeEventListener(e[1],i,i.$),delete this[r]}}}o.selection.enter=yt,o.selection.enter.prototype=gt,gt.append=$.append,gt.empty=$.empty,gt.node=$.node,gt.call=$.call,gt.size=$.size,gt.select=function(t){for(var e,n,r,i,o,a=[],s=-1,u=this.length;++s0?1:t<0?-1:0}function Rt(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function qt(t){return t>1?0:t<-1?Nt:Math.acos(t)}function zt(t){return t>1?Ot:t<-1?-Ot:Math.asin(t)}function Bt(t){return((t=Math.exp(t))+1/t)/2}function Ht(t){return(t=Math.sin(t/2))*t}var Gt=Math.SQRT2;o.interpolateZoom=function(t,e){var n,r,i=t[0],o=t[1],a=t[2],s=e[0],u=e[1],c=e[2],l=s-i,f=u-o,h=l*l+f*f;if(h0&&(t=t.transition().duration(y)),t.call(k.event)}function A(){s&&s.domain(a.range().map((function(t){return(t-h.x)/h.k})).map(a.invert)),f&&f.domain(c.range().map((function(t){return(t-h.y)/h.k})).map(c.invert))}function C(t){g++||t({type:"zoomstart"})}function L(t){A(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function N(t){--g||(t({type:"zoomend"}),e=null)}function T(){var t=this,e=w.of(t,arguments),n=0,r=o.select(l(t)).on(x,s).on(m,u),i=S(o.mouse(t)),a=_t(t);function s(){n=1,M(o.mouse(t),i),L(e)}function u(){r.on(x,null).on(m,null),a(n),N(e)}ws.call(t),C(e)}function P(){var t,e=this,n=w.of(e,arguments),r={},a=0,s=".zoom-"+o.event.changedTouches[0].identifier,u="touchmove"+s,c="touchend"+s,l=[],f=o.select(e),p=_t(e);function d(){var n=o.touches(e);return t=h.k,n.forEach((function(t){t.identifier in r&&(r[t.identifier]=S(t))})),n}function y(){var t=o.event.target;o.select(t).on(u,g).on(c,x),l.push(t);for(var n=o.event.changedTouches,s=0,f=n.length;s1){v=p[0];var m=p[1],b=v[0]-m[0],w=v[1]-m[1];a=b*b+w*w}}function g(){var s,u,c,l,f=o.touches(e);ws.call(e);for(var h=0,p=f.length;h360?t-=360:t<0&&(t+=360),t<60?r+(i-r)*t/60:t<180?i:t<240?r+(i-r)*(240-t)/60:r}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)||e<0?0:e>1?1:e,r=2*(n=n<0?0:n>1?1:n)-(i=n<=.5?n*(1+e):n+e-n*e),new se(o(t+120),o(t),o(t-120))}function $t(t,e,n){return this instanceof $t?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof $t?new $t(t.h,t.c,t.l):re(t instanceof Qt?t.l:(t=de((t=o.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new $t(t,e,n)}Yt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Wt(this.h,this.s,this.l/t)},Yt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Wt(this.h,this.s,t*this.l)},Yt.rgb=function(){return Zt(this.h,this.s,this.l)},o.hcl=$t;var Kt=$t.prototype=new Xt;function Jt(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Qt(n,Math.cos(t*=Dt)*e,Math.sin(t)*e)}function Qt(t,e,n){return this instanceof Qt?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof Qt?new Qt(t.l,t.a,t.b):t instanceof $t?Jt(t.h,t.c,t.l):de((t=se(t)).r,t.g,t.b):new Qt(t,e,n)}Kt.brighter=function(t){return new $t(this.h,this.c,Math.min(100,this.l+te*(arguments.length?t:1)))},Kt.darker=function(t){return new $t(this.h,this.c,Math.max(0,this.l-te*(arguments.length?t:1)))},Kt.rgb=function(){return Jt(this.h,this.c,this.l).rgb()},o.lab=Qt;var te=18,ee=Qt.prototype=new Xt;function ne(t,e,n){var r=(t+16)/116,i=r+e/500,o=r-n/200;return new se(ae(3.2404542*(i=.95047*ie(i))-1.5371385*(r=1*ie(r))-.4985314*(o=1.08883*ie(o))),ae(-.969266*i+1.8760108*r+.041556*o),ae(.0556434*i-.2040259*r+1.0572252*o))}function re(t,e,n){return t>0?new $t(Math.atan2(n,e)*jt,Math.sqrt(e*e+n*n),t):new $t(NaN,NaN,t)}function ie(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function oe(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ae(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function se(t,e,n){return this instanceof se?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof se?new se(t.r,t.g,t.b):he(""+t,se,Zt):new se(t,e,n)}function ue(t){return new se(t>>16,t>>8&255,255&t)}function ce(t){return ue(t)+""}ee.brighter=function(t){return new Qt(Math.min(100,this.l+te*(arguments.length?t:1)),this.a,this.b)},ee.darker=function(t){return new Qt(Math.max(0,this.l-te*(arguments.length?t:1)),this.a,this.b)},ee.rgb=function(){return ne(this.l,this.a,this.b)},o.rgb=se;var le=se.prototype=new Xt;function fe(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function he(t,e,n){var r,i,o,a=0,s=0,u=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(ge(i[0]),ge(i[1]),ge(i[2]))}return(o=ve.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,u=15&o,u|=u<<4):7===t.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,u=255&o)),e(a,s,u))}function pe(t,e,n){var r,i,o=Math.min(t/=255,e/=255,n/=255),a=Math.max(t,e,n),s=a-o,u=(a+o)/2;return s?(i=u<.5?s/(a+o):s/(2-a-o),r=t==a?(e-n)/s+(e0&&u<1?0:r),new Wt(r,i,u)}function de(t,e,n){var r=oe((.4124564*(t=ye(t))+.3575761*(e=ye(e))+.1804375*(n=ye(n)))/.95047),i=oe((.2126729*t+.7151522*e+.072175*n)/1);return Qt(116*i-16,500*(r-i),200*(i-oe((.0193339*t+.119192*e+.9503041*n)/1.08883)))}function ye(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ge(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}le.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,n=this.g,r=this.b,i=30;return e||n||r?(e&&e=200&&e<300||304===e){try{t=n.call(i,c)}catch(t){return void a.error.call(i,t)}a.load.call(i,t)}else a.error.call(i,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(t){var e=o.event;o.event=t;try{a.progress.call(i,c)}finally{o.event=e}},i.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?u[t]:(null==e?delete u[t]:u[t]=e+"",i)},i.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",i):e},i.responseType=function(t){return arguments.length?(l=t,i):l},i.response=function(t){return n=t,i},["get","post"].forEach((function(t){i[t]=function(){return i.send.apply(i,[t].concat(s(arguments)))}})),i.send=function(n,r,o){if(2===arguments.length&&"function"==typeof r&&(o=r,r=null),c.open(n,t,!0),null==e||"accept"in u||(u.accept=e+",*/*"),c.setRequestHeader)for(var s in u)c.setRequestHeader(s,u[s]);return null!=e&&c.overrideMimeType&&c.overrideMimeType(e),null!=l&&(c.responseType=l),null!=o&&i.on("error",o).on("load",(function(t){o(null,t)})),a.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},o.rebind(i,a,"on"),null==r?i:i.get(function(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}(r))}ve.forEach((function(t,e){ve.set(t,ue(e))})),o.functor=xe,o.xhr=me(D),o.dsv=function(t,e){var n=new RegExp('["'+t+"\n]"),r=t.charCodeAt(0);function i(t,n,r){arguments.length<3&&(r=n,n=null);var i=be(t,e,null==n?o:a(n),r);return i.row=function(t){return arguments.length?i.response(null==(n=t)?o:a(t)):n},i}function o(t){return i.parse(t.responseText)}function a(t){return function(e){return i.parse(e.responseText,t)}}function s(e){return e.map(u).join(t)}function u(t){return n.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return i.parse=function(t,e){var n;return i.parseRows(t,(function(t,r){if(n)return n(t,r-1);var i=new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+"]"})).join(",")+"}");n=e?function(t,n){return e(i(t),n)}:i}))},i.parseRows=function(t,e){var n,i,o={},a={},s=[],u=t.length,c=0,l=0;function f(){if(c>=u)return a;if(i)return i=!1,o;var e=c;if(34===t.charCodeAt(e)){for(var n=e;n++24?(isFinite(e)&&(clearTimeout(_e),_e=setTimeout(Ae,e)),Se=0):(Se=1,Me(Ae))}function Ce(){for(var t=Date.now(),e=we;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Le(){for(var t,e=we,n=1/0;e;)e.c?(e.t8?function(t){return t/n}:function(t){return t*n},symbol:t}}));function Pe(t){var e=t.decimal,n=t.thousands,r=t.grouping,i=t.currency,a=r&&n?function(t,e){for(var i=t.length,o=[],a=0,s=r[0],u=0;i>0&&s>0&&(u+s+1>e&&(s=Math.max(1,e-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>e));)s=r[a=(a+1)%r.length];return o.reverse().join(n)}:D;return function(t){var n=Oe.exec(t),r=n[1]||" ",s=n[2]||">",u=n[3]||"-",c=n[4]||"",l=n[5],f=+n[6],h=n[7],p=n[8],d=n[9],y=1,g="",v="",x=!1,m=!0;switch(p&&(p=+p.substring(1)),(l||"0"===r&&"="===s)&&(l=r="0",s="="),d){case"n":h=!0,d="g";break;case"%":y=100,v="%",d="f";break;case"p":y=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===c&&(g="0"+d.toLowerCase());case"c":m=!1;case"d":x=!0,p=0;break;case"s":y=-1,d="r"}"$"===c&&(g=i[0],v=i[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=De.get(d)||je;var b=l&&h;return function(t){var n=v;if(x&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===u?"":u;if(y<0){var c=o.formatPrefix(t,p);t=c.scale(t),n=c.symbol+v}else t*=y;var w,k,S=(t=d(t,p)).lastIndexOf(".");if(S<0){var _=m?t.lastIndexOf("e"):-1;_<0?(w=t,k=""):(w=t.substring(0,_),k=t.substring(_))}else w=t.substring(0,S),k=e+t.substring(S+1);!l&&h&&(w=a(w,1/0));var M=g.length+w.length+k.length+(b?0:i.length),E=M"===s?E+i+t:"^"===s?E.substring(0,M>>=1)+i+t+E.substring(M):i+(b?t:E+t))+n}}}o.formatPrefix=function(t,e){var n=0;return(t=+t)&&(t<0&&(t*=-1),e&&(t=o.round(t,Ne(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)))),Te[8+n/3]};var Oe=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,De=o.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=o.round(t,Ne(t,e))).toFixed(Math.max(0,Math.min(20,Ne(t*(1+1e-15),e))))}});function je(t){return t+""}var Ie=o.time={},Re=Date;function qe(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}qe.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(){ze.setUTCDate.apply(this._,arguments)},setDay:function(){ze.setUTCDay.apply(this._,arguments)},setFullYear:function(){ze.setUTCFullYear.apply(this._,arguments)},setHours:function(){ze.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ze.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ze.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ze.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ze.setUTCSeconds.apply(this._,arguments)},setTime:function(){ze.setTime.apply(this._,arguments)}};var ze=Date.prototype;function Be(t,e,n){function r(e){var n=t(e),r=o(n,1);return e-n1)for(;a=c)return-1;if(37===(i=e.charCodeAt(s++))){if(a=e.charAt(s++),!(o=k[a in Ve?e.charAt(s++):a])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}l.utc=function(t){var e=l(t);function n(t){try{var n=new(Re=qe);return n._=t,e(n)}finally{Re=Date}}return n.parse=function(t){try{Re=qe;var n=e.parse(t);return n&&n._}finally{Re=Date}},n.toString=e.toString,n},l.multi=l.utc.multi=fn;var h=o.map(),p=We(a),d=Ye(a),y=We(s),g=Ye(s),v=We(u),x=Ye(u),m=We(c),b=Ye(c);i.forEach((function(t,e){h.set(t.toLowerCase(),e)}));var w={a:function(t){return s[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:l(e),d:function(t,e){return Xe(t.getDate(),e,2)},e:function(t,e){return Xe(t.getDate(),e,2)},H:function(t,e){return Xe(t.getHours(),e,2)},I:function(t,e){return Xe(t.getHours()%12||12,e,2)},j:function(t,e){return Xe(1+Ie.dayOfYear(t),e,3)},L:function(t,e){return Xe(t.getMilliseconds(),e,3)},m:function(t,e){return Xe(t.getMonth()+1,e,2)},M:function(t,e){return Xe(t.getMinutes(),e,2)},p:function(t){return i[+(t.getHours()>=12)]},S:function(t,e){return Xe(t.getSeconds(),e,2)},U:function(t,e){return Xe(Ie.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Xe(Ie.mondayOfYear(t),e,2)},x:l(n),X:l(r),y:function(t,e){return Xe(t.getFullYear()%100,e,2)},Y:function(t,e){return Xe(t.getFullYear()%1e4,e,4)},Z:cn,"%":function(){return"%"}},k={a:function(t,e,n){y.lastIndex=0;var r=y.exec(e.slice(n));return r?(t.w=g.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){p.lastIndex=0;var r=p.exec(e.slice(n));return r?(t.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){m.lastIndex=0;var r=m.exec(e.slice(n));return r?(t.m=b.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){v.lastIndex=0;var r=v.exec(e.slice(n));return r?(t.m=x.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,e,n){return f(t,w.c.toString(),e,n)},d:nn,e:nn,H:on,I:on,j:rn,L:un,m:en,M:an,p:function(t,e,n){var r=h.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)},S:sn,U:$e,w:Ze,W:Ke,x:function(t,e,n){return f(t,w.x.toString(),e,n)},X:function(t,e,n){return f(t,w.X.toString(),e,n)},y:Qe,Y:Je,Z:tn,"%":ln};return l}Ie.year=Be((function(t){return(t=Ie.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),Ie.years=Ie.year.range,Ie.years.utc=Ie.year.utc.range,Ie.day=Be((function(t){var e=new Re(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})),Ie.days=Ie.day.range,Ie.days.utc=Ie.day.utc.range,Ie.dayOfYear=function(t){var e=Ie.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=Ie[t]=Be((function(t){return(t=Ie.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=Ie.year(t).getDay();return Math.floor((Ie.dayOfYear(t)+(n+e)%7)/7)-(n!==e)}));Ie[t+"s"]=n.range,Ie[t+"s"].utc=n.utc.range,Ie[t+"OfYear"]=function(t){var n=Ie.year(t).getDay();return Math.floor((Ie.dayOfYear(t)+(n+e)%7)/7)}})),Ie.week=Ie.sunday,Ie.weeks=Ie.sunday.range,Ie.weeks.utc=Ie.sunday.utc.range,Ie.weekOfYear=Ie.sundayOfYear;var Ve={"-":"",_:" ",0:"0"},Fe=/^\s*\d+/,Ue=/^%/;function Xe(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o68?1900:2e3),n+i[0].length):-1}function tn(t,e,n){return/^[+-]\d{4}$/.test(e=e.slice(n,n+5))?(t.Z=-e,n+5):-1}function en(t,e,n){Fe.lastIndex=0;var r=Fe.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function nn(t,e,n){Fe.lastIndex=0;var r=Fe.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function rn(t,e,n){Fe.lastIndex=0;var r=Fe.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function on(t,e,n){Fe.lastIndex=0;var r=Fe.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function an(t,e,n){Fe.lastIndex=0;var r=Fe.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function sn(t,e,n){Fe.lastIndex=0;var r=Fe.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function un(t,e,n){Fe.lastIndex=0;var r=Fe.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function cn(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=k(e)/60|0,i=k(e)%60;return n+Xe(r,"0",2)+Xe(i,"0",2)}function ln(t,e,n){Ue.lastIndex=0;var r=Ue.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function fn(t){for(var e=t.length,n=-1;++n=0?1:-1,s=a*o,u=Math.cos(e),c=Math.sin(e),l=i*c,f=r*u+l*Math.cos(s),h=l*a*Math.sin(s);On.add(Math.atan2(h,f)),n=t,r=u,i=c}Dn.point=function(a,s){Dn.point=o,n=(t=a)*Dt,r=Math.cos(s=(e=s)*Dt/2+Nt/4),i=Math.sin(s)},Dn.lineEnd=function(){o(t,e)}}function In(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function Rn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function qn(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 zn(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Bn(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Hn(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 Gn(t){return[Math.atan2(t[1],t[0]),zt(t[2])]}function Vn(t,e){return k(t[0]-e[0])Ct?r=90:c<-Ct&&(e=-90),f[0]=t,f[1]=n}};function p(i,o){l.push(f=[t=i,n=i]),or&&(r=o)}function d(o,a){var s=In([o*Dt,a*Dt]);if(u){var c=qn(u,s),l=qn([c[1],-c[0],0],c);Hn(l),l=Gn(l);var f=o-i,h=f>0?1:-1,d=l[0]*jt*h,y=k(f)>180;if(y^(h*ir&&(r=g);else if(y^(h*i<(d=(d+360)%360-180)&&dr&&(r=a);y?ob(t,n)&&(n=o):b(o,n)>b(t,n)&&(t=o):n>=t?(on&&(n=o)):o>i?b(t,o)>b(t,n)&&(n=o):b(o,n)>b(t,n)&&(t=o)}else p(o,a);u=s,i=o}function y(){h.point=d}function g(){f[0]=t,f[1]=n,h.point=p,u=null}function v(t,e){if(u){var n=t-i;c+=k(n)>180?n+(n>0?360:-360):n}else a=t,s=e;Dn.point(t,e),d(t,e)}function x(){Dn.lineStart()}function m(){v(a,s),Dn.lineEnd(),k(c)>Ct&&(t=-(n=180)),f[0]=t,f[1]=n,u=null}function b(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function S(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tb(y[0],y[1])&&(y[1]=p[1]),b(p[0],y[1])>b(y[0],y[1])&&(y[0]=p[0])):s.push(y=p);for(var u,c,p,d=-1/0,y=(a=0,s[c=s.length-1]);a<=c;y=p,++a)p=s[a],(u=b(y[1],p[0]))>d&&(d=u,t=p[0],n=y[1])}return l=f=null,t===1/0||e===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,e],[n,r]]}}(),o.geo.centroid=function(t){kn=Sn=_n=Mn=En=An=Cn=Ln=Nn=Tn=Pn=0,o.geo.stream(t,Fn);var e=Nn,n=Tn,r=Pn,i=e*e+n*n+r*r;return i=0;--s)i.point((f=l[s])[0],f[1]);else r(p.x,p.p.x,-1,i);p=p.p}l=(p=p.o).z,d=!d}while(!p.v);i.lineEnd()}}}function Qn(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r=0?1:-1,S=k*w,_=S>Nt,M=d*m;if(On.add(Math.atan2(M*k*Math.sin(S),y*b+M*Math.cos(S))),o+=_?w+k*Tt:w,_^h>=n^v>=n){var E=qn(In(f),In(t));Hn(E);var A=qn(i,E);Hn(A);var C=(_^w>=0?-1:1)*zt(A[2]);(r>C||r===C&&(E[0]||E[1]))&&(a+=_^w>=0?1:-1)}if(!g++)break;h=v,d=m,y=b,f=t}}return(o<-Ct||o0){for(m||(a.polygonStart(),m=!0),a.lineStart();++o1&&2&e&&n.push(n.pop().concat(n.shift())),s.push(n.filter(nr))}return l}}function nr(t){return t.length>1}function rr(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:q,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function ir(t,e){return((t=t.x)[0]<0?t[1]-Ot-Ct:Ot-t[1])-((e=e.x)[0]<0?e[1]-Ot-Ct:Ot-e[1])}var or=er(Kn,(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?Nt:-Nt,u=k(o-n);k(u-Nt)0?Ot:-Ot),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&u>=Nt&&(k(n-i)Ct?Math.atan((Math.sin(e)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(e))*Math.sin(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=a),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*Ot,r.point(-Nt,i),r.point(0,i),r.point(Nt,i),r.point(Nt,0),r.point(Nt,-i),r.point(0,-i),r.point(-Nt,-i),r.point(-Nt,0),r.point(-Nt,i);else if(k(t[0]-e[0])>Ct){var o=t[0]0,r=k(e)>Ct;return er(i,(function(t){var e,s,u,c,l;return{lineStart:function(){c=u=!1,l=1},point:function(f,h){var p,d=[f,h],y=i(f,h),g=n?y?0:a(f,h):y?a(f+(f<0?Nt:-Nt),h):0;if(!e&&(c=u=y)&&t.lineStart(),y!==u&&(p=o(e,d),(Vn(e,p)||Vn(d,p))&&(d[0]+=Ct,d[1]+=Ct,y=i(d[0],d[1]))),y!==u)l=0,y?(t.lineStart(),p=o(d,e),t.point(p[0],p[1])):(p=o(e,d),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(r&&e&&n^y){var v;g&s||!(v=o(d,e,!0))||(l=0,n?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!y||e&&Vn(e,d)||t.point(d[0],d[1]),e=d,u=y,s=g},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return l|(c&&u)<<1}}}),Gr(t,6*Dt),n?[0,-t]:[-Nt,t-Nt]);function i(t,n){return Math.cos(t)*Math.cos(n)>e}function o(t,n,r){var i=[1,0,0],o=qn(In(t),In(n)),a=Rn(o,o),s=o[0],u=a-s*s;if(!u)return!r&&t;var c=e*a/u,l=-e*s/u,f=qn(i,o),h=Bn(i,c);zn(h,Bn(o,l));var p=f,d=Rn(h,p),y=Rn(p,p),g=d*d-y*(Rn(h,h)-1);if(!(g<0)){var v=Math.sqrt(g),x=Bn(p,(-d-v)/y);if(zn(x,h),x=Gn(x),!r)return x;var m,b=t[0],w=n[0],S=t[1],_=n[1];w0^x[1]<(k(x[0]-b)Nt^(b<=x[0]&&x[0]<=w)){var A=Bn(p,(-d+v)/y);return zn(A,h),[x,Gn(A)]}}}function a(e,r){var i=n?t:Nt-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}}function sr(t,e,n,r){return function(i){var o,a=i.a,s=i.b,u=a.x,c=a.y,l=0,f=1,h=s.x-u,p=s.y-c;if(o=t-u,h||!(o>0)){if(o/=h,h<0){if(o0){if(o>f)return;o>l&&(l=o)}if(o=n-u,h||!(o<0)){if(o/=h,h<0){if(o>f)return;o>l&&(l=o)}else if(h>0){if(o0)){if(o/=p,p<0){if(o0){if(o>f)return;o>l&&(l=o)}if(o=r-c,p||!(o<0)){if(o/=p,p<0){if(o>f)return;o>l&&(l=o)}else if(p>0){if(o0&&(i.a={x:u+l*h,y:c+l*p}),f<1&&(i.b={x:u+f*h,y:c+f*p}),i}}}}}}function ur(t,e,n,r){return function(u){var c,l,f,h,p,d,y,g,v,x,m,b=u,w=rr(),k=sr(t,e,n,r),S={point:E,lineStart:function(){S.point=A,l&&l.push(f=[]);x=!0,v=!1,y=g=NaN},lineEnd:function(){c&&(A(h,p),d&&v&&w.rejoin(),c.push(w.buffer()));S.point=E,v&&u.lineEnd()},polygonStart:function(){u=w,c=[],l=[],m=!0},polygonEnd:function(){u=b,c=o.merge(c);var e=function(t){for(var e=0,n=l.length,r=t[1],i=0;ir&&Rt(c,o,t)>0&&++e:o[1]<=r&&Rt(c,o,t)<0&&--e,c=o;return 0!==e}([t,r]),n=m&&e,i=c.length;(n||i)&&(u.polygonStart(),n&&(u.lineStart(),_(null,null,1,u),u.lineEnd()),i&&Jn(c,a,e,_,u),u.polygonEnd()),c=l=f=null}};function _(o,a,u,c){var l=0,f=0;if(null==o||(l=i(o,u))!==(f=i(a,u))||s(o,a)<0^u>0)do{c.point(0===l||3===l?t:n,l>1?r:e)}while((l=(l+u+4)%4)!==f);else c.point(a[0],a[1])}function M(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function E(t,e){M(t,e)&&u.point(t,e)}function A(t,e){var n=M(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,e)));if(l&&f.push([t,e]),x)h=t,p=e,d=n,x=!1,n&&(u.lineStart(),u.point(t,e));else if(n&&v)u.point(t,e);else{var r={a:{x:y,y:g},b:{x:t,y:e}};k(r)?(v||(u.lineStart(),u.point(r.a.x,r.a.y)),u.point(r.b.x,r.b.y),n||u.lineEnd(),m=!1):n&&(u.lineStart(),u.point(t,e),m=!1)}y=t,g=e,v=n}return S};function i(r,i){return k(r[0]-t)0?0:3:k(r[0]-n)0?2:1:k(r[1]-e)0?1:0:i>0?3:2}function a(t,e){return s(t.x,e.x)}function s(t,e){var n=i(t,1),r=i(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}}function cr(t){var e=0,n=Nt/3,r=Dr(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*Nt/180,n=t[1]*Nt/180):[e/Nt*180,n/Nt*180]},i}function lr(t,e){var n=Math.sin(t),r=(n+Math.sin(e))/2,i=1+n*(2*r-n),o=Math.sqrt(i)/r;function a(t,e){var n=Math.sqrt(i-2*r*Math.sin(e))/r;return[n*Math.sin(t*=r),o-n*Math.cos(t)]}return a.invert=function(t,e){var n=o-e;return[Math.atan2(t,n)/r,zt((i-(t*t+n*n)*r*r)/(2*r))]},a}o.geo.clipExtent=function(){var t,e,n,r,i,o,a={stream:function(t){return i&&(i.valid=!1),(i=o(t)).valid=!0,i},extent:function(s){return arguments.length?(o=ur(t=+s[0][0],e=+s[0][1],n=+s[1][0],r=+s[1][1]),i&&(i.valid=!1,i=null),a):[[t,e],[n,r]]}};return a.extent([[0,0],[960,500]])},(o.geo.conicEqualArea=function(){return cr(lr)}).raw=lr,o.geo.albers=function(){return o.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},o.geo.albersUsa=function(){var t,e,n,r,i=o.geo.albers(),a=o.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=o.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(e,n){t=[e,n]}};function c(i){var o=i[0],a=i[1];return t=null,e(o,a),t||(n(o,a),t)||r(o,a),t}return c.invert=function(t){var e=i.scale(),n=i.translate(),r=(t[0]-n[0])/e,o=(t[1]-n[1])/e;return(o>=.12&&o<.234&&r>=-.425&&r<-.214?a:o>=.166&&o<.234&&r>=-.214&&r<-.115?s:i).invert(t)},c.stream=function(t){var e=i.stream(t),n=a.stream(t),r=s.stream(t);return{point:function(t,i){e.point(t,i),n.point(t,i),r.point(t,i)},sphere:function(){e.sphere(),n.sphere(),r.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),r.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),r.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),r.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),r.polygonEnd()}}},c.precision=function(t){return arguments.length?(i.precision(t),a.precision(t),s.precision(t),c):i.precision()},c.scale=function(t){return arguments.length?(i.scale(t),a.scale(.35*t),s.scale(t),c.translate(i.translate())):i.scale()},c.translate=function(t){if(!arguments.length)return i.translate();var o=i.scale(),l=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[l-.455*o,f-.238*o],[l+.455*o,f+.238*o]]).stream(u).point,n=a.translate([l-.307*o,f+.201*o]).clipExtent([[l-.425*o+Ct,f+.12*o+Ct],[l-.214*o-Ct,f+.234*o-Ct]]).stream(u).point,r=s.translate([l-.205*o,f+.212*o]).clipExtent([[l-.214*o+Ct,f+.166*o+Ct],[l-.115*o-Ct,f+.234*o-Ct]]).stream(u).point,c},c.scale(1070)};var fr,hr,pr,dr,yr,gr,vr={point:q,lineStart:q,lineEnd:q,polygonStart:function(){hr=0,vr.lineStart=xr},polygonEnd:function(){vr.lineStart=vr.lineEnd=vr.point=q,fr+=k(hr/2)}};function xr(){var t,e,n,r;function i(t,e){hr+=r*t-n*e,n=t,r=e}vr.point=function(o,a){vr.point=i,t=n=o,e=r=a},vr.lineEnd=function(){i(t,e)}}var mr={point:function(t,e){tyr&&(yr=t);egr&&(gr=e)},lineStart:q,lineEnd:q,polygonStart:q,polygonEnd:q};function br(){var t=wr(4.5),e=[],n={point:r,lineStart:function(){n.point=i},lineEnd:a,polygonStart:function(){n.lineEnd=s},polygonEnd:function(){n.lineEnd=a,n.point=r},pointRadius:function(e){return t=wr(e),n},result:function(){if(e.length){var t=e.join("");return e=[],t}}};function r(n,r){e.push("M",n,",",r,t)}function i(t,r){e.push("M",t,",",r),n.point=o}function o(t,n){e.push("L",t,",",n)}function a(){n.point=r}function s(){e.push("Z")}return n}function wr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var kr,Sr={point:_r,lineStart:Mr,lineEnd:Er,polygonStart:function(){Sr.lineStart=Ar},polygonEnd:function(){Sr.point=_r,Sr.lineStart=Mr,Sr.lineEnd=Er}};function _r(t,e){_n+=t,Mn+=e,++En}function Mr(){var t,e;function n(n,r){var i=n-t,o=r-e,a=Math.sqrt(i*i+o*o);An+=a*(t+n)/2,Cn+=a*(e+r)/2,Ln+=a,_r(t=n,e=r)}Sr.point=function(r,i){Sr.point=n,_r(t=r,e=i)}}function Er(){Sr.point=_r}function Ar(){var t,e,n,r;function i(t,e){var i=t-n,o=e-r,a=Math.sqrt(i*i+o*o);An+=a*(n+t)/2,Cn+=a*(r+e)/2,Ln+=a,Nn+=(a=r*t-n*e)*(n+t),Tn+=a*(r+e),Pn+=3*a,_r(n=t,r=e)}Sr.point=function(o,a){Sr.point=i,_r(t=n=o,e=r=a)},Sr.lineEnd=function(){i(t,e)}}function Cr(t){var e=4.5,n={point:r,lineStart:function(){n.point=i},lineEnd:a,polygonStart:function(){n.lineEnd=s},polygonEnd:function(){n.lineEnd=a,n.point=r},pointRadius:function(t){return e=t,n},result:q};function r(n,r){t.moveTo(n+e,r),t.arc(n,r,e,0,Tt)}function i(e,r){t.moveTo(e,r),n.point=o}function o(e,n){t.lineTo(e,n)}function a(){n.point=r}function s(){t.closePath()}return n}function Lr(t){var e=.5,n=Math.cos(30*Dt),r=16;function i(t){return(r?a:o)(t)}function o(e){return Pr(e,(function(n,r){n=t(n,r),e.point(n[0],n[1])}))}function a(e){var n,i,o,a,u,c,l,f,h,p,d,y,g={point:v,lineStart:x,lineEnd:b,polygonStart:function(){e.polygonStart(),g.lineStart=w},polygonEnd:function(){e.polygonEnd(),g.lineStart=x}};function v(n,r){n=t(n,r),e.point(n[0],n[1])}function x(){f=NaN,g.point=m,e.lineStart()}function m(n,i){var o=In([n,i]),a=t(n,i);s(f,h,l,p,d,y,f=a[0],h=a[1],l=n,p=o[0],d=o[1],y=o[2],r,e),e.point(f,h)}function b(){g.point=v,e.lineEnd()}function w(){x(),g.point=k,g.lineEnd=S}function k(t,e){m(n=t,e),i=f,o=h,a=p,u=d,c=y,g.point=m}function S(){s(f,h,l,p,d,y,i,o,n,a,u,c,r,e),g.lineEnd=b,b()}return g}function s(r,i,o,a,u,c,l,f,h,p,d,y,g,v){var x=l-r,m=f-i,b=x*x+m*m;if(b>4*e&&g--){var w=a+p,S=u+d,_=c+y,M=Math.sqrt(w*w+S*S+_*_),E=Math.asin(_/=M),A=k(k(_)-1)e||k((x*T+m*P)/b-.5)>.3||a*p+u*d+c*y0&&16,i):Math.sqrt(e)},i}function Nr(t){var e=Lr((function(e,n){return t([e*jt,n*jt])}));return function(t){return jr(e(t))}}function Tr(t){this.stream=t}function Pr(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 Or(t){return Dr((function(){return t}))()}function Dr(t){var e,n,r,i,a,s,u=Lr((function(t,n){return[(t=e(t,n))[0]*c+i,a-t[1]*c]})),c=150,l=480,f=250,h=0,p=0,d=0,y=0,g=0,v=or,x=D,m=null,b=null;function w(t){return[(t=r(t[0]*Dt,t[1]*Dt))[0]*c+i,a-t[1]*c]}function k(t){return(t=r.invert((t[0]-i)/c,(a-t[1])/c))&&[t[0]*jt,t[1]*jt]}function S(){r=$n(n=qr(d,y,g),e);var t=e(h,p);return i=l-t[0]*c,a=f+t[1]*c,_()}function _(){return s&&(s.valid=!1,s=null),w}return w.stream=function(t){return s&&(s.valid=!1),(s=jr(v(n,u(x(t))))).valid=!0,s},w.clipAngle=function(t){return arguments.length?(v=null==t?(m=t,or):ar((m=+t)*Dt),_()):m},w.clipExtent=function(t){return arguments.length?(b=t,x=t?ur(t[0][0],t[0][1],t[1][0],t[1][1]):D,_()):b},w.scale=function(t){return arguments.length?(c=+t,S()):c},w.translate=function(t){return arguments.length?(l=+t[0],f=+t[1],S()):[l,f]},w.center=function(t){return arguments.length?(h=t[0]%360*Dt,p=t[1]%360*Dt,S()):[h*jt,p*jt]},w.rotate=function(t){return arguments.length?(d=t[0]%360*Dt,y=t[1]%360*Dt,g=t.length>2?t[2]%360*Dt:0,S()):[d*jt,y*jt,g*jt]},o.rebind(w,u,"precision"),function(){return e=t.apply(this,arguments),w.invert=e.invert&&k,S()}}function jr(t){return Pr(t,(function(e,n){t.point(e*Dt,n*Dt)}))}function Ir(t,e){return[t,e]}function Rr(t,e){return[t>Nt?t-Tt:t<-Nt?t+Tt:t,e]}function qr(t,e,n){return t?e||n?$n(Br(t),Hr(e,n)):Br(t):e||n?Hr(e,n):Rr}function zr(t){return function(e,n){return[(e+=t)>Nt?e-Tt:e<-Nt?e+Tt:e,n]}}function Br(t){var e=zr(t);return e.invert=zr(-t),e}function Hr(t,e){var n=Math.cos(t),r=Math.sin(t),i=Math.cos(e),o=Math.sin(e);function a(t,e){var a=Math.cos(e),s=Math.cos(t)*a,u=Math.sin(t)*a,c=Math.sin(e),l=c*n+s*r;return[Math.atan2(u*i-l*o,s*n-c*r),zt(l*i+u*o)]}return a.invert=function(t,e){var a=Math.cos(e),s=Math.cos(t)*a,u=Math.sin(t)*a,c=Math.sin(e),l=c*i-u*o;return[Math.atan2(u*i+c*o,s*n+l*r),zt(l*n-s*r)]},a}function Gr(t,e){var n=Math.cos(t),r=Math.sin(t);return function(i,o,a,s){var u=a*e;null!=i?(i=Vr(n,i),o=Vr(n,o),(a>0?io)&&(i+=a*Tt)):(i=t+a*Tt,o=t-.5*u);for(var c,l=i;a>0?l>o:l2?t[2]*Dt:0),e.invert=function(e){return(e=t.invert(e[0]*Dt,e[1]*Dt))[0]*=jt,e[1]*=jt,e},e},Rr.invert=Ir,o.geo.circle=function(){var t,e,n=[0,0],r=6;function i(){var t="function"==typeof n?n.apply(this,arguments):n,r=qr(-t[0]*Dt,-t[1]*Dt,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=r(t,e)),t[0]*=jt,t[1]*=jt}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(n=t,i):n},i.angle=function(n){return arguments.length?(e=Gr((t=+n)*Dt,r*Dt),i):t},i.precision=function(n){return arguments.length?(e=Gr(t*Dt,(r=+n)*Dt),i):r},i.angle(90)},o.geo.distance=function(t,e){var n,r=(e[0]-t[0])*Dt,i=t[1]*Dt,o=e[1]*Dt,a=Math.sin(r),s=Math.cos(r),u=Math.sin(i),c=Math.cos(i),l=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*a)*n+(n=c*l-u*f*s)*n),u*l+c*f*s)},o.geo.graticule=function(){var t,e,n,r,i,a,s,u,c,l,f,h,p=10,d=p,y=90,g=360,v=2.5;function x(){return{type:"MultiLineString",coordinates:m()}}function m(){return o.range(Math.ceil(r/y)*y,n,y).map(f).concat(o.range(Math.ceil(u/g)*g,s,g).map(h)).concat(o.range(Math.ceil(e/p)*p,t,p).filter((function(t){return k(t%y)>Ct})).map(c)).concat(o.range(Math.ceil(a/d)*d,i,d).filter((function(t){return k(t%g)>Ct})).map(l))}return x.lines=function(){return m().map((function(t){return{type:"LineString",coordinates:t}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(r).concat(h(s).slice(1),f(n).reverse().slice(1),h(u).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.majorExtent(t).minorExtent(t):x.minorExtent()},x.majorExtent=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],u=+t[0][1],s=+t[1][1],r>n&&(t=r,r=n,n=t),u>s&&(t=u,u=s,s=t),x.precision(v)):[[r,u],[n,s]]},x.minorExtent=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],a=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),a>i&&(n=a,a=i,i=n),x.precision(v)):[[e,a],[t,i]]},x.step=function(t){return arguments.length?x.majorStep(t).minorStep(t):x.minorStep()},x.majorStep=function(t){return arguments.length?(y=+t[0],g=+t[1],x):[y,g]},x.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],x):[p,d]},x.precision=function(o){return arguments.length?(v=+o,c=Fr(a,i,90),l=Ur(e,t,v),f=Fr(u,s,90),h=Ur(r,n,v),x):v},x.majorExtent([[-180,-90+Ct],[180,90-Ct]]).minorExtent([[-180,-80-Ct],[180,80+Ct]])},o.geo.greatArc=function(){var t,e,n=Xr,r=Wr;function i(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),e||r.apply(this,arguments)]}}return i.distance=function(){return o.geo.distance(t||n.apply(this,arguments),e||r.apply(this,arguments))},i.source=function(e){return arguments.length?(n=e,t="function"==typeof e?null:e,i):n},i.target=function(t){return arguments.length?(r=t,e="function"==typeof t?null:t,i):r},i.precision=function(){return arguments.length?i:0},i},o.geo.interpolate=function(t,e){return n=t[0]*Dt,r=t[1]*Dt,i=e[0]*Dt,o=e[1]*Dt,a=Math.cos(r),s=Math.sin(r),u=Math.cos(o),c=Math.sin(o),l=a*Math.cos(n),f=a*Math.sin(n),h=u*Math.cos(i),p=u*Math.sin(i),d=2*Math.asin(Math.sqrt(Ht(o-r)+a*u*Ht(i-n))),y=1/Math.sin(d),(g=d?function(t){var e=Math.sin(t*=d)*y,n=Math.sin(d-t)*y,r=n*l+e*h,i=n*f+e*p,o=n*s+e*c;return[Math.atan2(i,r)*jt,Math.atan2(o,Math.sqrt(r*r+i*i))*jt]}:function(){return[n*jt,r*jt]}).distance=d,g;var n,r,i,o,a,s,u,c,l,f,h,p,d,y,g},o.geo.length=function(t){return kr=0,o.geo.stream(t,Yr),kr};var Yr={sphere:q,point:q,lineStart:function(){var t,e,n;function r(r,i){var o=Math.sin(i*=Dt),a=Math.cos(i),s=k((r*=Dt)-t),u=Math.cos(s);kr+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=n*o-e*a*u)*s),e*o+n*a*u),t=r,e=o,n=a}Yr.point=function(i,o){t=i*Dt,e=Math.sin(o*=Dt),n=Math.cos(o),Yr.point=r},Yr.lineEnd=function(){Yr.point=Yr.lineEnd=q}},lineEnd:q,polygonStart:q,polygonEnd:q};function Zr(t,e){function n(e,n){var r=Math.cos(e),i=Math.cos(n),o=t(r*i);return[o*i*Math.sin(e),o*Math.sin(n)]}return n.invert=function(t,n){var r=Math.sqrt(t*t+n*n),i=e(r),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,r*a),Math.asin(r&&n*o/r)]},n}var $r=Zr((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(o.geo.azimuthalEqualArea=function(){return Or($r)}).raw=$r;var Kr=Zr((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),D);function Jr(t,e){var n=Math.cos(t),r=function(t){return Math.tan(Nt/4+t/2)},i=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(r(e)/r(t)),o=n*Math.pow(r(t),i)/i;if(!i)return ei;function a(t,e){o>0?e<-Ot+Ct&&(e=-Ot+Ct):e>Ot-Ct&&(e=Ot-Ct);var n=o/Math.pow(r(e),i);return[n*Math.sin(i*t),o-n*Math.cos(i*t)]}return a.invert=function(t,e){var n=o-e,r=It(i)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/i,2*Math.atan(Math.pow(o/r,1/i))-Ot]},a}function Qr(t,e){var n=Math.cos(t),r=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),i=n/r+t;if(k(r)1&&Rt(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function ci(t,e){return t[0]-e[0]||t[1]-e[1]}(o.geo.stereographic=function(){return Or(ii)}).raw=ii,oi.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ot]},(o.geo.transverseMercator=function(){var t=ni(oi),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=oi,o.geom={},o.geom.hull=function(t){var e=ai,n=si;if(arguments.length)return r(t);function r(t){if(t.length<3)return[];var r,i=xe(e),o=xe(n),a=t.length,s=[],u=[];for(r=0;r=0;--r)p.push(t[s[c[r]][2]]);for(r=+f;rCt)s=s.L;else{if(!((i=o-Ai(s,a))>Ct)){r>-Ct?(e=s.P,n=s):i>-Ct?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}var u=ki(t);if(gi.insert(e,u),e||n){if(e===n)return Pi(e),n=ki(e.site),gi.insert(u,n),u.edge=n.edge=ji(e.site,u.site),Ti(e),void Ti(n);if(n){Pi(e),Pi(n);var c=e.site,l=c.x,f=c.y,h=t.x-l,p=t.y-f,d=n.site,y=d.x-l,g=d.y-f,v=2*(h*g-p*y),x=h*h+p*p,m=y*y+g*g,b={x:(g*x-p*m)/v+l,y:(h*m-y*x)/v+f};Ri(n.edge,c,d,b),u.edge=ji(c,t,null,b),n.edge=ji(t,d,null,b),Ti(e),Ti(n)}else u.edge=ji(e.site,u.site)}}function Ei(t,e){var n=t.site,r=n.x,i=n.y,o=i-e;if(!o)return r;var a=t.P;if(!a)return-1/0;var s=(n=a.site).x,u=n.y,c=u-e;if(!c)return s;var l=s-r,f=1/o-1/c,h=l/c;return f?(-h+Math.sqrt(h*h-2*f*(l*l/(-2*c)-u+c/2+i-o/2)))/f+r:(r+s)/2}function Ai(t,e){var n=t.N;if(n)return Ei(n,e);var r=t.site;return r.y===e?r.x:1/0}function Ci(t){this.site=t,this.edges=[]}function Li(t,e){return e.angle-t.angle}function Ni(){Bi(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ti(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,o=n.site;if(r!==o){var a=i.x,s=i.y,u=r.x-a,c=r.y-s,l=o.x-a,f=2*(u*(g=o.y-s)-c*l);if(!(f>=-Lt)){var h=u*u+c*c,p=l*l+g*g,d=(g*h-c*p)/f,y=(u*p-l*h)/f,g=y+s,v=bi.pop()||new Ni;v.arc=t,v.site=i,v.x=d+a,v.y=g+Math.sqrt(d*d+y*y),v.cy=g,t.circle=v;for(var x=null,m=xi._;m;)if(v.y=s)return;if(h>d){if(o){if(o.y>=c)return}else o={x:g,y:u};n={x:g,y:c}}else{if(o){if(o.y1)if(h>d){if(o){if(o.y>=c)return}else o={x:(u-i)/r,y:u};n={x:(c-i)/r,y:c}}else{if(o){if(o.y=s)return}else o={x:a,y:r*a+i};n={x:s,y:r*s+i}}else{if(o){if(o.xCt||k(i-n)>Ct)&&(s.splice(a,0,new qi(Ii(o.site,l,k(r-f)Ct?{x:f,y:k(e-f)Ct?{x:k(n-d)Ct?{x:h,y:k(e-h)Ct?{x:k(n-p)=n&&c.x<=i&&c.y>=r&&c.y<=a?[[n,a],[i,a],[i,r],[n,r]]:[]).point=t[s]})),e}function s(t){return t.map((function(t,e){return{x:Math.round(r(t,e)/Ct)*Ct,y:Math.round(i(t,e)/Ct)*Ct,i:e}}))}return a.links=function(t){return Fi(s(t)).edges.filter((function(t){return t.l&&t.r})).map((function(e){return{source:t[e.l.i],target:t[e.r.i]}}))},a.triangles=function(t){var e=[];return Fi(s(t)).cells.forEach((function(n,r){for(var i,o,a,s,u=n.site,c=n.edges.sort(Li),l=-1,f=c.length,h=c[f-1].edge,p=h.l===u?h.r:h.l;++lo||f>a||h=w)<<1|e>=b,S=k+4;ko&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:Qi(n,r)})),o=no.lastIndex;return oy&&(y=u.x),u.y>g&&(g=u.y),c.push(u.x),l.push(u.y);else for(f=0;fy&&(y=m),b>g&&(g=b),c.push(m),l.push(b)}var w=y-p,S=g-d;function _(t,e,n,r,i,o,a,s){if(!isNaN(n)&&!isNaN(r))if(t.leaf){var u=t.x,c=t.y;if(null!=u)if(k(u-n)+k(c-r)<.01)M(t,e,n,r,i,o,a,s);else{var l=t.point;t.x=t.y=t.point=null,M(t,l,u,c,i,o,a,s),M(t,e,n,r,i,o,a,s)}else t.x=n,t.y=r,t.point=e}else M(t,e,n,r,i,o,a,s)}function M(t,e,n,r,i,o,a,s){var u=.5*(i+a),c=.5*(o+s),l=n>=u,f=r>=c,h=f<<1|l;t.leaf=!1,l?i=u:a=u,f?o=c:s=c,_(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,n,r,i,o,a,s)}w>S?g=d+w:y=p+S;var E={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){_(E,t,+v(t,++f),+x(t,f),p,d,y,g)},visit:function(t){Zi(t,E,p,d,y,g)},find:function(t){return $i(E,t[0],t[1],p,d,y,g)}};if(f=-1,null==e){for(;++f=0&&!(n=o.interpolators[r](t,e)););return n}function io(t,e){var n,r=[],i=[],o=t.length,a=e.length,s=Math.min(t.length,e.length);for(n=0;n=1?1:t(e)}}function co(t){return function(e){return 1-t(1-e)}}function lo(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function fo(t){return t*t}function ho(t){return t*t*t}function po(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function yo(t){return 1-Math.cos(t*Ot)}function go(t){return Math.pow(2,10*(t-1))}function vo(t){return 1-Math.sqrt(1-t*t)}function xo(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function mo(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function bo(t){var e,n,r,i=[t.a,t.b],o=[t.c,t.d],a=ko(i),s=wo(i,o),u=ko(((e=o)[0]+=(r=-s)*(n=i)[0],e[1]+=r*n[1],e))||0;i[0]*o[1]=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";return n=ao.get(n)||oo,uo((r=so.get(r)||D)(n.apply(null,a.call(arguments,1))))},o.interpolateHcl=function(t,e){t=o.hcl(t),e=o.hcl(e);var n=t.h,r=t.c,i=t.l,a=e.h-n,s=e.c-r,u=e.l-i;isNaN(s)&&(s=0,r=isNaN(r)?e.c:r);isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:a<-180&&(a+=360);return function(t){return Jt(n+a*t,r+s*t,i+u*t)+""}},o.interpolateHsl=function(t,e){t=o.hsl(t),e=o.hsl(e);var n=t.h,r=t.s,i=t.l,a=e.h-n,s=e.s-r,u=e.l-i;isNaN(s)&&(s=0,r=isNaN(r)?e.s:r);isNaN(a)?(a=0,n=isNaN(n)?e.h:n):a>180?a-=360:a<-180&&(a+=360);return function(t){return Zt(n+a*t,r+s*t,i+u*t)+""}},o.interpolateLab=function(t,e){t=o.lab(t),e=o.lab(e);var n=t.l,r=t.a,i=t.b,a=e.l-n,s=e.a-r,u=e.b-i;return function(t){return ne(n+a*t,r+s*t,i+u*t)+""}},o.interpolateRound=mo,o.transform=function(t){var e=u.createElementNS(o.ns.prefix.svg,"g");return(o.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new bo(n?n.matrix:So)})(t)},bo.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var So={a:1,b:0,c:0,d:1,e:0,f:0};function _o(t){return t.length?t.pop()+",":""}function Mo(t,e){var n=[],r=[];return t=o.transform(t),e=o.transform(e),function(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var i=n.push("translate(",null,",",null,")");r.push({i:i-4,x:Qi(t[0],e[0])},{i:i-2,x:Qi(t[1],e[1])})}else(e[0]||e[1])&&n.push("translate("+e+")")}(t.translate,e.translate,n,r),function(t,e,n,r){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),r.push({i:n.push(_o(n)+"rotate(",null,")")-2,x:Qi(t,e)})):e&&n.push(_o(n)+"rotate("+e+")")}(t.rotate,e.rotate,n,r),function(t,e,n,r){t!==e?r.push({i:n.push(_o(n)+"skewX(",null,")")-2,x:Qi(t,e)}):e&&n.push(_o(n)+"skewX("+e+")")}(t.skew,e.skew,n,r),function(t,e,n,r){if(t[0]!==e[0]||t[1]!==e[1]){var i=n.push(_o(n)+"scale(",null,",",null,")");r.push({i:i-4,x:Qi(t[0],e[0])},{i:i-2,x:Qi(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(_o(n)+"scale("+e+")")}(t.scale,e.scale,n,r),t=e=null,function(t){for(var e,i=-1,o=r.length;++i0?n=e:(t.c=null,t.t=NaN,t=null,u.end({type:"end",alpha:n=0})):e>0&&(u.start({type:"start",alpha:n=e}),t=Ee(s.tick)),s):n},s.start=function(){var t,e,n,o=v.length,u=x.length,l=c[0],d=c[1];for(t=0;t=0;)n.push(i[r])}function zo(t,e){for(var n=[t],r=[];null!=(t=n.pop());)if(r.push(t),(o=t.children)&&(i=o.length))for(var i,o,a=-1;++a=0;)a.push(l=c[u]),l.parent=o,l.depth=o.depth+1;n&&(o.value=0),o.children=c}else n&&(o.value=+n.call(r,o,o.depth)||0),delete o.children;return zo(i,(function(e){var r,i;t&&(r=e.children)&&r.sort(t),n&&(i=e.parent)&&(i.value+=e.value)})),s}return r.sort=function(e){return arguments.length?(t=e,r):t},r.children=function(t){return arguments.length?(e=t,r):e},r.value=function(t){return arguments.length?(n=t,r):n},r.revalue=function(t){return n&&(qo(t,(function(t){t.children&&(t.value=0)})),zo(t,(function(t){var e;t.children||(t.value=+n.call(r,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)}))),t},r},o.layout.partition=function(){var t=o.layout.hierarchy(),e=[1,1];function n(n,r){var i=t.call(this,n,r);return function t(e,n,r,i){var o=e.children;if(e.x=n,e.y=e.depth*i,e.dx=r,e.dy=i,o&&(a=o.length)){var a,s,u,c=-1;for(r=e.value?r/e.value:0;++cs&&(s=r),a.push(r)}for(n=0;ni&&(r=n,i=e);return r}function Qo(t){return t.reduce(ta,0)}function ta(t,e){return t+e[1]}function ea(t,e){return na(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function na(t,e){for(var n=-1,r=+t[0],i=(t[1]-r)/e,o=[];++n<=e;)o[n]=i*n+r;return o}function ra(t){return[o.min(t),o.max(t)]}function ia(t,e){return t.value-e.value}function oa(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function aa(t,e){t._pack_next=e,e._pack_prev=t}function sa(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return.999*i*i>n*n+r*r}function ua(t){if((e=t.children)&&(u=e.length)){var e,n,r,i,o,a,s,u,c=1/0,l=-1/0,f=1/0,h=-1/0;if(e.forEach(ca),(n=e[0]).x=-n.r,n.y=0,m(n),u>1&&((r=e[1]).x=r.r,r.y=0,m(r),u>2))for(fa(n,r,i=e[2]),m(i),oa(n,i),n._pack_prev=i,oa(i,r),r=n._pack_next,o=3;o0)for(a=-1;++a=f[0]&&u<=f[1]&&((s=c[o.bisect(h,u,1,d)-1]).y+=y,s.push(i[a]));return c}return i.value=function(t){return arguments.length?(e=t,i):e},i.range=function(t){return arguments.length?(n=xe(t),i):n},i.bins=function(t){return arguments.length?(r="number"==typeof t?function(e){return na(e,t)}:xe(t),i):r},i.frequency=function(e){return arguments.length?(t=!!e,i):t},i},o.layout.pack=function(){var t,e=o.layout.hierarchy().sort(ia),n=0,r=[1,1];function i(i,o){var a=e.call(this,i,o),s=a[0],u=r[0],c=r[1],l=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(s.x=s.y=0,zo(s,(function(t){t.r=+l(t.value)})),zo(s,ua),n){var f=n*(t?1:Math.max(2*s.r/u,2*s.r/c))/2;zo(s,(function(t){t.r+=f})),zo(s,ua),zo(s,(function(t){t.r-=f}))}return function t(e,n,r,i){var o=e.children;if(e.x=n+=i*e.x,e.y=r+=i*e.y,e.r*=i,o)for(var a=-1,s=o.length;++ap.x&&(p=t),t.depth>d.depth&&(d=t)}));var y=e(h,p)/2-h.x,g=n[0]/(p.x+e(p,h)/2+y),v=n[1]/(d.depth||1);qo(l,(function(t){t.x=(t.x+y)*g,t.y=t.depth*v}))}return c}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n.length){!function(t){var e,n=0,r=0,i=t.children,o=i.length;for(;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-o):t.z=o}else i&&(t.z=i.z+e(t._,i._));t.parent.A=function(t,n,r){if(n){for(var i,o=t,a=t,s=n,u=o.parent.children[0],c=o.m,l=a.m,f=s.m,h=u.m;s=da(s),o=pa(o),s&&o;)u=pa(u),(a=da(a)).a=t,(i=s.z+f-o.z-c+e(s._,o._))>0&&(ya(ga(s,t,r),t,i),c+=i,l+=i),f+=s.m,c+=o.m,h+=u.m,l+=a.m;s&&!da(a)&&(a.t=s,a.m+=f-l),o&&!pa(u)&&(u.t=o,u.m+=c-h,r=t)}return r}(t,i,t.parent.A||r[0])}function s(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=n[0],t.y=t.depth*n[1]}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(t){return arguments.length?(r=null==(n=t)?u:null,i):r?null:n},i.nodeSize=function(t){return arguments.length?(r=null==(n=t)?null:u,i):r?n:null},Ro(i,t)},o.layout.cluster=function(){var t=o.layout.hierarchy().sort(null).value(null),e=ha,n=[1,1],r=!1;function i(i,a){var s,u=t.call(this,i,a),c=u[0],l=0;zo(c,(function(t){var n=t.children;n&&n.length?(t.x=function(t){return t.reduce((function(t,e){return t+e.x}),0)/t.length}(n),t.y=function(t){return 1+o.max(t,(function(t){return t.y}))}(n)):(t.x=s?l+=e(t,s):0,t.y=0,s=t)}));var f=function t(e){var n=e.children;return n&&n.length?t(n[0]):e}(c),h=function t(e){var n,r=e.children;return r&&(n=r.length)?t(r[n-1]):e}(c),p=f.x-e(f,h)/2,d=h.x+e(h,f)/2;return zo(c,r?function(t){t.x=(t.x-c.x)*n[0],t.y=(c.y-t.y)*n[1]}:function(t){t.x=(t.x-p)/(d-p)*n[0],t.y=(1-(c.y?t.y/c.y:1))*n[1]}),u}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(t){return arguments.length?(r=null==(n=t),i):r?null:n},i.nodeSize=function(t){return arguments.length?(r=null!=(n=t),i):r?n:null},Ro(i,t)},o.layout.treemap=function(){var t,e=o.layout.hierarchy(),n=Math.round,r=[1,1],i=null,a=va,s=!1,u="squarify",c=.5*(1+Math.sqrt(5));function l(t,e){for(var n,r,i=-1,o=t.length;++i0;)s.push(n=c[i-1]),s.area+=n.area,"squarify"!==u||(r=p(s,y))<=h?(c.pop(),h=r):(s.area-=s.pop().area,d(s,y,o,!1),y=Math.min(o.dx,o.dy),s.length=s.area=0,h=1/0);s.length&&(d(s,y,o,!0),s.length=s.area=0),e.forEach(f)}}function h(t){var e=t.children;if(e&&e.length){var n,r=a(t),i=e.slice(),o=[];for(l(i,r.dx*r.dy/t.value),o.area=0;n=i.pop();)o.push(n),o.area+=n.area,null!=n.z&&(d(o,n.z?r.dx:r.dy,r,!i.length),o.length=o.area=0);e.forEach(h)}}function p(t,e){for(var n,r=t.area,i=0,o=1/0,a=-1,s=t.length;++ai&&(i=n));return e*=e,(r*=r)?Math.max(e*i*c/r,r/(e*o*c)):1/0}function d(t,e,r,i){var o,a=-1,s=t.length,u=r.x,c=r.y,l=e?n(t.area/e):0;if(e==r.dx){for((i||l>r.dy)&&(l=r.dy);++ar.dx)&&(l=r.dx);++a1);return t+e*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=o.random.normal.apply(o,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=o.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;n2?Ma:wa,s=i?Ao:Eo;return o=t(e,n,s,r),a=t(n,e,s,ro),u}function u(t){return o(t)}return u.invert=function(t){return a(t)},u.domain=function(t){return arguments.length?(e=t.map(Number),s()):e},u.range=function(t){return arguments.length?(n=t,s()):n},u.rangeRound=function(t){return u.range(t).interpolate(mo)},u.clamp=function(t){return arguments.length?(i=t,s()):i},u.interpolate=function(t){return arguments.length?(r=t,s()):r},u.ticks=function(t){return La(e,t)},u.tickFormat=function(t,n){return Na(e,t,n)},u.nice=function(t){return Aa(e,t),s()},u.copy=function(){return t(e,n,r,i)},s()}([0,1],[0,1],ro,!1)};var Ta={s:1,g:1,p:1,r:1,e:1};function Pa(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}o.scale.log=function(){return function t(e,n,r,i){function a(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return r?Math.pow(n,t):-Math.pow(n,-t)}function u(t){return e(a(t))}return u.invert=function(t){return s(e.invert(t))},u.domain=function(t){return arguments.length?(r=t[0]>=0,e.domain((i=t.map(Number)).map(a)),u):i},u.base=function(t){return arguments.length?(n=+t,e.domain(i.map(a)),u):n},u.nice=function(){var t=ka(i.map(a),r?Math:Da);return e.domain(t),i=t.map(s),u},u.ticks=function(){var t=ma(i),e=[],o=t[0],u=t[1],c=Math.floor(a(o)),l=Math.ceil(a(u)),f=n%1?2:n;if(isFinite(l-c)){if(r){for(;c0;h--)e.push(s(c)*h);for(c=0;e[c]u;l--);e=e.slice(c,l)}return e},u.tickFormat=function(t,e){if(!arguments.length)return Oa;arguments.length<2?e=Oa:"function"!=typeof e&&(e=o.format(e));var r=Math.max(1,n*t/u.ticks().length);return function(t){var i=t/s(Math.round(a(t)));return i*n0?r[t-1]:e[0],tf?0:1;if(c=Pt)return u(c,p)+(s?u(s,1-p):"")+"Z";var d,y,g,v,x,m,b,w,k,S,_,M,E=0,A=0,C=[];if((v=(+a.apply(this,arguments)||0)/2)&&(g=r===Ha?Math.sqrt(s*s+c*c):+r.apply(this,arguments),p||(A*=-1),c&&(A=zt(g/c*Math.sin(v))),s&&(E=zt(g/s*Math.sin(v)))),c){x=c*Math.cos(l+A),m=c*Math.sin(l+A),b=c*Math.cos(f-A),w=c*Math.sin(f-A);var L=Math.abs(f-l-2*A)<=Nt?0:1;if(A&&Wa(x,m,b,w)===p^L){var N=(l+f)/2;x=c*Math.cos(N),m=c*Math.sin(N),b=w=null}}else x=m=0;if(s){k=s*Math.cos(f-E),S=s*Math.sin(f-E),_=s*Math.cos(l+E),M=s*Math.sin(l+E);var T=Math.abs(l-f+2*E)<=Nt?0:1;if(E&&Wa(k,S,_,M)===1-p^T){var P=(l+f)/2;k=s*Math.cos(P),S=s*Math.sin(P),_=M=null}}else k=S=0;if(h>Ct&&(d=Math.min(Math.abs(c-s)/2,+n.apply(this,arguments)))>.001){y=s0?0:1}function Ya(t,e,n,r,i){var o=t[0]-e[0],a=t[1]-e[1],s=(i?r:-r)/Math.sqrt(o*o+a*a),u=s*a,c=-s*o,l=t[0]+u,f=t[1]+c,h=e[0]+u,p=e[1]+c,d=(l+h)/2,y=(f+p)/2,g=h-l,v=p-f,x=g*g+v*v,m=n-r,b=l*p-h*f,w=(v<0?-1:1)*Math.sqrt(Math.max(0,m*m*x-b*b)),k=(b*v-g*w)/x,S=(-b*g-v*w)/x,_=(b*v+g*w)/x,M=(-b*g+v*w)/x,E=k-d,A=S-y,C=_-d,L=M-y;return E*E+A*A>C*C+L*L&&(k=_,S=M),[[k-u,S-c],[k*n/m,S*n/m]]}function Za(t){var e=ai,n=si,r=Kn,i=Ka,o=i.key,a=.7;function s(o){var s,u=[],c=[],l=-1,f=o.length,h=xe(e),p=xe(n);function d(){u.push("M",i(t(c),a))}for(;++l1&&i.push("H",r[0]);return i.join("")},"step-before":Qa,"step-after":ts,basis:rs,"basis-open":function(t){if(t.length<4)return Ka(t);var e,n=[],r=-1,i=t.length,o=[0],a=[0];for(;++r<3;)e=t[r],o.push(e[0]),a.push(e[1]);n.push(is(ss,o)+","+is(ss,a)),--r;for(;++r9&&(i=3*e/Math.sqrt(i),a[s]=i*n,a[s+1]=i*r));s=-1;for(;++s<=u;)i=(t[Math.min(u,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}(t))}});function Ka(t){return t.length>1?t.join("L"):t+"Z"}function Ja(t){return t.join("L")+"Z"}function Qa(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e1){s=e[1],o=t[u],u++,r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var c=2;cNt)+",1 "+e}function u(t,e,n,r){return"Q 0,0 "+r}return o.radius=function(t){return arguments.length?(n=xe(t),o):n},o.source=function(e){return arguments.length?(t=xe(e),o):t},o.target=function(t){return arguments.length?(e=xe(t),o):e},o.startAngle=function(t){return arguments.length?(r=xe(t),o):r},o.endAngle=function(t){return arguments.length?(i=xe(t),o):i},o},o.svg.diagonal=function(){var t=Xr,e=Wr,n=ps;function r(r,i){var o=t.call(this,r,i),a=e.call(this,r,i),s=(o.y+a.y)/2,u=[o,{x:o.x,y:s},{x:a.x,y:s},a];return"M"+(u=u.map(n))[0]+"C"+u[1]+" "+u[2]+" "+u[3]}return r.source=function(e){return arguments.length?(t=xe(e),r):t},r.target=function(t){return arguments.length?(e=xe(t),r):e},r.projection=function(t){return arguments.length?(n=t,r):n},r},o.svg.diagonal.radial=function(){var t=o.svg.diagonal(),e=ps,n=t.projection;return t.projection=function(t){return arguments.length?n(ds(e=t)):e},t},o.svg.symbol=function(){var t=gs,e=ys;function n(n,r){return(xs.get(t.call(this,n,r))||vs)(e.call(this,n,r))}return n.type=function(e){return arguments.length?(t=xe(e),n):t},n.size=function(t){return arguments.length?(e=xe(t),n):e},n};var xs=o.map({circle:vs,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*bs)),n=e*bs;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/ms),n=e*ms/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/ms),n=e*ms/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});o.svg.symbolTypes=xs.keys();var ms=Math.sqrt(3),bs=Math.tan(30*Dt);$.transition=function(t){for(var e,n,r=_s||++As,i=Ns(t),o=[],a=Ms||{time:Date.now(),ease:po,delay:0,duration:250},s=-1,u=this.length;++s0;)c[--h].call(t,a);if(o>=1)return f.event&&f.event.end.call(t,t.__data__,e),--l.count?delete l[r]:delete t[n],1}f||(o=i.time,a=Ee((function(t){var e=f.delay;if(a.t=e+o,e<=t)return h(t-e);a.c=h}),0,o),f=l[r]={tween:new M,time:o,timer:a,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++l.count)}Es.call=$.call,Es.empty=$.empty,Es.node=$.node,Es.size=$.size,o.transition=function(t,e){return t&&t.transition?_s?t.transition(e):t:o.selection().transition(t)},o.transition.prototype=Es,Es.select=function(t){var e,n,r,i=this.id,o=this.namespace,a=[];t=K(t);for(var s=-1,u=this.length;++srect,.s>rect").attr("width",a[1]-a[0])}function y(t){t.select(".extent").attr("y",s[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function g(){var f,g,v=this,x=o.select(o.event.target),m=n.of(v,arguments),b=o.select(v),w=x.datum(),k=!/^(n|s)$/.test(w)&&r,S=!/^(e|w)$/.test(w)&&i,_=x.classed("extent"),M=_t(v),E=o.mouse(v),A=o.select(l(v)).on("keydown.brush",N).on("keyup.brush",T);if(o.event.changedTouches?A.on("touchmove.brush",P).on("touchend.brush",D):A.on("mousemove.brush",P).on("mouseup.brush",D),b.interrupt().selectAll("*").interrupt(),_)E[0]=a[0]-E[0],E[1]=s[0]-E[1];else if(w){var C=+/w$/.test(w),L=+/^n/.test(w);g=[a[1-C]-E[0],s[1-L]-E[1]],E[0]=a[C],E[1]=s[L]}else o.event.altKey&&(f=E.slice());function N(){32==o.event.keyCode&&(_||(f=null,E[0]-=a[1],E[1]-=s[1],_=2),H())}function T(){32==o.event.keyCode&&2==_&&(E[0]+=a[1],E[1]+=s[1],_=0,H())}function P(){var t=o.mouse(v),e=!1;g&&(t[0]+=g[0],t[1]+=g[1]),_||(o.event.altKey?(f||(f=[(a[0]+a[1])/2,(s[0]+s[1])/2]),E[0]=a[+(t[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Vs(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Vs(+e+1);return e}}:t))},r.ticks=function(t,e){var n=ma(r.domain()),o=null==t?i(n,10):"number"==typeof t?i(n,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(n[0],Vs(+n[1]+1),e<1?1:e)},r.tickFormat=function(){return n},r.copy=function(){return Gs(t.copy(),e,n)},Ea(r,t)}function Vs(t){return new Date(t)}qs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Hs:Bs,Hs.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Hs.toString=Bs.toString,Ie.second=Be((function(t){return new Re(1e3*Math.floor(t/1e3))}),(function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))}),(function(t){return t.getSeconds()})),Ie.seconds=Ie.second.range,Ie.seconds.utc=Ie.second.utc.range,Ie.minute=Be((function(t){return new Re(6e4*Math.floor(t/6e4))}),(function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))}),(function(t){return t.getMinutes()})),Ie.minutes=Ie.minute.range,Ie.minutes.utc=Ie.minute.utc.range,Ie.hour=Be((function(t){var e=t.getTimezoneOffset()/60;return new Re(36e5*(Math.floor(t/36e5-e)+e))}),(function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))}),(function(t){return t.getHours()})),Ie.hours=Ie.hour.range,Ie.hours.utc=Ie.hour.utc.range,Ie.month=Be((function(t){return(t=Ie.day(t)).setDate(1),t}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t){return t.getMonth()})),Ie.months=Ie.month.range,Ie.months.utc=Ie.month.utc.range;var Fs=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Us=[[Ie.second,1],[Ie.second,5],[Ie.second,15],[Ie.second,30],[Ie.minute,1],[Ie.minute,5],[Ie.minute,15],[Ie.minute,30],[Ie.hour,1],[Ie.hour,3],[Ie.hour,6],[Ie.hour,12],[Ie.day,1],[Ie.day,2],[Ie.week,1],[Ie.month,1],[Ie.month,3],[Ie.year,1]],Xs=qs.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",Kn]]),Ws={range:function(t,e,n){return o.range(Math.ceil(t/n)*n,+e,n).map(Vs)},floor:D,ceil:D};Us.year=Ie.year,Ie.scale=function(){return Gs(o.scale.linear(),Us,Xs)};var Ys=Us.map((function(t){return[t[0].utc,t[1]]})),Zs=zs.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",Kn]]);function $s(t){return JSON.parse(t.responseText)}function Ks(t){var e=u.createRange();return e.selectNode(u.body),e.createContextualFragment(t.responseText)}Ys.year=Ie.year.utc,Ie.scale.utc=function(){return Gs(o.scale.linear(),Ys,Zs)},o.text=me((function(t){return t.responseText})),o.json=function(t,e){return be(t,"application/json",$s,e)},o.html=function(t,e){return be(t,"text/html",Ks,e)},o.xml=me((function(t){return t.responseXML})),this.d3=o,void 0===(i="function"==typeof(r=o)?r.call(e,n,e,t):r)||(t.exports=i)}()},function(t,e){function n(t,e){this.x=t||0,this.y=e||0,Object.freeze(this)}n.prototype.distance=function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},n.prototype.manhattanDistance=function(t){var e=this.sub(t).abs();return e.x+e.y},n.prototype.abs=function(){return new n(Math.abs(this.x),Math.abs(this.y))},n.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},n.prototype.add=function(t){return new n(this.x+t.x,this.y+t.y)},n.prototype.sub=function(t){return new n(this.x-t.x,this.y-t.y)},t.exports=n},function(t,e,n){var r=n(1);function i(t){arguments.length>0&&this.init(t)}i.prototype.init=function(t){this.status=t,this.points=new Array},i.prototype.appendPoint=function(t){this.points.push(t)},i.prototype.appendPoints=function(t){this.points=this.points.concat(t)},i.intersectShapes=function(t,e){var n,r=t.getIntersectionParams(),o=e.getIntersectionParams();if(null!=r&&null!=o)if("Path"==r.name)n=i.intersectPathShape(t,e);else if("Path"==o.name)n=i.intersectPathShape(e,t);else{var a,s;if(r.name0&&L.length>0){t:for(var N=0;N0&&(v.status="Intersection"),v},i.intersectBezier2Bezier3=function(t,e,n,o,a,s,u){var c,l,f,h,p,d,y,g,v,x,m,b=new i("No Intersection");c=e.multiply(-2),p=t.add(c.add(n)),c=t.multiply(-2),l=e.multiply(2),d=c.add(l),y=new r(t.x,t.y),c=o.multiply(-1),l=a.multiply(3),f=s.multiply(-3),h=c.add(l.add(f.add(u))),g=new Vector2D(h.x,h.y),c=o.multiply(3),l=a.multiply(-6),f=s.multiply(3),h=c.add(l.add(f)),v=new Vector2D(h.x,h.y),c=o.multiply(-3),l=a.multiply(3),f=c.add(l),x=new Vector2D(f.x,f.y),m=new Vector2D(o.x,o.y);for(var w=y.x*y.x,k=y.y*y.y,S=d.x*d.x,_=d.y*d.y,M=p.x*p.x,E=p.y*p.y,A=m.x*m.x,C=m.y*m.y,L=x.x*x.x,N=x.y*x.y,T=v.x*v.x,P=v.y*v.y,O=g.x*g.x,D=g.y*g.y,j=new Polynomial(-2*p.x*p.y*g.x*g.y+M*D+E*O,-2*p.x*p.y*v.x*g.y-2*p.x*p.y*v.y*g.x+2*E*v.x*g.x+2*M*v.y*g.y,-2*p.x*x.x*p.y*g.y-2*p.x*p.y*x.y*g.x-2*p.x*p.y*v.x*v.y+2*x.x*E*g.x+E*T+M*(2*x.y*g.y+P),2*y.x*p.x*p.y*g.y+2*y.y*p.x*p.y*g.x+d.x*d.y*p.x*g.y+d.x*d.y*p.y*g.x-2*m.x*p.x*p.y*g.y-2*p.x*m.y*p.y*g.x-2*p.x*x.x*p.y*v.y-2*p.x*p.y*x.y*v.x-2*y.x*E*g.x-2*y.y*M*g.y+2*m.x*E*g.x+2*x.x*E*v.x-_*p.x*g.x-S*p.y*g.y+M*(2*m.y*g.y+2*x.y*v.y),2*y.x*p.x*p.y*v.y+2*y.y*p.x*p.y*v.x+d.x*d.y*p.x*v.y+d.x*d.y*p.y*v.x-2*m.x*p.x*p.y*v.y-2*p.x*m.y*p.y*v.x-2*p.x*x.x*p.y*x.y-2*y.x*E*v.x-2*y.y*M*v.y+2*m.x*E*v.x-_*p.x*v.x-S*p.y*v.y+L*E+M*(2*m.y*v.y+N),2*y.x*p.x*p.y*x.y+2*y.y*p.x*x.x*p.y+d.x*d.y*p.x*x.y+d.x*d.y*x.x*p.y-2*m.x*p.x*p.y*x.y-2*p.x*m.y*x.x*p.y-2*y.x*x.x*E-2*y.y*M*x.y+2*m.x*x.x*E-_*p.x*x.x-S*p.y*x.y+2*M*m.y*x.y,-2*y.x*y.y*p.x*p.y-y.x*d.x*d.y*p.y-y.y*d.x*d.y*p.x+2*y.x*p.x*m.y*p.y+2*y.y*m.x*p.x*p.y+d.x*m.x*d.y*p.y+d.x*d.y*p.x*m.y-2*m.x*p.x*m.y*p.y-2*y.x*m.x*E+y.x*_*p.x+y.y*S*p.y-2*y.y*M*m.y-m.x*_*p.x-S*m.y*p.y+w*E+k*M+A*E+M*C).getRootsInInterval(0,1),I=0;I0&&z.length>0){t:for(var B=0;B0&&(b.status="Intersection"),b},i.intersectBezier2Circle=function(t,e,n,r,o){return i.intersectBezier2Ellipse(t,e,n,r,o,o)},i.intersectBezier2Ellipse=function(t,e,n,o,a,s){var u,c,l,f,h,p=new i("No Intersection");u=e.multiply(-2),l=t.add(u.add(n)),u=t.multiply(-2),c=e.multiply(2),f=u.add(c),h=new r(t.x,t.y);for(var d=a*a,y=s*s,g=new Polynomial(y*l.x*l.x+d*l.y*l.y,2*(y*l.x*f.x+d*l.y*f.y),y*(2*l.x*h.x+f.x*f.x)+d*(2*l.y*h.y+f.y*f.y)-2*(y*o.x*l.x+d*o.y*l.y),2*(y*f.x*(h.x-o.x)+d*f.y*(h.y-o.y)),y*(h.x*h.x+o.x*o.x)+d*(h.y*h.y+o.y*o.y)-2*(y*o.x*h.x+d*o.y*h.y)-d*y).getRoots(),v=0;v0&&(p.status="Intersection"),p},i.intersectBezier2Line=function(t,e,n,o,a){var s,u,c,l,f,h,p,d=o.min(a),y=o.max(a),g=new i("No Intersection");s=e.multiply(-2),c=t.add(s.add(n)),s=t.multiply(-2),u=e.multiply(2),l=s.add(u),f=new r(t.x,t.y),p=new Vector2D(o.y-a.y,a.x-o.x),h=o.x*a.y-a.x*o.y,roots=new Polynomial(p.dot(c),p.dot(l),p.dot(f)+h).getRoots();for(var v=0;v0&&(o.status="Intersection"),o},i.intersectBezier2Rectangle=function(t,e,n,o,a){var s=o.min(a),u=o.max(a),c=new r(u.x,s.y),l=new r(s.x,u.y),f=i.intersectBezier2Line(t,e,n,s,c),h=i.intersectBezier2Line(t,e,n,c,u),p=i.intersectBezier2Line(t,e,n,u,l),d=i.intersectBezier2Line(t,e,n,l,s),y=new i("No Intersection");return y.appendPoints(f.points),y.appendPoints(h.points),y.appendPoints(p.points),y.appendPoints(d.points),y.points.length>0&&(y.status="Intersection"),y},i.intersectBezier3Bezier3=function(t,e,n,r,o,a,s,u){var c,l,f,h,p,d,y,g,v,x,m,b,w=new i("No Intersection");c=t.multiply(-1),l=e.multiply(3),f=n.multiply(-3),h=c.add(l.add(f.add(r))),p=new Vector2D(h.x,h.y),c=t.multiply(3),l=e.multiply(-6),f=n.multiply(3),h=c.add(l.add(f)),d=new Vector2D(h.x,h.y),c=t.multiply(-3),l=e.multiply(3),f=c.add(l),y=new Vector2D(f.x,f.y),g=new Vector2D(t.x,t.y),c=o.multiply(-1),l=a.multiply(3),f=s.multiply(-3),h=c.add(l.add(f.add(u))),v=new Vector2D(h.x,h.y),c=o.multiply(3),l=a.multiply(-6),f=s.multiply(3),h=c.add(l.add(f)),x=new Vector2D(h.x,h.y),c=o.multiply(-3),l=a.multiply(3),f=c.add(l),m=new Vector2D(f.x,f.y),b=new Vector2D(o.x,o.y);for(var k=g.x*g.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b.y*d.y*p.y-3*k*y.y*d.y*p.x*p.y+2*E*y.y*b.y*p.x*p.y+E*d.x*b.y*d.y*p.y-3*q*y.y*d.y*p.x*p.y-S*R+M*j+z*R-H*j-3*g.x*q*R-g.x*L*D+3*k*b.x*R+g.y*A*I+3*g.y*B*j+b.x*L*D+k*O*p.x-3*_*b.y*j-_*T*p.y+q*O*p.x-A*b.y*I-T*B*p.y-g.x*E*y.y*I+g.y*y.x*C*D-3*g.x*_*D*p.y-g.x*C*N*p.y+g.y*E*P*p.x-y.x*C*b.y*D+3*k*g.y*p.x*I+k*y.x*d.y*I+2*k*y.y*d.x*I-2*_*y.x*d.y*D-_*y.y*d.x*D+E*b.x*y.y*I-3*g.x*B*D*p.y+3*g.y*q*p.x*I+y.x*q*d.y*I-2*y.x*B*d.y*D+b.x*C*N*p.y-y.y*d.x*B*D-k*d.x*P*p.y-3*k*b.y*p.x*I+3*_*b.x*D*p.y+_*N*d.y*p.x-E*b.y*P*p.x+2*q*y.y*d.x*I+3*b.x*B*D*p.y-q*d.x*P*p.y-3*q*b.y*p.x*I+N*B*d.y*p.x).getRootsInInterval(0,1),Q=0;Q0&&nt.length>0){t:for(var rt=0;rt0&&(w.status="Intersection"),w},i.intersectBezier3Circle=function(t,e,n,r,o,a){return i.intersectBezier3Ellipse(t,e,n,r,o,a,a)},i.intersectBezier3Ellipse=function(t,e,n,r,o,a,s){var u,c,l,f,h,p,d,y,g=new i("No Intersection");u=t.multiply(-1),c=e.multiply(3),l=n.multiply(-3),f=u.add(c.add(l.add(r))),h=new Vector2D(f.x,f.y),u=t.multiply(3),c=e.multiply(-6),l=n.multiply(3),f=u.add(c.add(l)),p=new Vector2D(f.x,f.y),u=t.multiply(-3),c=e.multiply(3),l=u.add(c),d=new Vector2D(l.x,l.y),y=new Vector2D(t.x,t.y);for(var v=a*a,x=s*s,m=new Polynomial(h.x*h.x*x+h.y*h.y*v,2*(h.x*p.x*x+h.y*p.y*v),2*(h.x*d.x*x+h.y*d.y*v)+p.x*p.x*x+p.y*p.y*v,2*h.x*x*(y.x-o.x)+2*h.y*v*(y.y-o.y)+2*(p.x*d.x*x+p.y*d.y*v),2*p.x*x*(y.x-o.x)+2*p.y*v*(y.y-o.y)+d.x*d.x*x+d.y*d.y*v,2*d.x*x*(y.x-o.x)+2*d.y*v*(y.y-o.y),y.x*y.x*x-2*y.y*o.y*v-2*y.x*o.x*x+y.y*y.y*v+o.x*o.x*x+o.y*o.y*v-v*x).getRootsInInterval(0,1),b=0;b0&&(g.status="Intersection"),g},i.intersectBezier3Line=function(t,e,n,r,o,a){var s,u,c,l,f,h,p,d,y,g,v=o.min(a),x=o.max(a),m=new i("No Intersection");s=t.multiply(-1),u=e.multiply(3),c=n.multiply(-3),l=s.add(u.add(c.add(r))),f=new Vector2D(l.x,l.y),s=t.multiply(3),u=e.multiply(-6),c=n.multiply(3),l=s.add(u.add(c)),h=new Vector2D(l.x,l.y),s=t.multiply(-3),u=e.multiply(3),c=s.add(u),p=new Vector2D(c.x,c.y),d=new Vector2D(t.x,t.y),g=new Vector2D(o.y-a.y,a.x-o.x),y=o.x*a.y-a.x*o.y,roots=new Polynomial(g.dot(f),g.dot(h),g.dot(p),g.dot(d)+y).getRoots();for(var b=0;b0&&(a.status="Intersection"),a},i.intersectBezier3Rectangle=function(t,e,n,o,a,s){var u=a.min(s),c=a.max(s),l=new r(c.x,u.y),f=new r(u.x,c.y),h=i.intersectBezier3Line(t,e,n,o,u,l),p=i.intersectBezier3Line(t,e,n,o,l,c),d=i.intersectBezier3Line(t,e,n,o,c,f),y=i.intersectBezier3Line(t,e,n,o,f,u),g=new i("No Intersection");return g.appendPoints(h.points),g.appendPoints(p.points),g.appendPoints(d.points),g.appendPoints(y.points),g.points.length>0&&(g.status="Intersection"),g},i.intersectCircleCircle=function(t,e,n,o){var a,s=e+o,u=Math.abs(e-o),c=t.distanceFrom(n);if(c>s)a=new i("Outside");else if(c1)&&(f<0||f>1)?o=new i(l<0&&f<0||l>1&&f>1?"Outside":"Inside"):(o=new i("Intersection"),0<=l&&l<=1&&o.points.push(n.lerp(r,l)),0<=f&&f<=1&&o.points.push(n.lerp(r,f)))}return o},i.intersectCirclePolygon=function(t,e,n){for(var r,o=new i("No Intersection"),a=n.length,s=0;s0?o.status="Intersection":o.status=r.status,o},i.intersectCircleRectangle=function(t,e,n,o){var a=n.min(o),s=n.max(o),u=new r(s.x,a.y),c=new r(a.x,s.y),l=i.intersectCircleLine(t,e,a,u),f=i.intersectCircleLine(t,e,u,s),h=i.intersectCircleLine(t,e,s,c),p=i.intersectCircleLine(t,e,c,a),d=new i("No Intersection");return d.appendPoints(l.points),d.appendPoints(f.points),d.appendPoints(h.points),d.appendPoints(p.points),d.points.length>0?d.status="Intersection":d.status=l.status,d},i.intersectEllipseEllipse=function(t,e,n,o,a,s){for(var u=[n*n,0,e*e,-2*n*n*t.x,-2*e*e*t.y,n*n*t.x*t.x+e*e*t.y*t.y-e*e*n*n],c=[s*s,0,a*a,-2*s*s*o.x,-2*a*a*o.y,s*s*o.x*o.x+a*a*o.y*o.y-a*a*s*s],l=i.bezout(u,c).getRoots(),f=.001*(u[0]*u[0]+2*u[1]*u[1]+u[2]*u[2]),h=.001*(c[0]*c[0]+2*c[1]*c[1]+c[2]*c[2]),p=new i("No Intersection"),d=0;d0&&(p.status="Intersection"),p},i.intersectEllipseLine=function(t,e,n,r,o){var a,s=new Vector2D(r.x,r.y),u=Vector2D.fromPoints(r,o),c=new Vector2D(t.x,t.y),l=s.subtract(c),f=new Vector2D(u.x/(e*e),u.y/(n*n)),h=new Vector2D(l.x/(e*e),l.y/(n*n)),p=u.dot(f),d=u.dot(h),y=d*d-p*(t=l.dot(h)-1);if(y<0)a=new i("Outside");else if(y>0){var g=Math.sqrt(y),v=(-d-g)/p,x=(-d+g)/p;(v<0||11&&x>1?"Outside":"Inside"):(a=new i("Intersection"),0<=v&&v<=1&&a.appendPoint(r.lerp(o,v)),0<=x&&x<=1&&a.appendPoint(r.lerp(o,x)))}else{var m=-d/p;0<=m&&m<=1?(a=new i("Intersection")).appendPoint(r.lerp(o,m)):a=new i("Outside")}return a},i.intersectEllipsePolygon=function(t,e,n,r){for(var o=new i("No Intersection"),a=r.length,s=0;s0&&(o.status="Intersection"),o},i.intersectEllipseRectangle=function(t,e,n,o,a){var s=o.min(a),u=o.max(a),c=new r(u.x,s.y),l=new r(s.x,u.y),f=i.intersectEllipseLine(t,e,n,s,c),h=i.intersectEllipseLine(t,e,n,c,u),p=i.intersectEllipseLine(t,e,n,u,l),d=i.intersectEllipseLine(t,e,n,l,s),y=new i("No Intersection");return y.appendPoints(f.points),y.appendPoints(h.points),y.appendPoints(p.points),y.appendPoints(d.points),y.points.length>0&&(y.status="Intersection"),y},i.intersectLineLine=function(t,e,n,o){var a,s=(o.x-n.x)*(t.y-n.y)-(o.y-n.y)*(t.x-n.x),u=(e.x-t.x)*(t.y-n.y)-(e.y-t.y)*(t.x-n.x),c=(o.y-n.y)*(e.x-t.x)-(o.x-n.x)*(e.y-t.y);if(0!=c){var l=s/c,f=u/c;0<=l&&l<=1&&0<=f&&f<=1?(a=new i("Intersection")).points.push(new r(t.x+l*(e.x-t.x),t.y+l*(e.y-t.y))):a=new i("No Intersection")}else a=new i(0==s||0==u?"Coincident":"Parallel");return a},i.intersectLinePolygon=function(t,e,n){for(var r=new i("No Intersection"),o=n.length,a=0;a0&&(r.status="Intersection"),r},i.intersectLineRectangle=function(t,e,n,o){var a=n.min(o),s=n.max(o),u=new r(s.x,a.y),c=new r(a.x,s.y),l=i.intersectLineLine(a,u,t,e),f=i.intersectLineLine(u,s,t,e),h=i.intersectLineLine(s,c,t,e),p=i.intersectLineLine(c,a,t,e),d=new i("No Intersection");return d.appendPoints(l.points),d.appendPoints(f.points),d.appendPoints(h.points),d.appendPoints(p.points),d.points.length>0&&(d.status="Intersection"),d},i.intersectPolygonPolygon=function(t,e){for(var n=new i("No Intersection"),r=t.length,o=0;o0&&(n.status="Intersection"),n},i.intersectPolygonRectangle=function(t,e,n){var o=e.min(n),a=e.max(n),s=new r(a.x,o.y),u=new r(o.x,a.y),c=i.intersectLinePolygon(o,s,t),l=i.intersectLinePolygon(s,a,t),f=i.intersectLinePolygon(a,u,t),h=i.intersectLinePolygon(u,o,t),p=new i("No Intersection");return p.appendPoints(c.points),p.appendPoints(l.points),p.appendPoints(f.points),p.appendPoints(h.points),p.points.length>0&&(p.status="Intersection"),p},i.intersectRayRay=function(t,e,n,o){var a,s=(o.x-n.x)*(t.y-n.y)-(o.y-n.y)*(t.x-n.x),u=(e.x-t.x)*(t.y-n.y)-(e.y-t.y)*(t.x-n.x),c=(o.y-n.y)*(e.x-t.x)-(o.x-n.x)*(e.y-t.y);if(0!=c){var l=s/c;(a=new i("Intersection")).points.push(new r(t.x+l*(e.x-t.x),t.y+l*(e.y-t.y)))}else a=new i(0==s||0==u?"Coincident":"Parallel");return a},i.intersectRectangleRectangle=function(t,e,n,o){var a=t.min(e),s=t.max(e),u=new r(s.x,a.y),c=new r(a.x,s.y),l=i.intersectLineRectangle(a,u,n,o),f=i.intersectLineRectangle(u,s,n,o),h=i.intersectLineRectangle(s,c,n,o),p=i.intersectLineRectangle(c,a,n,o),d=new i("No Intersection");return d.appendPoints(l.points),d.appendPoints(f.points),d.appendPoints(h.points),d.appendPoints(p.points),d.points.length>0&&(d.status="Intersection"),d},i.bezout=function(t,e){var n=t[0]*e[1]-e[0]*t[1],r=t[0]*e[2]-e[0]*t[2],i=t[0]*e[3]-e[0]*t[3],o=t[0]*e[4]-e[0]*t[4],a=t[0]*e[5]-e[0]*t[5],s=t[1]*e[2]-e[1]*t[2],u=t[1]*e[4]-e[1]*t[4],c=t[1]*e[5]-e[1]*t[5],l=t[2]*e[3]-e[2]*t[3],f=t[3]*e[4]-e[3]*t[4],h=t[3]*e[5]-e[3]*t[5],p=c+f,d=u-l;return new Polynomial(n*s-r*r,n*d+i*s-2*r*o,n*p+i*d-o*o-2*r*a,n*h+i*p-2*o*a,i*h-a*a)},t.exports=i},function(t,e,n){t.exports=function(){"use strict";var t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},e=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],n=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},r=function(){function t(t,e){for(var n=0;n255&&(this.r=255),this.g<0||Number.isNaN(this.g)||void 0===this.g?this.g=0:this.g>255&&(this.g=255),this.b<0||Number.isNaN(this.b)||void 0===this.b?this.b=0:this.b>255&&(this.b=255)}}return r(i,[{key:"isValid",value:function(){return this.ok}},{key:"rgb",value:function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"}},{key:"hex",value:function(){var t=this.r.toString(16),e=this.g.toString(16),n=this.b.toString(16);return 1===t.length&&(t="0"+t),1===e.length&&(e="0"+e),1===n.length&&(n="0"+n),"#"+t+e+n}},{key:"channels",value:function(){return{r:this.r,g:this.g,b:this.b}}}]),i}();return function(t){return new i(t)}}()},function(t,e,n){var r; +/*! + * jQuery JavaScript Library v3.6.0 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2021-03-02T17:08Z + */!function(e,n){"use strict";"object"==typeof t.exports?t.exports=e.document?n(e,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return n(t)}:n(e)}("undefined"!=typeof window?window:this,(function(n,i){"use strict";var o=[],a=Object.getPrototypeOf,s=o.slice,u=o.flat?function(t){return o.flat.call(t)}:function(t){return o.concat.apply([],t)},c=o.push,l=o.indexOf,f={},h=f.toString,p=f.hasOwnProperty,d=p.toString,y=d.call(Object),g={},v=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType&&"function"!=typeof t.item},x=function(t){return null!=t&&t===t.window},m=n.document,b={type:!0,src:!0,nonce:!0,noModule:!0};function w(t,e,n){var r,i,o=(n=n||m).createElement("script");if(o.text=t,e)for(r in b)(i=e[r]||e.getAttribute&&e.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function k(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?f[h.call(t)]||"object":typeof t}var S=function(t,e){return new S.fn.init(t,e)};function _(t){var e=!!t&&"length"in t&&t.length,n=k(t);return!v(t)&&!x(t)&&("array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t)}S.fn=S.prototype={jquery:"3.6.0",constructor:S,length:0,toArray:function(){return s.call(this)},get:function(t){return null==t?s.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=S.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return S.each(this,t)},map:function(t){return this.pushStack(S.map(this,(function(e,n){return t.call(e,n,e)})))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,(function(t,e){return(e+1)%2})))},odd:function(){return this.pushStack(S.grep(this,(function(t,e){return e%2})))},eq:function(t){var e=this.length,n=+t+(t<0?e:0);return this.pushStack(n>=0&&n+~]|"+R+")"+R+"*"),U=new RegExp(R+"|>"),X=new RegExp(B),W=new RegExp("^"+q+"$"),Y={ID:new RegExp("^#("+q+")"),CLASS:new RegExp("^\\.("+q+")"),TAG:new RegExp("^("+q+"|[*])"),ATTR:new RegExp("^"+z),PSEUDO:new RegExp("^"+B),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+R+"*(even|odd|(([+-]|)(\\d*)n|)"+R+"*(?:([+-]|)"+R+"*(\\d+)|))"+R+"*\\)|)","i"),bool:new RegExp("^(?:"+I+")$","i"),needsContext:new RegExp("^"+R+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+R+"*((?:-\\d)?\\d*)"+R+"*\\)|)(?=[^-]|$)","i")},Z=/HTML$/i,$=/^(?:input|select|textarea|button)$/i,K=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,Q=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,tt=/[+~]/,et=new RegExp("\\\\[\\da-fA-F]{1,6}"+R+"?|\\\\([^\\r\\n\\f])","g"),nt=function(t,e){var n="0x"+t.slice(1)-65536;return e||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},rt=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,it=function(t,e){return e?"\0"===t?"๏ฟฝ":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},ot=function(){h()},at=bt((function(t){return!0===t.disabled&&"fieldset"===t.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{O.apply(N=D.call(w.childNodes),w.childNodes),N[w.childNodes.length].nodeType}catch(t){O={apply:N.length?function(t,e){P.apply(t,D.call(e))}:function(t,e){for(var n=t.length,r=0;t[n++]=e[r++];);t.length=n-1}}}function st(t,e,r,i){var o,s,c,l,f,d,v,x=e&&e.ownerDocument,w=e?e.nodeType:9;if(r=r||[],"string"!=typeof t||!t||1!==w&&9!==w&&11!==w)return r;if(!i&&(h(e),e=e||p,y)){if(11!==w&&(f=Q.exec(t)))if(o=f[1]){if(9===w){if(!(c=e.getElementById(o)))return r;if(c.id===o)return r.push(c),r}else if(x&&(c=x.getElementById(o))&&m(e,c)&&c.id===o)return r.push(c),r}else{if(f[2])return O.apply(r,e.getElementsByTagName(t)),r;if((o=f[3])&&n.getElementsByClassName&&e.getElementsByClassName)return O.apply(r,e.getElementsByClassName(o)),r}if(n.qsa&&!A[t+" "]&&(!g||!g.test(t))&&(1!==w||"object"!==e.nodeName.toLowerCase())){if(v=t,x=e,1===w&&(U.test(t)||F.test(t))){for((x=tt.test(t)&&vt(e.parentNode)||e)===e&&n.scope||((l=e.getAttribute("id"))?l=l.replace(rt,it):e.setAttribute("id",l=b)),s=(d=a(t)).length;s--;)d[s]=(l?"#"+l:":scope")+" "+mt(d[s]);v=d.join(",")}try{return O.apply(r,x.querySelectorAll(v)),r}catch(e){A(t,!0)}finally{l===b&&e.removeAttribute("id")}}}return u(t.replace(G,"$1"),e,r,i)}function ut(){var t=[];return function e(n,i){return t.push(n+" ")>r.cacheLength&&delete e[t.shift()],e[n+" "]=i}}function ct(t){return t[b]=!0,t}function lt(t){var e=p.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function ft(t,e){for(var n=t.split("|"),i=n.length;i--;)r.attrHandle[n[i]]=e}function ht(t,e){var n=e&&t,r=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function pt(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function dt(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function yt(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&at(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function gt(t){return ct((function(e){return e=+e,ct((function(n,r){for(var i,o=t([],n.length,e),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))}))}))}function vt(t){return t&&void 0!==t.getElementsByTagName&&t}for(e in n=st.support={},o=st.isXML=function(t){var e=t&&t.namespaceURI,n=t&&(t.ownerDocument||t).documentElement;return!Z.test(e||n&&n.nodeName||"HTML")},h=st.setDocument=function(t){var e,i,a=t?t.ownerDocument||t:w;return a!=p&&9===a.nodeType&&a.documentElement?(d=(p=a).documentElement,y=!o(p),w!=p&&(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",ot,!1):i.attachEvent&&i.attachEvent("onunload",ot)),n.scope=lt((function(t){return d.appendChild(t).appendChild(p.createElement("div")),void 0!==t.querySelectorAll&&!t.querySelectorAll(":scope fieldset div").length})),n.attributes=lt((function(t){return t.className="i",!t.getAttribute("className")})),n.getElementsByTagName=lt((function(t){return t.appendChild(p.createComment("")),!t.getElementsByTagName("*").length})),n.getElementsByClassName=J.test(p.getElementsByClassName),n.getById=lt((function(t){return d.appendChild(t).id=b,!p.getElementsByName||!p.getElementsByName(b).length})),n.getById?(r.filter.ID=function(t){var e=t.replace(et,nt);return function(t){return t.getAttribute("id")===e}},r.find.ID=function(t,e){if(void 0!==e.getElementById&&y){var n=e.getElementById(t);return n?[n]:[]}}):(r.filter.ID=function(t){var e=t.replace(et,nt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},r.find.ID=function(t,e){if(void 0!==e.getElementById&&y){var n,r,i,o=e.getElementById(t);if(o){if((n=o.getAttributeNode("id"))&&n.value===t)return[o];for(i=e.getElementsByName(t),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===t)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):n.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,r=[],i=0,o=e.getElementsByTagName(t);if("*"===t){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&y)return e.getElementsByClassName(t)},v=[],g=[],(n.qsa=J.test(p.querySelectorAll))&&(lt((function(t){var e;d.appendChild(t).innerHTML="",t.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+R+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||g.push("\\["+R+"*(?:value|"+I+")"),t.querySelectorAll("[id~="+b+"-]").length||g.push("~="),(e=p.createElement("input")).setAttribute("name",""),t.appendChild(e),t.querySelectorAll("[name='']").length||g.push("\\["+R+"*name"+R+"*="+R+"*(?:''|\"\")"),t.querySelectorAll(":checked").length||g.push(":checked"),t.querySelectorAll("a#"+b+"+*").length||g.push(".#.+[+~]"),t.querySelectorAll("\\\f"),g.push("[\\r\\n\\f]")})),lt((function(t){t.innerHTML="";var e=p.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&g.push("name"+R+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),d.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),g.push(",.*:")}))),(n.matchesSelector=J.test(x=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&<((function(t){n.disconnectedMatch=x.call(t,"*"),x.call(t,"[s!='']:x"),v.push("!=",B)})),g=g.length&&new RegExp(g.join("|")),v=v.length&&new RegExp(v.join("|")),e=J.test(d.compareDocumentPosition),m=e||J.test(d.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,r=e&&e.parentNode;return t===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):t.compareDocumentPosition&&16&t.compareDocumentPosition(r)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},C=e?function(t,e){if(t===e)return f=!0,0;var r=!t.compareDocumentPosition-!e.compareDocumentPosition;return r||(1&(r=(t.ownerDocument||t)==(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!n.sortDetached&&e.compareDocumentPosition(t)===r?t==p||t.ownerDocument==w&&m(w,t)?-1:e==p||e.ownerDocument==w&&m(w,e)?1:l?j(l,t)-j(l,e):0:4&r?-1:1)}:function(t,e){if(t===e)return f=!0,0;var n,r=0,i=t.parentNode,o=e.parentNode,a=[t],s=[e];if(!i||!o)return t==p?-1:e==p?1:i?-1:o?1:l?j(l,t)-j(l,e):0;if(i===o)return ht(t,e);for(n=t;n=n.parentNode;)a.unshift(n);for(n=e;n=n.parentNode;)s.unshift(n);for(;a[r]===s[r];)r++;return r?ht(a[r],s[r]):a[r]==w?-1:s[r]==w?1:0},p):p},st.matches=function(t,e){return st(t,null,null,e)},st.matchesSelector=function(t,e){if(h(t),n.matchesSelector&&y&&!A[e+" "]&&(!v||!v.test(e))&&(!g||!g.test(e)))try{var r=x.call(t,e);if(r||n.disconnectedMatch||t.document&&11!==t.document.nodeType)return r}catch(t){A(e,!0)}return st(e,p,null,[t]).length>0},st.contains=function(t,e){return(t.ownerDocument||t)!=p&&h(t),m(t,e)},st.attr=function(t,e){(t.ownerDocument||t)!=p&&h(t);var i=r.attrHandle[e.toLowerCase()],o=i&&L.call(r.attrHandle,e.toLowerCase())?i(t,e,!y):void 0;return void 0!==o?o:n.attributes||!y?t.getAttribute(e):(o=t.getAttributeNode(e))&&o.specified?o.value:null},st.escape=function(t){return(t+"").replace(rt,it)},st.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},st.uniqueSort=function(t){var e,r=[],i=0,o=0;if(f=!n.detectDuplicates,l=!n.sortStable&&t.slice(0),t.sort(C),f){for(;e=t[o++];)e===t[o]&&(i=r.push(o));for(;i--;)t.splice(r[i],1)}return l=null,t},i=st.getText=function(t){var e,n="",r=0,o=t.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=i(t)}else if(3===o||4===o)return t.nodeValue}else for(;e=t[r++];)n+=i(e);return n},(r=st.selectors={cacheLength:50,createPseudo:ct,match:Y,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(et,nt),t[3]=(t[3]||t[4]||t[5]||"").replace(et,nt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||st.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&st.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return Y.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&X.test(n)&&(e=a(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(et,nt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=_[t+" "];return e||(e=new RegExp("(^|"+R+")"+t+"("+R+"|$)"))&&_(t,(function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")}))},ATTR:function(t,e,n){return function(r){var i=st.attr(r,t);return null==i?"!="===e:!e||(i+="","="===e?i===n:"!="===e?i!==n:"^="===e?n&&0===i.indexOf(n):"*="===e?n&&i.indexOf(n)>-1:"$="===e?n&&i.slice(-n.length)===n:"~="===e?(" "+i.replace(H," ")+" ").indexOf(n)>-1:"|="===e&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(t,e,n,r,i){var o="nth"!==t.slice(0,3),a="last"!==t.slice(-4),s="of-type"===e;return 1===r&&0===i?function(t){return!!t.parentNode}:function(e,n,u){var c,l,f,h,p,d,y=o!==a?"nextSibling":"previousSibling",g=e.parentNode,v=s&&e.nodeName.toLowerCase(),x=!u&&!s,m=!1;if(g){if(o){for(;y;){for(h=e;h=h[y];)if(s?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;d=y="only"===t&&!d&&"nextSibling"}return!0}if(d=[a?g.firstChild:g.lastChild],a&&x){for(m=(p=(c=(l=(f=(h=g)[b]||(h[b]={}))[h.uniqueID]||(f[h.uniqueID]={}))[t]||[])[0]===k&&c[1])&&c[2],h=p&&g.childNodes[p];h=++p&&h&&h[y]||(m=p=0)||d.pop();)if(1===h.nodeType&&++m&&h===e){l[t]=[k,p,m];break}}else if(x&&(m=p=(c=(l=(f=(h=e)[b]||(h[b]={}))[h.uniqueID]||(f[h.uniqueID]={}))[t]||[])[0]===k&&c[1]),!1===m)for(;(h=++p&&h&&h[y]||(m=p=0)||d.pop())&&((s?h.nodeName.toLowerCase()!==v:1!==h.nodeType)||!++m||(x&&((l=(f=h[b]||(h[b]={}))[h.uniqueID]||(f[h.uniqueID]={}))[t]=[k,m]),h!==e)););return(m-=i)===r||m%r==0&&m/r>=0}}},PSEUDO:function(t,e){var n,i=r.pseudos[t]||r.setFilters[t.toLowerCase()]||st.error("unsupported pseudo: "+t);return i[b]?i(e):i.length>1?(n=[t,t,"",e],r.setFilters.hasOwnProperty(t.toLowerCase())?ct((function(t,n){for(var r,o=i(t,e),a=o.length;a--;)t[r=j(t,o[a])]=!(n[r]=o[a])})):function(t){return i(t,0,n)}):i}},pseudos:{not:ct((function(t){var e=[],n=[],r=s(t.replace(G,"$1"));return r[b]?ct((function(t,e,n,i){for(var o,a=r(t,null,i,[]),s=t.length;s--;)(o=a[s])&&(t[s]=!(e[s]=o))})):function(t,i,o){return e[0]=t,r(e,null,o,n),e[0]=null,!n.pop()}})),has:ct((function(t){return function(e){return st(t,e).length>0}})),contains:ct((function(t){return t=t.replace(et,nt),function(e){return(e.textContent||i(e)).indexOf(t)>-1}})),lang:ct((function(t){return W.test(t||"")||st.error("unsupported lang: "+t),t=t.replace(et,nt).toLowerCase(),function(e){var n;do{if(n=y?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}})),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===d},focus:function(t){return t===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:yt(!1),disabled:yt(!0),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!r.pseudos.empty(t)},header:function(t){return K.test(t.nodeName)},input:function(t){return $.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:gt((function(){return[0]})),last:gt((function(t,e){return[e-1]})),eq:gt((function(t,e,n){return[n<0?n+e:n]})),even:gt((function(t,e){for(var n=0;ne?e:n;--r>=0;)t.push(r);return t})),gt:gt((function(t,e,n){for(var r=n<0?n+e:n;++r1?function(e,n,r){for(var i=t.length;i--;)if(!t[i](e,n,r))return!1;return!0}:t[0]}function kt(t,e,n,r,i){for(var o,a=[],s=0,u=t.length,c=null!=e;s-1&&(o[c]=!(a[c]=f))}}else v=kt(v===a?v.splice(d,v.length):v),i?i(null,a,v,u):O.apply(a,v)}))}function _t(t){for(var e,n,i,o=t.length,a=r.relative[t[0].type],s=a||r.relative[" "],u=a?1:0,l=bt((function(t){return t===e}),s,!0),f=bt((function(t){return j(e,t)>-1}),s,!0),h=[function(t,n,r){var i=!a&&(r||n!==c)||((e=n).nodeType?l(t,n,r):f(t,n,r));return e=null,i}];u1&&wt(h),u>1&&mt(t.slice(0,u-1).concat({value:" "===t[u-2].type?"*":""})).replace(G,"$1"),n,u0,i=t.length>0,o=function(o,a,s,u,l){var f,d,g,v=0,x="0",m=o&&[],b=[],w=c,S=o||i&&r.find.TAG("*",l),_=k+=null==w?1:Math.random()||.1,M=S.length;for(l&&(c=a==p||a||l);x!==M&&null!=(f=S[x]);x++){if(i&&f){for(d=0,a||f.ownerDocument==p||(h(f),s=!y);g=t[d++];)if(g(f,a||p,s)){u.push(f);break}l&&(k=_)}n&&((f=!g&&f)&&v--,o&&m.push(f))}if(v+=x,n&&x!==v){for(d=0;g=e[d++];)g(m,b,a,s);if(o){if(v>0)for(;x--;)m[x]||b[x]||(b[x]=T.call(u));b=kt(b)}O.apply(u,b),l&&!o&&b.length>0&&v+e.length>1&&st.uniqueSort(u)}return l&&(k=_,c=w),m};return n?ct(o):o}(o,i))).selector=t}return s},u=st.select=function(t,e,n,i){var o,u,c,l,f,h="function"==typeof t&&t,p=!i&&a(t=h.selector||t);if(n=n||[],1===p.length){if((u=p[0]=p[0].slice(0)).length>2&&"ID"===(c=u[0]).type&&9===e.nodeType&&y&&r.relative[u[1].type]){if(!(e=(r.find.ID(c.matches[0].replace(et,nt),e)||[])[0]))return n;h&&(e=e.parentNode),t=t.slice(u.shift().value.length)}for(o=Y.needsContext.test(t)?0:u.length;o--&&(c=u[o],!r.relative[l=c.type]);)if((f=r.find[l])&&(i=f(c.matches[0].replace(et,nt),tt.test(u[0].type)&&vt(e.parentNode)||e))){if(u.splice(o,1),!(t=i.length&&mt(u)))return O.apply(n,i),n;break}}return(h||s(t,p))(i,e,!y,n,!e||tt.test(t)&&vt(e.parentNode)||e),n},n.sortStable=b.split("").sort(C).join("")===b,n.detectDuplicates=!!f,h(),n.sortDetached=lt((function(t){return 1&t.compareDocumentPosition(p.createElement("fieldset"))})),lt((function(t){return t.innerHTML="","#"===t.firstChild.getAttribute("href")}))||ft("type|href|height|width",(function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)})),n.attributes&<((function(t){return t.innerHTML="",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")}))||ft("value",(function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue})),lt((function(t){return null==t.getAttribute("disabled")}))||ft(I,(function(t,e,n){var r;if(!n)return!0===t[e]?e.toLowerCase():(r=t.getAttributeNode(e))&&r.specified?r.value:null})),st}(n);S.find=M,S.expr=M.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=M.uniqueSort,S.text=M.getText,S.isXMLDoc=M.isXML,S.contains=M.contains,S.escapeSelector=M.escape;var E=function(t,e,n){for(var r=[],i=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(i&&S(t).is(n))break;r.push(t)}return r},A=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},C=S.expr.match.needsContext;function L(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}var N=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(t,e,n){return v(e)?S.grep(t,(function(t,r){return!!e.call(t,r,t)!==n})):e.nodeType?S.grep(t,(function(t){return t===e!==n})):"string"!=typeof e?S.grep(t,(function(t){return l.call(e,t)>-1!==n})):S.filter(e,t,n)}S.filter=function(t,e,n){var r=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===r.nodeType?S.find.matchesSelector(r,t)?[r]:[]:S.find.matches(t,S.grep(e,(function(t){return 1===t.nodeType})))},S.fn.extend({find:function(t){var e,n,r=this.length,i=this;if("string"!=typeof t)return this.pushStack(S(t).filter((function(){for(e=0;e1?S.uniqueSort(n):n},filter:function(t){return this.pushStack(T(this,t||[],!1))},not:function(t){return this.pushStack(T(this,t||[],!0))},is:function(t){return!!T(this,"string"==typeof t&&C.test(t)?S(t):t||[],!1).length}});var P,O=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(t,e,n){var r,i;if(!t)return this;if(n=n||P,"string"==typeof t){if(!(r="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:O.exec(t))||!r[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(r[1]){if(e=e instanceof S?e[0]:e,S.merge(this,S.parseHTML(r[1],e&&e.nodeType?e.ownerDocument||e:m,!0)),N.test(r[1])&&S.isPlainObject(e))for(r in e)v(this[r])?this[r](e[r]):this.attr(r,e[r]);return this}return(i=m.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):v(t)?void 0!==n.ready?n.ready(t):t(S):S.makeArray(t,this)}).prototype=S.fn,P=S(m);var D=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function I(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}S.fn.extend({has:function(t){var e=S(t,this),n=e.length;return this.filter((function(){for(var t=0;t-1:1===n.nodeType&&S.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?S.uniqueSort(o):o)},index:function(t){return t?"string"==typeof t?l.call(S(t),this[0]):l.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),S.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return E(t,"parentNode")},parentsUntil:function(t,e,n){return E(t,"parentNode",n)},next:function(t){return I(t,"nextSibling")},prev:function(t){return I(t,"previousSibling")},nextAll:function(t){return E(t,"nextSibling")},prevAll:function(t){return E(t,"previousSibling")},nextUntil:function(t,e,n){return E(t,"nextSibling",n)},prevUntil:function(t,e,n){return E(t,"previousSibling",n)},siblings:function(t){return A((t.parentNode||{}).firstChild,t)},children:function(t){return A(t.firstChild)},contents:function(t){return null!=t.contentDocument&&a(t.contentDocument)?t.contentDocument:(L(t,"template")&&(t=t.content||t),S.merge([],t.childNodes))}},(function(t,e){S.fn[t]=function(n,r){var i=S.map(this,e,n);return"Until"!==t.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=S.filter(r,i)),this.length>1&&(j[t]||S.uniqueSort(i),D.test(t)&&i.reverse()),this.pushStack(i)}}));var R=/[^\x20\t\r\n\f]+/g;function q(t){return t}function z(t){throw t}function B(t,e,n,r){var i;try{t&&v(i=t.promise)?i.call(t).done(e).fail(n):t&&v(i=t.then)?i.call(t,e,n):e.apply(void 0,[t].slice(r))}catch(t){n.apply(void 0,[t])}}S.Callbacks=function(t){t="string"==typeof t?function(t){var e={};return S.each(t.match(R)||[],(function(t,n){e[n]=!0})),e}(t):S.extend({},t);var e,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||t.once,r=e=!0;a.length;s=-1)for(n=a.shift();++s-1;)o.splice(n,1),n<=s&&s--})),this},has:function(t){return t?S.inArray(t,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||e||(o=n=""),this},locked:function(){return!!i},fireWith:function(t,n){return i||(n=[t,(n=n||[]).slice?n.slice():n],a.push(n),e||u()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},S.extend({Deferred:function(t){var e=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},catch:function(t){return i.then(null,t)},pipe:function(){var t=arguments;return S.Deferred((function(n){S.each(e,(function(e,r){var i=v(t[r[4]])&&t[r[4]];o[r[1]]((function(){var t=i&&i.apply(this,arguments);t&&v(t.promise)?t.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this,i?[t]:arguments)}))})),t=null})).promise()},then:function(t,r,i){var o=0;function a(t,e,r,i){return function(){var s=this,u=arguments,c=function(){var n,c;if(!(t=o&&(r!==z&&(s=void 0,u=[n]),e.rejectWith(s,u))}};t?l():(S.Deferred.getStackHook&&(l.stackTrace=S.Deferred.getStackHook()),n.setTimeout(l))}}return S.Deferred((function(n){e[0][3].add(a(0,n,v(i)?i:q,n.notifyWith)),e[1][3].add(a(0,n,v(t)?t:q)),e[2][3].add(a(0,n,v(r)?r:z))})).promise()},promise:function(t){return null!=t?S.extend(t,i):i}},o={};return S.each(e,(function(t,n){var a=n[2],s=n[5];i[n[1]]=a.add,s&&a.add((function(){r=s}),e[3-t][2].disable,e[3-t][3].disable,e[0][2].lock,e[0][3].lock),a.add(n[3].fire),o[n[0]]=function(){return o[n[0]+"With"](this===o?void 0:this,arguments),this},o[n[0]+"With"]=a.fireWith})),i.promise(o),t&&t.call(o,o),o},when:function(t){var e=arguments.length,n=e,r=Array(n),i=s.call(arguments),o=S.Deferred(),a=function(t){return function(n){r[t]=this,i[t]=arguments.length>1?s.call(arguments):n,--e||o.resolveWith(r,i)}};if(e<=1&&(B(t,o.done(a(n)).resolve,o.reject,!e),"pending"===o.state()||v(i[n]&&i[n].then)))return o.then();for(;n--;)B(i[n],a(n),o.reject);return o.promise()}});var H=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(t,e){n.console&&n.console.warn&&t&&H.test(t.name)&&n.console.warn("jQuery.Deferred exception: "+t.message,t.stack,e)},S.readyException=function(t){n.setTimeout((function(){throw t}))};var G=S.Deferred();function V(){m.removeEventListener("DOMContentLoaded",V),n.removeEventListener("load",V),S.ready()}S.fn.ready=function(t){return G.then(t).catch((function(t){S.readyException(t)})),this},S.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--S.readyWait:S.isReady)||(S.isReady=!0,!0!==t&&--S.readyWait>0||G.resolveWith(m,[S]))}}),S.ready.then=G.then,"complete"===m.readyState||"loading"!==m.readyState&&!m.documentElement.doScroll?n.setTimeout(S.ready):(m.addEventListener("DOMContentLoaded",V),n.addEventListener("load",V));var F=function(t,e,n,r,i,o,a){var s=0,u=t.length,c=null==n;if("object"===k(n))for(s in i=!0,n)F(t,e,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,v(r)||(a=!0),c&&(a?(e.call(t,r),e=null):(c=e,e=function(t,e,n){return c.call(S(t),n)})),e))for(;s1,null,!0)},removeData:function(t){return this.each((function(){J.remove(this,t)}))}}),S.extend({queue:function(t,e,n){var r;if(t)return e=(e||"fx")+"queue",r=K.get(t,e),n&&(!r||Array.isArray(n)?r=K.access(t,e,S.makeArray(n)):r.push(n)),r||[]},dequeue:function(t,e){e=e||"fx";var n=S.queue(t,e),r=n.length,i=n.shift(),o=S._queueHooks(t,e);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===e&&n.unshift("inprogress"),delete o.stop,i.call(t,(function(){S.dequeue(t,e)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return K.get(t,n)||K.access(t,n,{empty:S.Callbacks("once memory").add((function(){K.remove(t,[e+"queue",n])}))})}}),S.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length\x20\t\r\n\f]*)/i,vt=/^$|^module$|\/(?:java|ecma)script/i;pt=m.createDocumentFragment().appendChild(m.createElement("div")),(dt=m.createElement("input")).setAttribute("type","radio"),dt.setAttribute("checked","checked"),dt.setAttribute("name","t"),pt.appendChild(dt),g.checkClone=pt.cloneNode(!0).cloneNode(!0).lastChild.checked,pt.innerHTML="",g.noCloneChecked=!!pt.cloneNode(!0).lastChild.defaultValue,pt.innerHTML="",g.option=!!pt.lastChild;var xt={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function mt(t,e){var n;return n=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&L(t,e)?S.merge([t],n):n}function bt(t,e){for(var n=0,r=t.length;n",""]);var wt=/<|&#?\w+;/;function kt(t,e,n,r,i){for(var o,a,s,u,c,l,f=e.createDocumentFragment(),h=[],p=0,d=t.length;p-1)i&&i.push(o);else if(c=at(o),a=mt(f.appendChild(o),"script"),c&&bt(a),n)for(l=0;o=a[l++];)vt.test(o.type||"")&&n.push(o);return f}var St=/^([^.]*)(?:\.(.+)|)/;function _t(){return!0}function Mt(){return!1}function Et(t,e){return t===function(){try{return m.activeElement}catch(t){}}()==("focus"===e)}function At(t,e,n,r,i,o){var a,s;if("object"==typeof e){for(s in"string"!=typeof n&&(r=r||n,n=void 0),e)At(t,s,n,r,e[s],o);return t}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Mt;else if(!i)return t;return 1===o&&(a=i,(i=function(t){return S().off(t),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),t.each((function(){S.event.add(this,e,i,r,n)}))}function Ct(t,e,n){n?(K.set(t,e,!1),S.event.add(t,e,{namespace:!1,handler:function(t){var r,i,o=K.get(this,e);if(1&t.isTrigger&&this[e]){if(o.length)(S.event.special[e]||{}).delegateType&&t.stopPropagation();else if(o=s.call(arguments),K.set(this,e,o),r=n(this,e),this[e](),o!==(i=K.get(this,e))||r?K.set(this,e,!1):i={},o!==i)return t.stopImmediatePropagation(),t.preventDefault(),i&&i.value}else o.length&&(K.set(this,e,{value:S.event.trigger(S.extend(o[0],S.Event.prototype),o.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===K.get(t,e)&&S.event.add(t,e,_t)}S.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,c,l,f,h,p,d,y,g=K.get(t);if(Z(t))for(n.handler&&(n=(o=n).handler,i=o.selector),i&&S.find.matchesSelector(ot,i),n.guid||(n.guid=S.guid++),(u=g.events)||(u=g.events=Object.create(null)),(a=g.handle)||(a=g.handle=function(e){return void 0!==S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),c=(e=(e||"").match(R)||[""]).length;c--;)p=y=(s=St.exec(e[c])||[])[1],d=(s[2]||"").split(".").sort(),p&&(f=S.event.special[p]||{},p=(i?f.delegateType:f.bindType)||p,f=S.event.special[p]||{},l=S.extend({type:p,origType:y,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&S.expr.match.needsContext.test(i),namespace:d.join(".")},o),(h=u[p])||((h=u[p]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,d,a)||t.addEventListener&&t.addEventListener(p,a)),f.add&&(f.add.call(t,l),l.handler.guid||(l.handler.guid=n.guid)),i?h.splice(h.delegateCount++,0,l):h.push(l),S.event.global[p]=!0)},remove:function(t,e,n,r,i){var o,a,s,u,c,l,f,h,p,d,y,g=K.hasData(t)&&K.get(t);if(g&&(u=g.events)){for(c=(e=(e||"").match(R)||[""]).length;c--;)if(p=y=(s=St.exec(e[c])||[])[1],d=(s[2]||"").split(".").sort(),p){for(f=S.event.special[p]||{},h=u[p=(r?f.delegateType:f.bindType)||p]||[],s=s[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=h.length;o--;)l=h[o],!i&&y!==l.origType||n&&n.guid!==l.guid||s&&!s.test(l.namespace)||r&&r!==l.selector&&("**"!==r||!l.selector)||(h.splice(o,1),l.selector&&h.delegateCount--,f.remove&&f.remove.call(t,l));a&&!h.length&&(f.teardown&&!1!==f.teardown.call(t,d,g.handle)||S.removeEvent(t,p,g.handle),delete u[p])}else for(p in u)S.event.remove(t,p+e[c],n,r,!0);S.isEmptyObject(u)&&K.remove(t,"handle events")}},dispatch:function(t){var e,n,r,i,o,a,s=new Array(arguments.length),u=S.event.fix(t),c=(K.get(this,"events")||Object.create(null))[u.type]||[],l=S.event.special[u.type]||{};for(s[0]=u,e=1;e=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(o=[],a={},n=0;n-1:S.find(i,this,null,[c]).length),a[i]&&o.push(r);o.length&&s.push({elem:c,handlers:o})}return c=this,u\s*$/g;function Pt(t,e){return L(t,"table")&&L(11!==e.nodeType?e:e.firstChild,"tr")&&S(t).children("tbody")[0]||t}function Ot(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function Dt(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function jt(t,e){var n,r,i,o,a,s;if(1===e.nodeType){if(K.hasData(t)&&(s=K.get(t).events))for(i in K.remove(e,"handle events"),s)for(n=0,r=s[i].length;n1&&"string"==typeof d&&!g.checkClone&&Nt.test(d))return t.each((function(i){var o=t.eq(i);y&&(e[0]=d.call(this,i,o.html())),Rt(o,e,n,r)}));if(h&&(o=(i=kt(e,t[0].ownerDocument,!1,t,r)).firstChild,1===i.childNodes.length&&(i=o),o||r)){for(s=(a=S.map(mt(i,"script"),Ot)).length;f0&&bt(a,!u&&mt(t,"script")),s},cleanData:function(t){for(var e,n,r,i=S.event.special,o=0;void 0!==(n=t[o]);o++)if(Z(n)){if(e=n[K.expando]){if(e.events)for(r in e.events)i[r]?S.event.remove(n,r):S.removeEvent(n,r,e.handle);n[K.expando]=void 0}n[J.expando]&&(n[J.expando]=void 0)}}}),S.fn.extend({detach:function(t){return qt(this,t,!0)},remove:function(t){return qt(this,t)},text:function(t){return F(this,(function(t){return void 0===t?S.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)}))}),null,t,arguments.length)},append:function(){return Rt(this,arguments,(function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Pt(this,t).appendChild(t)}))},prepend:function(){return Rt(this,arguments,(function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=Pt(this,t);e.insertBefore(t,e.firstChild)}}))},before:function(){return Rt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this)}))},after:function(){return Rt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)}))},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(S.cleanData(mt(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map((function(){return S.clone(this,t,e)}))},html:function(t){return F(this,(function(t){var e=this[0]||{},n=0,r=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Lt.test(t)&&!xt[(gt.exec(t)||["",""])[1].toLowerCase()]){t=S.htmlPrefilter(t);try{for(;n=0&&(u+=Math.max(0,Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-o-u-s-.5))||0),u}function ee(t,e,n){var r=Bt(t),i=(!g.boxSizingReliable()||n)&&"border-box"===S.css(t,"boxSizing",!1,r),o=i,a=Vt(t,e,r),s="offset"+e[0].toUpperCase()+e.slice(1);if(zt.test(a)){if(!n)return a;a="auto"}return(!g.boxSizingReliable()&&i||!g.reliableTrDimensions()&&L(t,"tr")||"auto"===a||!parseFloat(a)&&"inline"===S.css(t,"display",!1,r))&&t.getClientRects().length&&(i="border-box"===S.css(t,"boxSizing",!1,r),(o=s in t)&&(a=t[s])),(a=parseFloat(a)||0)+te(t,e,n||(i?"border":"content"),o,r,a)+"px"}function ne(t,e,n,r,i){return new ne.prototype.init(t,e,n,r,i)}S.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=Vt(t,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(t,e,n,r){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var i,o,a,s=Y(e),u=$t.test(e),c=t.style;if(u||(e=Yt(s)),a=S.cssHooks[e]||S.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(t,!1,r))?i:c[e];"string"===(o=typeof n)&&(i=rt.exec(n))&&i[1]&&(n=ct(t,e,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(S.cssNumber[s]?"":"px")),g.clearCloneStyle||""!==n||0!==e.indexOf("background")||(c[e]="inherit"),a&&"set"in a&&void 0===(n=a.set(t,n,r))||(u?c.setProperty(e,n):c[e]=n))}},css:function(t,e,n,r){var i,o,a,s=Y(e);return $t.test(e)||(e=Yt(s)),(a=S.cssHooks[e]||S.cssHooks[s])&&"get"in a&&(i=a.get(t,!0,n)),void 0===i&&(i=Vt(t,e,r)),"normal"===i&&e in Jt&&(i=Jt[e]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),S.each(["height","width"],(function(t,e){S.cssHooks[e]={get:function(t,n,r){if(n)return!Zt.test(S.css(t,"display"))||t.getClientRects().length&&t.getBoundingClientRect().width?ee(t,e,r):Ht(t,Kt,(function(){return ee(t,e,r)}))},set:function(t,n,r){var i,o=Bt(t),a=!g.scrollboxSize()&&"absolute"===o.position,s=(a||r)&&"border-box"===S.css(t,"boxSizing",!1,o),u=r?te(t,e,r,s,o):0;return s&&a&&(u-=Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-parseFloat(o[e])-te(t,e,"border",!1,o)-.5)),u&&(i=rt.exec(n))&&"px"!==(i[3]||"px")&&(t.style[e]=n,n=S.css(t,e)),Qt(0,n,u)}}})),S.cssHooks.marginLeft=Ft(g.reliableMarginLeft,(function(t,e){if(e)return(parseFloat(Vt(t,"marginLeft"))||t.getBoundingClientRect().left-Ht(t,{marginLeft:0},(function(){return t.getBoundingClientRect().left})))+"px"})),S.each({margin:"",padding:"",border:"Width"},(function(t,e){S.cssHooks[t+e]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[t+it[r]+e]=o[r]||o[r-2]||o[0];return i}},"margin"!==t&&(S.cssHooks[t+e].set=Qt)})),S.fn.extend({css:function(t,e){return F(this,(function(t,e,n){var r,i,o={},a=0;if(Array.isArray(e)){for(r=Bt(t),i=e.length;a1)}}),S.Tween=ne,ne.prototype={constructor:ne,init:function(t,e,n,r,i,o){this.elem=t,this.prop=n,this.easing=i||S.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?"":"px")},cur:function(){var t=ne.propHooks[this.prop];return t&&t.get?t.get(this):ne.propHooks._default.get(this)},run:function(t){var e,n=ne.propHooks[this.prop];return this.options.duration?this.pos=e=S.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):ne.propHooks._default.set(this),this}},ne.prototype.init.prototype=ne.prototype,ne.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=S.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){S.fx.step[t.prop]?S.fx.step[t.prop](t):1!==t.elem.nodeType||!S.cssHooks[t.prop]&&null==t.elem.style[Yt(t.prop)]?t.elem[t.prop]=t.now:S.style(t.elem,t.prop,t.now+t.unit)}}},ne.propHooks.scrollTop=ne.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},S.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},S.fx=ne.prototype.init,S.fx.step={};var re,ie,oe=/^(?:toggle|show|hide)$/,ae=/queueHooks$/;function se(){ie&&(!1===m.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(se):n.setTimeout(se,S.fx.interval),S.fx.tick())}function ue(){return n.setTimeout((function(){re=void 0})),re=Date.now()}function ce(t,e){var n,r=0,i={height:t};for(e=e?1:0;r<4;r+=2-e)i["margin"+(n=it[r])]=i["padding"+n]=t;return e&&(i.opacity=i.width=t),i}function le(t,e,n){for(var r,i=(fe.tweeners[e]||[]).concat(fe.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(t){return this.each((function(){S.removeAttr(this,t)}))}}),S.extend({attr:function(t,e,n){var r,i,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===t.getAttribute?S.prop(t,e,n):(1===o&&S.isXMLDoc(t)||(i=S.attrHooks[e.toLowerCase()]||(S.expr.match.bool.test(e)?he:void 0)),void 0!==n?null===n?void S.removeAttr(t,e):i&&"set"in i&&void 0!==(r=i.set(t,n,e))?r:(t.setAttribute(e,n+""),n):i&&"get"in i&&null!==(r=i.get(t,e))?r:null==(r=S.find.attr(t,e))?void 0:r)},attrHooks:{type:{set:function(t,e){if(!g.radioValue&&"radio"===e&&L(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,r=0,i=e&&e.match(R);if(i&&1===t.nodeType)for(;n=i[r++];)t.removeAttribute(n)}}),he={set:function(t,e,n){return!1===e?S.removeAttr(t,n):t.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\w+/g),(function(t,e){var n=pe[e]||S.find.attr;pe[e]=function(t,e,r){var i,o,a=e.toLowerCase();return r||(o=pe[a],pe[a]=i,i=null!=n(t,e,r)?a:null,pe[a]=o),i}}));var de=/^(?:input|select|textarea|button)$/i,ye=/^(?:a|area)$/i;function ge(t){return(t.match(R)||[]).join(" ")}function ve(t){return t.getAttribute&&t.getAttribute("class")||""}function xe(t){return Array.isArray(t)?t:"string"==typeof t&&t.match(R)||[]}S.fn.extend({prop:function(t,e){return F(this,S.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each((function(){delete this[S.propFix[t]||t]}))}}),S.extend({prop:function(t,e,n){var r,i,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&S.isXMLDoc(t)||(e=S.propFix[e]||e,i=S.propHooks[e]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(t,n,e))?r:t[e]=n:i&&"get"in i&&null!==(r=i.get(t,e))?r:t[e]},propHooks:{tabIndex:{get:function(t){var e=S.find.attr(t,"tabindex");return e?parseInt(e,10):de.test(t.nodeName)||ye.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),g.optSelected||(S.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){S.propFix[this.toLowerCase()]=this})),S.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(v(t))return this.each((function(e){S(this).addClass(t.call(this,e,ve(this)))}));if((e=xe(t)).length)for(;n=this[u++];)if(i=ve(n),r=1===n.nodeType&&" "+ge(i)+" "){for(a=0;o=e[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=ge(r))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(v(t))return this.each((function(e){S(this).removeClass(t.call(this,e,ve(this)))}));if(!arguments.length)return this.attr("class","");if((e=xe(t)).length)for(;n=this[u++];)if(i=ve(n),r=1===n.nodeType&&" "+ge(i)+" "){for(a=0;o=e[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");i!==(s=ge(r))&&n.setAttribute("class",s)}return this},toggleClass:function(t,e){var n=typeof t,r="string"===n||Array.isArray(t);return"boolean"==typeof e&&r?e?this.addClass(t):this.removeClass(t):v(t)?this.each((function(n){S(this).toggleClass(t.call(this,n,ve(this),e),e)})):this.each((function(){var e,i,o,a;if(r)for(i=0,o=S(this),a=xe(t);e=a[i++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==n||((e=ve(this))&&K.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":K.get(this,"__className__")||""))}))},hasClass:function(t){var e,n,r=0;for(e=" "+t+" ";n=this[r++];)if(1===n.nodeType&&(" "+ge(ve(n))+" ").indexOf(e)>-1)return!0;return!1}});var me=/\r/g;S.fn.extend({val:function(t){var e,n,r,i=this[0];return arguments.length?(r=v(t),this.each((function(n){var i;1===this.nodeType&&(null==(i=r?t.call(this,n,S(this).val()):t)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=S.map(i,(function(t){return null==t?"":t+""}))),(e=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,i,"value")||(this.value=i))}))):i?(e=S.valHooks[i.type]||S.valHooks[i.nodeName.toLowerCase()])&&"get"in e&&void 0!==(n=e.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(me,""):null==n?"":n:void 0}}),S.extend({valHooks:{option:{get:function(t){var e=S.find.attr(t,"value");return null!=e?e:ge(S.text(t))}},select:{get:function(t){var e,n,r,i=t.options,o=t.selectedIndex,a="select-one"===t.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r-1)&&(n=!0);return n||(t.selectedIndex=-1),o}}}}),S.each(["radio","checkbox"],(function(){S.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=S.inArray(S(t).val(),e)>-1}},g.checkOn||(S.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})})),g.focusin="onfocusin"in n;var be=/^(?:focusinfocus|focusoutblur)$/,we=function(t){t.stopPropagation()};S.extend(S.event,{trigger:function(t,e,r,i){var o,a,s,u,c,l,f,h,d=[r||m],y=p.call(t,"type")?t.type:t,g=p.call(t,"namespace")?t.namespace.split("."):[];if(a=h=s=r=r||m,3!==r.nodeType&&8!==r.nodeType&&!be.test(y+S.event.triggered)&&(y.indexOf(".")>-1&&(g=y.split("."),y=g.shift(),g.sort()),c=y.indexOf(":")<0&&"on"+y,(t=t[S.expando]?t:new S.Event(y,"object"==typeof t&&t)).isTrigger=i?2:3,t.namespace=g.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),e=null==e?[t]:S.makeArray(e,[t]),f=S.event.special[y]||{},i||!f.trigger||!1!==f.trigger.apply(r,e))){if(!i&&!f.noBubble&&!x(r)){for(u=f.delegateType||y,be.test(u+y)||(a=a.parentNode);a;a=a.parentNode)d.push(a),s=a;s===(r.ownerDocument||m)&&d.push(s.defaultView||s.parentWindow||n)}for(o=0;(a=d[o++])&&!t.isPropagationStopped();)h=a,t.type=o>1?u:f.bindType||y,(l=(K.get(a,"events")||Object.create(null))[t.type]&&K.get(a,"handle"))&&l.apply(a,e),(l=c&&a[c])&&l.apply&&Z(a)&&(t.result=l.apply(a,e),!1===t.result&&t.preventDefault());return t.type=y,i||t.isDefaultPrevented()||f._default&&!1!==f._default.apply(d.pop(),e)||!Z(r)||c&&v(r[y])&&!x(r)&&((s=r[c])&&(r[c]=null),S.event.triggered=y,t.isPropagationStopped()&&h.addEventListener(y,we),r[y](),t.isPropagationStopped()&&h.removeEventListener(y,we),S.event.triggered=void 0,s&&(r[c]=s)),t.result}},simulate:function(t,e,n){var r=S.extend(new S.Event,n,{type:t,isSimulated:!0});S.event.trigger(r,null,e)}}),S.fn.extend({trigger:function(t,e){return this.each((function(){S.event.trigger(t,e,this)}))},triggerHandler:function(t,e){var n=this[0];if(n)return S.event.trigger(t,e,n,!0)}}),g.focusin||S.each({focus:"focusin",blur:"focusout"},(function(t,e){var n=function(t){S.event.simulate(e,t.target,S.event.fix(t))};S.event.special[e]={setup:function(){var r=this.ownerDocument||this.document||this,i=K.access(r,e);i||r.addEventListener(t,n,!0),K.access(r,e,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this.document||this,i=K.access(r,e)-1;i?K.access(r,e,i):(r.removeEventListener(t,n,!0),K.remove(r,e))}}}));var ke=n.location,Se={guid:Date.now()},_e=/\?/;S.parseXML=function(t){var e,r;if(!t||"string"!=typeof t)return null;try{e=(new n.DOMParser).parseFromString(t,"text/xml")}catch(t){}return r=e&&e.getElementsByTagName("parsererror")[0],e&&!r||S.error("Invalid XML: "+(r?S.map(r.childNodes,(function(t){return t.textContent})).join("\n"):t)),e};var Me=/\[\]$/,Ee=/\r?\n/g,Ae=/^(?:submit|button|image|reset|file)$/i,Ce=/^(?:input|select|textarea|keygen)/i;function Le(t,e,n,r){var i;if(Array.isArray(e))S.each(e,(function(e,i){n||Me.test(t)?r(t,i):Le(t+"["+("object"==typeof i&&null!=i?e:"")+"]",i,n,r)}));else if(n||"object"!==k(e))r(t,e);else for(i in e)Le(t+"["+i+"]",e[i],n,r)}S.param=function(t,e){var n,r=[],i=function(t,e){var n=v(e)?e():e;r[r.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!S.isPlainObject(t))S.each(t,(function(){i(this.name,this.value)}));else for(n in t)Le(n,t[n],e,i);return r.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var t=S.prop(this,"elements");return t?S.makeArray(t):this})).filter((function(){var t=this.type;return this.name&&!S(this).is(":disabled")&&Ce.test(this.nodeName)&&!Ae.test(t)&&(this.checked||!yt.test(t))})).map((function(t,e){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,(function(t){return{name:e.name,value:t.replace(Ee,"\r\n")}})):{name:e.name,value:n.replace(Ee,"\r\n")}})).get()}});var Ne=/%20/g,Te=/#.*$/,Pe=/([?&])_=[^&]*/,Oe=/^(.*?):[ \t]*([^\r\n]*)$/gm,De=/^(?:GET|HEAD)$/,je=/^\/\//,Ie={},Re={},qe="*/".concat("*"),ze=m.createElement("a");function Be(t){return function(e,n){"string"!=typeof e&&(n=e,e="*");var r,i=0,o=e.toLowerCase().match(R)||[];if(v(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(t[r]=t[r]||[]).unshift(n)):(t[r]=t[r]||[]).push(n)}}function He(t,e,n,r){var i={},o=t===Re;function a(s){var u;return i[s]=!0,S.each(t[s]||[],(function(t,s){var c=s(e,n,r);return"string"!=typeof c||o||i[c]?o?!(u=c):void 0:(e.dataTypes.unshift(c),a(c),!1)})),u}return a(e.dataTypes[0])||!i["*"]&&a("*")}function Ge(t,e){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((i[n]?t:r||(r={}))[n]=e[n]);return r&&S.extend(!0,t,r),t}ze.href=ke.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ke.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(ke.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":qe,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?Ge(Ge(t,S.ajaxSettings),e):Ge(S.ajaxSettings,t)},ajaxPrefilter:Be(Ie),ajaxTransport:Be(Re),ajax:function(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var r,i,o,a,s,u,c,l,f,h,p=S.ajaxSetup({},e),d=p.context||p,y=p.context&&(d.nodeType||d.jquery)?S(d):S.event,g=S.Deferred(),v=S.Callbacks("once memory"),x=p.statusCode||{},b={},w={},k="canceled",_={readyState:0,getResponseHeader:function(t){var e;if(c){if(!a)for(a={};e=Oe.exec(o);)a[e[1].toLowerCase()+" "]=(a[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=a[t.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return c?o:null},setRequestHeader:function(t,e){return null==c&&(t=w[t.toLowerCase()]=w[t.toLowerCase()]||t,b[t]=e),this},overrideMimeType:function(t){return null==c&&(p.mimeType=t),this},statusCode:function(t){var e;if(t)if(c)_.always(t[_.status]);else for(e in t)x[e]=[x[e],t[e]];return this},abort:function(t){var e=t||k;return r&&r.abort(e),M(0,e),this}};if(g.promise(_),p.url=((t||p.url||ke.href)+"").replace(je,ke.protocol+"//"),p.type=e.method||e.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(R)||[""],null==p.crossDomain){u=m.createElement("a");try{u.href=p.url,u.href=u.href,p.crossDomain=ze.protocol+"//"+ze.host!=u.protocol+"//"+u.host}catch(t){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=S.param(p.data,p.traditional)),He(Ie,p,e,_),c)return _;for(f in(l=S.event&&p.global)&&0==S.active++&&S.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!De.test(p.type),i=p.url.replace(Te,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(Ne,"+")):(h=p.url.slice(i.length),p.data&&(p.processData||"string"==typeof p.data)&&(i+=(_e.test(i)?"&":"?")+p.data,delete p.data),!1===p.cache&&(i=i.replace(Pe,"$1"),h=(_e.test(i)?"&":"?")+"_="+Se.guid+++h),p.url=i+h),p.ifModified&&(S.lastModified[i]&&_.setRequestHeader("If-Modified-Since",S.lastModified[i]),S.etag[i]&&_.setRequestHeader("If-None-Match",S.etag[i])),(p.data&&p.hasContent&&!1!==p.contentType||e.contentType)&&_.setRequestHeader("Content-Type",p.contentType),_.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+qe+"; q=0.01":""):p.accepts["*"]),p.headers)_.setRequestHeader(f,p.headers[f]);if(p.beforeSend&&(!1===p.beforeSend.call(d,_,p)||c))return _.abort();if(k="abort",v.add(p.complete),_.done(p.success),_.fail(p.error),r=He(Re,p,e,_)){if(_.readyState=1,l&&y.trigger("ajaxSend",[_,p]),c)return _;p.async&&p.timeout>0&&(s=n.setTimeout((function(){_.abort("timeout")}),p.timeout));try{c=!1,r.send(b,M)}catch(t){if(c)throw t;M(-1,t)}}else M(-1,"No Transport");function M(t,e,a,u){var f,h,m,b,w,k=e;c||(c=!0,s&&n.clearTimeout(s),r=void 0,o=u||"",_.readyState=t>0?4:0,f=t>=200&&t<300||304===t,a&&(b=function(t,e,n){for(var r,i,o,a,s=t.contents,u=t.dataTypes;"*"===u[0];)u.shift(),void 0===r&&(r=t.mimeType||e.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||t.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(p,_,a)),!f&&S.inArray("script",p.dataTypes)>-1&&S.inArray("json",p.dataTypes)<0&&(p.converters["text script"]=function(){}),b=function(t,e,n,r){var i,o,a,s,u,c={},l=t.dataTypes.slice();if(l[1])for(a in t.converters)c[a.toLowerCase()]=t.converters[a];for(o=l.shift();o;)if(t.responseFields[o]&&(n[t.responseFields[o]]=e),!u&&r&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),u=o,o=l.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=c[u+" "+o]||c["* "+o]))for(i in c)if((s=i.split(" "))[1]===o&&(a=c[u+" "+s[0]]||c["* "+s[0]])){!0===a?a=c[i]:!0!==c[i]&&(o=s[0],l.unshift(s[1]));break}if(!0!==a)if(a&&t.throws)e=a(e);else try{e=a(e)}catch(t){return{state:"parsererror",error:a?t:"No conversion from "+u+" to "+o}}}return{state:"success",data:e}}(p,b,_,f),f?(p.ifModified&&((w=_.getResponseHeader("Last-Modified"))&&(S.lastModified[i]=w),(w=_.getResponseHeader("etag"))&&(S.etag[i]=w)),204===t||"HEAD"===p.type?k="nocontent":304===t?k="notmodified":(k=b.state,h=b.data,f=!(m=b.error))):(m=k,!t&&k||(k="error",t<0&&(t=0))),_.status=t,_.statusText=(e||k)+"",f?g.resolveWith(d,[h,k,_]):g.rejectWith(d,[_,k,m]),_.statusCode(x),x=void 0,l&&y.trigger(f?"ajaxSuccess":"ajaxError",[_,p,f?h:m]),v.fireWith(d,[_,k]),l&&(y.trigger("ajaxComplete",[_,p]),--S.active||S.event.trigger("ajaxStop")))}return _},getJSON:function(t,e,n){return S.get(t,e,n,"json")},getScript:function(t,e){return S.get(t,void 0,e,"script")}}),S.each(["get","post"],(function(t,e){S[e]=function(t,n,r,i){return v(n)&&(i=i||r,r=n,n=void 0),S.ajax(S.extend({url:t,type:e,dataType:i,data:n,success:r},S.isPlainObject(t)&&t))}})),S.ajaxPrefilter((function(t){var e;for(e in t.headers)"content-type"===e.toLowerCase()&&(t.contentType=t.headers[e]||"")})),S._evalUrl=function(t,e,n){return S.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(t){S.globalEval(t,e,n)}})},S.fn.extend({wrapAll:function(t){var e;return this[0]&&(v(t)&&(t=t.call(this[0])),e=S(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map((function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t})).append(this)),this},wrapInner:function(t){return v(t)?this.each((function(e){S(this).wrapInner(t.call(this,e))})):this.each((function(){var e=S(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)}))},wrap:function(t){var e=v(t);return this.each((function(n){S(this).wrapAll(e?t.call(this,n):t)}))},unwrap:function(t){return this.parent(t).not("body").each((function(){S(this).replaceWith(this.childNodes)})),this}}),S.expr.pseudos.hidden=function(t){return!S.expr.pseudos.visible(t)},S.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(t){}};var Ve={0:200,1223:204},Fe=S.ajaxSettings.xhr();g.cors=!!Fe&&"withCredentials"in Fe,g.ajax=Fe=!!Fe,S.ajaxTransport((function(t){var e,r;if(g.cors||Fe&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];for(a in t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest"),i)s.setRequestHeader(a,i[a]);e=function(t){return function(){e&&(e=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===t?s.abort():"error"===t?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Ve[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=e(),r=s.onerror=s.ontimeout=e("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&n.setTimeout((function(){e&&r()}))},e=e("abort");try{s.send(t.hasContent&&t.data||null)}catch(t){if(e)throw t}},abort:function(){e&&e()}}})),S.ajaxPrefilter((function(t){t.crossDomain&&(t.contents.script=!1)})),S.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return S.globalEval(t),t}}}),S.ajaxPrefilter("script",(function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")})),S.ajaxTransport("script",(function(t){var e,n;if(t.crossDomain||t.scriptAttrs)return{send:function(r,i){e=S("