/*
 * Visual Sedimentation Library v0.01
 * http://www.visualsedimentation.org/
 *
 * Copyright 2013, Samuel Huron & Romain Vuillemont
 * Licensed under the CeCILL-B or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 *
 *
 *
 *
 * Includes jquery.js
 * http://jquery.com/
 * Copyright 2010, John Resig
 * Released under Dual licensed under the MIT or GPL Version 2 licenses.
 * 
 * Includes d3.js
 * http://d3js.org/
 * Copyright 2012, Michael Bostock
 * Released under BSD licenses.
 * 
 * Includes Box2DWeb
 * http://www.gphysics.com
 * Copyright 2006, Erin Catto 
 * Released under zlib License.
 * 
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Tue Jan 01 14:25:48 2010 -0500
 */
(function(At,AC){function A5(){if(!AL.isReady){try{AD.documentElement.doScroll("left")}catch(A){setTimeout(A5,1);return}AL.ready()}}function AA(F,A){A.src?AL.ajax({url:A.src,async:false,dataType:"script"}):AL.globalEval(A.text||A.textContent||A.innerHTML||"");A.parentNode&&A.parentNode.removeChild(A)}function AT(F,A,O,K,L,G){var J=F.length;if(typeof A==="object"){for(var N in A){AT(F,N,A[N],K,L,O)}return F}if(O!==AC){K=!G&&K&&AL.isFunction(O);for(N=0;N<J;N++){L(F[N],A,K?O.call(F[N],N,L(F[N],A)):O,G)}return F}return J?L(F[0],A):AC}function Ak(){return(new Date).getTime()}function AS(){return false}function AQ(){return true}function Ap(F,A,G){G[0].type=F;return AL.event.handle.apply(A,G)}function AK(R){var Q,P=[],N=[],O=arguments,K,L,F,J,G,A;L=AL.data(this,"events");if(!(R.liveFired===this||!L||!L.live||R.button&&R.type==="click")){R.liveFired=this;var T=L.live.slice(0);for(J=0;J<T.length;J++){L=T[J];L.origType.replace(Ae,"")===R.type?N.push(L.selector):T.splice(J--,1)}K=AL(R.target).closest(N,R.currentTarget);G=0;for(A=K.length;G<A;G++){for(J=0;J<T.length;J++){L=T[J];if(K[G].selector===L.selector){F=K[G].elem;N=null;if(L.preType==="mouseenter"||L.preType==="mouseleave"){N=AL(R.relatedTarget).closest(L.selector)[0]}if(!N||N!==F){P.push({elem:F,handleObj:L})}}}}G=0;for(A=P.length;G<A;G++){K=P[G];R.currentTarget=K.elem;R.data=K.handleObj.data;R.handleObj=K.handleObj;if(K.handleObj.origHandler.apply(K.elem,O)===false){Q=false;break}}return Q}}function u(F,A){return"live."+(F&&F!=="*"?F+".":"")+A.replace(/\./g,"`").replace(/ /g,"&")}function e(A){return !A||!A.parentNode||A.parentNode.nodeType===11}function BM(F,A){var G=0;A.each(function(){if(this.nodeName===(F[G]&&F[G].nodeName)){var L=AL.data(F[G++]),N=AL.data(this,L);if(L=L&&L.events){delete N.handle;N.events={};for(var J in L){for(var K in L[J]){AL.event.add(this,J,L[J][K],L[J][K].data)}}}}})}function A8(F,A,L){var J,K,G;A=A&&A[0]?A[0].ownerDocument||A[0]:AD;if(F.length===1&&typeof F[0]==="string"&&F[0].length<512&&A===AD&&!Au.test(F[0])&&(AL.support.checkClone||!AO.test(F[0]))){K=true;if(G=AL.fragments[F[0]]){if(G!==1){J=G}}}if(!J){J=A.createDocumentFragment();AL.clean(F,A,J,L)}if(K){AL.fragments[F[0]]=G?J:1}return{fragment:J,cacheable:K}}function Ah(F,A){var G={};AL.each(z.concat.apply([],z.slice(0,A)),function(){G[this]=F});return G}function h(A){return"scrollTo" in A&&A.document?A:A.nodeType===9?A.defaultView||A.parentWindow:false}var AL=function(F,A){return new AL.fn.init(F,A)},k=At.jQuery,D=At.$,AD=At.document,AW,BC=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ay=/^.[^:#\[\.,]*$/,AR=/\S/,AB=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,l=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Ac=navigator.userAgent,C=false,AY=[],Ag,A6=Object.prototype.toString,A0=Object.prototype.hasOwnProperty,Ad=Array.prototype.push,AX=Array.prototype.slice,BB=Array.prototype.indexOf;AL.fn=AL.prototype={init:function(F,A){var J,G;if(!F){return this}if(F.nodeType){this.context=this[0]=F;this.length=1;return this}if(F==="body"&&!A){this.context=AD;this[0]=AD.body;this.selector="body";this.length=1;return this}if(typeof F==="string"){if((J=BC.exec(F))&&(J[1]||!A)){if(J[1]){G=A?A.ownerDocument||A:AD;if(F=l.exec(F)){if(AL.isPlainObject(A)){F=[AD.createElement(F[1])];AL.fn.attr.call(F,A,true)}else{F=[G.createElement(F[1])]}}else{F=A8([J[1]],[G]);F=(F.cacheable?F.fragment.cloneNode(true):F.fragment).childNodes}return AL.merge(this,F)}else{if(A=AD.getElementById(J[2])){if(A.id!==J[2]){return AW.find(F)}this.length=1;this[0]=A}this.context=AD;this.selector=F;return this}}else{if(!A&&/^\w+$/.test(F)){this.selector=F;this.context=AD;F=AD.getElementsByTagName(F);return AL.merge(this,F)}else{return !A||A.jquery?(A||AW).find(F):AL(A).find(F)}}}else{if(AL.isFunction(F)){return AW.ready(F)}}if(F.selector!==AC){this.selector=F.selector;this.context=F.context}return AL.makeArray(F,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return AX.call(this,0)},get:function(A){return A==null?this.toArray():A<0?this.slice(A)[0]:this[A]},pushStack:function(F,A,J){var G=AL();AL.isArray(F)?Ad.apply(G,F):AL.merge(G,F);G.prevObject=this;G.context=this.context;if(A==="find"){G.selector=this.selector+(this.selector?" ":"")+J}else{if(A){G.selector=this.selector+"."+A+"("+J+")"}}return G},each:function(F,A){return AL.each(this,F,A)},ready:function(A){AL.bindReady();if(AL.isReady){A.call(AD,AL)}else{AY&&AY.push(A)}return this},eq:function(A){return A===-1?this.slice(A):this.slice(A,+A+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(AX.apply(this,arguments),"slice",AX.call(arguments).join(","))},map:function(A){return this.pushStack(AL.map(this,function(F,G){return A.call(F,G,F)}))},end:function(){return this.prevObject||AL(null)},push:Ad,sort:[].sort,splice:[].splice};AL.fn.init.prototype=AL.fn;AL.extend=AL.fn.extend=function(){var F=arguments[0]||{},A=1,O=arguments.length,K=false,L,G,J,N;if(typeof F==="boolean"){K=F;F=arguments[1]||{};A=2}if(typeof F!=="object"&&!AL.isFunction(F)){F={}}if(O===A){F=this;--A}for(;A<O;A++){if((L=arguments[A])!=null){for(G in L){J=F[G];N=L[G];if(F!==N){if(K&&N&&(AL.isPlainObject(N)||AL.isArray(N))){J=J&&(AL.isPlainObject(J)||AL.isArray(J))?J:AL.isArray(N)?[]:{};F[G]=AL.extend(K,J,N)}else{if(N!==AC){F[G]=N}}}}}}return F};AL.extend({noConflict:function(A){At.$=D;if(A){At.jQuery=k}return AL},isReady:false,ready:function(){if(!AL.isReady){if(!AD.body){return setTimeout(AL.ready,13)}AL.isReady=true;if(AY){for(var F,A=0;F=AY[A++];){F.call(AD,AL)}AY=null}AL.fn.triggerHandler&&AL(AD).triggerHandler("ready")}},bindReady:function(){if(!C){C=true;if(AD.readyState==="complete"){return AL.ready()}if(AD.addEventListener){AD.addEventListener("DOMContentLoaded",Ag,false);At.addEventListener("load",AL.ready,false)}else{if(AD.attachEvent){AD.attachEvent("onreadystatechange",Ag);At.attachEvent("onload",AL.ready);var F=false;try{F=At.frameElement==null}catch(A){}AD.documentElement.doScroll&&F&&A5()}}}},isFunction:function(A){return A6.call(A)==="[object Function]"},isArray:function(A){return A6.call(A)==="[object Array]"},isPlainObject:function(F){if(!F||A6.call(F)!=="[object Object]"||F.nodeType||F.setInterval){return false}if(F.constructor&&!A0.call(F,"constructor")&&!A0.call(F.constructor.prototype,"isPrototypeOf")){return false}var A;for(A in F){}return A===AC||A0.call(F,A)},isEmptyObject:function(F){for(var A in F){return false}return true},error:function(A){throw A},parseJSON:function(A){if(typeof A!=="string"||!A){return null}A=AL.trim(A);if(/^[\],:{}\s]*$/.test(A.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return At.JSON&&At.JSON.parse?At.JSON.parse(A):(new Function("return "+A))()}else{AL.error("Invalid JSON: "+A)}},noop:function(){},globalEval:function(F){if(F&&AR.test(F)){var A=AD.getElementsByTagName("head")[0]||AD.documentElement,G=AD.createElement("script");G.type="text/javascript";if(AL.support.scriptEval){G.appendChild(AD.createTextNode(F))}else{G.text=F}A.insertBefore(G,A.firstChild);A.removeChild(G)}},nodeName:function(F,A){return F.nodeName&&F.nodeName.toUpperCase()===A.toUpperCase()},each:function(F,A,N){var K,L=0,G=F.length,J=G===AC||AL.isFunction(F);if(N){if(J){for(K in F){if(A.apply(F[K],N)===false){break}}}else{for(;L<G;){if(A.apply(F[L++],N)===false){break}}}}else{if(J){for(K in F){if(A.call(F[K],K,F[K])===false){break}}}else{for(N=F[0];L<G&&A.call(N,L,N)!==false;N=F[++L]){}}}return F},trim:function(A){return(A||"").replace(AB,"")},makeArray:function(F,A){A=A||[];if(F!=null){F.length==null||typeof F==="string"||AL.isFunction(F)||typeof F!=="function"&&F.setInterval?Ad.call(A,F):AL.merge(A,F)}return A},inArray:function(F,A){if(A.indexOf){return A.indexOf(F)}for(var J=0,G=A.length;J<G;J++){if(A[J]===F){return J}}return -1},merge:function(F,A){var K=F.length,G=0;if(typeof A.length==="number"){for(var J=A.length;G<J;G++){F[K++]=A[G]}}else{for(;A[G]!==AC;){F[K++]=A[G++]}}F.length=K;return F},grep:function(F,A,L){for(var J=[],K=0,G=F.length;K<G;K++){!L!==!A(F[K],K)&&J.push(F[K])}return J},map:function(F,A,N){for(var K=[],L,G=0,J=F.length;G<J;G++){L=A(F[G],G,N);if(L!=null){K[K.length]=L}}return K.concat.apply([],K)},guid:1,proxy:function(F,A,G){if(arguments.length===2){if(typeof A==="string"){G=F;F=G[A];A=AC}else{if(A&&!AL.isFunction(A)){G=A;A=AC}}}if(!A&&F){A=function(){return F.apply(G||this,arguments)}}if(F){A.guid=F.guid=F.guid||A.guid||AL.guid++}return A},uaMatch:function(A){A=A.toLowerCase();A=/(webkit)[ \/]([\w.]+)/.exec(A)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(A)||/(msie) ([\w.]+)/.exec(A)||!/compatible/.test(A)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(A)||[];return{browser:A[1]||"",version:A[2]||"0"}},browser:{}});Ac=AL.uaMatch(Ac);if(Ac.browser){AL.browser[Ac.browser]=true;AL.browser.version=Ac.version}if(AL.browser.webkit){AL.browser.safari=true}if(BB){AL.inArray=function(F,A){return BB.call(A,F)}}AW=AL(AD);if(AD.addEventListener){Ag=function(){AD.removeEventListener("DOMContentLoaded",Ag,false);AL.ready()}}else{if(AD.attachEvent){Ag=function(){if(AD.readyState==="complete"){AD.detachEvent("onreadystatechange",Ag);AL.ready()}}}}(function(){AL.support={};var P=AD.documentElement,O=AD.createElement("script"),N=AD.createElement("div"),K="script"+Ak();N.style.display="none";N.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var L=N.getElementsByTagName("*"),G=N.getElementsByTagName("a")[0];if(!(!L||!L.length||!G)){AL.support={leadingWhitespace:N.firstChild.nodeType===3,tbody:!N.getElementsByTagName("tbody").length,htmlSerialize:!!N.getElementsByTagName("link").length,style:/red/.test(G.getAttribute("style")),hrefNormalized:G.getAttribute("href")==="/a",opacity:/^0.55$/.test(G.style.opacity),cssFloat:!!G.style.cssFloat,checkOn:N.getElementsByTagName("input")[0].value==="on",optSelected:AD.createElement("select").appendChild(AD.createElement("option")).selected,parentNode:N.removeChild(N.appendChild(AD.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};O.type="text/javascript";try{O.appendChild(AD.createTextNode("window."+K+"=1;"))}catch(J){}P.insertBefore(O,P.firstChild);if(At[K]){AL.support.scriptEval=true;delete At[K]}try{delete O.test}catch(A){AL.support.deleteExpando=false}P.removeChild(O);if(N.attachEvent&&N.fireEvent){N.attachEvent("onclick",function F(){AL.support.noCloneEvent=false;N.detachEvent("onclick",F)});N.cloneNode(true).fireEvent("onclick")}N=AD.createElement("div");N.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";P=AD.createDocumentFragment();P.appendChild(N.firstChild);AL.support.checkClone=P.cloneNode(true).cloneNode(true).lastChild.checked;AL(function(){var Q=AD.createElement("div");Q.style.width=Q.style.paddingLeft="1px";AD.body.appendChild(Q);AL.boxModel=AL.support.boxModel=Q.offsetWidth===2;AD.body.removeChild(Q).style.display="none"});P=function(Q){var T=AD.createElement("div");Q="on"+Q;var R=Q in T;if(!R){T.setAttribute(Q,"return;");R=typeof T[Q]==="function"}return R};AL.support.submitBubbles=P("submit");AL.support.changeBubbles=P("change");P=O=N=L=G=null}})();AL.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var Am="jQuery"+Ak(),E=0,Ax={};AL.extend({cache:{},expando:Am,noData:{embed:true,object:true,applet:true},data:function(F,A,K){if(!(F.nodeName&&AL.noData[F.nodeName.toLowerCase()])){F=F==At?Ax:F;var G=F[Am],J=AL.cache;if(!G&&typeof A==="string"&&K===AC){return null}G||(G=++E);if(typeof A==="object"){F[Am]=G;J[G]=AL.extend(true,{},A)}else{if(!J[G]){F[Am]=G;J[G]={}}}F=J[G];if(K!==AC){F[A]=K}return typeof A==="string"?F[A]:F}},removeData:function(F,A){if(!(F.nodeName&&AL.noData[F.nodeName.toLowerCase()])){F=F==At?Ax:F;var K=F[Am],G=AL.cache,J=G[K];if(A){if(J){delete J[A];AL.isEmptyObject(J)&&AL.removeData(F)}}else{if(AL.support.deleteExpando){delete F[AL.expando]}else{F.removeAttribute&&F.removeAttribute(AL.expando)}delete G[K]}}}});AL.fn.extend({data:function(F,A){if(typeof F==="undefined"&&this.length){return AL.data(this[0])}else{if(typeof F==="object"){return this.each(function(){AL.data(this,F)})}}var J=F.split(".");J[1]=J[1]?"."+J[1]:"";if(A===AC){var G=this.triggerHandler("getData"+J[1]+"!",[J[0]]);if(G===AC&&this.length){G=AL.data(this[0],F)}return G===AC&&J[1]?this.data(J[0]):G}else{return this.trigger("setData"+J[1]+"!",[J[0],A]).each(function(){AL.data(this,F,A)})}},removeData:function(A){return this.each(function(){AL.removeData(this,A)})}});AL.extend({queue:function(F,A,J){if(F){A=(A||"fx")+"queue";var G=AL.data(F,A);if(!J){return G||[]}if(!G||AL.isArray(J)){G=AL.data(F,A,AL.makeArray(J))}else{G.push(J)}return G}},dequeue:function(F,A){A=A||"fx";var J=AL.queue(F,A),G=J.shift();if(G==="inprogress"){G=J.shift()}if(G){A==="fx"&&J.unshift("inprogress");G.call(F,function(){AL.dequeue(F,A)})}}});AL.fn.extend({queue:function(F,A){if(typeof F!=="string"){A=F;F="fx"}if(A===AC){return AL.queue(this[0],F)}return this.each(function(){var G=AL.queue(this,F,A);F==="fx"&&G[0]!=="inprogress"&&AL.dequeue(this,F)})},dequeue:function(A){return this.each(function(){AL.dequeue(this,A)})},delay:function(F,A){F=AL.fx?AL.fx.speeds[F]||F:F;A=A||"fx";return this.queue(A,function(){var G=this;setTimeout(function(){AL.dequeue(G,A)},F)})},clearQueue:function(A){return this.queue(A||"fx",[])}});var BH=/[\n\t]/g,AF=/\s+/,BD=/\r/g,Ar=/href|src|style/,Az=/(button|input)/i,AZ=/(button|input|object|select|textarea)/i,AE=/^(a|area)$/i,A3=/radio|checkbox/;AL.fn.extend({attr:function(F,A){return AT(this,F,A,true,AL.attr)},removeAttr:function(A){return this.each(function(){AL.attr(this,A,"");this.nodeType===1&&this.removeAttribute(A)})},addClass:function(P){if(AL.isFunction(P)){return this.each(function(R){var Q=AL(this);Q.addClass(P.call(this,R,Q.attr("class")))})}if(P&&typeof P==="string"){for(var O=(P||"").split(AF),N=0,K=this.length;N<K;N++){var L=this[N];if(L.nodeType===1){if(L.className){for(var G=" "+L.className+" ",J=L.className,A=0,F=O.length;A<F;A++){if(G.indexOf(" "+O[A]+" ")<0){J+=" "+O[A]}}L.className=AL.trim(J)}else{L.className=P}}}}return this},removeClass:function(F){if(AL.isFunction(F)){return this.each(function(P){var Q=AL(this);Q.removeClass(F.call(this,P,Q.attr("class")))})}if(F&&typeof F==="string"||F===AC){for(var A=(F||"").split(AF),O=0,K=this.length;O<K;O++){var L=this[O];if(L.nodeType===1&&L.className){if(F){for(var G=(" "+L.className+" ").replace(BH," "),J=0,N=A.length;J<N;J++){G=G.replace(" "+A[J]+" "," ")}L.className=AL.trim(G)}else{L.className=""}}}}return this},toggleClass:function(F,A){var J=typeof F,G=typeof A==="boolean";if(AL.isFunction(F)){return this.each(function(L){var K=AL(this);K.toggleClass(F.call(this,L,K.attr("class"),A),A)})}return this.each(function(){if(J==="string"){for(var O,L=0,N=AL(this),P=A,K=F.split(AF);O=K[L++];){P=G?P:!N.hasClass(O);N[P?"addClass":"removeClass"](O)}}else{if(J==="undefined"||J==="boolean"){this.className&&AL.data(this,"__className__",this.className);this.className=this.className||F===false?"":AL.data(this,"__className__")||""}}})},hasClass:function(F){F=" "+F+" ";for(var A=0,G=this.length;A<G;A++){if((" "+this[A].className+" ").replace(BH," ").indexOf(F)>-1){return true}}return false},val:function(F){if(F===AC){var A=this[0];if(A){if(AL.nodeName(A,"option")){return(A.attributes.value||{}).specified?A.value:A.text}if(AL.nodeName(A,"select")){var O=A.selectedIndex,K=[],L=A.options;A=A.type==="select-one";if(O<0){return null}var G=A?O:0;for(O=A?O+1:L.length;G<O;G++){var J=L[G];if(J.selected){F=AL(J).val();if(A){return F}K.push(F)}}return K}if(A3.test(A.type)&&!AL.support.checkOn){return A.getAttribute("value")===null?"on":A.value}return(A.value||"").replace(BD,"")}return AC}var N=AL.isFunction(F);return this.each(function(P){var T=AL(this),R=F;if(this.nodeType===1){if(N){R=F.call(this,P,T.val())}if(typeof R==="number"){R+=""}if(AL.isArray(R)&&A3.test(this.type)){this.checked=AL.inArray(T.val(),R)>=0}else{if(AL.nodeName(this,"select")){var Q=AL.makeArray(R);AL("option",this).each(function(){this.selected=AL.inArray(AL(this).val(),Q)>=0});if(!Q.length){this.selectedIndex=-1}}else{this.value=R}}}})}});AL.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(F,A,L,J){if(!F||F.nodeType===3||F.nodeType===8){return AC}if(J&&A in AL.attrFn){return AL(F)[A](L)}J=F.nodeType!==1||!AL.isXMLDoc(F);var K=L!==AC;A=J&&AL.props[A]||A;if(F.nodeType===1){var G=Ar.test(A);if(A in F&&J&&!G){if(K){A==="type"&&Az.test(F.nodeName)&&F.parentNode&&AL.error("type property can't be changed");F[A]=L}if(AL.nodeName(F,"form")&&F.getAttributeNode(A)){return F.getAttributeNode(A).nodeValue}if(A==="tabIndex"){return(A=F.getAttributeNode("tabIndex"))&&A.specified?A.value:AZ.test(F.nodeName)||AE.test(F.nodeName)&&F.href?0:AC}return F[A]}if(!AL.support.style&&J&&A==="style"){if(K){F.style.cssText=""+L}return F.style.cssText}K&&F.setAttribute(A,""+L);F=!AL.support.hrefNormalized&&J&&G?F.getAttribute(A,2):F.getAttribute(A);return F===null?AC:F}return AL.style(F,A,L)}});var Ae=/\.(.*)$/,m=function(A){return A.replace(/[^\w\s\.\|`]/g,function(F){return"\\"+F})};AL.event={add:function(T,R,P,N){if(!(T.nodeType===3||T.nodeType===8)){if(T.setInterval&&T!==At&&!T.frameElement){T=At}var O,K;if(P.handler){O=P;P=O.handler}if(!P.guid){P.guid=AL.guid++}if(K=AL.data(T)){var L=K.events=K.events||{},F=K.handle;if(!F){K.handle=F=function(){return typeof AL!=="undefined"&&!AL.event.triggered?AL.event.handle.apply(F.elem,arguments):AC}}F.elem=T;R=R.split(" ");for(var J,G=0,A;J=R[G++];){K=O?AL.extend({},O):{handler:P,data:N};if(J.indexOf(".")>-1){A=J.split(".");J=A.shift();K.namespace=A.slice(0).sort().join(".")}else{A=[];K.namespace=""}K.type=J;K.guid=P.guid;var V=L[J],Q=AL.event.special[J]||{};if(!V){V=L[J]=[];if(!Q.setup||Q.setup.call(T,N,A,F)===false){if(T.addEventListener){T.addEventListener(J,F,false)}else{T.attachEvent&&T.attachEvent("on"+J,F)}}}if(Q.add){Q.add.call(T,K);if(!K.handler.guid){K.handler.guid=P.guid}}V.push(K);AL.event.global[J]=true}T=null}}},global:{},remove:function(W,V,R,P){if(!(W.nodeType===3||W.nodeType===8)){var Q,N=0,O,J,L,K,A,X,T=AL.data(W),F=T&&T.events;if(T&&F){if(V&&V.type){R=V.handler;V=V.type}if(!V||typeof V==="string"&&V.charAt(0)==="."){V=V||"";for(Q in F){AL.event.remove(W,Q+V)}}else{for(V=V.split(" ");Q=V[N++];){K=Q;O=Q.indexOf(".")<0;J=[];if(!O){J=Q.split(".");Q=J.shift();L=new RegExp("(^|\\.)"+AL.map(J.slice(0).sort(),m).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=F[Q]){if(R){K=AL.event.special[Q]||{};for(G=P||0;G<A.length;G++){X=A[G];if(R.guid===X.guid){if(O||L.test(X.namespace)){P==null&&A.splice(G--,1);K.remove&&K.remove.call(W,X)}if(P!=null){break}}}if(A.length===0||P!=null&&A.length===1){if(!K.teardown||K.teardown.call(W,J)===false){Al(W,Q,T.handle)}delete F[Q]}}else{for(var G=0;G<A.length;G++){X=A[G];if(O||L.test(X.namespace)){AL.event.remove(W,K,X.handler,G);A.splice(G--,1)}}}}}if(AL.isEmptyObject(F)){if(V=T.handle){V.elem=null}delete T.events;delete T.handle;AL.isEmptyObject(T)&&AL.removeData(W)}}}}},trigger:function(Q,P,O,L){var N=Q.type||Q;if(!L){Q=typeof Q==="object"?Q[Am]?Q:AL.extend(AL.Event(N),Q):AL.Event(N);if(N.indexOf("!")>=0){Q.type=N=N.slice(0,-1);Q.exclusive=true}if(!O){Q.stopPropagation();AL.event.global[N]&&AL.each(AL.cache,function(){this.events&&this.events[N]&&AL.event.trigger(Q,P,this.handle.elem)})}if(!O||O.nodeType===3||O.nodeType===8){return AC}Q.result=AC;Q.target=O;P=AL.makeArray(P);P.unshift(Q)}Q.currentTarget=O;(L=AL.data(O,"handle"))&&L.apply(O,P);L=O.parentNode||O.ownerDocument;try{if(!(O&&O.nodeName&&AL.noData[O.nodeName.toLowerCase()])){if(O["on"+N]&&O["on"+N].apply(O,P)===false){Q.result=false}}}catch(J){}if(!Q.isPropagationStopped()&&L){AL.event.trigger(Q,P,L,true)}else{if(!Q.isDefaultPrevented()){L=Q.target;var K,A=AL.nodeName(L,"a")&&N==="click",G=AL.event.special[N]||{};if((!G._default||G._default.call(O,Q)===false)&&!A&&!(L&&L.nodeName&&AL.noData[L.nodeName.toLowerCase()])){try{if(L[N]){if(K=L["on"+N]){L["on"+N]=null}AL.event.triggered=true;L[N]()}}catch(F){}if(K){L["on"+N]=K}AL.event.triggered=false}}}},handle:function(F){var A,N,K,L;F=arguments[0]=AL.event.fix(F||At.event);F.currentTarget=this;A=F.type.indexOf(".")<0&&!F.exclusive;if(!A){N=F.type.split(".");F.type=N.shift();K=new RegExp("(^|\\.)"+N.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}L=AL.data(this,"events");N=L[F.type];if(L&&N){N=N.slice(0);L=0;for(var G=N.length;L<G;L++){var J=N[L];if(A||K.test(J.namespace)){F.handler=J.handler;F.data=J.data;F.handleObj=J;J=J.handler.apply(this,arguments);if(J!==AC){F.result=J;if(J===false){F.preventDefault();F.stopPropagation()}}if(F.isImmediatePropagationStopped()){break}}}}return F.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(F){if(F[Am]){return F}var A=F;F=AL.Event(A);for(var J=this.props.length,G;J;){G=this.props[--J];F[G]=A[G]}if(!F.target){F.target=F.srcElement||AD}if(F.target.nodeType===3){F.target=F.target.parentNode}if(!F.relatedTarget&&F.fromElement){F.relatedTarget=F.fromElement===F.target?F.toElement:F.fromElement}if(F.pageX==null&&F.clientX!=null){A=AD.documentElement;J=AD.body;F.pageX=F.clientX+(A&&A.scrollLeft||J&&J.scrollLeft||0)-(A&&A.clientLeft||J&&J.clientLeft||0);F.pageY=F.clientY+(A&&A.scrollTop||J&&J.scrollTop||0)-(A&&A.clientTop||J&&J.clientTop||0)}if(!F.which&&(F.charCode||F.charCode===0?F.charCode:F.keyCode)){F.which=F.charCode||F.keyCode}if(!F.metaKey&&F.ctrlKey){F.metaKey=F.ctrlKey}if(!F.which&&F.button!==AC){F.which=F.button&1?1:F.button&2?3:F.button&4?2:0}return F},guid:100000000,proxy:AL.proxy,special:{ready:{setup:AL.bindReady,teardown:AL.noop},live:{add:function(A){AL.event.add(this,A.origType,AL.extend({},A,{handler:AK}))},remove:function(F){var A=true,G=F.origType.replace(Ae,"");AL.each(AL.data(this,"events").live||[],function(){if(G===this.origType.replace(Ae,"")){return A=false}});A&&AL.event.remove(this,F.origType,AK)}},beforeunload:{setup:function(F,A,G){if(this.setInterval){this.onbeforeunload=G}return false},teardown:function(F,A){if(this.onbeforeunload===A){this.onbeforeunload=null}}}}};var Al=AD.removeEventListener?function(F,A,G){F.removeEventListener(A,G,false)}:function(F,A,G){F.detachEvent("on"+A,G)};AL.Event=function(A){if(!this.preventDefault){return new AL.Event(A)}if(A&&A.type){this.originalEvent=A;this.type=A.type}else{this.type=A}this.timeStamp=Ak();this[Am]=true};AL.Event.prototype={preventDefault:function(){this.isDefaultPrevented=AQ;var A=this.originalEvent;if(A){A.preventDefault&&A.preventDefault();A.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=AQ;var A=this.originalEvent;if(A){A.stopPropagation&&A.stopPropagation();A.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=AQ;this.stopPropagation()},isDefaultPrevented:AS,isPropagationStopped:AS,isImmediatePropagationStopped:AS};var AI=function(F){var A=F.relatedTarget;try{for(;A&&A!==this;){A=A.parentNode}if(A!==this){F.type=F.data;AL.event.handle.apply(this,arguments)}}catch(G){}},r=function(A){A.type=A.data;AL.event.handle.apply(this,arguments)};AL.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(F,A){AL.event.special[F]={setup:function(G){AL.event.add(this,A,G&&G.selector?r:AI,F)},teardown:function(G){AL.event.remove(this,A,G&&G.selector?r:AI)}}});if(!AL.support.submitBubbles){AL.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!=="form"){AL.event.add(this,"click.specialSubmit",function(F){var A=F.target,G=A.type;if((G==="submit"||G==="image")&&AL(A).closest("form").length){return Ap("submit",this,arguments)}});AL.event.add(this,"keypress.specialSubmit",function(F){var A=F.target,G=A.type;if((G==="text"||G==="password")&&AL(A).closest("form").length&&F.keyCode===13){return Ap("submit",this,arguments)}})}else{return false}},teardown:function(){AL.event.remove(this,".specialSubmit")}}}if(!AL.support.changeBubbles){var n=/textarea|input|select/i,I,U=function(F){var A=F.type,G=F.value;if(A==="radio"||A==="checkbox"){G=F.checked}else{if(A==="select-multiple"){G=F.selectedIndex>-1?AL.map(F.options,function(J){return J.selected}).join("-"):""}else{if(F.nodeName.toLowerCase()==="select"){G=F.selectedIndex}}}return G},BG=function(F,A){var K=F.target,G,J;if(!(!n.test(K.nodeName)||K.readOnly)){G=AL.data(K,"_change_data");J=U(K);if(F.type!=="focusout"||K.type!=="radio"){AL.data(K,"_change_data",J)}if(!(G===AC||J===G)){if(G!=null||J){F.type="change";return AL.event.trigger(F,A,K)}}}};AL.event.special.change={filters:{focusout:BG,click:function(F){var A=F.target,G=A.type;if(G==="radio"||G==="checkbox"||A.nodeName.toLowerCase()==="select"){return BG.call(this,F)}},keydown:function(F){var A=F.target,G=A.type;if(F.keyCode===13&&A.nodeName.toLowerCase()!=="textarea"||F.keyCode===32&&(G==="checkbox"||G==="radio")||G==="select-multiple"){return BG.call(this,F)}},beforeactivate:function(A){A=A.target;AL.data(A,"_change_data",U(A))}},setup:function(){if(this.type==="file"){return false}for(var A in I){AL.event.add(this,A+".specialChange",I[A])}return n.test(this.nodeName)},teardown:function(){AL.event.remove(this,".specialChange");return n.test(this.nodeName)}};I=AL.event.special.change.filters}AD.addEventListener&&AL.each({focus:"focusin",blur:"focusout"},function(F,A){function G(J){J=AL.event.fix(J);J.type=A;return AL.event.handle.call(this,J)}AL.event.special[A]={setup:function(){this.addEventListener(F,G,true)},teardown:function(){this.removeEventListener(F,G,true)}}});AL.each(["bind","one"],function(F,A){AL.fn[A]=function(O,K,L){if(typeof O==="object"){for(var G in O){this[A](G,K,O[G],L)}return this}if(AL.isFunction(K)){L=K;K=AC}var J=A==="one"?AL.proxy(L,function(P){AL(this).unbind(P,J);return L.apply(this,arguments)}):L;if(O==="unload"&&A!=="one"){this.one(O,K,L)}else{G=0;for(var N=this.length;G<N;G++){AL.event.add(this[G],O,J,K)}}return this}});AL.fn.extend({unbind:function(F,A){if(typeof F==="object"&&!F.preventDefault){for(var J in F){this.unbind(J,F[J])}}else{J=0;for(var G=this.length;J<G;J++){AL.event.remove(this[J],F,A)}}return this},delegate:function(F,A,J,G){return this.live(A,J,G,F)},undelegate:function(F,A,G){return arguments.length===0?this.unbind("live"):this.die(A,null,G,F)},trigger:function(F,A){return this.each(function(){AL.event.trigger(F,A,this)})},triggerHandler:function(F,A){if(this[0]){F=AL.Event(F);F.preventDefault();F.stopPropagation();AL.event.trigger(F,A,this[0]);return F.result}},toggle:function(F){for(var A=arguments,G=1;G<A.length;){AL.proxy(F,A[G++])}return this.click(AL.proxy(F,function(J){var K=(AL.data(this,"lastToggle"+F.guid)||0)%G;AL.data(this,"lastToggle"+F.guid,K+1);J.preventDefault();return A[K].apply(this,arguments)||false}))},hover:function(F,A){return this.mouseenter(F).mouseleave(A||F)}});var BK={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};AL.each(["live","die"],function(F,A){AL.fn[A]=function(R,P,Q,N){var O,J=0,L,K,G=N||this.selector,T=N?this:AL(this.context);if(AL.isFunction(P)){Q=P;P=AC}for(R=(R||"").split(" ");(O=R[J++])!=null;){N=Ae.exec(O);L="";if(N){L=N[0];O=O.replace(Ae,"")}if(O==="hover"){R.push("mouseenter"+L,"mouseleave"+L)}else{K=O;if(O==="focus"||O==="blur"){R.push(BK[O]+L);O+=L}else{O=(BK[O]||O)+L}A==="live"?T.each(function(){AL.event.add(this,u(O,G),{data:P,selector:G,handler:Q,origType:O,origHandler:Q,preType:K})}):T.unbind(u(O,G),Q)}}return this}});AL.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(F,A){AL.fn[A]=function(G){return G?this.bind(A,G):this.trigger(A)};if(AL.attrFn){AL.attrFn[A]=true}});At.attachEvent&&!At.addEventListener&&At.attachEvent("onunload",function(){for(var F in AL.cache){if(AL.cache[F].handle){try{AL.event.remove(AL.cache[F].handle.elem)}catch(A){}}}});(function(){function Z(BO){for(var Ab="",Aa,w=0;BO[w];w++){Aa=BO[w];if(Aa.nodeType===3||Aa.nodeType===4){Ab+=Aa.nodeValue}else{if(Aa.nodeType!==8){Ab+=Z(Aa.childNodes)}}}return Ab}function Y(BQ,BP,BO,Ab,w,Aa){w=0;for(var BS=Ab.length;w<BS;w++){var BT=Ab[w];if(BT){BT=BT[BQ];for(var BR=false;BT;){if(BT.sizcache===BO){BR=Ab[BT.sizset];break}if(BT.nodeType===1&&!Aa){BT.sizcache=BO;BT.sizset=w}if(BT.nodeName.toLowerCase()===BP){BR=BT;break}BT=BT[BQ]}Ab[w]=BR}}}function X(BQ,BP,BO,Ab,w,Aa){w=0;for(var BS=Ab.length;w<BS;w++){var BT=Ab[w];if(BT){BT=BT[BQ];for(var BR=false;BT;){if(BT.sizcache===BO){BR=Ab[BT.sizset];break}if(BT.nodeType===1){if(!Aa){BT.sizcache=BO;BT.sizset=w}if(typeof BP!=="string"){if(BT===BP){BR=true;break}}else{if(Q.filter(BP,[BT]).length>0){BR=BT;break}}}BT=BT[BQ]}Ab[w]=BR}}}var V=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,W=0,R=Object.prototype.toString,T=false,O=true;[0,0].sort(function(){O=false;return 0});var Q=function(BS,BR,BP,BO){BP=BP||[];var Aa=BR=BR||AD;if(BR.nodeType!==1&&BR.nodeType!==9){return[]}if(!BS||typeof BS!=="string"){return BP}for(var Ab=[],BX,BY,BU,BQ,BW=true,BT=F(BR),BV=BS;(V.exec(""),BX=V.exec(BV))!==null;){BV=BX[3];Ab.push(BX[1]);if(BX[2]){BQ=BX[3];break}}if(Ab.length>1&&L.exec(BS)){if(Ab.length===2&&P.relative[Ab[0]]){BY=s(Ab[0]+Ab[1],BR)}else{for(BY=P.relative[Ab[0]]?[BR]:Q(Ab.shift(),BR);Ab.length;){BS=Ab.shift();if(P.relative[BS]){BS+=Ab.shift()}BY=s(BS,BY)}}}else{if(!BO&&Ab.length>1&&BR.nodeType===9&&!BT&&P.match.ID.test(Ab[0])&&!P.match.ID.test(Ab[Ab.length-1])){BX=Q.find(Ab.shift(),BR,BT);BR=BX.expr?Q.filter(BX.expr,BX.set)[0]:BX.set[0]}if(BR){BX=BO?{expr:Ab.pop(),set:A(BO)}:Q.find(Ab.pop(),Ab.length===1&&(Ab[0]==="~"||Ab[0]==="+")&&BR.parentNode?BR.parentNode:BR,BT);BY=BX.expr?Q.filter(BX.expr,BX.set):BX.set;if(Ab.length>0){BU=A(BY)}else{BW=false}for(;Ab.length;){var w=Ab.pop();BX=w;if(P.relative[w]){BX=Ab.pop()}else{w=""}if(BX==null){BX=BR}P.relative[w](BU,BX,BT)}}else{BU=[]}}BU||(BU=BY);BU||Q.error(w||BS);if(R.call(BU)==="[object Array]"){if(BW){if(BR&&BR.nodeType===1){for(BS=0;BU[BS]!=null;BS++){if(BU[BS]&&(BU[BS]===true||BU[BS].nodeType===1&&J(BR,BU[BS]))){BP.push(BY[BS])}}}else{for(BS=0;BU[BS]!=null;BS++){BU[BS]&&BU[BS].nodeType===1&&BP.push(BY[BS])}}}else{BP.push.apply(BP,BU)}}else{A(BU,BP)}if(BQ){Q(BQ,Aa,BP,BO);Q.uniqueSort(BP)}return BP};Q.uniqueSort=function(Aa){if(N){T=O;Aa.sort(N);if(T){for(var w=1;w<Aa.length;w++){Aa[w]===Aa[w-1]&&Aa.splice(w--,1)}}}return Aa};Q.matches=function(Aa,w){return Q(Aa,null,null,w)};Q.find=function(BQ,BP,BO){var Ab,w;if(!BQ){return[]}for(var Aa=0,BS=P.order.length;Aa<BS;Aa++){var BT=P.order[Aa];if(w=P.leftMatch[BT].exec(BQ)){var BR=w[1];w.splice(1,1);if(BR.substr(BR.length-1)!=="\\"){w[1]=(w[1]||"").replace(/\\/g,"");Ab=P.find[BT](w,BP,BO);if(Ab!=null){BQ=BQ.replace(P.match[BT],"");break}}}}Ab||(Ab=BP.getElementsByTagName("*"));return{set:Ab,expr:BQ}};Q.filter=function(BT,BS,BQ,BO){for(var Aa=BT,Ab=[],BZ=BS,Ba,BW,BR=BS&&BS[0]&&F(BS[0]);BT&&BS.length;){for(var BY in P.filter){if((Ba=P.leftMatch[BY].exec(BT))!=null&&Ba[2]){var BU=P.filter[BY],BX,w;w=Ba[1];BW=false;Ba.splice(1,1);if(w.substr(w.length-1)!=="\\"){if(BZ===Ab){Ab=[]}if(P.preFilter[BY]){if(Ba=P.preFilter[BY](Ba,BZ,BQ,Ab,BO,BR)){if(Ba===true){continue}}else{BW=BX=true}}if(Ba){for(var BP=0;(w=BZ[BP])!=null;BP++){if(w){BX=BU(w,Ba,BP,BZ);var BV=BO^!!BX;if(BQ&&BX!=null){if(BV){BW=true}else{BZ[BP]=false}}else{if(BV){Ab.push(w);BW=true}}}}}if(BX!==AC){BQ||(BZ=Ab);BT=BT.replace(P.match[BY],"");if(!BW){return[]}break}}}}if(BT===Aa){if(BW==null){Q.error(BT)}else{break}}Aa=BT}return BZ};Q.error=function(w){throw"Syntax error, unrecognized expression: "+w};var P=Q.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(w){return w.getAttribute("href")}},relative:{"+":function(BO,Ab){var Aa=typeof Ab==="string",w=Aa&&!/\W/.test(Ab);Aa=Aa&&!w;if(w){Ab=Ab.toLowerCase()}w=0;for(var BP=BO.length,BQ;w<BP;w++){if(BQ=BO[w]){for(;(BQ=BQ.previousSibling)&&BQ.nodeType!==1;){}BO[w]=Aa||BQ&&BQ.nodeName.toLowerCase()===Ab?BQ||false:BQ===Ab}}Aa&&Q.filter(Ab,BO,true)},">":function(BO,Ab){var Aa=typeof Ab==="string";if(Aa&&!/\W/.test(Ab)){Ab=Ab.toLowerCase();for(var w=0,BP=BO.length;w<BP;w++){var BQ=BO[w];if(BQ){Aa=BQ.parentNode;BO[w]=Aa.nodeName.toLowerCase()===Ab?Aa:false}}}else{w=0;for(BP=BO.length;w<BP;w++){if(BQ=BO[w]){BO[w]=Aa?BQ.parentNode:BQ.parentNode===Ab}}Aa&&Q.filter(Ab,BO,true)}},"":function(BO,Ab,Aa){var w=W++,BP=X;if(typeof Ab==="string"&&!/\W/.test(Ab)){var BQ=Ab=Ab.toLowerCase();BP=Y}BP("parentNode",Ab,w,BO,BQ,Aa)},"~":function(BO,Ab,Aa){var w=W++,BP=X;if(typeof Ab==="string"&&!/\W/.test(Ab)){var BQ=Ab=Ab.toLowerCase();BP=Y}BP("previousSibling",Ab,w,BO,BQ,Aa)}},find:{ID:function(Ab,Aa,w){if(typeof Aa.getElementById!=="undefined"&&!w){return(Ab=Aa.getElementById(Ab[1]))?[Ab]:[]}},NAME:function(BO,Ab){if(typeof Ab.getElementsByName!=="undefined"){var Aa=[];Ab=Ab.getElementsByName(BO[1]);for(var w=0,BP=Ab.length;w<BP;w++){Ab[w].getAttribute("name")===BO[1]&&Aa.push(Ab[w])}return Aa.length===0?null:Aa}},TAG:function(Aa,w){return w.getElementsByTagName(Aa[1])}},preFilter:{CLASS:function(BP,BO,Aa,w,BQ,BR){BP=" "+BP[1].replace(/\\/g,"")+" ";if(BR){return BP}BR=0;for(var Ab;(Ab=BO[BR])!=null;BR++){if(Ab){if(BQ^(Ab.className&&(" "+Ab.className+" ").replace(/[\t\n]/g," ").indexOf(BP)>=0)){Aa||w.push(Ab)}else{if(Aa){BO[BR]=false}}}}return false},ID:function(w){return w[1].replace(/\\/g,"")},TAG:function(w){return w[1].toLowerCase()},CHILD:function(Aa){if(Aa[1]==="nth"){var w=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(Aa[2]==="even"&&"2n"||Aa[2]==="odd"&&"2n+1"||!/\D/.test(Aa[2])&&"0n+"+Aa[2]||Aa[2]);Aa[2]=w[1]+(w[2]||1)-0;Aa[3]=w[3]-0}Aa[0]=W++;return Aa},ATTR:function(BO,Ab,Aa,w,BP,BQ){Ab=BO[1].replace(/\\/g,"");if(!BQ&&P.attrMap[Ab]){BO[1]=P.attrMap[Ab]}if(BO[2]==="~="){BO[4]=" "+BO[4]+" "}return BO},PSEUDO:function(BO,Ab,Aa,w,BP){if(BO[1]==="not"){if((V.exec(BO[3])||"").length>1||/^\w/.test(BO[3])){BO[3]=Q(BO[3],null,null,Ab)}else{BO=Q.filter(BO[3],Ab,Aa,true^BP);Aa||w.push.apply(w,BO);return false}}else{if(P.match.POS.test(BO[0])||P.match.CHILD.test(BO[0])){return true}}return BO},POS:function(w){w.unshift(true);return w}},filters:{enabled:function(w){return w.disabled===false&&w.type!=="hidden"},disabled:function(w){return w.disabled===true},checked:function(w){return w.checked===true},selected:function(w){return w.selected===true},parent:function(w){return !!w.firstChild},empty:function(w){return !w.firstChild},has:function(Ab,Aa,w){return !!Q(w[3],Ab).length},header:function(w){return/h\d/i.test(w.nodeName)},text:function(w){return"text"===w.type},radio:function(w){return"radio"===w.type},checkbox:function(w){return"checkbox"===w.type},file:function(w){return"file"===w.type},password:function(w){return"password"===w.type},submit:function(w){return"submit"===w.type},image:function(w){return"image"===w.type},reset:function(w){return"reset"===w.type},button:function(w){return"button"===w.type||w.nodeName.toLowerCase()==="button"},input:function(w){return/input|select|textarea|button/i.test(w.nodeName)}},setFilters:{first:function(Aa,w){return w===0},last:function(BO,Ab,Aa,w){return Ab===w.length-1},even:function(Aa,w){return w%2===0},odd:function(Aa,w){return w%2===1},lt:function(Ab,Aa,w){return Aa<w[3]-0},gt:function(Ab,Aa,w){return Aa>w[3]-0},nth:function(Ab,Aa,w){return w[3]-0===Aa},eq:function(Ab,Aa,w){return w[3]-0===Aa}},filter:{PSEUDO:function(BO,Ab,Aa,w){var BP=Ab[1],BQ=P.filters[BP];if(BQ){return BQ(BO,Aa,Ab,w)}else{if(BP==="contains"){return(BO.textContent||BO.innerText||Z([BO])||"").indexOf(Ab[3])>=0}else{if(BP==="not"){Ab=Ab[3];Aa=0;for(w=Ab.length;Aa<w;Aa++){if(Ab[Aa]===BO){return false}}return true}else{Q.error("Syntax error, unrecognized expression: "+BP)}}}},CHILD:function(BP,BO){var Aa=BO[1],w=BP;switch(Aa){case"only":case"first":for(;w=w.previousSibling;){if(w.nodeType===1){return false}}if(Aa==="first"){return true}w=BP;case"last":for(;w=w.nextSibling;){if(w.nodeType===1){return false}}return true;case"nth":Aa=BO[2];var BQ=BO[3];if(Aa===1&&BQ===0){return true}BO=BO[0];var BR=BP.parentNode;if(BR&&(BR.sizcache!==BO||!BP.nodeIndex)){var Ab=0;for(w=BR.firstChild;w;w=w.nextSibling){if(w.nodeType===1){w.nodeIndex=++Ab}}BR.sizcache=BO}BP=BP.nodeIndex-BQ;return Aa===0?BP===0:BP%Aa===0&&BP/Aa>=0}},ID:function(Aa,w){return Aa.nodeType===1&&Aa.getAttribute("id")===w},TAG:function(Aa,w){return w==="*"&&Aa.nodeType===1||Aa.nodeName.toLowerCase()===w},CLASS:function(Aa,w){return(" "+(Aa.className||Aa.getAttribute("class"))+" ").indexOf(w)>-1},ATTR:function(BO,Ab){var Aa=Ab[1];BO=P.attrHandle[Aa]?P.attrHandle[Aa](BO):BO[Aa]!=null?BO[Aa]:BO.getAttribute(Aa);Aa=BO+"";var w=Ab[2];Ab=Ab[4];return BO==null?w==="!=":w==="="?Aa===Ab:w==="*="?Aa.indexOf(Ab)>=0:w==="~="?(" "+Aa+" ").indexOf(Ab)>=0:!Ab?Aa&&BO!==false:w==="!="?Aa!==Ab:w==="^="?Aa.indexOf(Ab)===0:w==="$="?Aa.substr(Aa.length-Ab.length)===Ab:w==="|="?Aa===Ab||Aa.substr(0,Ab.length+1)===Ab+"-":false},POS:function(BO,Ab,Aa,w){var BP=P.setFilters[Ab[2]];if(BP){return BP(BO,Aa,Ab,w)}}}},L=P.match.POS;for(var G in P.match){P.match[G]=new RegExp(P.match[G].source+/(?![^\[]*\])(?![^\(]*\))/.source);P.leftMatch[G]=new RegExp(/(^(?:.|\r|\n)*?)/.source+P.match[G].source.replace(/\\(\d+)/g,function(Aa,w){return"\\"+(w-0+1)}))}var A=function(Aa,w){Aa=Array.prototype.slice.call(Aa,0);if(w){w.push.apply(w,Aa);return w}return Aa};try{Array.prototype.slice.call(AD.documentElement.childNodes,0)}catch(K){A=function(BO,Ab){Ab=Ab||[];if(R.call(BO)==="[object Array]"){Array.prototype.push.apply(Ab,BO)}else{if(typeof BO.length==="number"){for(var Aa=0,w=BO.length;Aa<w;Aa++){Ab.push(BO[Aa])}}else{for(Aa=0;BO[Aa];Aa++){Ab.push(BO[Aa])}}}return Ab}}var N;if(AD.documentElement.compareDocumentPosition){N=function(Aa,w){if(!Aa.compareDocumentPosition||!w.compareDocumentPosition){if(Aa==w){T=true}return Aa.compareDocumentPosition?-1:1}Aa=Aa.compareDocumentPosition(w)&4?-1:Aa===w?0:1;if(Aa===0){T=true}return Aa}}else{if("sourceIndex" in AD.documentElement){N=function(Aa,w){if(!Aa.sourceIndex||!w.sourceIndex){if(Aa==w){T=true}return Aa.sourceIndex?-1:1}Aa=Aa.sourceIndex-w.sourceIndex;if(Aa===0){T=true}return Aa}}else{if(AD.createRange){N=function(BO,Ab){if(!BO.ownerDocument||!Ab.ownerDocument){if(BO==Ab){T=true}return BO.ownerDocument?-1:1}var Aa=BO.ownerDocument.createRange(),w=Ab.ownerDocument.createRange();Aa.setStart(BO,0);Aa.setEnd(BO,0);w.setStart(Ab,0);w.setEnd(Ab,0);BO=Aa.compareBoundaryPoints(Range.START_TO_END,w);if(BO===0){T=true}return BO}}}}(function(){var Ab=AD.createElement("div"),Aa="script"+(new Date).getTime();Ab.innerHTML="<a name='"+Aa+"'/>";var w=AD.documentElement;w.insertBefore(Ab,w.firstChild);if(AD.getElementById(Aa)){P.find.ID=function(BO,BP,BQ){if(typeof BP.getElementById!=="undefined"&&!BQ){return(BP=BP.getElementById(BO[1]))?BP.id===BO[1]||typeof BP.getAttributeNode!=="undefined"&&BP.getAttributeNode("id").nodeValue===BO[1]?[BP]:AC:[]}};P.filter.ID=function(BO,BP){var BQ=typeof BO.getAttributeNode!=="undefined"&&BO.getAttributeNode("id");return BO.nodeType===1&&BQ&&BQ.nodeValue===BP}}w.removeChild(Ab);w=Ab=null})();(function(){var w=AD.createElement("div");w.appendChild(AD.createComment(""));if(w.getElementsByTagName("*").length>0){P.find.TAG=function(BO,Ab){Ab=Ab.getElementsByTagName(BO[1]);if(BO[1]==="*"){BO=[];for(var Aa=0;Ab[Aa];Aa++){Ab[Aa].nodeType===1&&BO.push(Ab[Aa])}Ab=BO}return Ab}}w.innerHTML="<a href='#'></a>";if(w.firstChild&&typeof w.firstChild.getAttribute!=="undefined"&&w.firstChild.getAttribute("href")!=="#"){P.attrHandle.href=function(Aa){return Aa.getAttribute("href",2)}}w=null})();AD.querySelectorAll&&function(){var Ab=Q,Aa=AD.createElement("div");Aa.innerHTML="<p class='TEST'></p>";if(!(Aa.querySelectorAll&&Aa.querySelectorAll(".TEST").length===0)){Q=function(BO,BR,BS,BP){BR=BR||AD;if(!BP&&BR.nodeType===9&&!F(BR)){try{return A(BR.querySelectorAll(BO),BS)}catch(BQ){}}return Ab(BO,BR,BS,BP)};for(var w in Ab){Q[w]=Ab[w]}Aa=null}}();(function(){var w=AD.createElement("div");w.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!w.getElementsByClassName||w.getElementsByClassName("e").length===0)){w.lastChild.className="e";if(w.getElementsByClassName("e").length!==1){P.order.splice(1,0,"CLASS");P.find.CLASS=function(BO,Ab,Aa){if(typeof Ab.getElementsByClassName!=="undefined"&&!Aa){return Ab.getElementsByClassName(BO[1])}};w=null}}})();var J=AD.compareDocumentPosition?function(Aa,w){return !!(Aa.compareDocumentPosition(w)&16)}:function(Aa,w){return Aa!==w&&(Aa.contains?Aa.contains(w):true)},F=function(w){return(w=(w?w.ownerDocument||w:0).documentElement)?w.nodeName!=="HTML":false},s=function(BO,Ab){var Aa=[],w="",BP;for(Ab=Ab.nodeType?[Ab]:Ab;BP=P.match.PSEUDO.exec(BO);){w+=BP[0];BO=BO.replace(P.match.PSEUDO,"")}BO=P.relative[BO]?BO+"*":BO;BP=0;for(var BQ=Ab.length;BP<BQ;BP++){Q(BO,Ab[BP],Aa)}return Q.filter(w,Aa)};AL.find=Q;AL.expr=Q.selectors;AL.expr[":"]=AL.expr.filters;AL.unique=Q.uniqueSort;AL.text=Z;AL.isXMLDoc=F;AL.contains=J})();var H=/Until$/,BE=/^(?:parents|prevUntil|prevAll)/,A1=/,/;AX=Array.prototype.slice;var Aq=function(F,A,J){if(AL.isFunction(A)){return AL.grep(F,function(L,K){return !!A.call(L,K,L)===J})}else{if(A.nodeType){return AL.grep(F,function(K){return K===A===J})}else{if(typeof A==="string"){var G=AL.grep(F,function(K){return K.nodeType===1});if(Ay.test(A)){return AL.filter(A,G,!J)}else{A=AL.filter(A,G)}}}}return AL.grep(F,function(K){return AL.inArray(K,A)>=0===J})};AL.fn.extend({find:function(F){for(var A=this.pushStack("","find",F),N=0,K=0,L=this.length;K<L;K++){N=A.length;AL.find(F,this[K],A);if(K>0){for(var G=N;G<A.length;G++){for(var J=0;J<N;J++){if(A[J]===A[G]){A.splice(G--,1);break}}}}}return A},has:function(F){var A=AL(F);return this.filter(function(){for(var J=0,G=A.length;J<G;J++){if(AL.contains(this,A[J])){return true}}})},not:function(A){return this.pushStack(Aq(this,A,false),"not",A)},filter:function(A){return this.pushStack(Aq(this,A,true),"filter",A)},is:function(A){return !!A&&AL.filter(A,this).length>0},closest:function(P,O){if(AL.isArray(P)){var N=[],K=this[0],L,G={},J;if(K&&P.length){L=0;for(var A=P.length;L<A;L++){J=P[L];G[J]||(G[J]=AL.expr.match.POS.test(J)?AL(J,O||this.context):J)}for(;K&&K.ownerDocument&&K!==O;){for(J in G){L=G[J];if(L.jquery?L.index(K)>-1:AL(K).is(L)){N.push({selector:J,elem:K});delete G[J]}}K=K.parentNode}}return N}var F=AL.expr.match.POS.test(P)?AL(P,O||this.context):null;return this.map(function(R,Q){for(;Q&&Q.ownerDocument&&Q!==O;){if(F?F.index(Q)>-1:AL(Q).is(P)){return Q}Q=Q.parentNode}return null})},index:function(A){if(!A||typeof A==="string"){return AL.inArray(this[0],A?AL(A):this.parent().children())}return AL.inArray(A.jquery?A[0]:A,this)},add:function(F,A){F=typeof F==="string"?AL(F,A||this.context):AL.makeArray(F);A=AL.merge(this.get(),F);return this.pushStack(e(F[0])||e(A[0])?A:AL.unique(A))},andSelf:function(){return this.add(this.prevObject)}});AL.each({parent:function(A){return(A=A.parentNode)&&A.nodeType!==11?A:null},parents:function(A){return AL.dir(A,"parentNode")},parentsUntil:function(F,A,G){return AL.dir(F,"parentNode",G)},next:function(A){return AL.nth(A,2,"nextSibling")},prev:function(A){return AL.nth(A,2,"previousSibling")},nextAll:function(A){return AL.dir(A,"nextSibling")},prevAll:function(A){return AL.dir(A,"previousSibling")},nextUntil:function(F,A,G){return AL.dir(F,"nextSibling",G)},prevUntil:function(F,A,G){return AL.dir(F,"previousSibling",G)},siblings:function(A){return AL.sibling(A.parentNode.firstChild,A)},children:function(A){return AL.sibling(A.firstChild)},contents:function(A){return AL.nodeName(A,"iframe")?A.contentDocument||A.contentWindow.document:AL.makeArray(A.childNodes)}},function(F,A){AL.fn[F]=function(K,G){var J=AL.map(this,A,K);H.test(F)||(G=K);if(G&&typeof G==="string"){J=AL.filter(G,J)}J=this.length>1?AL.unique(J):J;if((this.length>1||A1.test(G))&&BE.test(F)){J=J.reverse()}return this.pushStack(J,F,AX.call(arguments).join(","))}});AL.extend({filter:function(F,A,G){if(G){F=":not("+F+")"}return AL.find.matches(F,A)},dir:function(F,A,J){var G=[];for(F=F[A];F&&F.nodeType!==9&&(J===AC||F.nodeType!==1||!AL(F).is(J));){F.nodeType===1&&G.push(F);F=F[A]}return G},nth:function(F,A,J){A=A||1;for(var G=0;F;F=F[J]){if(F.nodeType===1&&++G===A){break}}return F},sibling:function(F,A){for(var G=[];F;F=F.nextSibling){F.nodeType===1&&F!==A&&G.push(F)}return G}});var AM=/ jQuery\d+="(?:\d+|null)"/g,AV=/^\s+/,x=/(<([\w:]+)[^>]*?)\/>/g,Ai=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,f=/<([\w:]+)/,AG=/<tbody/i,o=/<|&#?\w+;/,Au=/<script|<object|<embed|<option|<style/i,AO=/checked\s*(?:[^=]|=\s*.checked.)/i,BN=function(F,A,G){return Ai.test(G)?F:A+"></"+G+">"},Ao={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};Ao.optgroup=Ao.option;Ao.tbody=Ao.tfoot=Ao.colgroup=Ao.caption=Ao.thead;Ao.th=Ao.td;if(!AL.support.htmlSerialize){Ao._default=[1,"div<div>","</div>"]}AL.fn.extend({text:function(A){if(AL.isFunction(A)){return this.each(function(F){var G=AL(this);G.text(A.call(this,F,G.text()))})}if(typeof A!=="object"&&A!==AC){return this.empty().append((this[0]&&this[0].ownerDocument||AD).createTextNode(A))}return AL.text(this)},wrapAll:function(F){if(AL.isFunction(F)){return this.each(function(G){AL(this).wrapAll(F.call(this,G))})}if(this[0]){var A=AL(F,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&A.insertBefore(this[0]);A.map(function(){for(var G=this;G.firstChild&&G.firstChild.nodeType===1;){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(A){if(AL.isFunction(A)){return this.each(function(F){AL(this).wrapInner(A.call(this,F))})}return this.each(function(){var F=AL(this),G=F.contents();G.length?G.wrapAll(A):F.append(A)})},wrap:function(A){return this.each(function(){AL(this).wrapAll(A)})},unwrap:function(){return this.parent().each(function(){AL.nodeName(this,"body")||AL(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(A){this.nodeType===1&&this.appendChild(A)})},prepend:function(){return this.domManip(arguments,true,function(A){this.nodeType===1&&this.insertBefore(A,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(F){this.parentNode.insertBefore(F,this)})}else{if(arguments.length){var A=AL(arguments[0]);A.push.apply(A,this.toArray());return this.pushStack(A,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(F){this.parentNode.insertBefore(F,this.nextSibling)})}else{if(arguments.length){var A=this.pushStack(this,"after",arguments);A.push.apply(A,AL(arguments[0]).toArray());return A}}},remove:function(F,A){for(var J=0,G;(G=this[J])!=null;J++){if(!F||AL.filter(F,[G]).length){if(!A&&G.nodeType===1){AL.cleanData(G.getElementsByTagName("*"));AL.cleanData([G])}G.parentNode&&G.parentNode.removeChild(G)}}return this},empty:function(){for(var F=0,A;(A=this[F])!=null;F++){for(A.nodeType===1&&AL.cleanData(A.getElementsByTagName("*"));A.firstChild;){A.removeChild(A.firstChild)}}return this},clone:function(F){var A=this.map(function(){if(!AL.support.noCloneEvent&&!AL.isXMLDoc(this)){var J=this.outerHTML,G=this.ownerDocument;if(!J){J=G.createElement("div");J.appendChild(this.cloneNode(true));J=J.innerHTML}return AL.clean([J.replace(AM,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(AV,"")],G)[0]}else{return this.cloneNode(true)}});if(F===true){BM(this,A);BM(this.find("*"),A.find("*"))}return A},html:function(F){if(F===AC){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(AM,""):null}else{if(typeof F==="string"&&!Au.test(F)&&(AL.support.leadingWhitespace||!AV.test(F))&&!Ao[(f.exec(F)||["",""])[1].toLowerCase()]){F=F.replace(x,BN);try{for(var A=0,J=this.length;A<J;A++){if(this[A].nodeType===1){AL.cleanData(this[A].getElementsByTagName("*"));this[A].innerHTML=F}}}catch(G){this.empty().append(F)}}else{AL.isFunction(F)?this.each(function(N){var K=AL(this),L=K.html();K.empty().append(function(){return F.call(this,N,L)})}):this.empty().append(F)}}return this},replaceWith:function(A){if(this[0]&&this[0].parentNode){if(AL.isFunction(A)){return this.each(function(F){var J=AL(this),G=J.html();J.replaceWith(A.call(this,F,G))})}if(typeof A!=="string"){A=AL(A).detach()}return this.each(function(){var F=this.nextSibling,G=this.parentNode;AL(this).remove();F?AL(F).before(A):AL(G).append(A)})}else{return this.pushStack(AL(AL.isFunction(A)?A():A),"replaceWith",A)}},detach:function(A){return this.remove(A,true)},domManip:function(R,Q,P){function N(T){return AL.nodeName(T,"table")?T.getElementsByTagName("tbody")[0]||T.appendChild(T.ownerDocument.createElement("tbody")):T}var O,K,L=R[0],F=[],J;if(!AL.support.checkClone&&arguments.length===3&&typeof L==="string"&&AO.test(L)){return this.each(function(){AL(this).domManip(R,Q,P,true)})}if(AL.isFunction(L)){return this.each(function(T){var V=AL(this);R[0]=L.call(this,T,Q?V.html():AC);V.domManip(R,Q,P)})}if(this[0]){O=L&&L.parentNode;O=AL.support.parentNode&&O&&O.nodeType===11&&O.childNodes.length===this.length?{fragment:O}:A8(R,this,F);J=O.fragment;if(K=J.childNodes.length===1?(J=J.firstChild):J.firstChild){Q=Q&&AL.nodeName(K,"tr");for(var G=0,A=this.length;G<A;G++){P.call(Q?N(this[G],K):this[G],G>0||O.cacheable||this.length>1?J.cloneNode(true):J)}}F.length&&AL.each(F,AA)}return this}});AL.fragments={};AL.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(F,A){AL.fn[F]=function(N){var K=[];N=AL(N);var L=this.length===1&&this[0].parentNode;if(L&&L.nodeType===11&&L.childNodes.length===1&&N.length===1){N[A](this[0]);return this}else{L=0;for(var G=N.length;L<G;L++){var J=(L>0?this.clone(true):this).get();AL.fn[A].apply(AL(N[L]),J);K=K.concat(J)}return this.pushStack(K,F,N.selector)}}});AL.extend({clean:function(R,Q,P,N){Q=Q||AD;if(typeof Q.createElement==="undefined"){Q=Q.ownerDocument||Q[0]&&Q[0].ownerDocument||AD}for(var O=[],K=0,L;(L=R[K])!=null;K++){if(typeof L==="number"){L+=""}if(L){if(typeof L==="string"&&!o.test(L)){L=Q.createTextNode(L)}else{if(typeof L==="string"){L=L.replace(x,BN);var F=(f.exec(L)||["",""])[1].toLowerCase(),J=Ao[F]||Ao._default,G=J[0],A=Q.createElement("div");for(A.innerHTML=J[1]+L+J[2];G--;){A=A.lastChild}if(!AL.support.tbody){G=AG.test(L);F=F==="table"&&!G?A.firstChild&&A.firstChild.childNodes:J[1]==="<table>"&&!G?A.childNodes:[];for(J=F.length-1;J>=0;--J){AL.nodeName(F[J],"tbody")&&!F[J].childNodes.length&&F[J].parentNode.removeChild(F[J])}}!AL.support.leadingWhitespace&&AV.test(L)&&A.insertBefore(Q.createTextNode(AV.exec(L)[0]),A.firstChild);L=A.childNodes}}if(L.nodeType){O.push(L)}else{O=AL.merge(O,L)}}}if(P){for(K=0;O[K];K++){if(N&&AL.nodeName(O[K],"script")&&(!O[K].type||O[K].type.toLowerCase()==="text/javascript")){N.push(O[K].parentNode?O[K].parentNode.removeChild(O[K]):O[K])}else{O[K].nodeType===1&&O.splice.apply(O,[K+1,0].concat(AL.makeArray(O[K].getElementsByTagName("script"))));P.appendChild(O[K])}}}return O},cleanData:function(P){for(var O,N,K=AL.cache,L=AL.event.special,G=AL.support.deleteExpando,J=0,A;(A=P[J])!=null;J++){if(N=A[AL.expando]){O=K[N];if(O.events){for(var F in O.events){L[F]?AL.event.remove(A,F):Al(A,F,O.handle)}}if(G){delete A[AL.expando]}else{A.removeAttribute&&A.removeAttribute(AL.expando)}delete K[N]}}}});var M=/z-?index|font-?weight|opacity|zoom|line-?height/i,A9=/alpha\([^)]*\)/,Av=/opacity=([^)]*)/,Aj=/float/i,AH=/-([a-z])/ig,BI=/([A-Z])/g,A4=/^-?\d+(?:px)?$/i,An=/^-?\d/,AJ={position:"absolute",visibility:"hidden",display:"block"},t=["Left","Right"],b=["Top","Bottom"],BL=AD.defaultView&&AD.defaultView.getComputedStyle,AP=AL.support.cssFloat?"cssFloat":"styleFloat",p=function(F,A){return A.toUpperCase()};AL.fn.css=function(F,A){return AT(this,F,A,true,function(K,G,J){if(J===AC){return AL.curCSS(K,G)}if(typeof J==="number"&&!M.test(G)){J+="px"}AL.style(K,G,J)})};AL.extend({style:function(F,A,K){if(!F||F.nodeType===3||F.nodeType===8){return AC}if((A==="width"||A==="height")&&parseFloat(K)<0){K=AC}var G=F.style||F,J=K!==AC;if(!AL.support.opacity&&A==="opacity"){if(J){G.zoom=1;A=parseInt(K,10)+""==="NaN"?"":"alpha(opacity="+K*100+")";F=G.filter||AL.curCSS(F,"filter")||"";G.filter=A9.test(F)?F.replace(A9,A):A}return G.filter&&G.filter.indexOf("opacity=")>=0?parseFloat(Av.exec(G.filter)[1])/100+"":""}if(Aj.test(A)){A=AP}A=A.replace(AH,p);if(J){G[A]=K}return G[A]},css:function(F,A,N,K){if(A==="width"||A==="height"){var L,G=A==="width"?t:b;function J(){L=A==="width"?F.offsetWidth:F.offsetHeight;K!=="border"&&AL.each(G,function(){K||(L-=parseFloat(AL.curCSS(F,"padding"+this,true))||0);if(K==="margin"){L+=parseFloat(AL.curCSS(F,"margin"+this,true))||0}else{L-=parseFloat(AL.curCSS(F,"border"+this+"Width",true))||0}})}F.offsetWidth!==0?J():AL.swap(F,AJ,J);return Math.max(0,Math.round(L))}return AL.curCSS(F,A,N)},curCSS:function(F,A,L){var J,K=F.style;if(!AL.support.opacity&&A==="opacity"&&F.currentStyle){J=Av.test(F.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return J===""?"1":J}if(Aj.test(A)){A=AP}if(!L&&K&&K[A]){J=K[A]}else{if(BL){if(Aj.test(A)){A="float"}A=A.replace(BI,"-$1").toLowerCase();K=F.ownerDocument.defaultView;if(!K){return null}if(F=K.getComputedStyle(F,null)){J=F.getPropertyValue(A)}if(A==="opacity"&&J===""){J="1"}}else{if(F.currentStyle){L=A.replace(AH,p);J=F.currentStyle[A]||F.currentStyle[L];if(!A4.test(J)&&An.test(J)){A=K.left;var G=F.runtimeStyle.left;F.runtimeStyle.left=F.currentStyle.left;K.left=L==="fontSize"?"1em":J||0;J=K.pixelLeft+"px";K.left=A;F.runtimeStyle.left=G}}}}return J},swap:function(F,A,K){var G={};for(var J in A){G[J]=F.style[J];F.style[J]=A[J]}K.call(F);for(J in A){F.style[J]=G[J]}}});if(AL.expr&&AL.expr.filters){AL.expr.filters.hidden=function(F){var A=F.offsetWidth,J=F.offsetHeight,G=F.nodeName.toLowerCase()==="tr";return A===0&&J===0&&!G?true:A>0&&J>0&&!G?false:AL.curCSS(F,"display")==="none"};AL.expr.filters.visible=function(A){return !AL.expr.filters.hidden(A)}}var A7=Ak(),As=/<script(.|\s)*?\/script>/gi,AN=/select|textarea/i,y=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,Af=/=\?(&|$)/,S=/\?/,g=/(\?|&)_=.*?(&|$)/,B=/^(\w+:)?\/\/([^\/?#]+)/,BA=/%20/g,Aw=AL.fn.load;AL.fn.extend({load:function(F,A,L){if(typeof F!=="string"){return Aw.call(this,F)}else{if(!this.length){return this}}var J=F.indexOf(" ");if(J>=0){var K=F.slice(J,F.length);F=F.slice(0,J)}J="GET";if(A){if(AL.isFunction(A)){L=A;A=null}else{if(typeof A==="object"){A=AL.param(A,AL.ajaxSettings.traditional);J="POST"}}}var G=this;AL.ajax({url:F,type:J,dataType:"html",data:A,complete:function(N,O){if(O==="success"||O==="notmodified"){G.html(K?AL("<div />").append(N.responseText.replace(As,"")).find(K):N.responseText)}L&&G.each(L,[N.responseText,O,N])}});return this},serialize:function(){return AL.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?AL.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||AN.test(this.nodeName)||y.test(this.type))}).map(function(F,A){F=AL(this).val();return F==null?null:AL.isArray(F)?AL.map(F,function(G){return{name:A.name,value:G}}):{name:A.name,value:F}}).get()}});AL.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(F,A){AL.fn[A]=function(G){return this.bind(A,G)}});AL.extend({get:function(F,A,J,G){if(AL.isFunction(A)){G=G||J;J=A;A=null}return AL.ajax({type:"GET",url:F,data:A,success:J,dataType:G})},getScript:function(F,A){return AL.get(F,null,A,"script")},getJSON:function(F,A,G){return AL.get(F,A,G,"json")},post:function(F,A,J,G){if(AL.isFunction(A)){G=G||J;J=A;A={}}return AL.ajax({type:"POST",url:F,data:A,success:J,dataType:G})},ajaxSetup:function(A){AL.extend(AL.ajaxSettings,A)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:At.XMLHttpRequest&&(At.location.protocol!=="file:"||!At.ActiveXObject)?function(){return new At.XMLHttpRequest}:function(){try{return new At.ActiveXObject("Microsoft.XMLHTTP")}catch(A){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(Ab){function Aa(){s.success&&s.success.call(T,O,W,F);s.global&&Z("ajaxSuccess",[F,s])}function w(){s.complete&&s.complete.call(T,F,W);s.global&&Z("ajaxComplete",[F,s]);s.global&&!--AL.active&&AL.event.trigger("ajaxStop")}function Z(BP,BQ){(s.context?AL(s.context):AL.event).trigger(BP,BQ)}var s=AL.extend(true,{},AL.ajaxSettings,Ab),V,W,O,T=Ab&&Ab.context||s,P=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!=="string"){s.data=AL.param(s.data,s.traditional)}if(s.dataType==="jsonp"){if(P==="GET"){Af.test(s.url)||(s.url+=(S.test(s.url)?"&":"?")+(s.jsonp||"callback")+"=?")}else{if(!s.data||!Af.test(s.data)){s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?"}}s.dataType="json"}if(s.dataType==="json"&&(s.data&&Af.test(s.data)||Af.test(s.url))){V=s.jsonpCallback||"jsonp"+A7++;if(s.data){s.data=(s.data+"").replace(Af,"="+V+"$1")}s.url=s.url.replace(Af,"="+V+"$1");s.dataType="script";At[V]=At[V]||function(BP){O=BP;Aa();w();At[V]=AC;try{delete At[V]}catch(BQ){}A&&A.removeChild(K)}}if(s.dataType==="script"&&s.cache===null){s.cache=false}if(s.cache===false&&P==="GET"){var L=Ak(),G=s.url.replace(g,"$1_="+L+"$2");s.url=G+(G===s.url?(S.test(s.url)?"&":"?")+"_="+L:"")}if(s.data&&P==="GET"){s.url+=(S.test(s.url)?"&":"?")+s.data}s.global&&!AL.active++&&AL.event.trigger("ajaxStart");L=(L=B.exec(s.url))&&(L[1]&&L[1]!==location.protocol||L[2]!==location.host);if(s.dataType==="script"&&P==="GET"&&L){var A=AD.getElementsByTagName("head")[0]||AD.documentElement,K=AD.createElement("script");K.src=s.url;if(s.scriptCharset){K.charset=s.scriptCharset}if(!V){var N=false;K.onload=K.onreadystatechange=function(){if(!N&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){N=true;Aa();w();K.onload=K.onreadystatechange=null;A&&K.parentNode&&A.removeChild(K)}}}A.insertBefore(K,A.firstChild);return AC}var J=false,F=s.xhr();if(F){s.username?F.open(P,s.url,s.async,s.username,s.password):F.open(P,s.url,s.async);try{if(s.data||Ab&&Ab.contentType){F.setRequestHeader("Content-Type",s.contentType)}if(s.ifModified){AL.lastModified[s.url]&&F.setRequestHeader("If-Modified-Since",AL.lastModified[s.url]);AL.etag[s.url]&&F.setRequestHeader("If-None-Match",AL.etag[s.url])}L||F.setRequestHeader("X-Requested-With","XMLHttpRequest");F.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default)}catch(BO){}if(s.beforeSend&&s.beforeSend.call(T,F,s)===false){s.global&&!--AL.active&&AL.event.trigger("ajaxStop");F.abort();return false}s.global&&Z("ajaxSend",[F,s]);var Y=F.onreadystatechange=function(BQ){if(!F||F.readyState===0||BQ==="abort"){J||w();J=true;if(F){F.onreadystatechange=AL.noop}}else{if(!J&&F&&(F.readyState===4||BQ==="timeout")){J=true;F.onreadystatechange=AL.noop;W=BQ==="timeout"?"timeout":!AL.httpSuccess(F)?"error":s.ifModified&&AL.httpNotModified(F,s.url)?"notmodified":"success";var BR;if(W==="success"){try{O=AL.httpData(F,s.dataType,s)}catch(BP){W="parsererror";BR=BP}}if(W==="success"||W==="notmodified"){V||Aa()}else{AL.handleError(s,F,W,BR)}w();BQ==="timeout"&&F.abort();if(s.async){F=null}}}};try{var X=F.abort;F.abort=function(){F&&X.call(F);Y("abort")}}catch(R){}s.async&&s.timeout>0&&setTimeout(function(){F&&!J&&Y("timeout")},s.timeout);try{F.send(P==="POST"||P==="PUT"||P==="DELETE"?s.data:null)}catch(Q){AL.handleError(s,F,null,Q);w()}s.async||Y();return F}},handleError:function(F,A,J,G){if(F.error){F.error.call(F.context||F,A,J,G)}if(F.global){(F.context?AL(F.context):AL.event).trigger("ajaxError",[A,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol==="file:"||F.status>=200&&F.status<300||F.status===304||F.status===1223||F.status===0}catch(A){}return false},httpNotModified:function(F,A){var J=F.getResponseHeader("Last-Modified"),G=F.getResponseHeader("Etag");if(J){AL.lastModified[A]=J}if(G){AL.etag[A]=G}return F.status===304||F.status===0},httpData:function(F,A,K){var G=F.getResponseHeader("content-type")||"",J=A==="xml"||!A&&G.indexOf("xml")>=0;F=J?F.responseXML:F.responseText;J&&F.documentElement.nodeName==="parsererror"&&AL.error("parsererror");if(K&&K.dataFilter){F=K.dataFilter(F,A)}if(typeof F==="string"){if(A==="json"||!A&&G.indexOf("json")>=0){F=AL.parseJSON(F)}else{if(A==="script"||!A&&G.indexOf("javascript")>=0){AL.globalEval(F)}}}return F},param:function(F,A){function L(N,O){if(AL.isArray(O)){AL.each(O,function(P,Q){A||/\[\]$/.test(N)?J(N,Q):L(N+"["+(typeof Q==="object"||AL.isArray(Q)?P:"")+"]",Q)})}else{!A&&O!=null&&typeof O==="object"?AL.each(O,function(P,Q){L(N+"["+P+"]",Q)}):J(N,O)}}function J(N,O){O=AL.isFunction(O)?O():O;K[K.length]=encodeURIComponent(N)+"="+encodeURIComponent(O)}var K=[];if(A===AC){A=AL.ajaxSettings.traditional}if(AL.isArray(F)||F.jquery){AL.each(F,function(){J(this.name,this.value)})}else{for(var G in F){L(G,F[G])}}return K.join("&").replace(BA,"+")}});var BJ={},BF=/toggle|show|hide/,A2=/^([+-]=)?([\d+-.]+)(.*)$/,AU,z=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];AL.fn.extend({show:function(F,A){if(F||F===0){return this.animate(Ah("show",3),F,A)}else{F=0;for(A=this.length;F<A;F++){var K=AL.data(this[F],"olddisplay");this[F].style.display=K||"";if(AL.css(this[F],"display")==="none"){K=this[F].nodeName;var G;if(BJ[K]){G=BJ[K]}else{var J=AL("<"+K+" />").appendTo("body");G=J.css("display");if(G==="none"){G="block"}J.remove();BJ[K]=G}AL.data(this[F],"olddisplay",G)}}F=0;for(A=this.length;F<A;F++){this[F].style.display=AL.data(this[F],"olddisplay")||""}return this}},hide:function(F,A){if(F||F===0){return this.animate(Ah("hide",3),F,A)}else{F=0;for(A=this.length;F<A;F++){var G=AL.data(this[F],"olddisplay");!G&&G!=="none"&&AL.data(this[F],"olddisplay",AL.css(this[F],"display"))}F=0;for(A=this.length;F<A;F++){this[F].style.display="none"}return this}},_toggle:AL.fn.toggle,toggle:function(F,A){var G=typeof F==="boolean";if(AL.isFunction(F)&&AL.isFunction(A)){this._toggle.apply(this,arguments)}else{F==null||G?this.each(function(){var J=G?F:AL(this).is(":hidden");AL(this)[J?"show":"hide"]()}):this.animate(Ah("toggle",3),F,A)}return this},fadeTo:function(F,A,G){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:A},F,G)},animate:function(F,A,K,G){var J=AL.speed(A,K,G);if(AL.isEmptyObject(F)){return this.each(J.complete)}return this[J.queue===false?"each":"queue"](function(){var N=AL.extend({},J),O,P=this.nodeType===1&&AL(this).is(":hidden"),L=this;for(O in F){var Q=O.replace(AH,p);if(O!==Q){F[Q]=F[O];delete F[O];O=Q}if(F[O]==="hide"&&P||F[O]==="show"&&!P){return N.complete.call(this)}if((O==="height"||O==="width")&&this.style){N.display=AL.css(this,"display");N.overflow=this.style.overflow}if(AL.isArray(F[O])){(N.specialEasing=N.specialEasing||{})[O]=F[O][1];F[O]=F[O][0]}}if(N.overflow!=null){this.style.overflow="hidden"}N.curAnim=AL.extend({},F);AL.each(F,function(T,R){var X=new AL.fx(L,N,T);if(BF.test(R)){X[R==="toggle"?P?"show":"hide":R](F)}else{var W=A2.exec(R),Y=X.cur(true)||0;if(W){R=parseFloat(W[2]);var V=W[3]||"px";if(V!=="px"){L.style[T]=(R||1)+V;Y=(R||1)/X.cur(true)*Y;L.style[T]=Y+V}if(W[1]){R=(W[1]==="-="?-1:1)*R+Y}X.custom(Y,R,V)}else{X.custom(Y,R,"")}}});return true})},stop:function(F,A){var G=AL.timers;F&&this.queue([]);this.each(function(){for(var J=G.length-1;J>=0;J--){if(G[J].elem===this){A&&G[J](true);G.splice(J,1)}}});A||this.dequeue();return this}});AL.each({slideDown:Ah("show",1),slideUp:Ah("hide",1),slideToggle:Ah("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(F,A){AL.fn[F]=function(J,G){return this.animate(A,J,G)}});AL.extend({speed:function(F,A,J){var G=F&&typeof F==="object"?F:{complete:J||!J&&A||AL.isFunction(F)&&F,duration:F,easing:J&&A||A&&!AL.isFunction(A)&&A};G.duration=AL.fx.off?0:typeof G.duration==="number"?G.duration:AL.fx.speeds[G.duration]||AL.fx.speeds._default;G.old=G.complete;G.complete=function(){G.queue!==false&&AL(this).dequeue();AL.isFunction(G.old)&&G.old.call(this)};return G},easing:{linear:function(F,A,J,G){return J+G*F},swing:function(F,A,J,G){return(-Math.cos(F*Math.PI)/2+0.5)*G+J}},timers:[],fx:function(F,A,G){this.options=A;this.elem=F;this.prop=G;if(!A.orig){A.orig={}}}});AL.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(AL.fx.step[this.prop]||AL.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(A){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}return(A=parseFloat(AL.css(this.elem,this.prop,A)))&&A>-10000?A:parseFloat(AL.curCSS(this.elem,this.prop))||0},custom:function(F,A,K){function G(L){return J.step(L)}this.startTime=Ak();this.start=F;this.end=A;this.unit=K||this.unit||"px";this.now=this.start;this.pos=this.state=0;var J=this;G.elem=this.elem;if(G()&&AL.timers.push(G)&&!AU){AU=setInterval(AL.fx.tick,13)}},show:function(){this.options.orig[this.prop]=AL.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());AL(this.elem).show()},hide:function(){this.options.orig[this.prop]=AL.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(F){var A=Ak(),K=true;if(F||A>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var G in this.options.curAnim){if(this.options.curAnim[G]!==true){K=false}}if(K){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;F=AL.data(this.elem,"olddisplay");this.elem.style.display=F?F:this.options.display;if(AL.css(this.elem,"display")==="none"){this.elem.style.display="block"}}this.options.hide&&AL(this.elem).hide();if(this.options.hide||this.options.show){for(var J in this.options.curAnim){AL.style(this.elem,J,this.options.orig[J])}}this.options.complete.call(this.elem)}return false}else{J=A-this.startTime;this.state=J/this.options.duration;F=this.options.easing||(AL.easing.swing?"swing":"linear");this.pos=AL.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||F](this.state,J,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};AL.extend(AL.fx,{tick:function(){for(var F=AL.timers,A=0;A<F.length;A++){F[A]()||F.splice(A--,1)}F.length||AL.fx.stop()},stop:function(){clearInterval(AU);AU=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(A){AL.style(A.elem,"opacity",A.now)},_default:function(A){if(A.elem.style&&A.elem.style[A.prop]!=null){A.elem.style[A.prop]=(A.prop==="width"||A.prop==="height"?Math.max(0,A.now):A.now)+A.unit}else{A.elem[A.prop]=A.now}}}});if(AL.expr&&AL.expr.filters){AL.expr.filters.animated=function(A){return AL.grep(AL.timers,function(F){return A===F.elem}).length}}AL.fn.offset="getBoundingClientRect" in AD.documentElement?function(F){var A=this[0];if(F){return this.each(function(K){AL.offset.setOffset(this,F,K)})}if(!A||!A.ownerDocument){return null}if(A===A.ownerDocument.body){return AL.offset.bodyOffset(A)}var J=A.getBoundingClientRect(),G=A.ownerDocument;A=G.body;G=G.documentElement;return{top:J.top+(self.pageYOffset||AL.support.boxModel&&G.scrollTop||A.scrollTop)-(G.clientTop||A.clientTop||0),left:J.left+(self.pageXOffset||AL.support.boxModel&&G.scrollLeft||A.scrollLeft)-(G.clientLeft||A.clientLeft||0)}}:function(Q){var P=this[0];if(Q){return this.each(function(R){AL.offset.setOffset(this,Q,R)})}if(!P||!P.ownerDocument){return null}if(P===P.ownerDocument.body){return AL.offset.bodyOffset(P)}AL.offset.initialize();var O=P.offsetParent,L=P,N=P.ownerDocument,J,K=N.documentElement,A=N.body;L=(N=N.defaultView)?N.getComputedStyle(P,null):P.currentStyle;for(var G=P.offsetTop,F=P.offsetLeft;(P=P.parentNode)&&P!==A&&P!==K;){if(AL.offset.supportsFixedPosition&&L.position==="fixed"){break}J=N?N.getComputedStyle(P,null):P.currentStyle;G-=P.scrollTop;F-=P.scrollLeft;if(P===O){G+=P.offsetTop;F+=P.offsetLeft;if(AL.offset.doesNotAddBorder&&!(AL.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(P.nodeName))){G+=parseFloat(J.borderTopWidth)||0;F+=parseFloat(J.borderLeftWidth)||0}L=O;O=P.offsetParent}if(AL.offset.subtractsBorderForOverflowNotVisible&&J.overflow!=="visible"){G+=parseFloat(J.borderTopWidth)||0;F+=parseFloat(J.borderLeftWidth)||0}L=J}if(L.position==="relative"||L.position==="static"){G+=A.offsetTop;F+=A.offsetLeft}if(AL.offset.supportsFixedPosition&&L.position==="fixed"){G+=Math.max(K.scrollTop,A.scrollTop);F+=Math.max(K.scrollLeft,A.scrollLeft)}return{top:G,left:F}};AL.offset={initialize:function(){var F=AD.body,A=AD.createElement("div"),L,J,K,G=parseFloat(AL.curCSS(F,"marginTop",true))||0;AL.extend(A.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});A.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";F.insertBefore(A,F.firstChild);L=A.firstChild;J=L.firstChild;K=L.nextSibling.firstChild.firstChild;this.doesNotAddBorder=J.offsetTop!==5;this.doesAddBorderForTableAndCells=K.offsetTop===5;J.style.position="fixed";J.style.top="20px";this.supportsFixedPosition=J.offsetTop===20||J.offsetTop===15;J.style.position=J.style.top="";L.style.overflow="hidden";L.style.position="relative";this.subtractsBorderForOverflowNotVisible=J.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=F.offsetTop!==G;F.removeChild(A);AL.offset.initialize=AL.noop},bodyOffset:function(F){var A=F.offsetTop,G=F.offsetLeft;AL.offset.initialize();if(AL.offset.doesNotIncludeMarginInBodyOffset){A+=parseFloat(AL.curCSS(F,"marginTop",true))||0;G+=parseFloat(AL.curCSS(F,"marginLeft",true))||0}return{top:A,left:G}},setOffset:function(F,A,N){if(/static/.test(AL.curCSS(F,"position"))){F.style.position="relative"}var K=AL(F),L=K.offset(),G=parseInt(AL.curCSS(F,"top",true),10)||0,J=parseInt(AL.curCSS(F,"left",true),10)||0;if(AL.isFunction(A)){A=A.call(F,N,L)}N={top:A.top-L.top+G,left:A.left-L.left+J};"using" in A?A.using.call(F,N):K.css(N)}};AL.fn.extend({position:function(){if(!this[0]){return null}var F=this[0],A=this.offsetParent(),J=this.offset(),G=/^body|html$/i.test(A[0].nodeName)?{top:0,left:0}:A.offset();J.top-=parseFloat(AL.curCSS(F,"marginTop",true))||0;J.left-=parseFloat(AL.curCSS(F,"marginLeft",true))||0;G.top+=parseFloat(AL.curCSS(A[0],"borderTopWidth",true))||0;G.left+=parseFloat(AL.curCSS(A[0],"borderLeftWidth",true))||0;return{top:J.top-G.top,left:J.left-G.left}},offsetParent:function(){return this.map(function(){for(var A=this.offsetParent||AD.body;A&&!/^body|html$/i.test(A.nodeName)&&AL.css(A,"position")==="static";){A=A.offsetParent}return A})}});AL.each(["Left","Top"],function(F,A){var G="scroll"+A;AL.fn[G]=function(K){var L=this[0],J;if(!L){return null}if(K!==AC){return this.each(function(){if(J=h(this)){J.scrollTo(!F?K:AL(J).scrollLeft(),F?K:AL(J).scrollTop())}else{this[G]=K}})}else{return(J=h(L))?"pageXOffset" in J?J[F?"pageYOffset":"pageXOffset"]:AL.support.boxModel&&J.document.documentElement[G]||J.document.body[G]:L[G]}}});AL.each(["Height","Width"],function(F,A){var G=A.toLowerCase();AL.fn["inner"+A]=function(){return this[0]?AL.css(this[0],G,false,"padding"):null};AL.fn["outer"+A]=function(J){return this[0]?AL.css(this[0],G,false,J?"margin":"border"):null};AL.fn[G]=function(J){var K=this[0];if(!K){return J==null?null:this}if(AL.isFunction(J)){return this.each(function(L){var N=AL(this);N[G](J.call(this,L,N[G]()))})}return"scrollTo" in K&&K.document?K.document.compatMode==="CSS1Compat"&&K.document.documentElement["client"+A]||K.document.body["client"+A]:K.nodeType===9?Math.max(K.documentElement["client"+A],K.body["scroll"+A],K.documentElement["scroll"+A],K.body["offset"+A],K.documentElement["offset"+A]):J===AC?AL.css(K,G):this.css(G,typeof J==="string"?J:J+"px")}});At.jQuery=At.$=AL})(window);(function(){if(!Date.now){Date.now=function(){return +new Date}}try{document.createElement("div").style.setProperty("opacity",0,"")}catch(DD){var Bt=CSSStyleDeclaration.prototype,D2=Bt.setProperty;Bt.setProperty=function(e,Eu,Et){D2.call(this,e,Eu+"",Et)}}d3={version:"2.8.1"};function En(Ev,Eu){try{for(var Et in Eu){Object.defineProperty(Ev.prototype,Et,{value:Eu[Et],enumerable:false})}}catch(Ew){Ev.prototype=Eu}}var B0=Ar;function El(Et){var e=-1,Ev=Et.length,Eu=[];while(++e<Ev){Eu.push(Et[e])}return Eu}function Ar(e){return Array.prototype.slice.call(e)}try{B0(document.documentElement.childNodes)[0].nodeType}catch(EK){B0=El}var Cg=[].__proto__?function(Et,e){Et.__proto__=e}:function(Eu,e){for(var Et in e){Eu[Et]=e[Et]}};d3.map=function(e){var Eu=new AI;for(var Et in e){Eu.set(Et,e[Et])}return Eu};function AI(){}En(AI,{has:function(e){return Ep+e in this},get:function(e){return this[Ep+e]},set:function(e,Et){return this[Ep+e]=Et},remove:function(e){e=Ep+e;return e in this&&delete this[e]},keys:function(){var e=[];this.forEach(function(Et){e.push(Et)});return e},values:function(){var e=[];this.forEach(function(Et,Eu){e.push(Eu)});return e},entries:function(){var e=[];this.forEach(function(Et,Eu){e.push({key:Et,value:Eu})});return e},forEach:function(Et){for(var e in this){if(e.charCodeAt(0)===Bv){Et.call(this,e.substring(1),this[e])}}}});var Ep="\0",Bv=Ep.charCodeAt(0);function r(){return this}d3.functor=function(e){return typeof e==="function"?e:function(){return e}};d3.rebind=function(Eu,Et){var e=1,Ew=arguments.length,Ev;while(++e<Ew){Eu[Ev=arguments[e]]=CR(Eu,Et,Et[Ev])}return Eu};function CR(Et,e,Eu){return function(){var Ev=Eu.apply(e,arguments);return arguments.length?Et:Ev}}d3.ascending=function(Et,e){return Et<e?-1:Et>e?1:Et>=e?0:NaN};d3.descending=function(Et,e){return e<Et?-1:e>Et?1:e>=Et?0:NaN};d3.mean=function(Ey,Ew){var Ex=Ey.length,Et,e=0,Ev=-1,Eu=0;if(arguments.length===1){while(++Ev<Ex){if(ER(Et=Ey[Ev])){e+=(Et-e)/++Eu}}}else{while(++Ev<Ex){if(ER(Et=Ew.call(Ey,Ey[Ev],Ev))){e+=(Et-e)/++Eu}}}return Eu?e:undefined};d3.median=function(Et,e){if(arguments.length>1){Et=Et.map(e)}Et=Et.filter(ER);return Et.length?d3.quantile(Et.sort(d3.ascending),0.5):undefined};d3.min=function(Ex,Ev){var Eu=-1,Ew=Ex.length,Et,e;if(arguments.length===1){while(++Eu<Ew&&((Et=Ex[Eu])==null||Et!=Et)){Et=undefined}while(++Eu<Ew){if((e=Ex[Eu])!=null&&Et>e){Et=e}}}else{while(++Eu<Ew&&((Et=Ev.call(Ex,Ex[Eu],Eu))==null||Et!=Et)){Et=undefined}while(++Eu<Ew){if((e=Ev.call(Ex,Ex[Eu],Eu))!=null&&Et>e){Et=e}}}return Et};d3.max=function(Ex,Ev){var Eu=-1,Ew=Ex.length,Et,e;if(arguments.length===1){while(++Eu<Ew&&((Et=Ex[Eu])==null||Et!=Et)){Et=undefined}while(++Eu<Ew){if((e=Ex[Eu])!=null&&e>Et){Et=e}}}else{while(++Eu<Ew&&((Et=Ev.call(Ex,Ex[Eu],Eu))==null||Et!=Et)){Et=undefined}while(++Eu<Ew){if((e=Ev.call(Ex,Ex[Eu],Eu))!=null&&e>Et){Et=e}}}return Et};d3.extent=function(Ey,Ev){var Eu=-1,Ex=Ey.length,Et,e,Ew;if(arguments.length===1){while(++Eu<Ex&&((Et=Ew=Ey[Eu])==null||Et!=Et)){Et=Ew=undefined}while(++Eu<Ex){if((e=Ey[Eu])!=null){if(Et>e){Et=e}if(Ew<e){Ew=e}}}}else{while(++Eu<Ex&&((Et=Ew=Ev.call(Ey,Ey[Eu],Eu))==null||Et!=Et)){Et=undefined}while(++Eu<Ex){if((e=Ev.call(Ey,Ey[Eu],Eu))!=null){if(Et>e){Et=e}if(Ew<e){Ew=e}}}}return[Et,Ew]};d3.random={normal:function(e,Et){if(arguments.length<2){Et=1}if(arguments.length<1){e=0}return function(){var Eu,Ew,Ev;do{Eu=Math.random()*2-1;Ew=Math.random()*2-1;Ev=Eu*Eu+Ew*Ew}while(!Ev||Ev>1);return e+Et*Eu*Math.sqrt(-2*Math.log(Ev)/Ev)}}};function ER(e){return e!=null&&!isNaN(e)}d3.sum=function(Ex,Ev){var Eu=0,Ew=Ex.length,e,Et=-1;if(arguments.length===1){while(++Et<Ew){if(!isNaN(e=+Ex[Et])){Eu+=e}}}else{while(++Et<Ew){if(!isNaN(e=+Ev.call(Ex,Ex[Et],Et))){Eu+=e}}}return Eu};d3.quantile=function(Eu,Ey){var Ev=(Eu.length-1)*Ey+1,Ew=Math.floor(Ev),Et=Eu[Ew-1],Ex=Ev-Ew;return Ex?Et+Ex*(Eu[Ew]-Et):Et};d3.transpose=function(e){return d3.zip.apply(d3,e)};d3.zip=function(){if(!(Ex=arguments.length)){return[]}for(var Ev=-1,e=d3.min(arguments,Cx),Eu=new Array(e);++Ev<e;){for(var Et=-1,Ex,Ew=Eu[Ev]=new Array(Ex);++Et<Ex;){Ew[Et]=arguments[Et][Ev]}}return Eu};function Cx(e){return e.length}d3.bisector=function(e){return{left:function(Eu,Et,Ex,Ew){if(arguments.length<3){Ex=0}if(arguments.length<4){Ew=Eu.length}while(Ex<Ew){var Ev=Ex+Ew>>1;if(e.call(Eu,Eu[Ev],Ev)<Et){Ex=Ev+1}else{Ew=Ev}}return Ex},right:function(Eu,Et,Ex,Ew){if(arguments.length<3){Ex=0}if(arguments.length<4){Ew=Eu.length}while(Ex<Ew){var Ev=Ex+Ew>>1;if(Et<e.call(Eu,Eu[Ev],Ev)){Ew=Ev}else{Ex=Ev+1}}return Ex}}};var Dm=d3.bisector(function(e){return e});d3.bisectLeft=Dm.left;d3.bisect=d3.bisectRight=Dm.right;d3.first=function(Ex,Ev){var Eu=0,Ew=Ex.length,Et=Ex[0],e;if(arguments.length===1){Ev=d3.ascending}while(++Eu<Ew){if(Ev.call(Ex,Et,e=Ex[Eu])>0){Et=e}}return Et};d3.last=function(Ex,Ev){var Eu=0,Ew=Ex.length,Et=Ex[0],e;if(arguments.length===1){Ev=d3.ascending}while(++Eu<Ew){if(Ev.call(Ex,Et,e=Ex[Eu])<=0){Et=e}}return Et};d3.nest=function(){var Ev={},Eu=[],Ey=[],Et,Ew;function Ex(E6,E4){if(E4>=Eu.length){return Ew?Ew.call(Ev,E6):(Et?E6.sort(Et):E6)}var E5=-1,E0=E6.length,E8=Eu[E4++],E3,E2,E1=new AI,E7,Ez={};while(++E5<E0){if(E7=E1.get(E3=E8(E2=E6[E5]))){E7.push(E2)}else{E1.set(E3,[E2])}}E1.forEach(function(E9){Ez[E9]=Ex(E1.get(E9),E4)});return Ez}function e(E2,E3){if(E3>=Eu.length){return E2}var Ez=[],E0=Ey[E3++],E1;for(E1 in E2){Ez.push({key:E1,values:e(E2[E1],E3)})}if(E0){Ez.sort(function(E5,E4){return E0(E5.key,E4.key)})}return Ez}Ev.map=function(Ez){return Ex(Ez,0)};Ev.entries=function(Ez){return e(Ex(Ez,0),0)};Ev.key=function(Ez){Eu.push(Ez);return Ev};Ev.sortKeys=function(Ez){Ey[Eu.length-1]=Ez;return Ev};Ev.sortValues=function(Ez){Et=Ez;return Ev};Ev.rollup=function(Ez){Ew=Ez;return Ev};return Ev};d3.keys=function(Eu){var Et=[];for(var e in Eu){Et.push(e)}return Et};d3.values=function(Eu){var e=[];for(var Et in Eu){e.push(Eu[Et])}return e};d3.entries=function(Eu){var e=[];for(var Et in Eu){e.push({key:Et,value:Eu[Et]})}return e};d3.permute=function(Ew,Et){var e=[],Eu=-1,Ev=Et.length;while(++Eu<Ev){e[Eu]=Ew[Et[Eu]]}return e};d3.merge=function(e){return Array.prototype.concat.apply([],e)};d3.split=function(Ey,Ew){var Ev=[],e=[],Eu,Et=-1,Ex=Ey.length;if(arguments.length<2){Ew=Ce}while(++Et<Ex){if(Ew.call(e,Eu=Ey[Et],Et)){e=[]}else{if(!e.length){Ev.push(e)}e.push(Eu)}}return Ev};function Ce(e){return e==null}function BP(e){return e.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}d3.range=function(Ey,Ew,Ex){if(arguments.length<3){Ex=1;if(arguments.length<2){Ew=Ey;Ey=0}}if((Ew-Ey)/Ex===Infinity){throw new Error("infinite range")}var Et=[],e=Dj(Math.abs(Ex)),Ev=-1,Eu;Ey*=e,Ew*=e,Ex*=e;if(Ex<0){while((Eu=Ey+Ex*++Ev)>Ew){Et.push(Eu/e)}}else{while((Eu=Ey+Ex*++Ev)<Ew){Et.push(Eu/e)}}return Et};function Dj(e){var Et=1;while(e*Et%1){Et*=10}return Et}d3.requote=function(e){return e.replace(Be,"\\$&")};var Be=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(e,Et){return Et?Math.round(e*(Et=Math.pow(10,Et)))/Et:Math.round(e)};d3.xhr=function(e,Eu,Ev){var Et=new XMLHttpRequest;if(arguments.length<3){Ev=Eu,Eu=null}else{if(Eu&&Et.overrideMimeType){Et.overrideMimeType(Eu)}}Et.open("GET",e,true);if(Eu){Et.setRequestHeader("Accept",Eu)}Et.onreadystatechange=function(){if(Et.readyState===4){Ev(Et.status<300?Et:null)}};Et.send(null)};d3.text=function(e,Eu,Ev){function Et(Ew){Ev(Ew&&Ew.responseText)}if(arguments.length<3){Ev=Eu;Eu=null}d3.xhr(e,Eu,Et)};d3.json=function(e,Et){d3.text(e,"application/json",function(Eu){Et(Eu?JSON.parse(Eu):null)})};d3.html=function(e,Et){d3.text(e,"text/html",function(Ev){if(Ev!=null){var Eu=document.createRange();Eu.selectNode(document.body);Ev=Eu.createContextualFragment(Ev)}Et(Ev)})};d3.xml=function(e,Eu,Ev){function Et(Ew){Ev(Ew&&Ew.responseXML)}if(arguments.length<3){Ev=Eu;Eu=null}d3.xhr(e,Eu,Et)};var CH={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};d3.ns={prefix:CH,qualify:function(e){var Et=e.indexOf(":"),Eu=e;if(Et>=0){Eu=e.substring(0,Et);e=e.substring(Et+1)}return CH.hasOwnProperty(Eu)?{space:CH[Eu],local:e}:e}};d3.dispatch=function(){var e=new Cc,Et=-1,Eu=arguments.length;while(++Et<Eu){e[arguments[Et]]=C0(e)}return e};function Cc(){}Cc.prototype.on=function(Eu,Ev){var Et=Eu.indexOf("."),e="";if(Et>0){e=Eu.substring(Et+1);Eu=Eu.substring(0,Et)}return arguments.length<2?this[Eu].on(e):this[Eu].on(e,Ev)};function C0(e){var Eu=[],Et=new AI;function Ev(){var Ey=Eu,Ex=-1,Ez=Ey.length,Ew;while(++Ex<Ez){if(Ew=Ey[Ex].on){Ew.apply(this,arguments)}}return e}Ev.on=function(Ex,Ez){var Ew=Et.get(Ex),Ey;if(arguments.length<2){return Ew&&Ew.on}if(Ew){Ew.on=null;Eu=Eu.slice(0,Ey=Eu.indexOf(Ew)).concat(Eu.slice(Ey+1));Et.remove(Ex)}if(Ez){Eu.push(Et.set(Ex,{on:Ez}))}return e};return Ev}d3.format=function(E0){var Ex=BI.exec(E0),E2=Ex[1]||" ",Et=Ex[3]||"",Ev=Ex[5],e=+Ex[6],E3=Ex[7],Ey=Ex[8],Ez=Ex[9],Eu=1,E1="",Ew=false;if(Ey){Ey=+Ey.substring(1)}if(Ev){E2="0";if(E3){e-=Math.floor((e-1)/4)}}switch(Ez){case"n":E3=true;Ez="g";break;case"%":Eu=100;E1="%";Ez="f";break;case"p":Eu=100;E1="%";Ez="r";break;case"d":Ew=true;Ey=0;break;case"s":Eu=-1;Ez="r";break}if(Ez=="r"&&!Ey){Ez="g"}Ez=R.get(Ez)||Ae;return function(E7){if(Ew&&(E7%1)){return""}var E4=(E7<0)&&(E7=-E7)?"\u2212":Et;if(Eu<0){var E6=d3.formatPrefix(E7,Ey);E7*=E6.scale;E1=E6.symbol}else{E7*=Eu}E7=Ez(E7,Ey);if(Ev){var E5=E7.length+E4.length;if(E5<e){E7=new Array(e-E5+1).join(E2)+E7}if(E3){E7=Bh(E7)}E7=E4+E7}else{if(E3){E7=Bh(E7)}E7=E4+E7;var E5=E7.length;if(E5<e){E7=new Array(e-E5+1).join(E2)+E7}}return E7+E1}};var BI=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;var R=d3.map({g:function(e,Et){return e.toPrecision(Et)},e:function(e,Et){return e.toExponential(Et)},f:function(e,Et){return e.toFixed(Et)},r:function(e,Et){return d3.round(e,Et=CJ(e,Et)).toFixed(Math.max(0,Math.min(20,Et)))}});function CJ(e,Et){return Et-(e?1+Math.floor(Math.log(e+Math.pow(10,1+Math.floor(Math.log(e)/Math.LN10)-Et))/Math.LN10):1)}function Ae(e){return e+""}function Bh(Ev){var Et=Ev.lastIndexOf("."),Eu=Et>=0?Ev.substring(Et):(Et=Ev.length,""),e=[];while(Et>0){e.push(Ev.substring(Et-=3,Et+3))}return e.reverse().join(",")+Eu}var BF=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(Bz);d3.formatPrefix=function(Eu,e){var Et=0;if(Eu){if(Eu<0){Eu*=-1}if(e){Eu=d3.round(Eu,CJ(Eu,e))}Et=1+Math.floor(1e-12+Math.log(Eu)/Math.LN10);Et=Math.max(-24,Math.min(24,Math.floor((Et<=0?Et+1:Et-1)/3)*3))}return BF[8+Et/3]};function Bz(Et,e){return{scale:Math.pow(10,(8-e)*3),symbol:Et}}var A0=AN(2),Y=AN(3),EM=function(){return Bg};var p=d3.map({linear:EM,poly:AN,quad:function(){return A0},cubic:function(){return Y},sin:function(){return Dd},exp:function(){return DA},circle:function(){return CF},elastic:o,back:EB,bounce:function(){return A9}});var I=d3.map({"in":Bg,out:U,"in-out":AU,"out-in":function(e){return AU(U(e))}});d3.ease=function(Et){var Ev=Et.indexOf("-"),Eu=Ev>=0?Et.substring(0,Ev):Et,e=Ev>=0?Et.substring(Ev+1):"in";Eu=p.get(Eu)||EM;e=I.get(e)||Bg;return DH(e(Eu.apply(null,Array.prototype.slice.call(arguments,1))))};function DH(e){return function(Et){return Et<=0?0:Et>=1?1:e(Et)}}function U(e){return function(Et){return 1-e(1-Et)}}function AU(e){return function(Et){return 0.5*(Et<0.5?e(2*Et):(2-e(2-2*Et)))}}function Bg(e){return e}function AN(Et){return function(e){return Math.pow(e,Et)}}function Dd(e){return 1-Math.cos(e*Math.PI/2)}function DA(e){return Math.pow(2,10*(e-1))}function CF(e){return 1-Math.sqrt(1-e*e)}function o(e,Eu){var Et;if(arguments.length<2){Eu=0.45}if(arguments.length<1){e=1;Et=Eu/4}else{Et=Eu/(2*Math.PI)*Math.asin(1/e)}return function(Ev){return 1+e*Math.pow(2,10*-Ev)*Math.sin((Ev-Et)*2*Math.PI/Eu)}}function EB(e){if(!e){e=1.70158}return function(Et){return Et*Et*((e+1)*Et-e)}}function A9(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+0.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+0.9375:7.5625*(e-=2.625/2.75)*e+0.984375}d3.event=null;function Ec(){d3.event.stopPropagation();d3.event.preventDefault()}function s(){var Eu=d3.event,Et;while(Et=Eu.sourceEvent){Eu=Et}return Eu}function EL(Eu){var e=new Cc,Et=0,Ev=arguments.length;while(++Et<Ev){e[arguments[Et]]=C0(e)}e.of=function(Ex,Ew){return function(Ey){try{var Ez=Ey.sourceEvent=d3.event;Ey.target=Eu;d3.event=Ey;e[Ey.type].apply(Ex,Ew)}finally{d3.event=Ez}}};return e}d3.interpolate=function(Et,e){var Eu=d3.interpolators.length,Ev;while(--Eu>=0&&!(Ev=d3.interpolators[Eu](Et,e))){}return Ev};d3.interpolateNumber=function(Et,e){e-=Et;return function(Eu){return Et+e*Eu}};d3.interpolateRound=function(Et,e){e-=Et;return function(Eu){return Math.round(Et+e*Eu)}};d3.interpolateString=function(Ez,Ey){var Ev,Ex,Ew,E1=0,E0=0,E2=[],e=[],Eu,Et;DQ.lastIndex=0;for(Ex=0;Ev=DQ.exec(Ey);++Ex){if(Ev.index){E2.push(Ey.substring(E1,E0=Ev.index))}e.push({i:E2.length,x:Ev[0]});E2.push(null);E1=DQ.lastIndex}if(E1<Ey.length){E2.push(Ey.substring(E1))}for(Ex=0,Eu=e.length;(Ev=DQ.exec(Ez))&&Ex<Eu;++Ex){Et=e[Ex];if(Et.x==Ev[0]){if(Et.i){if(E2[Et.i+1]==null){E2[Et.i-1]+=Et.x;E2.splice(Et.i,1);for(Ew=Ex+1;Ew<Eu;++Ew){e[Ew].i--}}else{E2[Et.i-1]+=Et.x+E2[Et.i+1];E2.splice(Et.i,2);for(Ew=Ex+1;Ew<Eu;++Ew){e[Ew].i-=2}}}else{if(E2[Et.i+1]==null){E2[Et.i]=Et.x}else{E2[Et.i]=Et.x+E2[Et.i+1];E2.splice(Et.i+1,1);for(Ew=Ex+1;Ew<Eu;++Ew){e[Ew].i--}}}e.splice(Ex,1);Eu--;Ex--}else{Et.x=d3.interpolateNumber(parseFloat(Ev[0]),parseFloat(Et.x))}}while(Ex<Eu){Et=e.pop();if(E2[Et.i+1]==null){E2[Et.i]=Et.x}else{E2[Et.i]=Et.x+E2[Et.i+1];E2.splice(Et.i+1,1)}Eu--}if(E2.length===1){return E2[0]==null?e[0].x:function(){return Ey}}return function(E3){for(Ex=0;Ex<Eu;++Ex){E2[(Et=e[Ex]).i]=Et.x(E3)}return E2.join("")}};d3.interpolateTransform=function(E5,E4){var E6=[],Et=[],Ex,Ew=d3.transform(E5),Ev=d3.transform(E4),E1=Ew.translate,E0=Ev.translate,Eu=Ew.rotate,e=Ev.rotate,Ez=Ew.skew,Ey=Ev.skew,E3=Ew.scale,E2=Ev.scale;if(E1[0]!=E0[0]||E1[1]!=E0[1]){E6.push("translate(",null,",",null,")");Et.push({i:1,x:d3.interpolateNumber(E1[0],E0[0])},{i:3,x:d3.interpolateNumber(E1[1],E0[1])})}else{if(E0[0]||E0[1]){E6.push("translate("+E0+")")}else{E6.push("")}}if(Eu!=e){Et.push({i:E6.push(E6.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(Eu,e)})}else{if(e){E6.push(E6.pop()+"rotate("+e+")")}}if(Ez!=Ey){Et.push({i:E6.push(E6.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(Ez,Ey)})}else{if(Ey){E6.push(E6.pop()+"skewX("+Ey+")")}}if(E3[0]!=E2[0]||E3[1]!=E2[1]){Ex=E6.push(E6.pop()+"scale(",null,",",null,")");Et.push({i:Ex-4,x:d3.interpolateNumber(E3[0],E2[0])},{i:Ex-2,x:d3.interpolateNumber(E3[1],E2[1])})}else{if(E2[0]!=1||E2[1]!=1){E6.push(E6.pop()+"scale("+E2+")")}}Ex=Et.length;return function(E8){var E7=-1,E9;while(++E7<Ex){E6[(E9=Et[E7]).i]=E9.x(E8)}return E6.join("")}};d3.interpolateRgb=function(Et,e){Et=d3.rgb(Et);e=d3.rgb(e);var Ev=Et.r,Eu=Et.g,Ey=Et.b,Ex=e.r-Ev,Ew=e.g-Eu,Ez=e.b-Ey;return function(E0){return"#"+BG(Math.round(Ev+Ex*E0))+BG(Math.round(Eu+Ew*E0))+BG(Math.round(Ey+Ez*E0))}};d3.interpolateHsl=function(Eu,e){Eu=d3.hsl(Eu);e=d3.hsl(e);var Ez=Eu.h,Ey=Eu.s,Ev=Eu.l,Ex=e.h-Ez,Ew=e.s-Ey,Et=e.l-Ev;return function(E0){return Aa(Ez+Ex*E0,Ey+Ew*E0,Ev+Et*E0).toString()}};d3.interpolateArray=function(Ew,Eu){var Et=[],Ez=[],Ev=Ew.length,e=Eu.length,Ey=Math.min(Ew.length,Eu.length),Ex;for(Ex=0;Ex<Ey;++Ex){Et.push(d3.interpolate(Ew[Ex],Eu[Ex]))}for(;Ex<Ev;++Ex){Ez[Ex]=Ew[Ex]}for(;Ex<e;++Ex){Ez[Ex]=Eu[Ex]}return function(E0){for(Ex=0;Ex<Ey;++Ex){Ez[Ex]=Et[Ex](E0)}return Ez}};d3.interpolateObject=function(Et,e){var Ev={},Ew={},Eu;for(Eu in Et){if(Eu in e){Ev[Eu]=DB(Eu)(Et[Eu],e[Eu])}else{Ew[Eu]=Et[Eu]}}for(Eu in e){if(!(Eu in Et)){Ew[Eu]=e[Eu]}}return function(Ex){for(Eu in Ev){Ew[Eu]=Ev[Eu](Ex)}return Ew}};var DQ=/[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;function DB(e){return e=="transform"?d3.interpolateTransform:d3.interpolate}d3.interpolators=[d3.interpolateObject,function(Et,e){return(e instanceof Array)&&d3.interpolateArray(Et,e)},function(Et,e){return(typeof Et==="string"||typeof e==="string")&&d3.interpolateString(Et+"",e+"")},function(Et,e){return(typeof e==="string"?u.has(e)||/^(#|rgb\(|hsl\()/.test(e):e instanceof Cr||e instanceof C9)&&d3.interpolateRgb(Et,e)},function(Et,e){return !isNaN(Et=+Et)&&!isNaN(e=+e)&&d3.interpolateNumber(Et,e)}];function EU(Et,e){e=e-(Et=+Et)?1/(e-Et):0;return function(Eu){return(Eu-Et)*e}}function AD(Et,e){e=e-(Et=+Et)?1/(e-Et):0;return function(Eu){return Math.max(0,Math.min(1,(Eu-Et)*e))}}d3.rgb=function(Eu,Et,e){return arguments.length===1?(Eu instanceof Cr?CM(Eu.r,Eu.g,Eu.b):AP(""+Eu,CM,Aa)):CM(~~Eu,~~Et,~~e)};function CM(Eu,Et,e){return new Cr(Eu,Et,e)}function Cr(Eu,Et,e){this.r=Eu;this.g=Et;this.b=e}Cr.prototype.brighter=function(Et){Et=Math.pow(0.7,arguments.length?Et:1);var Ew=this.r,Ev=this.g,e=this.b,Eu=30;if(!Ew&&!Ev&&!e){return CM(Eu,Eu,Eu)}if(Ew&&Ew<Eu){Ew=Eu}if(Ev&&Ev<Eu){Ev=Eu}if(e&&e<Eu){e=Eu}return CM(Math.min(255,Math.floor(Ew/Et)),Math.min(255,Math.floor(Ev/Et)),Math.min(255,Math.floor(e/Et)))};Cr.prototype.darker=function(e){e=Math.pow(0.7,arguments.length?e:1);return CM(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))};Cr.prototype.hsl=function(){return Dq(this.r,this.g,this.b)};Cr.prototype.toString=function(){return"#"+BG(this.r)+BG(this.g)+BG(this.b)};function BG(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function AP(Ex,Ev,Ey){var e=0,Eu=0,Ew=0,E0,Ez,Et;E0=/([a-z]+)\((.*)\)/i.exec(Ex);if(E0){Ez=E0[2].split(",");switch(E0[1]){case"hsl":return Ey(parseFloat(Ez[0]),parseFloat(Ez[1])/100,parseFloat(Ez[2])/100);case"rgb":return Ev(Cf(Ez[0]),Cf(Ez[1]),Cf(Ez[2]))}}if(Et=u.get(Ex)){return Ev(Et.r,Et.g,Et.b)}if(Ex!=null&&Ex.charAt(0)==="#"){if(Ex.length===4){e=Ex.charAt(1);e+=e;Eu=Ex.charAt(2);Eu+=Eu;Ew=Ex.charAt(3);Ew+=Ew}else{if(Ex.length===7){e=Ex.substring(1,3);Eu=Ex.substring(3,5);Ew=Ex.substring(5,7)}}e=parseInt(e,16);Eu=parseInt(Eu,16);Ew=parseInt(Ew,16)}return Ev(e,Eu,Ew)}function Dq(e,Ew,Ey){var Eu=Math.min(e/=255,Ew/=255,Ey/=255),Ez=Math.max(e,Ew,Ey),Ex=Ez-Eu,Ev,E0,Et=(Ez+Eu)/2;if(Ex){E0=Et<0.5?Ex/(Ez+Eu):Ex/(2-Ez-Eu);if(e==Ez){Ev=(Ew-Ey)/Ex+(Ew<Ey?6:0)}else{if(Ew==Ez){Ev=(Ey-e)/Ex+2}else{Ev=(e-Ew)/Ex+4}}Ev*=60}else{E0=Ev=0}return CV(Ev,E0,Et)}function Cf(Et){var e=parseFloat(Et);return Et.charAt(Et.length-1)==="%"?Math.round(e*2.55):e}var u=d3.map({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",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",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",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});u.forEach(function(e,Et){u.set(e,AP(Et,CM,Aa))});d3.hsl=function(Eu,Et,e){return arguments.length===1?(Eu instanceof C9?CV(Eu.h,Eu.s,Eu.l):AP(""+Eu,Dq,CV)):CV(+Eu,+Et,+e)};function CV(Eu,Et,e){return new C9(Eu,Et,e)}function C9(Eu,Et,e){this.h=Eu;this.s=Et;this.l=e}C9.prototype.brighter=function(e){e=Math.pow(0.7,arguments.length?e:1);return CV(this.h,this.s,this.l/e)};C9.prototype.darker=function(e){e=Math.pow(0.7,arguments.length?e:1);return CV(this.h,this.s,e*this.l)};C9.prototype.rgb=function(){return Aa(this.h,this.s,this.l)};C9.prototype.toString=function(){return this.rgb().toString()};function Aa(Ex,Ew,e){var Ev,Eu;Ex=Ex%360;if(Ex<0){Ex+=360}Ew=Ew<0?0:Ew>1?1:Ew;e=e<0?0:e>1?1:e;Eu=e<=0.5?e*(1+Ew):e+Ew-e*Ew;Ev=2*e-Eu;function Et(Ez){if(Ez>360){Ez-=360}else{if(Ez<0){Ez+=360}}if(Ez<60){return Ev+(Eu-Ev)*Ez/60}if(Ez<180){return Eu}if(Ez<240){return Ev+(Eu-Ev)*(240-Ez)/60}return Ev}function Ey(Ez){return Math.round(Et(Ez)*255)}return CM(Ey(Ex+120),Ey(Ex),Ey(Ex-120))}function B8(e){Cg(e,B7);return e}var Bl=function(e,Et){return Et.querySelector(e)},DZ=function(e,Et){return Et.querySelectorAll(e)},CU=document.documentElement,B=CU.matchesSelector||CU.webkitMatchesSelector||CU.mozMatchesSelector||CU.msMatchesSelector||CU.oMatchesSelector,A=function(Et,e){return B.call(Et,e)};if(typeof Sizzle==="function"){Bl=function(e,Et){return Sizzle(e,Et)[0]};DZ=function(e,Et){return Sizzle.uniqueSort(Sizzle(e,Et))};A=Sizzle.matchesSelector}var B7=[];d3.selection=function(){return D5};d3.selection.prototype=B7;B7.select=function(Ex){var Eu=[],E1,e,E0,Ev;if(typeof Ex!=="function"){Ex=S(Ex)}for(var Ey=-1,Ew=this.length;++Ey<Ew;){Eu.push(E1=[]);E1.parentNode=(E0=this[Ey]).parentNode;for(var Ez=-1,Et=E0.length;++Ez<Et;){if(Ev=E0[Ez]){E1.push(e=Ex.call(Ev,Ev.__data__,Ez));if(e&&"__data__" in Ev){e.__data__=Ev.__data__}}else{E1.push(null)}}}return B8(Eu)};function S(e){return function(){return Bl(e,this)}}B7.selectAll=function(Ew){var Et=[],E0,Eu;if(typeof Ew!=="function"){Ew=Ba(Ew)}for(var Ex=-1,Ev=this.length;++Ex<Ev;){for(var Ez=this[Ex],Ey=-1,e=Ez.length;++Ey<e;){if(Eu=Ez[Ey]){Et.push(E0=B0(Ew.call(Eu,Eu.__data__,Ey)));E0.parentNode=Eu}}}return B8(Et)};function Ba(e){return function(){return DZ(e,this)}}B7.attr=function(Et,Ez){Et=d3.ns.qualify(Et);if(arguments.length<2){var Ex=this.node();return Et.local?Ex.getAttributeNS(Et.space,Et.local):Ex.getAttribute(Et)}function Eu(){this.removeAttribute(Et)}function Ew(){this.removeAttributeNS(Et.space,Et.local)}function E0(){this.setAttribute(Et,Ez)}function Ev(){this.setAttributeNS(Et.space,Et.local,Ez)}function Ey(){var E1=Ez.apply(this,arguments);if(E1==null){this.removeAttribute(Et)}else{this.setAttribute(Et,E1)}}function e(){var E1=Ez.apply(this,arguments);if(E1==null){this.removeAttributeNS(Et.space,Et.local)}else{this.setAttributeNS(Et.space,Et.local,E1)}}return this.each(Ez==null?(Et.local?Ew:Eu):(typeof Ez==="function"?(Et.local?e:Ey):(Et.local?Ev:E0)))};B7.classed=function(e,Eu){var Ev=e.split(G),Ew=Ev.length,Et=-1;if(arguments.length>1){while(++Et<Ew){Dw.call(this,Ev[Et],Eu)}return this}else{while(++Et<Ew){if(!Dw.call(this,Ev[Et])){return false}}return true}};var G=/\s+/g;function Dw(e,Ew){var Et=new RegExp("(^|\\s+)"+d3.requote(e)+"(\\s+|$)","g");if(arguments.length<2){var Ev=this.node();if(Ez=Ev.classList){return Ez.contains(e)}var Ez=Ev.className;Et.lastIndex=0;return Et.test(Ez.baseVal!=null?Ez.baseVal:Ez)}function Ey(){if(E2=this.classList){return E2.add(e)}var E2=this.className,E0=E2.baseVal!=null,E1=E0?E2.baseVal:E2;Et.lastIndex=0;if(!Et.test(E1)){E1=BP(E1+" "+e);if(E0){E2.baseVal=E1}else{this.className=E1}}}function Ex(){if(E2=this.classList){return E2.remove(e)}var E2=this.className,E0=E2.baseVal!=null,E1=E0?E2.baseVal:E2;E1=BP(E1.replace(Et," "));if(E0){E2.baseVal=E1}else{this.className=E1}}function Eu(){(Ew.apply(this,arguments)?Ey:Ex).call(this)}return this.each(typeof Ew==="function"?Eu:Ew?Ey:Ex)}B7.style=function(Eu,Ex,Ev){if(arguments.length<3){Ev=""}if(arguments.length<2){return window.getComputedStyle(this.node(),null).getPropertyValue(Eu)}function Et(){this.style.removeProperty(Eu)}function Ew(){this.style.setProperty(Eu,Ex,Ev)}function e(){var Ey=Ex.apply(this,arguments);if(Ey==null){this.style.removeProperty(Eu)}else{this.style.setProperty(Eu,Ey,Ev)}}return this.each(Ex==null?Et:(typeof Ex==="function"?e:Ew))};B7.property=function(Et,Ev){if(arguments.length<2){return this.node()[Et]}function e(){delete this[Et]}function Eu(){this[Et]=Ev}function Ew(){var Ex=Ev.apply(this,arguments);if(Ex==null){delete this[Et]}else{this[Et]=Ex}}return this.each(Ev==null?e:(typeof Ev==="function"?Ew:Eu))};B7.text=function(e){return arguments.length<1?this.node().textContent:this.each(typeof e==="function"?function(){var Et=e.apply(this,arguments);this.textContent=Et==null?"":Et}:e==null?function(){this.textContent=""}:function(){this.textContent=e})};B7.html=function(e){return arguments.length<1?this.node().innerHTML:this.each(typeof e==="function"?function(){var Et=e.apply(this,arguments);this.innerHTML=Et==null?"":Et}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e})};B7.append=function(Et){Et=d3.ns.qualify(Et);function e(){return this.appendChild(document.createElementNS(this.namespaceURI,Et))}function Eu(){return this.appendChild(document.createElementNS(Et.space,Et.local))}return this.select(Et.local?Eu:e)};B7.insert=function(e,Eu){e=d3.ns.qualify(e);function Et(){return this.insertBefore(document.createElementNS(this.namespaceURI,e),Bl(Eu,this))}function Ev(){return this.insertBefore(document.createElementNS(e.space,e.local),Bl(Eu,this))}return this.select(e.local?Ev:Et)};B7.remove=function(){return this.each(function(){var e=this.parentNode;if(e){e.removeChild(this)}})};B7.data=function(Ez,E1){var Ew=-1,Et=this.length,E0,Eu;if(!arguments.length){Ez=new Array(Et=(E0=this[0]).length);while(++Ew<Et){if(Eu=E0[Ew]){Ez[Ew]=Eu.__data__}}return Ez}function Ex(FE,E6){var E9,E3=FE.length,E5=E6.length,FC=Math.min(E3,E5),FB=Math.max(E3,E5),FG=[],FD=[],FA=[],E4,E2;if(E1){var FH=new AI,FF=[],E8,E7=E6.length;for(E9=-1;++E9<E3;){E8=E1.call(E4=FE[E9],E4.__data__,E9);if(FH.has(E8)){FA[E7++]=E4}else{FH.set(E8,E4)}FF.push(E8)}for(E9=-1;++E9<E5;){E8=E1.call(E6,E2=E6[E9],E9);if(FH.has(E8)){FG[E9]=E4=FH.get(E8);E4.__data__=E2;FD[E9]=FA[E9]=null}else{FD[E9]=b(E2);FG[E9]=FA[E9]=null}FH.remove(E8)}for(E9=-1;++E9<E3;){if(FH.has(FF[E9])){FA[E9]=FE[E9]}}}else{for(E9=-1;++E9<FC;){E4=FE[E9];E2=E6[E9];if(E4){E4.__data__=E2;FG[E9]=E4;FD[E9]=FA[E9]=null}else{FD[E9]=b(E2);FG[E9]=FA[E9]=null}}for(;E9<E5;++E9){FD[E9]=b(E6[E9]);FG[E9]=FA[E9]=null}for(;E9<FB;++E9){FA[E9]=FE[E9];FD[E9]=FG[E9]=null}}FD.update=FG;FD.parentNode=FG.parentNode=FA.parentNode=FE.parentNode;Ey.push(FD);Ev.push(FG);e.push(FA)}var Ey=Ax([]),Ev=B8([]),e=B8([]);if(typeof Ez==="function"){while(++Ew<Et){Ex(E0=this[Ew],Ez.call(E0,E0.parentNode.__data__,Ew))}}else{while(++Ew<Et){Ex(E0=this[Ew],Ez)}}Ev.enter=function(){return Ey};Ev.exit=function(){return e};return Ev};function b(e){return{__data__:e}}B7.datum=B7.map=function(e){return arguments.length<1?this.property("__data__"):this.property("__data__",e)};B7.filter=function(e){var Eu=[],E0,Ez,Ev;if(typeof e!=="function"){e=AW(e)}for(var Ex=0,Ew=this.length;Ex<Ew;Ex++){Eu.push(E0=[]);E0.parentNode=(Ez=this[Ex]).parentNode;for(var Ey=0,Et=Ez.length;Ey<Et;Ey++){if((Ev=Ez[Ey])&&e.call(Ev,Ev.__data__,Ey)){E0.push(Ev)}}}return B8(Eu)};function AW(e){return function(){return A(this,e)}}B7.order=function(){for(var Et=-1,e=this.length;++Et<e;){for(var Ex=this[Et],Eu=Ex.length-1,Ev=Ex[Eu],Ew;--Eu>=0;){if(Ew=Ex[Eu]){if(Ev&&Ev!==Ew.nextSibling){Ev.parentNode.insertBefore(Ew,Ev)}Ev=Ew}}}return this};B7.sort=function(Et){Et=D1.apply(this,arguments);for(var Eu=-1,e=this.length;++Eu<e;){this[Eu].sort(Et)}return this.order()};function D1(e){if(!arguments.length){e=d3.ascending}return function(Eu,Et){return e(Eu&&Eu.__data__,Et&&Et.__data__)}}B7.on=function(Ev,Ew,e){if(arguments.length<3){e=false}var Et="__on"+Ev,Eu=Ev.indexOf(".");if(Eu>0){Ev=Ev.substring(0,Eu)}if(arguments.length<2){return(Eu=this.node()[Et])&&Eu._}return this.each(function(E1,Ey){var Ez=this,E0=Ez[Et];if(E0){Ez.removeEventListener(Ev,E0,E0.$);delete Ez[Et]}if(Ew){Ez.addEventListener(Ev,Ez[Et]=Ex,Ex.$=e);Ex._=Ew}function Ex(E2){var E3=d3.event;d3.event=E2;try{Ew.call(Ez,Ez.__data__,Ey)}finally{d3.event=E3}}})};B7.each=function(Ey){for(var Et=-1,e=this.length;++Et<e;){for(var Ew=this[Et],Eu=-1,Ex=Ew.length;++Eu<Ex;){var Ev=Ew[Eu];if(Ev){Ey.call(Ev,Ev.__data__,Eu,Et)}}}return this};B7.call=function(e){e.apply(this,(arguments[0]=this,arguments));return this};B7.empty=function(){return !this.node()};B7.node=function(Ey){for(var Et=0,e=this.length;Et<e;Et++){for(var Ew=this[Et],Eu=0,Ex=Ew.length;Eu<Ex;Eu++){var Ev=Ew[Eu];if(Ev){return Ev}}}return null};B7.transition=function(){var Et=[],Eu,Ex;for(var Ev=-1,e=this.length;++Ev<e;){Et.push(Eu=[]);for(var Ey=this[Ev],Ew=-1,Ez=Ey.length;++Ew<Ez;){Eu.push((Ex=Ey[Ew])?{node:Ex,delay:Cl,duration:EC}:null)}}return D3(Et,EJ||++EX,Date.now())};var D5=B8([[document]]);D5[0].parentNode=CU;d3.select=function(e){return typeof e==="string"?D5.select(e):B8([[e]])};d3.selectAll=function(e){return typeof e==="string"?D5.selectAll(e):B8([B0(e)])};function Ax(e){Cg(e,Co);return e}var Co=[];d3.selection.enter=Ax;d3.selection.enter.prototype=Co;Co.append=B7.append;Co.insert=B7.insert;Co.empty=B7.empty;Co.node=B7.node;Co.select=function(Ex){var Eu=[],E2,e,E0,E1,Ew;for(var Ey=-1,Ev=this.length;++Ey<Ev;){E0=(E1=this[Ey]).update;Eu.push(E2=[]);E2.parentNode=E1.parentNode;for(var Ez=-1,Et=E1.length;++Ez<Et;){if(Ew=E1[Ez]){E2.push(E0[Ez]=e=Ex.call(E1.parentNode,Ew.__data__,Ez));e.__data__=Ew.__data__}else{E2.push(null)}}}return B8(Eu)};function D3(e,Ex,Ev){Cg(e,CP);var Eu=new AI,Et=d3.dispatch("start","end"),Ew=Ab;e.id=Ex;e.time=Ev;e.tween=function(Ey,Ez){if(arguments.length<2){return Eu.get(Ey)}if(Ez==null){Eu.remove(Ey)}else{Eu.set(Ey,Ez)}return e};e.ease=function(Ey){if(!arguments.length){return Ew}Ew=typeof Ey==="function"?Ey:d3.ease.apply(d3,arguments);return e};e.each=function(Ey,Ez){if(arguments.length<2){return B1.call(e,Ey)}Et.on(Ey,Ez);return e};d3.timer(function(Ey){e.each(function(E6,E3,E2){var E8=[],E0=this,E4=e[E2][E3].delay,E1=e[E2][E3].duration,E9=E0.__transition__||(E0.__transition__={active:0,count:0});++E9.count;E4<=Ey?Ez(Ey):d3.timer(Ez,E4,Ev);function Ez(FA){if(E9.active>Ex){return E7()}E9.active=Ex;Eu.forEach(function(FB,FC){if(tween=FC.call(E0,E6,E3)){E8.push(tween)}});Et.start.call(E0,E6,E3);if(!E5(FA)){d3.timer(E5,0,Ev)}return 1}function E5(FA){if(E9.active!==Ex){return E7()}var FB=(FA-E4)/E1,FC=Ew(FB),FD=E8.length;while(FD>0){E8[--FD].call(E0,FC)}if(FB>=1){E7();EJ=Ex;Et.end.call(E0,E6,E3);EJ=0;return 1}}function E7(){if(!--E9.count){delete E0.__transition__}return 1}});return 1},0,Ev);return e}var Q={};function EA(Eu,Et,e){return e!=""&&Q}function E(Ev,e){var Eu=DB(Ev);function Et(E0,Ez,Ex){var Ey=e.call(this,E0,Ez);return Ey==null?Ex!=""&&Q:Ex!=Ey&&Eu(Ex,Ey)}function Ew(Ez,Ey,Ex){return Ex!=e&&Eu(Ex,e)}return typeof e==="function"?Et:e==null?EA:(e+="",Ew)}var CP=[],EX=0,EJ=0,D=0,D8=250,C1=d3.ease("cubic-in-out"),Cl=D,EC=D8,Ab=C1;CP.call=B7.call;d3.transition=function(e){return arguments.length?(EJ?e.transition():e):D5.transition()};d3.transition.prototype=CP;CP.select=function(Ex){var Eu=[],E1,e,Ev;if(typeof Ex!=="function"){Ex=S(Ex)}for(var Ey=-1,Ew=this.length;++Ey<Ew;){Eu.push(E1=[]);for(var E0=this[Ey],Ez=-1,Et=E0.length;++Ez<Et;){if((Ev=E0[Ez])&&(e=Ex.call(Ev.node,Ev.node.__data__,Ez))){if("__data__" in Ev.node){e.__data__=Ev.node.__data__}E1.push({node:e,delay:Ev.delay,duration:Ev.duration})}else{E1.push(null)}}}return D3(Eu,this.id,this.time).ease(this.ease())};CP.selectAll=function(Ey){var Ev=[],E3,e,Ew;if(typeof Ey!=="function"){Ey=Ba(Ey)}for(var E0=-1,Ex=this.length;++E0<Ex;){for(var E2=this[E0],E1=-1,Eu=E2.length;++E1<Eu;){if(Ew=E2[E1]){e=Ey.call(Ew.node,Ew.node.__data__,E1);Ev.push(E3=[]);for(var Ez=-1,Et=e.length;++Ez<Et;){E3.push({node:e[Ez],delay:Ew.delay,duration:Ew.duration})}}}}return D3(Ev,this.id,this.time).ease(this.ease())};CP.attr=function(e,Et){return this.attrTween(e,E(e,Et))};CP.attrTween=function(e,Eu){var Et=d3.ns.qualify(e);function Ev(Ez,Ex){var Ey=Eu.call(this,Ez,Ex,this.getAttribute(Et));return Ey===Q?(this.removeAttribute(Et),null):Ey&&function(E0){this.setAttribute(Et,Ey(E0))}}function Ew(Ez,Ex){var Ey=Eu.call(this,Ez,Ex,this.getAttributeNS(Et.space,Et.local));return Ey===Q?(this.removeAttributeNS(Et.space,Et.local),null):Ey&&function(E0){this.setAttributeNS(Et.space,Et.local,Ey(E0))}}return this.tween("attr."+e,Et.local?Ew:Ev)};CP.style=function(e,Eu,Et){if(arguments.length<3){Et=""}return this.styleTween(e,E(e,Eu),Et)};CP.styleTween=function(e,Eu,Et){if(arguments.length<3){Et=""}return this.tween("style."+e,function(Ex,Ev){var Ew=Eu.call(this,Ex,Ev,window.getComputedStyle(this,null).getPropertyValue(e));return Ew===Q?(this.style.removeProperty(e),null):Ew&&function(Ey){this.style.setProperty(e,Ew(Ey),Et)}})};CP.text=function(e){return this.tween("text",function(Eu,Et){this.textContent=typeof e==="function"?e.call(this,Eu,Et):e})};CP.remove=function(){return this.each("end.transition",function(){var e;if(!this.__transition__&&(e=this.parentNode)){e.removeChild(this)}})};CP.delay=function(Et){var e=this;return e.each(typeof Et==="function"?function(Ew,Ev,Eu){e[Eu][Ev].delay=Et.apply(this,arguments)|0}:(Et=Et|0,function(Ew,Ev,Eu){e[Eu][Ev].delay=Et}))};CP.duration=function(Et){var e=this;return e.each(typeof Et==="function"?function(Ew,Ev,Eu){e[Eu][Ev].duration=Math.max(1,Et.apply(this,arguments)|0)}:(Et=Math.max(1,Et|0),function(Ew,Ev,Eu){e[Eu][Ev].duration=Et}))};function B1(E2){var e=EJ,Ew=Ab,E0=Cl,Ex=EC;EJ=this.id;Ab=this.ease();for(var Ey=0,Ev=this.length;Ey<Ev;Ey++){for(var E1=this[Ey],Ez=0,Et=E1.length;Ez<Et;Ez++){var Eu=E1[Ez];if(Eu){Cl=this[Ey][Ez].delay;EC=this[Ey][Ez].duration;E2.call(Eu=Eu.node,Eu.__data__,Ez,Ey)}}}EJ=e;Ab=Ew;Cl=E0;EC=Ex;return this}CP.transition=function(){return this.select(r)};var A4=null,BC,Cz;d3.timer=function(Ex,e,Ew){var Ev=false,Eu,Et=A4;if(arguments.length<3){if(arguments.length<2){e=0}else{if(!isFinite(e)){return}}Ew=Date.now()}while(Et){if(Et.callback===Ex){Et.then=Ew;Et.delay=e;Ev=true;break}Eu=Et;Et=Et.next}if(!Ev){A4={callback:Ex,then:Ew,delay:e,next:A4}}if(!BC){Cz=clearTimeout(Cz);BC=1;ES(ET)}};function ET(){var e,Eu=Date.now(),Ev=A4;while(Ev){e=Eu-Ev.then;if(e>=Ev.delay){Ev.flush=Ev.callback(e)}Ev=Ev.next}var Et=Cq()-Eu;if(Et>24){if(isFinite(Et)){clearTimeout(Cz);Cz=setTimeout(ET,Et)}BC=0}else{BC=1;ES(ET)}}d3.timer.flush=function(){var e,Et=Date.now(),Eu=A4;while(Eu){e=Et-Eu.then;if(!Eu.delay){Eu.flush=Eu.callback(e)}Eu=Eu.next}Cq()};function Cq(){var Et=null,e=A4,Eu=Infinity;while(e){if(e.flush){e=Et?Et.next=e.next:A4=e.next}else{Eu=Math.min(Eu,e.then+e.delay);e=(Et=e).next}}return Eu}var ES=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};d3.transform=function(Et){var Eu=document.createElementNS(d3.ns.prefix.svg,"g"),e={a:1,b:0,c:0,d:1,e:0,f:0};return(d3.transform=function(Ev){Eu.setAttribute("transform",Ev);var Ew=Eu.transform.baseVal.consolidate();return new N(Ew?Ew.matrix:e)})(Et)};function N(e){var Ev=[e.a,e.b],Et=[e.c,e.d],Ex=C8(Ev),Eu=Ch(Ev,Et),Ew=C8(Av(Et,Ev,-Eu))||0;if(Ev[0]*Et[1]<Et[0]*Ev[1]){Ev[0]*=-1;Ev[1]*=-1;Ex*=-1;Eu*=-1}this.rotate=(Ex?Math.atan2(Ev[1],Ev[0]):Math.atan2(-Et[0],Et[1]))*CW;this.translate=[e.e,e.f];this.scale=[Ex,Ew];this.skew=Ew?Math.atan2(Eu,Ew)*CW:0}N.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};function Ch(Et,e){return Et[0]*e[0]+Et[1]*e[1]}function C8(e){var Et=Math.sqrt(Ch(e,e));if(Et){e[0]/=Et;e[1]/=Et}return Et}function Av(Et,e,Eu){Et[0]+=Eu*e[0];Et[1]+=Eu*e[1];return Et}var CW=180/Math.PI;d3.mouse=function(e){return AQ(e,s())};var BN=/WebKit/.test(navigator.userAgent)?-1:0;function AQ(Ev,Ey){var Ew=Ev.ownerSVGElement||Ev;if(Ew.createSVGPoint){var Et=Ew.createSVGPoint();if((BN<0)&&(window.scrollX||window.scrollY)){Ew=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var Eu=Ew[0][0].getScreenCTM();BN=!(Eu.f||Eu.e);Ew.remove()}if(BN){Et.x=Ey.pageX;Et.y=Ey.pageY}else{Et.x=Ey.clientX;Et.y=Ey.clientY}Et=Et.matrixTransform(Ev.getScreenCTM().inverse());return[Et.x,Et.y]}var Ex=Ev.getBoundingClientRect();return[Ey.clientX-Ex.left-Ev.clientLeft,Ey.clientY-Ex.top-Ev.clientTop]}d3.touches=function(e,Et){if(arguments.length<2){Et=s().touches}return Et?B0(Et).map(function(Ev){var Eu=AQ(e,Ev);Eu.identifier=Ev.identifier;return Eu}):[]};function AH(){}d3.scale={};function CN(Et){var Eu=Et[0],e=Et[Et.length-1];return Eu<e?[Eu,e]:[e,Eu]}function AR(e){return e.rangeExtent?e.rangeExtent():CN(e.range())}function Di(Ey,Ew){var Ex=0,Ev=Ey.length-1,Eu=Ey[Ex],Et=Ey[Ev],e;if(Et<Eu){e=Ex;Ex=Ev;Ev=e;e=Eu;Eu=Et;Et=e}if(e=Et-Eu){Ew=Ew(e);Ey[Ex]=Ew.floor(Eu);Ey[Ev]=Ew.ceil(Et)}return Ey}function Ca(){return Math}d3.scale.linear=function(){return CK([0,1],[0,1],d3.interpolate,false)};function CK(Ex,Ev,Ew,Ez){var Eu,Et;function e(){var E0=Math.min(Ex.length,Ev.length)>2?f:AG,E1=Ez?AD:EU;Eu=E0(Ex,Ev,E1,Ew);Et=E0(Ev,Ex,E1,d3.interpolate);return Ey}function Ey(E0){return Eu(E0)}Ey.invert=function(E0){return Et(E0)};Ey.domain=function(E0){if(!arguments.length){return Ex}Ex=E0.map(Number);return e()};Ey.range=function(E0){if(!arguments.length){return Ev}Ev=E0;return e()};Ey.rangeRound=function(E0){return Ey.range(E0).interpolate(d3.interpolateRound)};Ey.clamp=function(E0){if(!arguments.length){return Ez}Ez=E0;return e()};Ey.interpolate=function(E0){if(!arguments.length){return Ew}Ew=E0;return e()};Ey.ticks=function(E0){return Ck(Ex,E0)};Ey.tickFormat=function(E0){return Cu(Ex,E0)};Ey.nice=function(){Di(Ex,AK);return e()};Ey.copy=function(){return CK(Ex,Ev,Ew,Ez)};return e()}function Da(Et,e){return d3.rebind(Et,e,"range","rangeRound","interpolate","clamp")}function AK(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return{floor:function(Et){return Math.floor(Et/e)*e},ceil:function(Et){return Math.ceil(Et/e)*e}}}function O(Ex,e){var Eu=CN(Ex),Et=Eu[1]-Eu[0],Ew=Math.pow(10,Math.floor(Math.log(Et/e)/Math.LN10)),Ev=e/Et*Ew;if(Ev<=0.15){Ew*=10}else{if(Ev<=0.35){Ew*=5}else{if(Ev<=0.75){Ew*=2}}}Eu[0]=Math.ceil(Eu[0]/Ew)*Ew;Eu[1]=Math.floor(Eu[1]/Ew)*Ew+Ew*0.5;Eu[2]=Ew;return Eu}function Ck(Et,e){return d3.range.apply(d3,O(Et,e))}function Cu(Et,e){return d3.format(",."+Math.max(0,-Math.floor(Math.log(O(Et,e)[2])/Math.LN10+0.01))+"f")}function AG(Ew,e,Ex,Eu){var Et=Ex(Ew[0],Ew[1]),Ev=Eu(e[0],e[1]);return function(Ey){return Ev(Et(Ey))}}function f(Ey,Et,Ez,Ew){var Ev=[],Ex=[],Eu=0,e=Math.min(Ey.length,Et.length)-1;if(Ey[e]<Ey[0]){Ey=Ey.slice().reverse();Et=Et.slice().reverse()}while(++Eu<=e){Ev.push(Ez(Ey[Eu-1],Ey[Eu]));Ex.push(Ew(Et[Eu-1],Et[Eu]))}return function(E0){var E1=d3.bisect(Ey,E0,1,e)-1;return Ex[E1](Ev[E1](E0))}}d3.scale.log=function(){return Dz(d3.scale.linear(),Db)};function Dz(e,Et){var Eu=Et.pow;function Ev(Ew){return e(Et(Ew))}Ev.invert=function(Ew){return Eu(e.invert(Ew))};Ev.domain=function(Ew){if(!arguments.length){return e.domain().map(Eu)}Et=Ew[0]<0?De:Db;Eu=Et.pow;e.domain(Ew.map(Et));return Ev};Ev.nice=function(){e.domain(Di(e.domain(),Ca));return Ev};Ev.ticks=function(){var E1=CN(e.domain()),E2=[];if(E1.every(isFinite)){var E0=Math.floor(E1[0]),Ez=Math.ceil(E1[1]),Ey=Eu(E1[0]),Ex=Eu(E1[1]);if(Et===De){E2.push(Eu(E0));for(;E0++<Ez;){for(var Ew=9;Ew>0;Ew--){E2.push(Eu(E0)*Ew)}}}else{for(;E0<Ez;E0++){for(var Ew=1;Ew<10;Ew++){E2.push(Eu(E0)*Ew)}}E2.push(Eu(E0))}for(E0=0;E2[E0]<Ey;E0++){}for(Ez=E2.length;E2[Ez-1]>Ex;Ez--){}E2=E2.slice(E0,Ez)}return E2};Ev.tickFormat=function(E0,Ez){if(arguments.length<2){Ez=Bm}if(arguments.length<1){return Ez}var Ew=E0/Ev.ticks().length,Ex=Et===De?(Ey=-1e-12,Math.floor):(Ey=1e-12,Math.ceil),Ey;return function(E1){return E1/Eu(Ex(Et(E1)+Ey))<Ew?Ez(E1):""}};Ev.copy=function(){return Dz(e.copy(),Et)};return Da(Ev,e)}var Bm=d3.format(".0e");function Db(e){return Math.log(e<0?0:e)/Math.LN10}function De(e){return -Math.log(e>0?0:-e)/Math.LN10}Db.pow=function(e){return Math.pow(10,e)};De.pow=function(e){return -Math.pow(10,-e)};d3.scale.pow=function(){return Dn(d3.scale.linear(),1)};function Dn(e,Eu){var Et=DS(Eu),Ev=DS(1/Eu);function Ew(Ex){return e(Et(Ex))}Ew.invert=function(Ex){return Ev(e.invert(Ex))};Ew.domain=function(Ex){if(!arguments.length){return e.domain().map(Ev)}e.domain(Ex.map(Et));return Ew};Ew.ticks=function(Ex){return Ck(Ew.domain(),Ex)};Ew.tickFormat=function(Ex){return Cu(Ew.domain(),Ex)};Ew.nice=function(){return Ew.domain(Di(Ew.domain(),AK))};Ew.exponent=function(Ex){if(!arguments.length){return Eu}var Ey=Ew.domain();Et=DS(Eu=Ex);Ev=DS(1/Eu);return Ew.domain(Ey)};Ew.copy=function(){return Dn(e.copy(),Eu)};return Da(Ew,e)}function DS(Et){return function(e){return e<0?-Math.pow(-e,Et):Math.pow(e,Et)}}d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){return BD([],{t:"range",x:[]})};function BD(Ex,Eu){var Ew,Et,Ev;function Ey(Ez){return Et[((Ew.get(Ez)||Ew.set(Ez,Ex.push(Ez)))-1)%Et.length]}function e(E0,Ez){return d3.range(Ex.length).map(function(E1){return E0+Ez*E1})}Ey.domain=function(Ez){if(!arguments.length){return Ex}Ex=[];Ew=new AI;var E1=-1,E2=Ez.length,E0;while(++E1<E2){if(!Ew.has(E0=Ez[E1])){Ew.set(E0,Ex.push(E0))}}return Ey[Eu.t](Eu.x,Eu.p)};Ey.range=function(Ez){if(!arguments.length){return Et}Et=Ez;Ev=0;Eu={t:"range",x:Ez};return Ey};Ey.rangePoints=function(Ez,E2){if(arguments.length<2){E2=0}var E3=Ez[0],E0=Ez[1],E1=(E0-E3)/(Ex.length-1+E2);Et=e(Ex.length<2?(E3+E0)/2:E3+E1*E2/2,E1);Ev=0;Eu={t:"rangePoints",x:Ez,p:E2};return Ey};Ey.rangeBands=function(Ez,E3){if(arguments.length<2){E3=0}var E0=Ez[1]<Ez[0],E4=Ez[E0-0],E1=Ez[1-E0],E2=(E1-E4)/(Ex.length+E3);Et=e(E4+E2*E3,E2);if(E0){Et.reverse()}Ev=E2*(1-E3);Eu={t:"rangeBands",x:Ez,p:E3};return Ey};Ey.rangeRoundBands=function(Ez,E4){if(arguments.length<2){E4=0}var E1=Ez[1]<Ez[0],E5=Ez[E1-0],E2=Ez[1-E1],E3=Math.floor((E2-E5)/(Ex.length+E4)),E0=E2-E5-(Ex.length-E4)*E3;Et=e(E5+Math.round(E0/2),E3);if(E1){Et.reverse()}Ev=Math.round(E3*(1-E4));Eu={t:"rangeRoundBands",x:Ez,p:E4};return Ey};Ey.rangeBand=function(){return Ev};Ey.rangeExtent=function(){return CN(Eu.x)};Ey.copy=function(){return BD(Ex,Eu)};return Ey.domain(Ex)}d3.scale.category10=function(){return d3.scale.ordinal().range(BK)};d3.scale.category20=function(){return d3.scale.ordinal().range(A8)};d3.scale.category20b=function(){return d3.scale.ordinal().range(EI)};d3.scale.category20c=function(){return d3.scale.ordinal().range(EH)};var BK=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var A8=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];var EI=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"];var EH=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return V([],[])};function V(Eu,Et){var Ev;function e(){var Ex=0,Ez=Eu.length,Ey=Et.length;Ev=[];while(++Ex<Ey){Ev[Ex-1]=d3.quantile(Eu,Ex/Ey)}return Ew}function Ew(Ex){if(isNaN(Ex=+Ex)){return NaN}return Et[d3.bisect(Ev,Ex)]}Ew.domain=function(Ex){if(!arguments.length){return Eu}Eu=Ex.filter(function(Ey){return !isNaN(Ey)}).sort(d3.ascending);return e()};Ew.range=function(Ex){if(!arguments.length){return Et}Et=Ex;return e()};Ew.quantiles=function(){return Ev};Ew.copy=function(){return V(Eu,Et)};return e()}d3.scale.quantize=function(){return Bw(0,1,[0,1])};function Bw(Ew,Eu,Et){var Ex,Ev;function Ey(Ez){return Et[Math.max(0,Math.min(Ev,Math.floor(Ex*(Ez-Ew))))]}function e(){Ex=Et.length/(Eu-Ew);Ev=Et.length-1;return Ey}Ey.domain=function(Ez){if(!arguments.length){return[Ew,Eu]}Ew=+Ez[0];Eu=+Ez[Ez.length-1];return e()};Ey.range=function(Ez){if(!arguments.length){return Et}Et=Ez;return e()};Ey.copy=function(){return Bw(Ew,Eu,Et)};return e()}d3.scale.identity=function(){return Cb([0,1])};function Cb(Et){function e(Eu){return +Eu}e.invert=e;e.domain=e.range=function(Eu){if(!arguments.length){return Et}Et=Eu.map(e);return e};e.ticks=function(Eu){return Ck(Et,Eu)};e.tickFormat=function(Eu){return Cu(Et,Eu)};e.copy=function(){return Cb(Et)};return e}d3.svg={};d3.svg.arc=function(){var Ew=Al,Ev=BT,Eu=Df,e=y;function Et(){var E0=Ew.apply(this,arguments),Ez=Ev.apply(this,arguments),Ey=Eu.apply(this,arguments)+Ea,Ex=e.apply(this,arguments)+Ea,E6=(Ex<Ey&&(E6=Ey,Ey=Ex,Ex=E6),Ex-Ey),E3=E6<Math.PI?"0":"1",E2=Math.cos(Ey),E5=Math.sin(Ey),E1=Math.cos(Ex),E4=Math.sin(Ex);return E6>=Ef?(E0?"M0,"+Ez+"A"+Ez+","+Ez+" 0 1,1 0,"+(-Ez)+"A"+Ez+","+Ez+" 0 1,1 0,"+Ez+"M0,"+E0+"A"+E0+","+E0+" 0 1,0 0,"+(-E0)+"A"+E0+","+E0+" 0 1,0 0,"+E0+"Z":"M0,"+Ez+"A"+Ez+","+Ez+" 0 1,1 0,"+(-Ez)+"A"+Ez+","+Ez+" 0 1,1 0,"+Ez+"Z"):(E0?"M"+Ez*E2+","+Ez*E5+"A"+Ez+","+Ez+" 0 "+E3+",1 "+Ez*E1+","+Ez*E4+"L"+E0*E1+","+E0*E4+"A"+E0+","+E0+" 0 "+E3+",0 "+E0*E2+","+E0*E5+"Z":"M"+Ez*E2+","+Ez*E5+"A"+Ez+","+Ez+" 0 "+E3+",1 "+Ez*E1+","+Ez*E4+"L0,0Z")}Et.innerRadius=function(Ex){if(!arguments.length){return Ew}Ew=d3.functor(Ex);return Et};Et.outerRadius=function(Ex){if(!arguments.length){return Ev}Ev=d3.functor(Ex);return Et};Et.startAngle=function(Ex){if(!arguments.length){return Eu}Eu=d3.functor(Ex);return Et};Et.endAngle=function(Ex){if(!arguments.length){return e}e=d3.functor(Ex);return Et};Et.centroid=function(){var Ey=(Ew.apply(this,arguments)+Ev.apply(this,arguments))/2,Ex=(Eu.apply(this,arguments)+e.apply(this,arguments))/2+Ea;return[Math.cos(Ex)*Ey,Math.sin(Ex)*Ey]};return Et};var Ea=-Math.PI/2,Ef=2*Math.PI-0.000001;function Al(e){return e.innerRadius}function BT(e){return e.outerRadius}function Df(e){return e.startAngle}function y(e){return e.endAngle}function Ct(Et){var e=D7,Ey=D6,Ev=CC,Ex=A5.get(Ev),Ew=0.7;function Eu(Ez){return Ez.length<1?null:"M"+Ex(Et(AF(this,Ez,e,Ey)),Ew)}Eu.x=function(Ez){if(!arguments.length){return e}e=Ez;return Eu};Eu.y=function(Ez){if(!arguments.length){return Ey}Ey=Ez;return Eu};Eu.interpolate=function(Ez){if(!arguments.length){return Ev}if(!A5.has(Ez+="")){Ez=CC}Ex=A5.get(Ev=Ez);return Eu};Eu.tension=function(Ez){if(!arguments.length){return Ew}Ew=Ez;return Eu};return Eu}d3.svg.line=function(){return Ct(Object)};function AF(E1,Ew,Ey,Ex){var E0=[],Ev=-1,e=Ew.length,Eu=typeof Ey==="function",Et=typeof Ex==="function",Ez;if(Eu&&Et){while(++Ev<e){E0.push([Ey.call(E1,Ez=Ew[Ev],Ev),Ex.call(E1,Ez,Ev)])}}else{if(Eu){while(++Ev<e){E0.push([Ey.call(E1,Ew[Ev],Ev),Ex])}}else{if(Et){while(++Ev<e){E0.push([Ey,Ex.call(E1,Ew[Ev],Ev)])}}else{while(++Ev<e){E0.push([Ey,Ex])}}}}return E0}function D7(e){return e[0]}function D6(e){return e[1]}var CC="linear";var A5=d3.map({linear:Ei,"step-before":Af,"step-after":EW,basis:Cy,"basis-open":Ac,"basis-closed":BR,bundle:BS,cardinal:B5,"cardinal-open":A2,"cardinal-closed":P,monotone:Bj});function Ei(Et){var e=0,Ew=Et.length,Ev=Et[0],Eu=[Ev[0],",",Ev[1]];while(++e<Ew){Eu.push("L",(Ev=Et[e])[0],",",Ev[1])}return Eu.join("")}function Af(Et){var e=0,Ew=Et.length,Ev=Et[0],Eu=[Ev[0],",",Ev[1]];while(++e<Ew){Eu.push("V",(Ev=Et[e])[1],"H",Ev[0])}return Eu.join("")}function EW(Et){var e=0,Ew=Et.length,Ev=Et[0],Eu=[Ev[0],",",Ev[1]];while(++e<Ew){Eu.push("H",(Ev=Et[e])[0],"V",Ev[1])}return Eu.join("")}function A2(Et,e){return Et.length<4?Ei(Et):Et[1]+BX(Et.slice(1,Et.length-1),Ay(Et,e))}function P(Et,e){return Et.length<3?Ei(Et):Et[0]+BX((Et.push(Et[0]),Et),Ay([Et[Et.length-2]].concat(Et,[Et[1]]),e))}function B5(Eu,Et,e){return Eu.length<3?Ei(Eu):Eu[0]+BX(Eu,Ay(Eu,Et))}function BX(Ey,Ex){if(Ex.length<1||(Ey.length!=Ex.length&&Ey.length!=Ex.length+2)){return Ei(Ey)}var Ez=Ey.length!=Ex.length,E2="",E0=Ey[0],e=Ey[1],Ew=Ex[0],E1=Ew,Eu=1;if(Ez){E2+="Q"+(e[0]-Ew[0]*2/3)+","+(e[1]-Ew[1]*2/3)+","+e[0]+","+e[1];E0=Ey[1];Eu=2}if(Ex.length>1){E1=Ex[1];e=Ey[Eu];Eu++;E2+="C"+(E0[0]+Ew[0])+","+(E0[1]+Ew[1])+","+(e[0]-E1[0])+","+(e[1]-E1[1])+","+e[0]+","+e[1];for(var Et=2;Et<Ex.length;Et++,Eu++){e=Ey[Eu];E1=Ex[Et];E2+="S"+(e[0]-E1[0])+","+(e[1]-E1[1])+","+e[0]+","+e[1]}}if(Ez){var Ev=Ey[Eu];E2+="Q"+(e[0]+E1[0]*2/3)+","+(e[1]+E1[1]*2/3)+","+Ev[0]+","+Ev[1]}return E2}function Ay(Ey,Ew){var Eu=[],Ev=(1-Ew)/2,E0,Ez=Ey[0],Ex=Ey[1],Et=1,e=Ey.length;while(++Et<e){E0=Ez;Ez=Ex;Ex=Ey[Et];Eu.push([Ev*(Ex[0]-E0[0]),Ev*(Ex[1]-E0[1])])}return Eu}function Cy(Ez){if(Ez.length<3){return Ei(Ez)}var Eu=1,Et=Ez.length,Ev=Ez[0],e=Ev[0],Ex=Ev[1],Ey=[e,e,e,(Ev=Ez[1])[0]],Ew=[Ex,Ex,Ex,Ev[1]],E0=[e,",",Ex];As(E0,Ey,Ew);while(++Eu<Et){Ev=Ez[Eu];Ey.shift();Ey.push(Ev[0]);Ew.shift();Ew.push(Ev[1]);As(E0,Ey,Ew)}Eu=-1;while(++Eu<2){Ey.shift();Ey.push(Ev[0]);Ew.shift();Ew.push(Ev[1]);As(E0,Ey,Ew)}return E0.join("")}function Ac(Ev){if(Ev.length<4){return Ei(Ev)}var Ex=[],Eu=-1,Ey=Ev.length,Ew,Et=[0],e=[0];while(++Eu<3){Ew=Ev[Eu];Et.push(Ew[0]);e.push(Ew[1])}Ex.push(Dl(EN,Et)+","+Dl(EN,e));--Eu;while(++Eu<Ey){Ew=Ev[Eu];Et.shift();Et.push(Ew[0]);e.shift();e.push(Ew[1]);As(Ex,Et,e)}return Ex.join("")}function BR(Ew){var Ey,Ev=-1,Ez=Ew.length,e=Ez+4,Ex,Eu=[],Et=[];while(++Ev<4){Ex=Ew[Ev%Ez];Eu.push(Ex[0]);Et.push(Ex[1])}Ey=[Dl(EN,Eu),",",Dl(EN,Et)];--Ev;while(++Ev<e){Ex=Ew[Ev%Ez];Eu.shift();Eu.push(Ex[0]);Et.shift();Et.push(Ex[1]);As(Ey,Eu,Et)}return Ey.join("")}function BS(Ey,Ex){var Eu=Ey.length-1,Et=Ey[0][0],Ew=Ey[0][1],E1=Ey[Eu][0]-Et,E0=Ey[Eu][1]-Ew,Ev=-1,e,Ez;while(++Ev<=Eu){e=Ey[Ev];Ez=Ev/Eu;e[0]=Ex*e[0]+(1-Ex)*(Et+Ez*E1);e[1]=Ex*e[1]+(1-Ex)*(Ew+Ez*E0)}return Cy(Ey)}function Dl(Et,e){return Et[0]*e[0]+Et[1]*e[1]+Et[2]*e[2]+Et[3]*e[3]}var EQ=[0,2/3,1/3,0],EO=[0,1/3,2/3,0],EN=[0,1/6,2/3,1/6];function As(Et,e,Eu){Et.push("C",Dl(EQ,e),",",Dl(EQ,Eu),",",Dl(EO,e),",",Dl(EO,Eu),",",Dl(EN,e),",",Dl(EN,Eu))}function Eo(Et,e){return(e[1]-Et[1])/(e[0]-Et[0])}function CG(Ev){var Eu=0,Et=Ev.length-1,e=[],Ey=Ev[0],Ex=Ev[1],Ew=e[0]=Eo(Ey,Ex);while(++Eu<Et){e[Eu]=Ew+(Ew=Eo(Ey=Ex,Ex=Ev[Eu+1]))}e[Eu]=Ew;return e}function AA(Ez){var Ew=[],Ev,Ey,Ex,E0,e=CG(Ez),Eu=-1,Et=Ez.length-1;while(++Eu<Et){Ev=Eo(Ez[Eu],Ez[Eu+1]);if(Math.abs(Ev)<0.000001){e[Eu]=e[Eu+1]=0}else{Ey=e[Eu]/Ev;Ex=e[Eu+1]/Ev;E0=Ey*Ey+Ex*Ex;if(E0>9){E0=Ev*3/Math.sqrt(E0);e[Eu]=E0*Ey;e[Eu+1]=E0*Ex}}}Eu=-1;while(++Eu<=Et){E0=(Ez[Math.min(Et,Eu+1)][0]-Ez[Math.max(0,Eu-1)][0])/(6*(1+e[Eu]*e[Eu]));Ew.push([E0||0,e[Eu]*E0||0])}return Ew}function Bj(e){return e.length<3?Ei(e):e[0]+BX(e,AA(e))}d3.svg.line.radial=function(){var e=Ct(h);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};function h(Ev){var e,Eu=-1,Ex=Ev.length,Ew,Et;while(++Eu<Ex){e=Ev[Eu];Ew=e[0];Et=e[1]+Ea;e[0]=Ew*Math.cos(Et);e[1]=Ew*Math.sin(Et)}return Ev}function Eq(Ex){var Eu=D7,Et=D7,E1=0,Ez=D6,Ey,Ew,Ev,E0=0.7;function e(E4){if(E4.length<1){return null}var E3=AF(this,E4,Eu,E1),E2=AF(this,E4,Eu===Et?Bo(E3):Et,E1===Ez?Bn(E3):Ez);return"M"+Ew(Ex(E2),E0)+"L"+Ev(Ex(E3.reverse()),E0)+"Z"}e.x=function(E2){if(!arguments.length){return Et}Eu=Et=E2;return e};e.x0=function(E2){if(!arguments.length){return Eu}Eu=E2;return e};e.x1=function(E2){if(!arguments.length){return Et}Et=E2;return e};e.y=function(E2){if(!arguments.length){return Ez}E1=Ez=E2;return e};e.y0=function(E2){if(!arguments.length){return E1}E1=E2;return e};e.y1=function(E2){if(!arguments.length){return Ez}Ez=E2;return e};e.interpolate=function(E2){if(!arguments.length){return Ey}if(!A5.has(E2+="")){E2=CC}Ew=A5.get(Ey=E2);Ev=Ew.reverse||Ew;return e};e.tension=function(E2){if(!arguments.length){return E0}E0=E2;return e};return e.interpolate("linear")}Af.reverse=EW;EW.reverse=Af;d3.svg.area=function(){return Eq(Object)};function Bo(e){return function(Eu,Et){return e[Et][0]}}function Bn(e){return function(Eu,Et){return e[Et][1]}}d3.svg.area.radial=function(){var e=Eq(h);e.radius=e.x,delete e.x;e.innerRadius=e.x0,delete e.x0;e.outerRadius=e.x1,delete e.x1;e.angle=e.y,delete e.y;e.startAngle=e.y0,delete e.y0;e.endAngle=e.y1,delete e.y1;return e};d3.svg.chord=function(){var e=z,Ez=AJ,Ey=X,E0=Df,Ew=y;function Ex(E5,E3){var E4=E1(this,e,E5,E3),E2=E1(this,Ez,E5,E3);return"M"+E4.p0+Et(E4.r,E4.p1,E4.a1-E4.a0)+(Eu(E4,E2)?Ev(E4.r,E4.p1,E4.r,E4.p0):Ev(E4.r,E4.p1,E2.r,E2.p0)+Et(E2.r,E2.p1,E2.a1-E2.a0)+Ev(E2.r,E2.p1,E4.r,E4.p0))+"Z"}function E1(E5,E8,E9,E6){var E4=E8.call(E5,E9,E6),E7=Ey.call(E5,E4,E6),E3=E0.call(E5,E4,E6)+Ea,E2=Ew.call(E5,E4,E6)+Ea;return{r:E7,a0:E3,a1:E2,p0:[E7*Math.cos(E3),E7*Math.sin(E3)],p1:[E7*Math.cos(E2),E7*Math.sin(E2)]}}function Eu(E3,E2){return E3.a0==E2.a0&&E3.a1==E2.a1}function Et(E3,E4,E2){return"A"+E3+","+E3+" 0 "+ +(E2>Math.PI)+",1 "+E4}function Ev(E3,E5,E2,E4){return"Q 0,0 "+E4}Ex.radius=function(E2){if(!arguments.length){return Ey}Ey=d3.functor(E2);return Ex};Ex.source=function(E2){if(!arguments.length){return e}e=d3.functor(E2);return Ex};Ex.target=function(E2){if(!arguments.length){return Ez}Ez=d3.functor(E2);return Ex};Ex.startAngle=function(E2){if(!arguments.length){return E0}E0=d3.functor(E2);return Ex};Ex.endAngle=function(E2){if(!arguments.length){return Ew}Ew=d3.functor(E2);return Ex};return Ex};function z(e){return e.source}function AJ(e){return e.target}function X(e){return e.radius}function Dv(e){return e.startAngle}function CO(e){return e.endAngle}d3.svg.diagonal=function(){var Eu=z,Ev=AJ,e=L;function Et(E0,Ex){var E1=Eu.call(this,E0,Ex),Ey=Ev.call(this,E0,Ex),Ew=(E1.y+Ey.y)/2,Ez=[E1,{x:E1.x,y:Ew},{x:Ey.x,y:Ew},Ey];Ez=Ez.map(e);return"M"+Ez[0]+"C"+Ez[1]+" "+Ez[2]+" "+Ez[3]}Et.source=function(Ew){if(!arguments.length){return Eu}Eu=d3.functor(Ew);return Et};Et.target=function(Ew){if(!arguments.length){return Ev}Ev=d3.functor(Ew);return Et};Et.projection=function(Ew){if(!arguments.length){return e}e=Ew;return Et};return Et};function L(e){return[e.x,e.y]}d3.svg.diagonal.radial=function(){var Eu=d3.svg.diagonal(),e=L,Et=Eu.projection;Eu.projection=function(Ev){return arguments.length?Et(M(e=Ev)):e};return Eu};function M(e){return function(){var Ev=e.apply(this,arguments),Eu=Ev[0],Et=Ev[1]+Ea;return[Eu*Math.cos(Et),Eu*Math.sin(Et)]}}d3.svg.mouse=d3.mouse;d3.svg.touches=d3.touches;d3.svg.symbol=function(){var Et=AO,e=Cp;function Eu(Ew,Ev){return(Eg.get(Et.call(this,Ew,Ev))||A6)(e.call(this,Ew,Ev))}Eu.type=function(Ev){if(!arguments.length){return Et}Et=d3.functor(Ev);return Eu};Eu.size=function(Ev){if(!arguments.length){return e}e=d3.functor(Ev);return Eu};return Eu};function Cp(){return 64}function AO(){return"circle"}function A6(e){var Et=Math.sqrt(e/Math.PI);return"M0,"+Et+"A"+Et+","+Et+" 0 1,1 0,"+(-Et)+"A"+Et+","+Et+" 0 1,1 0,"+Et+"Z"}var Eg=d3.map({circle:A6,cross:function(e){var Et=Math.sqrt(e/5)/2;return"M"+-3*Et+","+-Et+"H"+-Et+"V"+-3*Et+"H"+Et+"V"+-Et+"H"+3*Et+"V"+Et+"H"+Et+"V"+3*Et+"H"+-Et+"V"+Et+"H"+-3*Et+"Z"},diamond:function(e){var Et=Math.sqrt(e/(2*BA)),Eu=Et*BA;return"M0,"+-Et+"L"+Eu+",0 0,"+Et+" "+-Eu+",0Z"},square:function(e){var Et=Math.sqrt(e)/2;return"M"+-Et+","+-Et+"L"+Et+","+-Et+" "+Et+","+Et+" "+-Et+","+Et+"Z"},"triangle-down":function(e){var Eu=Math.sqrt(e/A3),Et=Eu*A3/2;return"M0,"+Et+"L"+Eu+","+-Et+" "+-Eu+","+-Et+"Z"},"triangle-up":function(e){var Eu=Math.sqrt(e/A3),Et=Eu*A3/2;return"M0,"+-Et+"L"+Eu+","+Et+" "+-Eu+","+Et+"Z"}});d3.svg.symbolTypes=Eg.keys();var A3=Math.sqrt(3),BA=Math.tan(30*Math.PI/180);d3.svg.axis=function(){var Ev=d3.scale.linear(),Ey="bottom",Ew=6,e=6,Et=6,E2=3,E1=[10],Ex=null,E0,Ez=0;function Eu(E3){E3.each(function(){var FM=d3.select(this);var FN=Ex==null?(Ev.ticks?Ev.ticks.apply(Ev,E1):Ev.domain()):Ex,FG=E0==null?(Ev.tickFormat?Ev.tickFormat.apply(Ev,E1):String):E0;var E8=BU(Ev,FN,Ez),E7=FM.selectAll(".minor").data(E8,String),FJ=E7.enter().insert("line","g").attr("class","tick minor").style("opacity",0.000001),FH=d3.transition(E7.exit()).style("opacity",0.000001).remove(),E5=d3.transition(E7).style("opacity",1);var FL=FM.selectAll("g").data(FN,String),FD=FL.enter().insert("g","path").style("opacity",0.000001),FF=d3.transition(FL.exit()).style("opacity",0.000001).remove(),E9=d3.transition(FL).style("opacity",1),E4;var FC=AR(Ev),FE=FM.selectAll(".domain").data([0]),E6=FE.enter().append("path").attr("class","domain"),FO=d3.transition(FE);var FI=Ev.copy(),FK=this.__chart__||FI;this.__chart__=FI;FD.append("line").attr("class","tick");FD.append("text");E9.select("text").text(FG);switch(Ey){case"bottom":E4=C5;FJ.attr("y2",e);E5.attr("x2",0).attr("y2",e);FD.select("line").attr("y2",Ew);FD.select("text").attr("y",Math.max(Ew,0)+E2);E9.select("line").attr("x2",0).attr("y2",Ew);E9.select("text").attr("x",0).attr("y",Math.max(Ew,0)+E2).attr("dy",".71em").attr("text-anchor","middle");FO.attr("d","M"+FC[0]+","+Et+"V0H"+FC[1]+"V"+Et);break;case"top":E4=C5;FJ.attr("y2",-e);E5.attr("x2",0).attr("y2",-e);FD.select("line").attr("y2",-Ew);FD.select("text").attr("y",-(Math.max(Ew,0)+E2));E9.select("line").attr("x2",0).attr("y2",-Ew);E9.select("text").attr("x",0).attr("y",-(Math.max(Ew,0)+E2)).attr("dy","0em").attr("text-anchor","middle");FO.attr("d","M"+FC[0]+","+-Et+"V0H"+FC[1]+"V"+-Et);break;case"left":E4=C3;FJ.attr("x2",-e);E5.attr("x2",-e).attr("y2",0);FD.select("line").attr("x2",-Ew);FD.select("text").attr("x",-(Math.max(Ew,0)+E2));E9.select("line").attr("x2",-Ew).attr("y2",0);E9.select("text").attr("x",-(Math.max(Ew,0)+E2)).attr("y",0).attr("dy",".32em").attr("text-anchor","end");FO.attr("d","M"+-Et+","+FC[0]+"H0V"+FC[1]+"H"+-Et);break;case"right":E4=C3;FJ.attr("x2",e);E5.attr("x2",e).attr("y2",0);FD.select("line").attr("x2",Ew);FD.select("text").attr("x",Math.max(Ew,0)+E2);E9.select("line").attr("x2",Ew).attr("y2",0);E9.select("text").attr("x",Math.max(Ew,0)+E2).attr("y",0).attr("dy",".32em").attr("text-anchor","start");FO.attr("d","M"+Et+","+FC[0]+"H0V"+FC[1]+"H"+Et);break}if(Ev.ticks){FD.call(E4,FK);E9.call(E4,FI);FF.call(E4,FI);FJ.call(E4,FK);E5.call(E4,FI);FH.call(E4,FI)}else{var FB=FI.rangeBand()/2,FA=function(FP){return FI(FP)+FB};FD.call(E4,FA);E9.call(E4,FA)}})}Eu.scale=function(E3){if(!arguments.length){return Ev}Ev=E3;return Eu};Eu.orient=function(E3){if(!arguments.length){return Ey}Ey=E3;return Eu};Eu.ticks=function(){if(!arguments.length){return E1}E1=arguments;return Eu};Eu.tickValues=function(E3){if(!arguments.length){return Ex}Ex=E3;return Eu};Eu.tickFormat=function(E3){if(!arguments.length){return E0}E0=E3;return Eu};Eu.tickSize=function(E3,E6,E4){if(!arguments.length){return Ew}var E5=arguments.length-1;Ew=+E3;e=E5>1?+E6:Ew;Et=E5>0?+arguments[E5]:Ew;return Eu};Eu.tickPadding=function(E3){if(!arguments.length){return E2}E2=+E3;return Eu};Eu.tickSubdivide=function(E3){if(!arguments.length){return Ez}Ez=+E3;return Eu};return Eu};function C5(Et,e){Et.attr("transform",function(Eu){return"translate("+e(Eu)+",0)"})}function C3(e,Et){e.attr("transform",function(Eu){return"translate(0,"+Et(Eu)+")"})}function BU(Eu,Ey,Et){Ez=[];if(Et&&Ey.length>1){var E1=CN(Eu.domain()),Ez,Ew=-1,e=Ey.length,Ex=(Ey[1]-Ey[0])/++Et,Ev,E0;while(++Ew<e){for(Ev=Et;--Ev>0;){if((E0=+Ey[Ew]-Ev*Ex)>=E1[0]){Ez.push(E0)}}}for(--Ew,Ev=0;++Ev<Et&&(E0=+Ey[Ew]+Ev*Ex)<E1[1];){Ez.push(E0)}}return Ez}d3.svg.brush=function(){var e=EL(Ew,"brushstart","brush","brushend"),Ey=null,Ex=null,Ez=AB[0],E2=[[0,0],[0,0]],Et;function Ew(E3){E3.each(function(){var E6=d3.select(this),E5=E6.selectAll(".background").data([0]),E4=E6.selectAll(".extent").data([0]),E8=E6.selectAll(".resize").data(Ez,String),E7;E6.style("pointer-events","all").on("mousedown.brush",E0).on("touchstart.brush",E0);E5.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");E4.enter().append("rect").attr("class","extent").style("cursor","move");E8.enter().append("g").attr("class",function(E9){return"resize "+E9}).style("cursor",function(E9){return Cd[E9]}).append("rect").attr("x",function(E9){return/[ew]$/.test(E9)?-3:null}).attr("y",function(E9){return/^[ns]/.test(E9)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");E8.style("display",Ew.empty()?"none":null);E8.exit().remove();if(Ey){E7=AR(Ey);E5.attr("x",E7[0]).attr("width",E7[1]-E7[0]);Ev(E6)}if(Ex){E7=AR(Ex);E5.attr("y",E7[0]).attr("height",E7[1]-E7[0]);Eu(E6)}E1(E6)})}function E1(E3){E3.selectAll(".resize").attr("transform",function(E4){return"translate("+E2[+/e$/.test(E4)][0]+","+E2[+/^s/.test(E4)][1]+")"})}function Ev(E3){E3.select(".extent").attr("x",E2[0][0]);E3.selectAll(".extent,.n>rect,.s>rect").attr("width",E2[1][0]-E2[0][0])}function Eu(E3){E3.select(".extent").attr("y",E2[0][1]);E3.selectAll(".extent,.e>rect,.w>rect").attr("height",E2[1][1]-E2[0][1])}function E0(){var FM=this,E4=d3.select(d3.event.target),FA=e.of(FM,arguments),FH=d3.select(FM),FJ=E4.datum(),FF=!/^(n|s)$/.test(FJ)&&Ey,FD=!/^(e|w)$/.test(FJ)&&Ex,FE=E4.classed("extent"),FK,FL=FB(),E5;var E8=d3.select(window).on("mousemove.brush",E9).on("mouseup.brush",E3).on("touchmove.brush",E9).on("touchend.brush",E3).on("keydown.brush",FC).on("keyup.brush",E7);if(FE){FL[0]=E2[0][0]-FL[0];FL[1]=E2[0][1]-FL[1]}else{if(FJ){var FI=+/w$/.test(FJ),FG=+/^n/.test(FJ);E5=[E2[1-FI][0]-FL[0],E2[1-FG][1]-FL[1]];FL[0]=E2[FI][0];FL[1]=E2[FG][1]}else{if(d3.event.altKey){FK=FL.slice()}}}FH.style("pointer-events","none").selectAll(".resize").style("display",null);d3.select("body").style("cursor",E4.style("cursor"));FA({type:"brushstart"});E9();Ec();function FB(){var FN=d3.event.changedTouches;return FN?d3.touches(FM,FN)[0]:d3.mouse(FM)}function FC(){if(d3.event.keyCode==32){if(!FE){FK=null;FL[0]-=E2[1][0];FL[1]-=E2[1][1];FE=2}Ec()}}function E7(){if(d3.event.keyCode==32&&FE==2){FL[0]+=E2[1][0];FL[1]+=E2[1][1];FE=0;Ec()}}function E9(){var FN=FB(),FO=false;if(E5){FN[0]+=E5[0];FN[1]+=E5[1]}if(!FE){if(d3.event.altKey){if(!FK){FK=[(E2[0][0]+E2[1][0])/2,(E2[0][1]+E2[1][1])/2]}FL[0]=E2[+(FN[0]<FK[0])][0];FL[1]=E2[+(FN[1]<FK[1])][1]}else{FK=null}}if(FF&&E6(FN,Ey,0)){Ev(FH);FO=true}if(FD&&E6(FN,Ex,1)){Eu(FH);FO=true}if(FO){E1(FH);FA({type:"brush",mode:FE?"move":"resize"})}}function E6(FV,FP,FR){var FS=AR(FP),FO=FS[0],FN=FS[1],FT=FL[FR],FW=E2[1][FR]-E2[0][FR],FQ,FU;if(FE){FO-=FT;FN-=FW+FT}FQ=Math.max(FO,Math.min(FN,FV[FR]));if(FE){FU=(FQ+=FT)+FW}else{if(FK){FT=Math.max(FO,Math.min(FN,2*FK[FR]-FQ))}if(FT<FQ){FU=FQ;FQ=FT}else{FU=FT}}if(E2[0][FR]!==FQ||E2[1][FR]!==FU){Et=null;E2[0][FR]=FQ;E2[1][FR]=FU;return true}}function E3(){E9();FH.style("pointer-events","all").selectAll(".resize").style("display",Ew.empty()?"none":null);d3.select("body").style("cursor",null);E8.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);FA({type:"brushend"});Ec()}}Ew.x=function(E3){if(!arguments.length){return Ey}Ey=E3;Ez=AB[!Ey<<1|!Ex];return Ew};Ew.y=function(E3){if(!arguments.length){return Ex}Ex=E3;Ez=AB[!Ey<<1|!Ex];return Ew};Ew.extent=function(E8){var E5,E3,E7,E6,E4;if(!arguments.length){E8=Et||E2;if(Ey){E5=E8[0][0],E3=E8[1][0];if(!Et){E5=E2[0][0],E3=E2[1][0];if(Ey.invert){E5=Ey.invert(E5),E3=Ey.invert(E3)}if(E3<E5){E4=E5,E5=E3,E3=E4}}}if(Ex){E7=E8[0][1],E6=E8[1][1];if(!Et){E7=E2[0][1],E6=E2[1][1];if(Ex.invert){E7=Ex.invert(E7),E6=Ex.invert(E6)}if(E6<E7){E4=E7,E7=E6,E6=E4}}}return Ey&&Ex?[[E5,E7],[E3,E6]]:Ey?[E5,E3]:Ex&&[E7,E6]}Et=[[0,0],[0,0]];if(Ey){E5=E8[0],E3=E8[1];if(Ex){E5=E5[0],E3=E3[0]}Et[0][0]=E5,Et[1][0]=E3;if(Ey.invert){E5=Ey(E5),E3=Ey(E3)}if(E3<E5){E4=E5,E5=E3,E3=E4}E2[0][0]=E5|0,E2[1][0]=E3|0}if(Ex){E7=E8[0],E6=E8[1];if(Ey){E7=E7[1],E6=E6[1]}Et[0][1]=E7,Et[1][1]=E6;if(Ex.invert){E7=Ex(E7),E6=Ex(E6)}if(E6<E7){E4=E7,E7=E6,E6=E4}E2[0][1]=E7|0,E2[1][1]=E6|0}return Ew};Ew.clear=function(){Et=null;E2[0][0]=E2[0][1]=E2[1][0]=E2[1][1]=0;return Ew};Ew.empty=function(){return(Ey&&E2[0][0]===E2[1][0])||(Ex&&E2[0][1]===E2[1][1])};return d3.rebind(Ew,e,"on")};var Cd={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"};var AB=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];d3.behavior={};d3.behavior.drag=function(){var Ev=EL(Eu,"drag","dragstart","dragend"),e=null;function Eu(){this.on("mousedown.drag",Et).on("touchstart.drag",Et)}function Et(){var Ey=this,E2=Ev.of(Ey,arguments),E1=d3.event.target,Ex,Ez=E4(),E0=0;var E3=d3.select(window).on("mousemove.drag",E5).on("touchmove.drag",E5).on("mouseup.drag",Ew,true).on("touchend.drag",Ew,true);if(e){Ex=e.apply(Ey,arguments);Ex=[Ex.x-Ez[0],Ex.y-Ez[1]]}else{Ex=[0,0]}E2({type:"dragstart"});function E4(){var E8=Ey.parentNode,E7=d3.event.changedTouches;return E7?d3.touches(E8,E7)[0]:d3.mouse(E8)}function E5(){if(!Ey.parentNode){return Ew()}var E9=E4(),E8=E9[0]-Ez[0],E7=E9[1]-Ez[1];E0|=E8|E7;Ez=E9;Ec();E2({type:"drag",x:E9[0]+Ex[0],y:E9[1]+Ex[1],dx:E8,dy:E7})}function Ew(){E2({type:"dragend"});if(E0){Ec();if(d3.event.target===E1){E3.on("click.drag",E6,true)}}E3.on("mousemove.drag",null).on("touchmove.drag",null).on("mouseup.drag",null).on("touchend.drag",null)}function E6(){Ec();E3.on("click.drag",null)}}Eu.origin=function(Ew){if(!arguments.length){return e}e=Ew;return Eu};return d3.rebind(Eu,Ev,"on")};d3.behavior.zoom=function(){var Ez=[0,0],FA,FE=1,E6,Eu=DT,E5=EL(e,"zoom"),E9,E7,Ew,Ev,Ey;function e(){this.on("mousedown.zoom",E3).on("mousewheel.zoom",E2).on("mousemove.zoom",FB).on("DOMMouseScroll.zoom",E2).on("dblclick.zoom",E0).on("touchstart.zoom",E8).on("touchmove.zoom",E1).on("touchend.zoom",E8)}e.translate=function(FF){if(!arguments.length){return Ez}Ez=FF.map(Number);return e};e.scale=function(FF){if(!arguments.length){return FE}FE=+FF;return e};e.scaleExtent=function(FF){if(!arguments.length){return Eu}Eu=FF==null?DT:FF.map(Number);return e};e.x=function(FF){if(!arguments.length){return E7}E7=FF;E9=FF.copy();return e};e.y=function(FF){if(!arguments.length){return Ev}Ev=FF;Ew=FF.copy();return e};function Et(FF){return[(FF[0]-Ez[0])/FE,(FF[1]-Ez[1])/FE]}function E4(FF){return[FF[0]*FE+Ez[0],FF[1]*FE+Ez[1]]}function Ex(FF){FE=Math.max(Eu[0],Math.min(Eu[1],FF))}function FC(FG,FF){FF=E4(FF);Ez[0]+=FG[0]-FF[0];Ez[1]+=FG[1]-FF[1]}function FD(FF){if(E7){E7.domain(E9.range().map(function(FG){return(FG-Ez[0])/FE}).map(E9.invert))}if(Ev){Ev.domain(Ew.range().map(function(FG){return(FG-Ez[1])/FE}).map(Ew.invert))}d3.event.preventDefault();FF({type:"zoom",scale:FE,translate:Ez})}function E3(){var FI=this,FL=E5.of(FI,arguments),FK=d3.event.target,FJ=0,FM=d3.select(window).on("mousemove.zoom",FH).on("mouseup.zoom",FG),FF=Et(d3.mouse(FI));window.focus();Ec();function FH(){FJ=1;FC(d3.mouse(FI),FF);FD(FL)}function FG(){if(FJ){Ec()}FM.on("mousemove.zoom",null).on("mouseup.zoom",null);if(FJ&&d3.event.target===FK){FM.on("click.zoom",FN)}}function FN(){Ec();FM.on("click.zoom",null)}}function E2(){if(!FA){FA=Et(d3.mouse(this))}Ex(Math.pow(2,BH()*0.002)*FE);FC(d3.mouse(this),FA);FD(E5.of(this,arguments))}function FB(){FA=null}function E0(){var FG=d3.mouse(this),FF=Et(FG);Ex(d3.event.shiftKey?FE/2:FE*2);FC(FG,FF);FD(E5.of(this,arguments))}function E8(){var FI=d3.touches(this),FG=Date.now();E6=FE;FA={};FI.forEach(function(FJ){FA[FJ.identifier]=Et(FJ)});Ec();if((FI.length===1)&&(FG-Ey<500)){var FH=FI[0],FF=Et(FI[0]);Ex(FE*2);FC(FH,FF);FD(E5.of(this,arguments))}Ey=FG}function E1(){var FH=d3.touches(this),FJ=FH[0],FG=FA[FJ.identifier];if(FI=FH[1]){var FI,FF=FA[FI.identifier];FJ=[(FJ[0]+FI[0])/2,(FJ[1]+FI[1])/2];FG=[(FG[0]+FF[0])/2,(FG[1]+FF[1])/2];Ex(d3.event.scale*E6)}FC(FJ,FG);FD(E5.of(this,arguments))}return d3.rebind(e,E5,"on")};var CB,DT=[0,Infinity];function BH(){if(!CB){CB=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode}var Eu=d3.event,Ev;try{CB.scrollTop=1000;CB.dispatchEvent(Eu);Ev=1000-CB.scrollTop}catch(Et){Ev=Eu.wheelDelta||(-Eu.detail*5)}return Ev}d3.layout={};d3.layout.bundle=function(){return function(e){var Eu=[],Et=-1,Ev=e.length;while(++Et<Ev){Eu.push(CX(e[Et]))}return Eu}};function CX(Ev){var Ex=Ev.source,e=Ev.target,Ew=DO(Ex,e),Eu=[Ex];while(Ex!==Ew){Ex=Ex.parent;Eu.push(Ex)}var Et=Eu.length;while(e!==Ew){Eu.splice(Et,0,e);e=e.parent}return Eu}function C7(Eu){var Et=[],e=Eu.parent;while(e!=null){Et.push(Eu);Eu=e;e=e.parent}Et.push(Eu);return Et}function DO(Ev,Et){if(Ev===Et){return Ev}var Eu=C7(Ev),e=C7(Et),Ew=Eu.pop(),Ex=e.pop(),Ey=null;while(Ew===Ex){Ey=Ew;Ew=Eu.pop();Ex=e.pop()}return Ey}d3.layout.chord=function(){var Ex={},Ey,Ev,E2,Eu,E1=0,e,Et,Ew;function E0(){var E7={},FA=[],FI=d3.range(Eu),FE=[],E8,FG,E6,FB,E9;Ey=[];Ev=[];E8=0,FB=-1;while(++FB<Eu){FG=0,E9=-1;while(++E9<Eu){FG+=E2[FB][E9]}FA.push(FG);FE.push(d3.range(Eu));E8+=FG}if(e){FI.sort(function(FK,FJ){return e(FA[FK],FA[FJ])})}if(Et){FE.forEach(function(FK,FJ){FK.sort(function(FM,FL){return Et(E2[FJ][FM],E2[FJ][FL])})})}E8=(2*Math.PI-E1*Eu)/E8;FG=0,FB=-1;while(++FB<Eu){E6=FG,E9=-1;while(++E9<Eu){var FF=FI[FB],FD=FE[FF][E9],FH=E2[FF][FD],E5=FG,E4=FG+=FH*E8;E7[FF+"-"+FD]={index:FF,subindex:FD,startAngle:E5,endAngle:E4,value:FH}}Ev.push({index:FF,startAngle:E6,endAngle:FG,value:(FG-E6)/E8});FG+=E1}FB=-1;while(++FB<Eu){E9=FB-1;while(++E9<Eu){var E3=E7[FB+"-"+E9],FC=E7[E9+"-"+FB];if(E3.value||FC.value){Ey.push(E3.value<FC.value?{source:FC,target:E3}:{source:E3,target:FC})}}}if(Ew){Ez()}}function Ez(){Ey.sort(function(E4,E3){return Ew((E4.source.value+E4.target.value)/2,(E3.source.value+E3.target.value)/2)})}Ex.matrix=function(E3){if(!arguments.length){return E2}Eu=(E2=E3)&&E2.length;Ey=Ev=null;return Ex};Ex.padding=function(E3){if(!arguments.length){return E1}E1=E3;Ey=Ev=null;return Ex};Ex.sortGroups=function(E3){if(!arguments.length){return e}e=E3;Ey=Ev=null;return Ex};Ex.sortSubgroups=function(E3){if(!arguments.length){return Et}Et=E3;Ey=null;return Ex};Ex.sortChords=function(E3){if(!arguments.length){return Ew}Ew=E3;if(Ey){Ez()}return Ex};Ex.chords=function(){if(!Ey){E0()}return Ey};Ex.groups=function(){if(!Ev){E0()}return Ev};return Ex};d3.layout.force=function(){var Et={},E6=d3.dispatch("start","tick","end"),E2=[1,1],E8,Ew,Ez=0.9,FA=DP,Ev=BE,E5=-30,Ex=0.1,E0=0.8,E9,E4=[],Eu=[],Ey,e,E1;function E7(FB){return function(FI,FD,FH,FC,FG){if(FI.point!==FB){var FK=FI.cx-FB.x,FJ=FI.cy-FB.y,FF=1/Math.sqrt(FK*FK+FJ*FJ);if((FC-FD)*FF<E0){var FE=FI.charge*FF*FF;FB.px-=FK*FE;FB.py-=FJ*FE;return true}if(FI.point&&isFinite(FF)){var FE=FI.pointCharge*FF*FF;FB.px-=FK*FE;FB.py-=FJ*FE}}return !FI.charge}}Et.tick=function(){if((Ew*=0.99)<0.005){E6.end({type:"end",alpha:Ew=0});return true}var FD=E4.length,FE=Eu.length,FB,FH,FC,FL,FK,FF,FG,FJ,FI;for(FH=0;FH<FE;++FH){FC=Eu[FH];FL=FC.source;FK=FC.target;FJ=FK.x-FL.x;FI=FK.y-FL.y;if(FF=(FJ*FJ+FI*FI)){FF=Ew*e[FH]*((FF=Math.sqrt(FF))-Ey[FH])/FF;FJ*=FF;FI*=FF;FK.x-=FJ*(FG=FL.weight/(FK.weight+FL.weight));FK.y-=FI*FG;FL.x+=FJ*(FG=1-FG);FL.y+=FI*FG}}if(FG=Ew*Ex){FJ=E2[0]/2;FI=E2[1]/2;FH=-1;if(FG){while(++FH<FD){FC=E4[FH];FC.x+=(FJ-FC.x)*FG;FC.y+=(FI-FC.y)*FG}}}if(E5){Dt(FB=d3.geom.quadtree(E4),Ew,E1);FH=-1;while(++FH<FD){if(!(FC=E4[FH]).fixed){FB.visit(E7(FC))}}}FH=-1;while(++FH<FD){FC=E4[FH];if(FC.fixed){FC.x=FC.px;FC.y=FC.py}else{FC.x-=(FC.px-(FC.px=FC.x))*Ez;FC.y-=(FC.py-(FC.py=FC.y))*Ez}}E6.tick({type:"tick",alpha:Ew})};Et.nodes=function(FB){if(!arguments.length){return E4}E4=FB;return Et};Et.links=function(FB){if(!arguments.length){return Eu}Eu=FB;return Et};Et.size=function(FB){if(!arguments.length){return E2}E2=FB;return Et};Et.linkDistance=function(FB){if(!arguments.length){return FA}FA=d3.functor(FB);return Et};Et.distance=Et.linkDistance;Et.linkStrength=function(FB){if(!arguments.length){return Ev}Ev=d3.functor(FB);return Et};Et.friction=function(FB){if(!arguments.length){return Ez}Ez=FB;return Et};Et.charge=function(FB){if(!arguments.length){return E5}E5=typeof FB==="function"?FB:+FB;return Et};Et.gravity=function(FB){if(!arguments.length){return Ex}Ex=FB;return Et};Et.theta=function(FB){if(!arguments.length){return E0}E0=FB;return Et};Et.alpha=function(FB){if(!arguments.length){return Ew}if(Ew){if(FB>0){Ew=FB}else{Ew=0}}else{if(FB>0){E6.start({type:"start",alpha:Ew=FB});d3.timer(Et.tick)}}return Et};Et.start=function(){var FF,FE,FC=E4.length,FD=Eu.length,FI=E2[0],FH=E2[1],FK,FB;for(FF=0;FF<FC;++FF){(FB=E4[FF]).index=FF;FB.weight=0}Ey=[];e=[];for(FF=0;FF<FD;++FF){FB=Eu[FF];if(typeof FB.source=="number"){FB.source=E4[FB.source]}if(typeof FB.target=="number"){FB.target=E4[FB.target]}Ey[FF]=FA.call(this,FB,FF);e[FF]=Ev.call(this,FB,FF);++FB.source.weight;++FB.target.weight}for(FF=0;FF<FC;++FF){FB=E4[FF];if(isNaN(FB.x)){FB.x=FG("x",FI)}if(isNaN(FB.y)){FB.y=FG("y",FH)}if(isNaN(FB.px)){FB.px=FB.x}if(isNaN(FB.py)){FB.py=FB.y}}E1=[];if(typeof E5==="function"){for(FF=0;FF<FC;++FF){E1[FF]=+E5.call(this,E4[FF],FF)}}else{for(FF=0;FF<FC;++FF){E1[FF]=E5}}function FG(FQ,FP){var FO=FJ(FF),FN=-1,FM=FO.length,FL;while(++FN<FM){if(!isNaN(FL=FO[FN][FQ])){return FL}}return Math.random()*FP}function FJ(){if(!FK){FK=[];for(FE=0;FE<FC;++FE){FK[FE]=[]}for(FE=0;FE<FD;++FE){var FL=Eu[FE];FK[FL.source.index].push(FL.target);FK[FL.target.index].push(FL.source)}}return FK[FF]}return Et.resume()};Et.resume=function(){return Et.alpha(0.1)};Et.stop=function(){return Et.alpha(0)};Et.drag=function(){if(!E8){E8=d3.behavior.drag().origin(Object).on("dragstart",E3).on("drag",DC).on("dragend",Ci)}this.on("mouseover.force",J).on("mouseout.force",Ds).call(E8)};function E3(FB){J(DI=FB);C4=Et}return d3.rebind(Et,E6,"on")};var C4,DI;function J(e){e.fixed|=2}function Ds(e){if(e!==DI){e.fixed&=1}}function Ci(){DI.fixed&=1;C4=DI=null}function DC(){DI.px=d3.event.x;DI.py=d3.event.y;C4.resume()}function Dt(E1,Ew,E0){var Ex=0,Eu=0;E1.charge=0;if(!E1.leaf){var e=E1.nodes,Et=e.length,Ey=-1,Ez;while(++Ey<Et){Ez=e[Ey];if(Ez==null){continue}Dt(Ez,Ew,E0);E1.charge+=Ez.charge;Ex+=Ez.charge*Ez.cx;Eu+=Ez.charge*Ez.cy}}if(E1.point){if(!E1.leaf){E1.point.x+=Math.random()-0.5;E1.point.y+=Math.random()-0.5}var Ev=Ew*E0[E1.point.index];E1.charge+=E1.pointCharge=Ev;Ex+=Ev*E1.point.x;Eu+=Ev*E1.point.y}E1.cx=Ex/E1.charge;E1.cy=Eu/E1.charge}function DP(e){return 20}function BE(e){return 1}d3.layout.partition=function(){var Eu=d3.layout.hierarchy(),Ev=[1,1];function e(Ez,E3,E5,E4){var Ex=Ez.children;Ez.x=E3;Ez.y=Ez.depth*E4;Ez.dx=E5;Ez.dy=E4;if(Ex&&(Ey=Ex.length)){var E0=-1,Ey,E2,E1;E5=Ez.value?E5/Ez.value:0;while(++E0<Ey){e(E2=Ex[E0],E3,E1=E2.value*E5,E4);E3+=E1}}}function Ew(Ez){var Ey=Ez.children,E0=0;if(Ey&&(E1=Ey.length)){var Ex=-1,E1;while(++Ex<E1){E0=Math.max(E0,Ew(Ey[Ex]))}}return 1+E0}function Et(Ez,Ey){var Ex=Eu.call(this,Ez,Ey);e(Ex[0],0,Ev[0],Ev[1]/Ew(Ex[0]));return Ex}Et.size=function(Ex){if(!arguments.length){return Ev}Ev=Ex;return Et};return Do(Et,Eu)};d3.layout.pie=function(){var Ew=Number,Ev=n,Eu=0,Et=2*Math.PI;function e(E3,E1){var Ez=E3.map(function(E5,E4){return +Ew.call(e,E5,E4)});var Ex=+(typeof Eu==="function"?Eu.apply(this,arguments):Eu);var Ey=((typeof Et==="function"?Et.apply(this,arguments):Et)-Eu)/d3.sum(Ez);var E0=d3.range(E3.length);if(Ev!=null){E0.sort(Ev===n?function(E5,E4){return Ez[E4]-Ez[E5]}:function(E5,E4){return Ev(E3[E5],E3[E4])})}var E2=[];E0.forEach(function(E4){E2[E4]={data:E3[E4],value:d=Ez[E4],startAngle:Ex,endAngle:Ex+=d*Ey}});return E2}e.value=function(Ex){if(!arguments.length){return Ew}Ew=Ex;return e};e.sort=function(Ex){if(!arguments.length){return Ev}Ev=Ex;return e};e.startAngle=function(Ex){if(!arguments.length){return Eu}Eu=Ex;return e};e.endAngle=function(Ex){if(!arguments.length){return Et}Et=Ex;return e};return e};var n={};d3.layout.stack=function(){var Ev=Object,Eu=At,Ex=DK,Ew=DL,Et=x,Ey=w;function e(E6,E8){var E7=E6.map(function(FB,FA){return Ev.call(e,FB,FA)});var E9=E7.map(function(FB,FA){return FB.map(function(FC,FD){return[Et.call(e,FC,FD),Ey.call(e,FC,FD)]})});var E3=Eu.call(e,E9,E8);E7=d3.permute(E7,E3);E9=d3.permute(E9,E3);var E2=Ex.call(e,E9,E8);var E0=E7.length,E1=E7[0].length,E5,E4,Ez;for(E4=0;E4<E1;++E4){Ew.call(e,E7[0][E4],Ez=E2[E4],E9[0][E4][1]);for(E5=1;E5<E0;++E5){Ew.call(e,E7[E5][E4],Ez+=E9[E5-1][E4][1],E9[E5][E4][1])}}return E6}e.values=function(Ez){if(!arguments.length){return Ev}Ev=Ez;return e};e.order=function(Ez){if(!arguments.length){return Eu}Eu=typeof Ez==="function"?Ez:AV.get(Ez)||At;return e};e.offset=function(Ez){if(!arguments.length){return Ex}Ex=typeof Ez==="function"?Ez:t.get(Ez)||DK;return e};e.x=function(Ez){if(!arguments.length){return Et}Et=Ez;return e};e.y=function(Ez){if(!arguments.length){return Ey}Ey=Ez;return e};e.out=function(Ez){if(!arguments.length){return Ew}Ew=Ez;return e};return e};function x(e){return e.x}function w(e){return e.y}function DL(Et,e,Eu){Et.y0=e;Et.y=Eu}var AV=d3.map({"inside-out":function(Ew){var Eu=Ew.length,Ex,Ev,E1=Ew.map(Az),Ey=Ew.map(Bp),Ez=d3.range(Eu).sort(function(E4,E3){return E1[E4]-E1[E3]}),E0=0,e=0,E2=[],Et=[];for(Ex=0;Ex<Eu;++Ex){Ev=Ez[Ex];if(E0<e){E0+=Ey[Ev];E2.push(Ev)}else{e+=Ey[Ev];Et.push(Ev)}}return Et.reverse().concat(E2)},reverse:function(e){return d3.range(e.length).reverse()},"default":At});var t=d3.map({silhouette:function(Ew){var Et=Ew.length,Eu=Ew[0].length,Ey=[],Ez=0,Ex,Ev,e,E0=[];for(Ev=0;Ev<Eu;++Ev){for(Ex=0,e=0;Ex<Et;Ex++){e+=Ew[Ex][Ev][1]}if(e>Ez){Ez=e}Ey.push(e)}for(Ev=0;Ev<Eu;++Ev){E0[Ev]=(Ez-Ey[Ev])/2}return E0},wiggle:function(Ey){var Et=Ey.length,E2=Ey[0],Eu=E2.length,E0=0,Ez,Ex,Ew,E5,E4,E1,E6,e,Ev,E3=[];E3[0]=e=Ev=0;for(Ex=1;Ex<Eu;++Ex){for(Ez=0,E5=0;Ez<Et;++Ez){E5+=Ey[Ez][Ex][1]}for(Ez=0,E4=0,E6=E2[Ex][0]-E2[Ex-1][0];Ez<Et;++Ez){for(Ew=0,E1=(Ey[Ez][Ex][1]-Ey[Ez][Ex-1][1])/(2*E6);Ew<Ez;++Ew){E1+=(Ey[Ew][Ex][1]-Ey[Ew][Ex-1][1])/E6}E4+=E1*Ey[Ez][Ex][1]}E3[Ex]=e-=E5?E4/E5*E6:0;if(e<Ev){Ev=e}}for(Ex=0;Ex<Eu;++Ex){E3[Ex]-=Ev}return E3},expand:function(Ex){var Ez=Ex.length,e=Ex[0].length,Et=1/Ez,Ev,Eu,Ey,Ew=[];for(Eu=0;Eu<e;++Eu){for(Ev=0,Ey=0;Ev<Ez;Ev++){Ey+=Ex[Ev][Eu][1]}if(Ey){for(Ev=0;Ev<Ez;Ev++){Ex[Ev][Eu][1]/=Ey}}else{for(Ev=0;Ev<Ez;Ev++){Ex[Ev][Eu][1]=Et}}}for(Eu=0;Eu<e;++Eu){Ew[Eu]=0}return Ew},zero:DK});function At(e){return d3.range(e.length)}function DK(Ev){var Et=-1,e=Ev[0].length,Eu=[];while(++Et<e){Eu[Et]=0}return Eu}function Az(Ex){var Ev=1,Eu=0,Et=Ex[0][1],e,Ew=Ex.length;for(;Ev<Ew;++Ev){if((e=Ex[Ev][1])>Et){Eu=Ev;Et=e}}return Eu}function Bp(e){return e.reduce(DJ,0)}function DJ(e,Et){return e+Et[1]}d3.layout.histogram=function(){var Ew=true,Et=Number,e=Ad,Eu=EV;function Ev(E0,E1){var E6=[],E4=E0.map(Et,this),E2=e.call(this,E4,E1),E5=Eu.call(this,E2,E4,E1),E7,E1=-1,Ex=E4.length,Ey=E5.length-1,Ez=Ew?1:1/Ex,E3;while(++E1<Ey){E7=E6[E1]=[];E7.dx=E5[E1+1]-(E7.x=E5[E1]);E7.y=0}E1=-1;while(++E1<Ex){E3=E4[E1];if((E3>=E2[0])&&(E3<=E2[1])){E7=E6[d3.bisect(E5,E3,1,Ey)-1];E7.y+=Ez;E7.push(E0[E1])}}return E6}Ev.value=function(Ex){if(!arguments.length){return Et}Et=Ex;return Ev};Ev.range=function(Ex){if(!arguments.length){return e}e=d3.functor(Ex);return Ev};Ev.bins=function(Ex){if(!arguments.length){return Eu}Eu=typeof Ex==="number"?function(Ey){return F(Ey,Ex)}:d3.functor(Ex);return Ev};Ev.frequency=function(Ex){if(!arguments.length){return Ew}Ew=!!Ex;return Ev};return Ev};function EV(Et,e){return F(Et,Math.ceil(Math.log(e.length)/Math.LN2+1))}function F(Ev,Ex){var Eu=-1,Et=+Ev[0],e=(Ev[1]-Et)/Ex,Ew=[];while(++Eu<=Ex){Ew[Eu]=e*Eu+Et}return Ew}function Ad(e){return[d3.min(e),d3.max(e)]}d3.layout.hierarchy=function(){var Eu=B3,Et=AX,Ew=Ee;function Ev(E3,E2,Ey){var E5=Et.call(e,E3,E2),E0=H?E3:{data:E3};E0.depth=E2;Ey.push(E0);if(E5&&(Ez=E5.length)){var E4=-1,Ez,E6=E0.children=[],E7=0,E1=E2+1;while(++E4<Ez){d=Ev(E5[E4],E1,Ey);d.parent=E0;E6.push(d);E7+=d.value}if(Eu){E6.sort(Eu)}if(Ew){E0.value=E7}}else{if(Ew){E0.value=+Ew.call(e,E3,E2)||0}}return E0}function Ex(E2,E3){var E1=E2.children,Ey=0;if(E1&&(E4=E1.length)){var E0=-1,E4,Ez=E3+1;while(++E0<E4){Ey+=Ex(E1[E0],Ez)}}else{if(Ew){Ey=+Ew.call(e,H?E2:E2.data,E3)||0}}if(Ew){E2.value=Ey}return Ey}function e(Ez){var Ey=[];Ev(Ez,0,Ey);return Ey}e.sort=function(Ey){if(!arguments.length){return Eu}Eu=Ey;return e};e.children=function(Ey){if(!arguments.length){return Et}Et=Ey;return e};e.value=function(Ey){if(!arguments.length){return Ew}Ew=Ey;return e};e.revalue=function(Ey){Ex(Ey,0);return Ey};return e};function Do(Et,e){d3.rebind(Et,e,"sort","children","value");Et.links=Dp;Et.nodes=function(Eu){H=true;return(Et.nodes=Et)(Eu)};return Et}function AX(e){return e.children}function Ee(e){return e.value}function B3(Et,e){return e.value-Et.value}function Dp(e){return d3.merge(e.map(function(Et){return(Et.children||[]).map(function(Eu){return{source:Et,target:Eu}})}))}var H=false;d3.layout.pack=function(){var e=d3.layout.hierarchy().sort(CS),Eu=[1,1];function Et(E1,Ez){var Ey=e.call(this,E1,Ez),Ew=Ey[0];Ew.x=0;Ew.y=0;CD(Ew);var Ev=Eu[0],E0=Eu[1],Ex=1/Math.max(2*Ew.r/Ev,2*Ew.r/E0);C6(Ew,Ev/2,E0/2,Ex);return Ey}Et.size=function(Ev){if(!arguments.length){return Eu}Eu=Ev;return Et};return Do(Et,e)};function CS(Et,e){return Et.value-e.value}function Au(Et,e){var Eu=Et._pack_next;Et._pack_next=e;e._pack_prev=Et;e._pack_next=Eu;Eu._pack_prev=e}function AZ(Et,e){Et._pack_next=e;e._pack_prev=Et}function CL(Eu,e){var Ev=e.x-Eu.x,Et=e.y-Eu.y,Ew=Eu.r+e.r;return Ew*Ew-Ev*Ev-Et*Et>0.001}function k(E2){var E7=Infinity,FB=-Infinity,e=Infinity,Ew=-Infinity,E1=E2.length,FA,E9,E8,E5,E4;function Eu(FC){E7=Math.min(FC.x-FC.r,E7);FB=Math.max(FC.x+FC.r,FB);e=Math.min(FC.y-FC.r,e);Ew=Math.max(FC.y+FC.r,Ew)}E2.forEach(AM);FA=E2[0];FA.x=-FA.r;FA.y=0;Eu(FA);if(E1>1){E9=E2[1];E9.x=E9.r;E9.y=0;Eu(E9);if(E1>2){E8=E2[2];AY(FA,E9,E8);Eu(E8);Au(FA,E8);FA._pack_prev=E8;Au(E8,E9);E9=FA._pack_next;for(var E6=3;E6<E1;E6++){AY(FA,E9,E8=E2[E6]);var Et=0,Ex=1,Ev=1;for(E5=E9._pack_next;E5!==E9;E5=E5._pack_next,Ex++){if(CL(E5,E8)){Et=1;break}}if(Et==1){for(E4=FA._pack_prev;E4!==E5._pack_prev;E4=E4._pack_prev,Ev++){if(CL(E4,E8)){break}}}if(Et){if(Ex<Ev||(Ex==Ev&&E9.r<FA.r)){AZ(FA,E9=E5)}else{AZ(FA=E4,E9)}E6--}else{Au(FA,E8);E9=E8;Eu(E8)}}}}var Ez=(E7+FB)/2,Ey=(e+Ew)/2,E0=0;for(var E6=0;E6<E1;E6++){var E3=E2[E6];E3.x-=Ez;E3.y-=Ey;E0=Math.max(E0,E3.r+Math.sqrt(E3.x*E3.x+E3.y*E3.y))}E2.forEach(CY);return E0}function AM(e){e._pack_next=e._pack_prev=e}function CY(e){delete e._pack_next;delete e._pack_prev}function CD(Et){var e=Et.children;if(e&&e.length){e.forEach(CD);Et.r=k(e)}else{Et.r=Math.sqrt(Et.value)}}function C6(Ew,e,Ey,Et){var Ev=Ew.children;Ew.x=(e+=Et*Ew.x);Ew.y=(Ey+=Et*Ew.y);Ew.r*=Et;if(Ev){var Eu=-1,Ex=Ev.length;while(++Eu<Ex){C6(Ev[Eu],e,Ey,Et)}}}function AY(Ex,Ev,Et){var E0=Ex.r+Et.r,E3=Ev.x-Ex.x,E1=Ev.y-Ex.y;if(E0&&(E3||E1)){var E2=Ev.r+Et.r,Ez=Math.sqrt(E3*E3+E1*E1),Ey=Math.max(-1,Math.min(1,(E0*E0+Ez*Ez-E2*E2)/(2*E0*Ez))),e=Math.acos(Ey),Ew=Ey*(E0/=Ez),Eu=Math.sin(e)*E0;Et.x=Ex.x+Ew*E3+Eu*E1;Et.y=Ex.y+Ew*E1-Eu*E3}else{Et.x=Ex.x+E0;Et.y=Ex.y}}d3.layout.cluster=function(){var Et=d3.layout.hierarchy().sort(null).value(null),Ev=Bs,Eu=[1,1];function e(E3,E0){var Ew=Et.call(this,E3,E0),E4=Ew[0],E5,E6=0,E2,E1;EZ(E4,function(E9){var E8=E9.children;if(E8&&E8.length){E9.x=Aj(E8);E9.y=Ai(E8)}else{E9.x=E5?E6+=Ev(E9,E5):0;E9.y=0;E5=E9}});var Ez=CT(E4),E7=Bx(E4),Ey=Ez.x-Ev(Ez,E7)/2,Ex=E7.x+Ev(E7,Ez)/2;EZ(E4,function(E8){E8.x=(E8.x-Ey)/(Ex-Ey)*Eu[0];E8.y=(1-(E4.y?E8.y/E4.y:1))*Eu[1]});return Ew}e.separation=function(Ew){if(!arguments.length){return Ev}Ev=Ew;return e};e.size=function(Ew){if(!arguments.length){return Eu}Eu=Ew;return e};return Do(e,Et)};function Ai(e){return 1+d3.max(e,function(Et){return Et.y})}function Aj(e){return e.reduce(function(Et,Eu){return Et+Eu.x},0)/e.length}function CT(Et){var e=Et.children;return e&&e.length?CT(e[0]):Et}function Bx(Et){var e=Et.children,Eu;return e&&(Eu=e.length)?Bx(e[Eu-1]):Et}d3.layout.tree=function(){var Et=d3.layout.hierarchy().sort(null).value(null),Ev=Bs,Eu=[1,1];function e(E3,E1){var Ex=Et.call(this,E3,E1),E5=Ex[0];function E2(FD,E9){var FB=FD.children,FG=FD._tree;if(FB&&(FC=FB.length)){var FC,FI=FB[0],FH,FF=FI,FA,FE=-1;while(++FE<FC){FA=FB[FE];E2(FA,FH);FF=Ew(FA,FH,FF);FH=FA}Bu(FD);var FJ=0.5*(FI._tree.prelim+FA._tree.prelim);if(E9){FG.prelim=E9._tree.prelim+Ev(FD,E9);FG.mod=FG.prelim-FJ}else{FG.prelim=FJ}}else{if(E9){FG.prelim=E9._tree.prelim+Ev(FD,E9)}}}function E4(FC,E9){FC.x=FC._tree.prelim+E9;var FB=FC.children;if(FB&&(FD=FB.length)){var FA=-1,FD;E9+=FC._tree.mod;while(++FA<FD){E4(FB[FA],E9)}}}function Ew(FD,E9,FG){if(E9){var FC=FD,FB=FD,FF=E9,FE=FD.parent.children[0],FI=FC._tree.mod,FH=FB._tree.mod,FK=FF._tree.mod,FJ=FE._tree.mod,FA;while(FF=AE(FF),FC=Ek(FC),FF&&FC){FE=Ek(FE);FB=AE(FB);FB._tree.ancestor=FD;FA=FF._tree.prelim+FK-FC._tree.prelim-FI+Ev(FF,FC);if(FA>0){Em(DV(FF,FD,FG),FD,FA);FI+=FA;FH+=FA}FK+=FF._tree.mod;FI+=FC._tree.mod;FJ+=FE._tree.mod;FH+=FB._tree.mod}if(FF&&!AE(FB)){FB._tree.thread=FF;FB._tree.mod+=FK-FH}if(FC&&!Ek(FE)){FE._tree.thread=FC;FE._tree.mod+=FI-FJ;FG=FD}}return FG}EZ(E5,function(FA,E9){FA._tree={ancestor:FA,prelim:0,mod:0,change:0,shift:0,number:E9?E9._tree.number+1:0}});E2(E5);E4(E5,-E5._tree.prelim);var E0=CA(E5,An),E8=CA(E5,BZ),E7=CA(E5,W),Ez=E0.x-Ev(E0,E8)/2,Ey=E8.x+Ev(E8,E0)/2,E6=E7.depth||1;EZ(E5,function(E9){E9.x=(E9.x-Ez)/(Ey-Ez)*Eu[0];E9.y=E9.depth/E6*Eu[1];delete E9._tree});return Ex}e.separation=function(Ew){if(!arguments.length){return Ev}Ev=Ew;return e};e.size=function(Ew){if(!arguments.length){return Eu}Eu=Ew;return e};return Do(e,Et)};function Bs(Et,e){return Et.parent==e.parent?1:2}function Ek(Et){var e=Et.children;return e&&e.length?e[0]:Et._tree.thread}function AE(Et){var e=Et.children,Eu;return e&&(Eu=e.length)?e[Eu-1]:Et._tree.thread}function CA(Eu,Ev){var Et=Eu.children;if(Et&&(Ew=Et.length)){var Ex,Ew,e=-1;while(++e<Ew){if(Ev(Ex=CA(Et[e],Ev),Eu)>0){Eu=Ex}}}return Eu}function BZ(Et,e){return Et.x-e.x}function An(Et,e){return e.x-Et.x}function W(Et,e){return Et.depth-e.depth}function EZ(Et,Eu){function e(Ez,Ey){var Ex=Ez.children;if(Ex&&(E0=Ex.length)){var E1,Ew=null,Ev=-1,E0;while(++Ev<E0){E1=Ex[Ev];e(E1,Ew);Ew=E1}}Eu(Ez,Ey)}e(Et,null)}function Bu(Ev){var e=0,Ex=0,Eu=Ev.children,Et=Eu.length,Ew;while(--Et>=0){Ew=Eu[Et]._tree;Ew.prelim+=e;Ew.mod+=e;e+=Ew.shift+(Ex+=Ew.change)}}function Em(Et,Eu,e){Et=Et._tree;Eu=Eu._tree;var Ev=e/(Eu.number-Et.number);Et.change+=Ev;Eu.change-=Ev;Eu.shift+=e;Eu.prelim+=e;Eu.mod+=e}function DV(e,Eu,Et){return e._tree.ancestor.parent==Eu.parent?e._tree.ancestor:Et}d3.layout.treemap=function(){var Ez=d3.layout.hierarchy(),E3=Math.round,E5=[1,1],E0=null,e=Cs,E1=false,Ex,Ey=0.5*(1+Math.sqrt(5));function Et(E8,E6){var E7=-1,FB=E8.length,FA,E9;while(++E7<FB){E9=(FA=E8[E7]).value*(E6<0?0:E6);FA.area=isNaN(E9)||E9<=0?0:E9}}function Ev(FA){var E7=FA.children;if(E7&&E7.length){var FD=e(FA),FF=[],FC=E7.slice(),E6,FB=Infinity,E9,FE=Math.min(FD.dx,FD.dy),E8;Et(FC,FD.dx*FD.dy/FA.value);FF.area=0;while((E8=FC.length)>0){FF.push(E6=FC[E8-1]);FF.area+=E6.area;if((E9=Eu(FF,FE))<=FB){FC.pop();FB=E9}else{FF.area-=FF.pop().area;Ew(FF,FE,FD,false);FE=Math.min(FD.dx,FD.dy);FF.length=FF.area=0;FB=Infinity}}if(FF.length){Ew(FF,FE,FD,true);FF.length=FF.area=0}E7.forEach(Ev)}}function E4(E9){var E6=E9.children;if(E6&&E6.length){var E8=e(E9),E7=E6.slice(),FB,FA=[];Et(E7,E8.dx*E8.dy/E9.value);FA.area=0;while(FB=E7.pop()){FA.push(FB);FA.area+=FB.area;if(FB.z!=null){Ew(FA,FB.z?E8.dx:E8.dy,E8,!E7.length);FA.length=FA.area=0}}E6.forEach(E4)}}function Eu(FB,E7){var E9=FB.area,FA,FD=0,E6=Infinity,E8=-1,FC=FB.length;while(++E8<FC){if(!(FA=FB[E8].area)){continue}if(FA<E6){E6=FA}if(FA>FD){FD=FA}}E9*=E9;E7*=E7;return E9?Math.max((E7*FD*Ey)/E9,E9/(E7*E6*Ey)):Infinity}function Ew(FF,FE,FA,FD){var E8=-1,E7=FF.length,FB=FA.x,E9=FA.y,FC=FE?E3(FF.area/FE):0,E6;if(FE==FA.dx){if(FD||FC>FA.dy){FC=FA.dy}while(++E8<E7){E6=FF[E8];E6.x=FB;E6.y=E9;E6.dy=FC;FB+=E6.dx=Math.min(FA.x+FA.dx-FB,FC?E3(E6.area/FC):0)}E6.z=true;E6.dx+=FA.x+FA.dx-FB;FA.y+=FC;FA.dy-=FC}else{if(FD||FC>FA.dx){FC=FA.dx}while(++E8<E7){E6=FF[E8];E6.x=FB;E6.y=E9;E6.dx=FC;E9+=E6.dy=Math.min(FA.y+FA.dy-E9,FC?E3(E6.area/FC):0)}E6.z=false;E6.dy+=FA.y+FA.dy-E9;FA.x+=FC;FA.dx-=FC}}function E2(E8){var E7=Ex||Ez(E8),E6=E7[0];E6.x=0;E6.y=0;E6.dx=E5[0];E6.dy=E5[1];if(Ex){Ez.revalue(E6)}Et([E6],E6.dx*E6.dy/E6.value);(Ex?E4:Ev)(E6);if(E1){Ex=E7}return E7}E2.size=function(E6){if(!arguments.length){return E5}E5=E6;return E2};E2.padding=function(E6){if(!arguments.length){return E0}function E9(FA){var FB=E6.call(E2,FA,FA.depth);return FB==null?Cs(FA):AS(FA,typeof FB==="number"?[FB,FB,FB,FB]:FB)}function E8(FA){return AS(FA,E6)}var E7;e=(E0=E6)==null?Cs:(E7=typeof E6)==="function"?E9:E7==="number"?(E6=[E6,E6,E6,E6],E8):E8;return E2};E2.round=function(E6){if(!arguments.length){return E3!=Number}E3=E6?Math.round:Number;return E2};E2.sticky=function(E6){if(!arguments.length){return E1}E1=E6;Ex=null;return E2};E2.ratio=function(E6){if(!arguments.length){return Ey}Ey=E6;return E2};return Do(E2,Ez)};function Cs(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function AS(Ev,Ew){var e=Ev.x+Ew[3],Ex=Ev.y+Ew[0],Eu=Ev.dx-Ew[1]-Ew[3],Et=Ev.dy-Ew[0]-Ew[2];if(Eu<0){e+=Eu/2;Eu=0}if(Et<0){Ex+=Et/2;Et=0}return{x:e,y:Ex,dx:Eu,dy:Et}}d3.csv=function(e,Et){d3.text(e,"text/csv",function(Eu){Et(Eu&&d3.csv.parse(Eu))})};d3.csv.parse=function(e){var Et;return d3.csv.parseRows(e,function(Ey,Ew){if(Ew){var Ex={},Ev=-1,Eu=Et.length;while(++Ev<Eu){Ex[Et[Ev]]=Ey[Ev]}return Ex}else{Et=Ey;return null}})};d3.csv.parseRows=function(Ez,Ew){var Et={},Ev={},E2=[],E0=/\r\n|[,\r\n]/g,e=0,E1,Ex;E0.lastIndex=0;function Eu(){if(E0.lastIndex>=Ez.length){return Ev}if(Ex){Ex=false;return Et}var E4=E0.lastIndex;if(Ez.charCodeAt(E4)===34){var E5=E4;while(E5++<Ez.length){if(Ez.charCodeAt(E5)===34){if(Ez.charCodeAt(E5+1)!==34){break}E5++}}E0.lastIndex=E5+2;var E6=Ez.charCodeAt(E5+1);if(E6===13){Ex=true;if(Ez.charCodeAt(E5+2)===10){E0.lastIndex++}}else{if(E6===10){Ex=true}}return Ez.substring(E4+1,E5).replace(/""/g,'"')}var E3=E0.exec(Ez);if(E3){Ex=E3[0].charCodeAt(0)!==44;return Ez.substring(E4,E3.index)}E0.lastIndex=Ez.length;return Ez.substring(E4)}while((E1=Eu())!==Ev){var Ey=[];while((E1!==Et)&&(E1!==Ev)){Ey.push(E1);E1=Eu()}if(Ew&&!(Ey=Ew(Ey,e++))){continue}E2.push(Ey)}return E2};d3.csv.format=function(e){return e.map(CI).join("\n")};function CI(e){return e.map(AC).join(",")}function AC(e){return/[",\n]/.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}d3.geo={};var CZ=Math.PI/180;d3.geo.azimuthal=function(){var Ex="orthographic",E0,Ev=200,Eu=[480,250],e,Ez,Ew,Ey;function Et(FC){var E2=FC[0]*CZ-e,FB=FC[1]*CZ,E6=Math.cos(E2),E1=Math.sin(E2),E4=Math.cos(FB),FA=Math.sin(FB),E3=Ex!=="orthographic"?Ey*FA+Ew*E4*E6:null,E7,E5=Ex==="stereographic"?1/(1+E3):Ex==="gnomonic"?1/E3:Ex==="equidistant"?(E7=Math.acos(E3),E7?E7/Math.sin(E7):0):Ex==="equalarea"?Math.sqrt(2/(1+E3)):1,E9=E5*E4*E1,E8=E5*(Ey*E4*E6-Ew*FA);return[Ev*E9+Eu[0],Ev*E8+Eu[1]]}Et.invert=function(E4){var E1=(E4[0]-Eu[0])/Ev,E7=(E4[1]-Eu[1])/Ev,E2=Math.sqrt(E1*E1+E7*E7),E6=Ex==="stereographic"?2*Math.atan(E2):Ex==="gnomonic"?Math.atan(E2):Ex==="equidistant"?E2:Ex==="equalarea"?2*Math.asin(0.5*E2):Math.asin(E2),E3=Math.sin(E6),E5=Math.cos(E6);return[(e+Math.atan2(E1*E3,E2*Ew*E5+E7*Ey*E3))/CZ,Math.asin(E5*Ey-(E2?(E7*E3*Ew)/E2:0))/CZ]};Et.mode=function(E1){if(!arguments.length){return Ex}Ex=E1+"";return Et};Et.origin=function(E1){if(!arguments.length){return E0}E0=E1;e=E0[0]*CZ;Ez=E0[1]*CZ;Ew=Math.cos(Ez);Ey=Math.sin(Ez);return Et};Et.scale=function(E1){if(!arguments.length){return Ev}Ev=+E1;return Et};Et.translate=function(E1){if(!arguments.length){return Eu}Eu=[+E1[0],+E1[1]];return Et};return Et.origin([0,0])};d3.geo.albers=function(){var E0=[-98,38],Ey=[29.5,45.5],Ex=1000,Ew=[480,250],Ez,Ev,Et,E1;function Eu(E4){var E2=Ev*(CZ*E4[0]-Ez),E3=Math.sqrt(Et-2*Ev*Math.sin(CZ*E4[1]))/Ev;return[Ex*E3*Math.sin(E2)+Ew[0],Ex*(E3*Math.cos(E2)-E1)+Ew[1]]}Eu.invert=function(E5){var E2=(E5[0]-Ew[0])/Ex,E7=(E5[1]-Ew[1])/Ex,E6=E1+E7,E3=Math.atan2(E2,E6),E4=Math.sqrt(E2*E2+E6*E6);return[(Ez+E3/Ev)/CZ,Math.asin((Et-E4*E4*Ev*Ev)/(2*Ev))/CZ]};function e(){var E3=CZ*Ey[0],E2=CZ*Ey[1],E6=CZ*E0[1],E4=Math.sin(E3),E5=Math.cos(E3);Ez=CZ*E0[0];Ev=0.5*(E4+Math.sin(E2));Et=E5*E5+2*Ev*E4;E1=Math.sqrt(Et-2*Ev*Math.sin(E6))/Ev;return Eu}Eu.origin=function(E2){if(!arguments.length){return E0}E0=[+E2[0],+E2[1]];return e()};Eu.parallels=function(E2){if(!arguments.length){return Ey}Ey=[+E2[0],+E2[1]];return e()};Eu.scale=function(E2){if(!arguments.length){return Ex}Ex=+E2;return Eu};Eu.translate=function(E2){if(!arguments.length){return Ew}Ew=[+E2[0],+E2[1]];return Eu};return e()};d3.geo.albersUsa=function(){var e=d3.geo.albers();var Ew=d3.geo.albers().origin([-160,60]).parallels([55,65]);var Ev=d3.geo.albers().origin([-160,20]).parallels([8,18]);var Eu=d3.geo.albers().origin([-60,10]).parallels([8,18]);function Et(Ez){var Ey=Ez[0],Ex=Ez[1];return(Ex>50?Ew:Ey<-140?Ev:Ex<21?Eu:e)(Ez)}Et.scale=function(Ex){if(!arguments.length){return e.scale()}e.scale(Ex);Ew.scale(Ex*0.6);Ev.scale(Ex);Eu.scale(Ex*1.5);return Et.translate(e.translate())};Et.translate=function(Ey){if(!arguments.length){return e.translate()}var Ex=e.scale()/1000,E0=Ey[0],Ez=Ey[1];e.translate(Ey);Ew.translate([E0-400*Ex,Ez+170*Ex]);Ev.translate([E0-190*Ex,Ez+200*Ex]);Eu.translate([E0+580*Ex,Ez+430*Ex]);return Et};return Et.scale(e.scale())};d3.geo.bonne=function(){var Ex=200,Ew=[480,250],e,Ev,Eu,Et;function Ey(E2){var Ez=E2[0]*CZ-e,E3=E2[1]*CZ-Ev;if(Eu){var E1=Et+Eu-E3,E0=Ez*Math.cos(E3)/E1;Ez=E1*Math.sin(E0);E3=E1*Math.cos(E0)-Et}else{Ez*=Math.cos(E3);E3*=-1}return[Ex*Ez+Ew[0],Ex*E3+Ew[1]]}Ey.invert=function(E1){var Ez=(E1[0]-Ew[0])/Ex,E3=(E1[1]-Ew[1])/Ex;if(Eu){var E2=Et+E3,E0=Math.sqrt(Ez*Ez+E2*E2);E3=Et+Eu-E0;Ez=e+E0*Math.atan2(Ez,E2)/Math.cos(E3)}else{E3*=-1;Ez/=Math.cos(E3)}return[Ez/CZ,E3/CZ]};Ey.parallel=function(Ez){if(!arguments.length){return Eu/CZ}Et=1/Math.tan(Eu=Ez*CZ);return Ey};Ey.origin=function(Ez){if(!arguments.length){return[e/CZ,Ev/CZ]}e=Ez[0]*CZ;Ev=Ez[1]*CZ;return Ey};Ey.scale=function(Ez){if(!arguments.length){return Ex}Ex=+Ez;return Ey};Ey.translate=function(Ez){if(!arguments.length){return Ew}Ew=[+Ez[0],+Ez[1]];return Ey};return Ey.origin([0,0]).parallel(45)};d3.geo.equirectangular=function(){var Eu=500,Et=[480,250];function e(Ew){var Ev=Ew[0]/360,Ex=-Ew[1]/360;return[Eu*Ev+Et[0],Eu*Ex+Et[1]]}e.invert=function(Ew){var Ev=(Ew[0]-Et[0])/Eu,Ex=(Ew[1]-Et[1])/Eu;return[360*Ev,-360*Ex]};e.scale=function(Ev){if(!arguments.length){return Eu}Eu=+Ev;return e};e.translate=function(Ev){if(!arguments.length){return Et}Et=[+Ev[0],+Ev[1]];return e};return e};d3.geo.mercator=function(){var Eu=500,Et=[480,250];function e(Ew){var Ev=Ew[0]/360,Ex=-(Math.log(Math.tan(Math.PI/4+Ew[1]*CZ/2))/CZ)/360;return[Eu*Ev+Et[0],Eu*Math.max(-0.5,Math.min(0.5,Ex))+Et[1]]}e.invert=function(Ew){var Ev=(Ew[0]-Et[0])/Eu,Ex=(Ew[1]-Et[1])/Eu;return[360*Ev,2*Math.atan(Math.exp(-360*Ex*CZ))/CZ-90]};e.scale=function(Ev){if(!arguments.length){return Eu}Eu=+Ev;return e};e.translate=function(Ev){if(!arguments.length){return Et}Et=[+Ev[0],+Ev[1]];return e};return e};function DG(Et,e){return function(Eu){return Eu&&Et.hasOwnProperty(Eu.type)?Et[Eu.type](Eu):e}}d3.geo.path=function(){var Ey=4.5,E2=Z(Ey),Ex=d3.geo.albersUsa();function E1(E4,E3){if(typeof Ey==="function"){E2=Z(Ey.apply(this,arguments))}return Et(E4)||null}function Ez(E3){return Ex(E3).join(",")}var Et=DG({FeatureCollection:function(E6){var E5=[],E4=E6.features,E3=-1,E7=E4.length;while(++E3<E7){E5.push(Et(E4[E3].geometry))}return E5.join("")},Feature:function(E3){return Et(E3.geometry)},Point:function(E3){return"M"+Ez(E3.coordinates)+E2},MultiPoint:function(E6){var E4=[],E5=E6.coordinates,E3=-1,E7=E5.length;while(++E3<E7){E4.push("M",Ez(E5[E3]),E2)}return E4.join("")},LineString:function(E6){var E4=["M"],E5=E6.coordinates,E3=-1,E7=E5.length;while(++E3<E7){E4.push(Ez(E5[E3]),"L")}E4.pop();return E4.join("")},MultiLineString:function(E9){var E7=[],E8=E9.coordinates,E6=-1,FA=E8.length,E4,E5,E3;while(++E6<FA){E4=E8[E6];E5=-1;E3=E4.length;E7.push("M");while(++E5<E3){E7.push(Ez(E4[E5]),"L")}E7.pop()}return E7.join("")},Polygon:function(E9){var E7=[],E8=E9.coordinates,E6=-1,FA=E8.length,E4,E5,E3;while(++E6<FA){E4=E8[E6];E5=-1;if((E3=E4.length-1)>0){E7.push("M");while(++E5<E3){E7.push(Ez(E4[E5]),"L")}E7[E7.length-1]="Z"}}return E7.join("")},MultiPolygon:function(E4){var FD=[],FC=E4.coordinates,FB=-1,E5=FC.length,E8,FA,E6,E9,E7,E3;while(++FB<E5){E8=FC[FB];FA=-1;E6=E8.length;while(++FA<E6){E9=E8[FA];E7=-1;if((E3=E9.length-1)>0){FD.push("M");while(++E7<E3){FD.push(Ez(E9[E7]),"L")}FD[FD.length-1]="Z"}}}return FD.join("")},GeometryCollection:function(E6){var E5=[],E4=E6.geometries,E3=-1,E7=E4.length;while(++E3<E7){E5.push(Et(E4[E3]))}return E5.join("")}});var Eu=E1.area=DG({FeatureCollection:function(E6){var E5=0,E4=E6.features,E3=-1,E7=E4.length;while(++E3<E7){E5+=Eu(E4[E3])}return E5},Feature:function(E3){return Eu(E3.geometry)},Polygon:function(E3){return Ew(E3.coordinates)},MultiPolygon:function(E6){var E4=0,E5=E6.coordinates,E3=-1,E7=E5.length;while(++E3<E7){E4+=Ew(E5[E3])}return E4},GeometryCollection:function(E6){var E5=0,E4=E6.geometries,E3=-1,E7=E4.length;while(++E3<E7){E5+=Eu(E4[E3])}return E5}},0);function Ew(E5){var E4=Ev(E5[0]),E3=0,E6=E5.length;while(++E3<E6){E4-=Ev(E5[E3])}return E4}function e(FB){var E9=d3.geom.polygon(FB[0].map(Ex)),E3=E9.area(),E4=E9.centroid(E3<0?(E3*=-1,1):-1),FA=E4[0],E8=E4[1],E7=E3,E6=0,E5=FB.length;while(++E6<E5){E9=d3.geom.polygon(FB[E6].map(Ex));E3=E9.area();E4=E9.centroid(E3<0?(E3*=-1,1):-1);FA-=E4[0];E8-=E4[1];E7-=E3}return[FA,E8,6*E7]}var E0=E1.centroid=DG({Feature:function(E3){return E0(E3.geometry)},Polygon:function(E4){var E3=e(E4.coordinates);return[E3[0]/E3[2],E3[1]/E3[2]]},MultiPolygon:function(E4){var E3=0,FB=E4.coordinates,E5,FA=0,E9=0,E8=0,E7=-1,E6=FB.length;while(++E7<E6){E5=e(FB[E7]);FA+=E5[0];E9+=E5[1];E8+=E5[2]}return[FA/E8,E9/E8]}});function Ev(E3){return Math.abs(d3.geom.polygon(E3.map(Ex)).area())}E1.projection=function(E3){Ex=E3;return E1};E1.pointRadius=function(E3){if(typeof E3==="function"){Ey=E3}else{Ey=+E3;E2=Z(Ey)}return E1};return E1};function Z(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+(-2*e)+"a"+e+","+e+" 0 1,1 0,"+(+2*e)+"z"}d3.geo.bounds=function(Eu){var Ew=Infinity,e=Infinity,Et=-Infinity,Ev=-Infinity;Bi(Eu,function(Ex,Ey){if(Ex<Ew){Ew=Ex}if(Ex>Et){Et=Ex}if(Ey<e){e=Ey}if(Ey>Ev){Ev=Ey}});return[[Ew,e],[Et,Ev]]};function Bi(Et,e){if(Dy.hasOwnProperty(Et.type)){Dy[Et.type](Et,e)}}var Dy={Feature:Ed,FeatureCollection:Dc,GeometryCollection:Cw,LineString:Dh,MultiLineString:Du,MultiPoint:Dh,MultiPolygon:Eb,Point:EP,Polygon:BO};function Ed(Et,e){Bi(Et.geometry,e)}function Dc(Ev,Eu){for(var e=Ev.features,Et=0,Ew=e.length;Et<Ew;Et++){Bi(e[Et].geometry,Eu)}}function Cw(Ev,Eu){for(var e=Ev.geometries,Et=0,Ew=e.length;Et<Ew;Et++){Bi(e[Et],Eu)}}function Dh(Ev,Eu){for(var e=Ev.coordinates,Et=0,Ew=e.length;Et<Ew;Et++){Eu.apply(null,e[Et])}}function Du(Ey,Ex){for(var Eu=Ey.coordinates,Ew=0,Ez=Eu.length;Ew<Ez;Ew++){for(var Et=Eu[Ew],Ev=0,e=Et.length;Ev<e;Ev++){Ex.apply(null,Et[Ev])}}}function Eb(Ey,Ex){for(var Eu=Ey.coordinates,Ew=0,Ez=Eu.length;Ew<Ez;Ew++){for(var Et=Eu[Ew][0],Ev=0,e=Et.length;Ev<e;Ev++){Ex.apply(null,Et[Ev])}}}function EP(Et,e){e.apply(null,Et.coordinates)}function BO(Ev,Eu){for(var e=Ev.coordinates[0],Et=0,Ew=e.length;Et<Ew;Et++){Eu.apply(null,e[Et])}}d3.geo.circle=function(){var E0=[0,0],Ex=90-0.01,Ey=Ex*CZ,Eu=d3.geo.greatArc().target(Object);function Et(){}function Ev(E1){return Eu.distance(E1)<Ey}Et.clip=function(E1){Eu.source(typeof E0==="function"?E0.apply(this,arguments):E0);return Ez(E1)};var Ez=DG({FeatureCollection:function(E2){var E1=E2.features.map(Ez).filter(Object);return E1&&(E2=Object.create(E2),E2.features=E1,E2)},Feature:function(E2){var E1=Ez(E2.geometry);return E1&&(E2=Object.create(E2),E2.geometry=E1,E2)},Point:function(E1){return Ev(E1.coordinates)&&E1},MultiPoint:function(E2){var E1=E2.coordinates.filter(Ev);return E1.length&&{type:E2.type,coordinates:E1}},LineString:function(E2){var E1=Ew(E2.coordinates);return E1.length&&(E2=Object.create(E2),E2.coordinates=E1,E2)},MultiLineString:function(E2){var E1=E2.coordinates.map(Ew).filter(function(E3){return E3.length});return E1.length&&(E2=Object.create(E2),E2.coordinates=E1,E2)},Polygon:function(E2){var E1=E2.coordinates.map(Ew);return E1[0].length&&(E2=Object.create(E2),E2.coordinates=E1,E2)},MultiPolygon:function(E2){var E1=E2.coordinates.map(function(E3){return E3.map(Ew)}).filter(function(E3){return E3[0].length});return E1.length&&(E2=Object.create(E2),E2.coordinates=E1,E2)},GeometryCollection:function(E2){var E1=E2.geometries.map(Ez).filter(Object);return E1.length&&(E2=Object.create(E2),E2.geometries=E1,E2)}});function Ew(E6){var E5=-1,E3=E6.length,E4=[],E9,E8,E7,E2,E1;while(++E5<E3){E1=Eu.distance(E7=E6[E5]);if(E1<Ey){if(E8){E4.push(Es(E8,E7)((E2-Ey)/(E2-E1)))}E4.push(E7);E9=E8=null}else{E8=E7;if(!E9&&E4.length){E4.push(Es(E4[E4.length-1],E8)((Ey-E2)/(E1-E2)));E9=E8}}E2=E1}if(E8&&E4.length){E1=Eu.distance(E7=E4[0]);E4.push(Es(E8,E7)((E2-Ey)/(E2-E1)))}return e(E4)}function e(E7){var E5=0,E8=E7.length,E4,E1,E2=E8?[E7[0]]:E7,E6,E3=Eu.source();while(++E5<E8){E6=Eu.source(E7[E5-1])(E7[E5]).coordinates;for(E4=0,E1=E6.length;++E4<E1;){E2.push(E6[E4])}}Eu.source(E3);return E2}Et.origin=function(E1){if(!arguments.length){return E0}E0=E1;return Et};Et.angle=function(E1){if(!arguments.length){return Ex}Ey=(Ex=+E1)*CZ;return Et};Et.precision=function(E1){if(!arguments.length){return Eu.precision()}Eu.precision(E1);return Et};return Et};d3.geo.greatArc=function(){var Eu=Bf,Ev=Bk,Et=6*CZ;function e(){var Ex=typeof Eu==="function"?Eu.apply(this,arguments):Eu,Ew=typeof Ev==="function"?Ev.apply(this,arguments):Ev,Ez=Es(Ex,Ew),E0=Et/Ez.d,Ey=0,E1=[Ex];while((Ey+=E0)<1){E1.push(Ez(Ey))}E1.push(Ew);return{type:"LineString",coordinates:E1}}e.distance=function(){var Ex=typeof Eu==="function"?Eu.apply(this,arguments):Eu,Ew=typeof Ev==="function"?Ev.apply(this,arguments):Ev;return Es(Ex,Ew).d};e.source=function(Ew){if(!arguments.length){return Eu}Eu=Ew;return e};e.target=function(Ew){if(!arguments.length){return Ev}Ev=Ew;return e};e.precision=function(Ew){if(!arguments.length){return Et/CZ}Et=Ew*CZ;return e};return e};function Bf(e){return e.source}function Bk(e){return e.target}function Es(E6,E3){var Ev=E6[0]*CZ,E2=Math.cos(Ev),Eu=Math.sin(Ev),E8=E6[1]*CZ,Ex=Math.cos(E8),E7=Math.sin(E8),Et=E3[0]*CZ,E1=Math.cos(Et),e=Math.sin(Et),E5=E3[1]*CZ,Ew=Math.cos(E5),E4=Math.sin(E5),E0=Ey.d=Math.acos(Math.max(-1,Math.min(1,E7*E4+Ex*Ew*Math.cos(Et-Ev)))),Ez=Math.sin(E0);function Ey(FB){var FA=Math.sin(E0-(FB*=E0))/Ez,FE=Math.sin(FB)/Ez,E9=FA*Ex*E2+FE*Ew*E1,FD=FA*Ex*Eu+FE*Ew*e,FC=FA*E7+FE*E4;return[Math.atan2(FD,E9)/CZ,Math.atan2(FC,Math.sqrt(E9*E9+FD*FD))/CZ]}return Ey}d3.geo.greatCircle=d3.geo.circle;d3.geom={};d3.geom.contour=function(e,Et){var E1=Et||K(e),Ex=[],Ez=E1[0],Ey=E1[1],E2=0,E0=0,Ev=NaN,Eu=NaN,Ew=0;do{Ew=0;if(e(Ez-1,Ey-1)){Ew+=1}if(e(Ez,Ey-1)){Ew+=2}if(e(Ez-1,Ey)){Ew+=4}if(e(Ez,Ey)){Ew+=8}if(Ew===6){E2=Eu===-1?-1:1;E0=0}else{if(Ew===9){E2=0;E0=Ev===1?-1:1}else{E2=Bd[Ew];E0=Bb[Ew]}}if(E2!=Ev&&E0!=Eu){Ex.push([Ez,Ey]);Ev=E2;Eu=E0}Ez+=E2;Ey+=E0}while(E1[0]!=Ez||E1[1]!=Ey);return Ex};var Bd=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],Bb=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];function K(Et){var e=0,Eu=0;while(true){if(Et(e,Eu)){return[e,Eu]}if(e===0){e=Eu+1;Eu=0}else{e=e-1;Eu=Eu+1}}}d3.geom.hull=function(E1){if(E1.length<3){return[]}var E0=E1.length,Ew=E0-1,E7=[],E3=[],Ey,Ex,Ez=0,Ev,E5,Et,E2,E8,E6,E4,Eu;for(Ey=1;Ey<E0;++Ey){if(E1[Ey][1]<E1[Ez][1]){Ez=Ey}else{if(E1[Ey][1]==E1[Ez][1]){Ez=(E1[Ey][0]<E1[Ez][0]?Ey:Ez)}}}for(Ey=0;Ey<E0;++Ey){if(Ey===Ez){continue}E5=E1[Ey][1]-E1[Ez][1];Ev=E1[Ey][0]-E1[Ez][0];E7.push({angle:Math.atan2(E5,Ev),index:Ey})}E7.sort(function(FA,E9){return FA.angle-E9.angle});E4=E7[0].angle;E6=E7[0].index;E8=0;for(Ey=1;Ey<Ew;++Ey){Ex=E7[Ey].index;if(E4==E7[Ey].angle){Ev=E1[E6][0]-E1[Ez][0];E5=E1[E6][1]-E1[Ez][1];Et=E1[Ex][0]-E1[Ez][0];E2=E1[Ex][1]-E1[Ez][1];if((Ev*Ev+E5*E5)>=(Et*Et+E2*E2)){E7[Ey].index=-1}else{E7[E8].index=-1;E4=E7[Ey].angle;E8=Ey;E6=Ex}}else{E4=E7[Ey].angle;E8=Ey;E6=Ex}}E3.push(Ez);for(Ey=0,Ex=0;Ey<2;++Ex){if(E7[Ex].index!==-1){E3.push(E7[Ex].index);Ey++}}Eu=E3.length;for(;Ex<Ew;++Ex){if(E7[Ex].index===-1){continue}while(!By(E3[Eu-2],E3[Eu-1],E7[Ex].index,E1)){--Eu}E3[Eu++]=E7[Ex].index}var e=[];for(Ey=0;Ey<Eu;++Ey){e.push(E1[E3[Ey]])}return e};function By(Ev,Eu,Et,E2){var E3,E1,E0,Ez,Ey,Ex,Ew;E3=E2[Ev];E1=E3[0];E0=E3[1];E3=E2[Eu];Ez=E3[0];Ey=E3[1];E3=E2[Et];Ex=E3[0];Ew=E3[1];return((Ew-E0)*(Ez-E1)-(Ey-E0)*(Ex-E1))>0}d3.geom.polygon=function(e){e.area=function(){var Ev=0,Ew=e.length,Eu=e[Ew-1][0]*e[0][1],Et=e[Ew-1][1]*e[0][0];while(++Ev<Ew){Eu+=e[Ev-1][0]*e[Ev][1];Et+=e[Ev-1][1]*e[Ev][0]}return(Et-Eu)*0.5};e.centroid=function(Ew){var Ex=-1,E0=e.length,Eu=0,Ez=0,Ev,Et=e[E0-1],Ey;if(!arguments.length){Ew=-1/(6*e.area())}while(++Ex<E0){Ev=Et;Et=e[Ex];Ey=Ev[0]*Et[1]-Et[0]*Ev[1];Eu+=(Ev[0]+Et[0])*Ey;Ez+=(Ev[1]+Et[1])*Ey}return[Eu*Ew,Ez*Ew]};e.clip=function(Ez){var E1,Ew=-1,Et=e.length,Ev,Eu,E2=e[Et-1],E0,Ey,Ex;while(++Ew<Et){E1=Ez.slice();Ez.length=0;E0=e[Ew];Ey=E1[(Eu=E1.length)-1];Ev=-1;while(++Ev<Eu){Ex=E1[Ev];if(T(Ex,E2,E0)){if(!T(Ey,E2,E0)){Ez.push(Dk(Ey,Ex,E2,E0))}Ez.push(Ex)}else{if(T(Ey,E2,E0)){Ez.push(Dk(Ey,Ex,E2,E0))}}Ey=Ex}E2=E0}return Ez};return e};function T(Eu,Et,e){return(e[0]-Et[0])*(Eu[1]-Et[1])<(e[1]-Et[1])*(Eu[0]-Et[0])}function Dk(E5,E4,E8,E7){var E3=E5[0],E2=E4[0],E1=E8[0],Ez=E7[0],Ev=E5[1],Eu=E4[1],Et=E8[1],e=E7[1],E9=E3-E1,Ew=E2-E3,FA=Ez-E1,Ex=Ev-Et,E6=Eu-Ev,Ey=e-Et,E0=(FA*Ex-Ey*E9)/(Ey*Ew-FA*E6);return[E3+E0*Ew,Ev+E0*E6]}d3.geom.voronoi=function(Et){var e=Et.map(function(){return[]});D4(Et,function(Ew){var E2,E1,Ev,Eu,Ez,Ex;if(Ew.a===1&&Ew.b>=0){E2=Ew.ep.r;E1=Ew.ep.l}else{E2=Ew.ep.l;E1=Ew.ep.r}if(Ew.a===1){Ez=E2?E2.y:-1000000;Ev=Ew.c-Ew.b*Ez;Ex=E1?E1.y:1000000;Eu=Ew.c-Ew.b*Ex}else{Ev=E2?E2.x:-1000000;Ez=Ew.c-Ew.a*Ev;Eu=E1?E1.x:1000000;Ex=Ew.c-Ew.a*Eu}var E0=[Ev,Ez],Ey=[Eu,Ex];e[Ew.region.l.index].push(E0,Ey);e[Ew.region.r.index].push(E0,Ey)});return e.map(function(Ew,Ev){var Eu=Et[Ev][0],Ex=Et[Ev][1];Ew.forEach(function(Ey){Ey.angle=Math.atan2(Ey[0]-Eu,Ey[1]-Ex)});return Ew.sort(function(Ez,Ey){return Ez.angle-Ey.angle}).filter(function(Ez,Ey){return !Ey||(Ez.angle-Ew[Ey-1].angle>1e-10)})})};var Bq={l:"r",r:"l"};function D4(Ex,Ev){var FB={list:Ex.map(function(e,FD){return{index:FD,x:e[0],y:e[1]}}).sort(function(FD,e){return FD.y<e.y?-1:FD.y>e.y?1:FD.x<e.x?-1:FD.x>e.x?1:0}),bottomSite:null};var Eu={list:[],leftEnd:null,rightEnd:null,init:function(){Eu.leftEnd=Eu.createHalfEdge(null,"l");Eu.rightEnd=Eu.createHalfEdge(null,"l");Eu.leftEnd.r=Eu.rightEnd;Eu.rightEnd.l=Eu.leftEnd;Eu.list.unshift(Eu.leftEnd,Eu.rightEnd)},createHalfEdge:function(FD,e){return{edge:FD,side:e,vertex:null,l:null,r:null}},insert:function(FD,e){e.l=FD;e.r=FD.r;FD.r.l=e;FD.r=e},leftBound:function(FD){var e=Eu.leftEnd;do{e=e.r}while(e!=Eu.rightEnd&&FA.rightOf(e,FD));e=e.l;return e},del:function(e){e.l.r=e.r;e.r.l=e.l;e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?FB.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?FB.bottomSite:e.edge.region[Bq[e.side]]}};var FA={bisect:function(FG,FE){var FF={region:{l:FG,r:FE},ep:{l:null,r:null}};var FD=FE.x-FG.x,e=FE.y-FG.y,FI=FD>0?FD:-FD,FH=e>0?e:-e;FF.c=FG.x*FD+FG.y*e+(FD*FD+e*e)*0.5;if(FI>FH){FF.a=1;FF.b=e/FD;FF.c/=FD}else{FF.b=1;FF.a=FD/e;FF.c/=e}return FF},intersect:function(FG,FF){var FL=FG.edge,FK=FF.edge;if(!FL||!FK||(FL.region.r==FK.region.r)){return null}var FJ=(FL.a*FK.b)-(FL.b*FK.a);if(Math.abs(FJ)<1e-10){return null}var FE=(FL.c*FK.b-FK.c*FL.b)/FJ,FO=(FK.c*FL.a-FL.c*FK.a)/FJ,FN=FL.region.r,FI=FK.region.r,FD,FH;if((FN.y<FI.y)||(FN.y==FI.y&&FN.x<FI.x)){FD=FG;FH=FL}else{FD=FF;FH=FK}var FM=(FE>=FH.region.r.x);if((FM&&(FD.side==="l"))||(!FM&&(FD.side==="r"))){return null}return{x:FE,y:FO}},rightOf:function(FI,FD){var FM=FI.edge,FG=FM.region.r,FP=(FD.x>FG.x);if(FP&&(FI.side==="l")){return 1}if(!FP&&(FI.side==="r")){return 0}if(FM.a===1){var FO=FD.y-FG.y,FE=FD.x-FG.x,FJ=0,FN=0;if((!FP&&(FM.b<0))||(FP&&(FM.b>=0))){FN=FJ=(FO>=FM.b*FE)}else{FN=((FD.x+FD.y*FM.b)>FM.c);if(FM.b<0){FN=!FN}if(!FN){FJ=1}}if(!FJ){var FQ=FG.x-FM.region.l.x;FN=(FM.b*(FE*FE-FO*FO))<(FQ*FO*(1+2*FE/FQ+FM.b*FM.b));if(FM.b<0){FN=!FN}}}else{var FF=FM.c-FM.a*FD.x,FL=FD.y-FF,FK=FD.x-FG.x,FH=FF-FG.y;FN=(FL*FL)>(FK*FK+FH*FH)}return FI.side==="l"?FN:!FN},endPoint:function(FE,FD,e){FE.ep[FD]=e;if(!FE.ep[Bq[FD]]){return}Ev(FE)},distance:function(FF,FE){var FD=FF.x-FE.x,e=FF.y-FE.y;return Math.sqrt(FD*FD+e*e)}};var Et={list:[],insert:function(FH,FD,FI){FH.vertex=FD;FH.ystar=FD.y+FI;for(var FE=0,FG=Et.list,e=FG.length;FE<e;FE++){var FF=FG[FE];if(FH.ystar>FF.ystar||(FH.ystar==FF.ystar&&FD.x>FF.vertex.x)){continue}else{break}}FG.splice(FE,0,FH)},del:function(FF){for(var FE=0,FD=Et.list,e=FD.length;FE<e&&(FD[FE]!=FF);++FE){}FD.splice(FE,1)},empty:function(){return Et.list.length===0},nextEvent:function(FF){for(var FE=0,FD=Et.list,e=FD.length;FE<e;++FE){if(FD[FE]==FF){return FD[FE+1]}}return null},min:function(){var e=Et.list[0];return{x:e.vertex.x,y:e.ystar}},extractMin:function(){return Et.list.shift()}};Eu.init();FB.bottomSite=FB.list.shift();var FC=FB.list.shift(),Ez;var E4,E1,Ew,E8,Ey;var E2,E3,E9,E5,E0;var E7,E6;while(true){if(!Et.empty()){Ez=Et.min()}if(FC&&(Et.empty()||FC.y<Ez.y||(FC.y==Ez.y&&FC.x<Ez.x))){E4=Eu.leftBound(FC);E1=Eu.right(E4);E2=Eu.rightRegion(E4);E7=FA.bisect(E2,FC);Ey=Eu.createHalfEdge(E7,"l");Eu.insert(E4,Ey);E5=FA.intersect(E4,Ey);if(E5){Et.del(E4);Et.insert(E4,E5,FA.distance(E5,FC))}E4=Ey;Ey=Eu.createHalfEdge(E7,"r");Eu.insert(E4,Ey);E5=FA.intersect(Ey,E1);if(E5){Et.insert(Ey,E5,FA.distance(E5,FC))}FC=FB.list.shift()}else{if(!Et.empty()){E4=Et.extractMin();Ew=Eu.left(E4);E1=Eu.right(E4);E8=Eu.right(E1);E2=Eu.leftRegion(E4);E3=Eu.rightRegion(E1);E0=E4.vertex;FA.endPoint(E4.edge,E4.side,E0);FA.endPoint(E1.edge,E1.side,E0);Eu.del(E4);Et.del(E1);Eu.del(E1);E6="l";if(E2.y>E3.y){E9=E2;E2=E3;E3=E9;E6="r"}E7=FA.bisect(E2,E3);Ey=Eu.createHalfEdge(E7,E6);Eu.insert(Ew,Ey);FA.endPoint(E7,Bq[E6],E0);E5=FA.intersect(Ew,Ey);if(E5){Et.del(Ew);Et.insert(Ew,E5,FA.distance(E5,E2))}E5=FA.intersect(Ey,E8);if(E5){Et.insert(Ey,E5,FA.distance(E5,E2))}}else{break}}}for(E4=Eu.right(Eu.leftEnd);E4!=Eu.rightEnd;E4=Eu.right(E4)){Ev(E4.edge)}}d3.geom.delaunay=function(Et){var e=Et.map(function(){return[]}),Eu=[];D4(Et,function(Ev){e[Ev.region.l.index].push(Et[Ev.region.r.index])});e.forEach(function(E0,Ez){var Ex=Et[Ez],Ew=Ex[0],E1=Ex[1];E0.forEach(function(E2){E2.angle=Math.atan2(E2[0]-Ew,E2[1]-E1)});E0.sort(function(E3,E2){return E3.angle-E2.angle});for(var Ey=0,Ev=E0.length-1;Ey<Ev;Ey++){Eu.push([Ex,E0[Ey],E0[Ey+1]])}});return Eu};d3.geom.quadtree=function(E1,Eu,E0,e,Ez){var Et,Ew=-1,Ev=E1.length;if(Ev&&isNaN(E1[0].x)){E1=E1.map(l)}if(arguments.length<5){if(arguments.length===3){Ez=e=E0;E0=Eu}else{Eu=E0=Infinity;e=Ez=-Infinity;while(++Ew<Ev){Et=E1[Ew];if(Et.x<Eu){Eu=Et.x}if(Et.y<E0){E0=Et.y}if(Et.x>e){e=Et.x}if(Et.y>Ez){Ez=Et.y}}var E4=e-Eu,E3=Ez-E0;if(E4>E3){Ez=E0+E4}else{e=Eu+E3}}}function E2(FB,FA,E7,E9,E6,E8){if(isNaN(FA.x)||isNaN(FA.y)){return}if(FB.leaf){var E5=FB.point;if(E5){if((Math.abs(E5.x-FA.x)+Math.abs(E5.y-FA.y))<0.01){Ex(FB,FA,E7,E9,E6,E8)}else{FB.point=null;Ex(FB,E5,E7,E9,E6,E8);Ex(FB,FA,E7,E9,E6,E8)}}else{FB.point=FA}}else{Ex(FB,FA,E7,E9,E6,E8)}}function Ex(E9,E7,E8,FE,E6,FC){var FD=(E8+E6)*0.5,FB=(FE+FC)*0.5,FF=E7.x>=FD,E5=E7.y>=FB,FA=(E5<<1)+FF;E9.leaf=false;E9=E9.nodes[FA]||(E9.nodes[FA]=DN());if(FF){E8=FD}else{E6=FD}if(E5){FE=FB}else{FC=FB}E2(E9,E7,E8,FE,E6,FC)}var Ey=DN();Ey.add=function(E5){E2(Ey,E5,Eu,E0,e,Ez)};Ey.visit=function(E5){BQ(E5,Ey,Eu,E0,e,Ez)};E1.forEach(Ey.add);return Ey};function DN(){return{leaf:true,nodes:[],point:null}}function BQ(Ew,Ev,Et,E0,e,Ey){if(!Ew(Ev,Et,E0,e,Ey)){var Ez=(Et+e)*0.5,Ex=(E0+Ey)*0.5,Eu=Ev.nodes;if(Eu[0]){BQ(Ew,Eu[0],Et,E0,Ez,Ex)}if(Eu[1]){BQ(Ew,Eu[1],Ez,E0,e,Ex)}if(Eu[2]){BQ(Ew,Eu[2],Et,Ex,Ez,Ey)}if(Eu[3]){BQ(Ew,Eu[3],Ez,Ex,e,Ey)}}}function l(e){return{x:e[0],y:e[1]}}d3.time={};var DM=Date;function EE(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}EE.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(){DX.setUTCDate.apply(this._,arguments)},setDay:function(){DX.setUTCDay.apply(this._,arguments)},setFullYear:function(){DX.setUTCFullYear.apply(this._,arguments)},setHours:function(){DX.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){DX.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){DX.setUTCMinutes.apply(this._,arguments)},setMonth:function(){DX.setUTCMonth.apply(this._,arguments)},setSeconds:function(){DX.setUTCSeconds.apply(this._,arguments)},setTime:function(){DX.setTime.apply(this._,arguments)}};var DX=Date.prototype;d3.time.format=function(e){var Eu=e.length;function Et(Ex){var Ew=[],Ey=-1,Ev=0,E0,Ez;while(++Ey<Eu){if(e.charCodeAt(Ey)==37){Ew.push(e.substring(Ev,Ey),(Ez=Dr[E0=e.charAt(++Ey)])?Ez(Ex):E0);Ev=Ey+1}}Ew.push(e.substring(Ev,Ey));return Ew.join("")}Et.parse=function(Ew){var Ey={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},Ex=CE(Ey,e,Ew,0);if(Ex!=Ew.length){return null}if("p" in Ey){Ey.H=Ey.H%12+Ey.p*12}var Ev=new DM();Ev.setFullYear(Ey.y,Ey.m,Ey.d);Ev.setHours(Ey.H,Ey.M,Ey.S,Ey.L);return Ev};Et.toString=function(){return e};return Et};function CE(Ev,E0,Ey,Ew){var Ez,e,Ex=0,Et=E0.length,Eu=Ey.length;while(Ex<Et){if(Ew>=Eu){return -1}Ez=E0.charCodeAt(Ex++);if(Ez==37){e=Eh[E0.charAt(Ex++)];if(!e||((Ew=e(Ev,Ey,Ew))<0)){return -1}}else{if(Ez!=Ey.charCodeAt(Ew++)){return -1}}}return Ew}var Aq=d3.format("02d"),Ap=d3.format("03d"),Ao=d3.format("04d"),Am=d3.format("2d");var Dr={a:function(e){return d3_time_weekdays[e.getDay()].substring(0,3)},A:function(e){return d3_time_weekdays[e.getDay()]},b:function(e){return BB[e.getMonth()].substring(0,3)},B:function(e){return BB[e.getMonth()]},c:d3.time.format("%a %b %e %H:%M:%S %Y"),d:function(e){return Aq(e.getDate())},e:function(e){return Am(e.getDate())},H:function(e){return Aq(e.getHours())},I:function(e){return Aq(e.getHours()%12||12)},j:function(e){return Ap(1+d3.time.dayOfYear(e))},L:function(e){return Ap(e.getMilliseconds())},m:function(e){return Aq(e.getMonth()+1)},M:function(e){return Aq(e.getMinutes())},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e){return Aq(e.getSeconds())},U:function(e){return Aq(d3.time.sundayOfYear(e))},w:function(e){return e.getDay()},W:function(e){return Aq(d3.time.mondayOfYear(e))},x:d3.time.format("%m/%d/%y"),X:d3.time.format("%H:%M:%S"),y:function(e){return Aq(e.getFullYear()%100)},Y:function(e){return Ao(e.getFullYear()%10000)},Z:DU,"%":function(e){return"%"}};var Eh={a:ED,A:BM,b:AT,B:Cj,c:CQ,d:A1,e:A1,H:AL,I:AL,L:D9,m:D0,M:BW,p:EY,S:B6,x:Er,X:Dx,y:g,Y:Ak};function ED(Et,e,Eu){return C2.test(e.substring(Eu,Eu+=3))?Eu:-1}function BM(Et,e,Eu){Aw.lastIndex=0;var Ev=Aw.exec(e.substring(Eu,Eu+10));return Ev?Eu+=Ev[0].length:-1}var C2=/^(?:sun|mon|tue|wed|thu|fri|sat)/i,Aw=/^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/i;d3_time_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function AT(Et,e,Eu){var Ev=Cn.get(e.substring(Eu,Eu+=3).toLowerCase());return Ev==null?-1:(Et.m=Ev,Eu)}var Cn=d3.map({jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11});function Cj(Et,e,Eu){EG.lastIndex=0;var Ev=EG.exec(e.substring(Eu,Eu+12));return Ev?(Et.m=DE.get(Ev[0].toLowerCase()),Eu+=Ev[0].length):-1}var EG=/^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;var DE=d3.map({january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11});var BB=["January","February","March","April","May","June","July","August","September","October","November","December"];function CQ(Et,e,Eu){return CE(Et,Dr.c.toString(),e,Eu)}function Er(Et,e,Eu){return CE(Et,Dr.x.toString(),e,Eu)}function Dx(Et,e,Eu){return CE(Et,Dr.X.toString(),e,Eu)}function Ak(Et,e,Eu){DY.lastIndex=0;var Ev=DY.exec(e.substring(Eu,Eu+4));return Ev?(Et.y=+Ev[0],Eu+=Ev[0].length):-1}function g(Et,e,Eu){DY.lastIndex=0;var Ev=DY.exec(e.substring(Eu,Eu+2));return Ev?(Et.y=Ah()+ +Ev[0],Eu+=Ev[0].length):-1}function Ah(){return ~~(new Date().getFullYear()/1000)*1000}function D0(Et,e,Eu){DY.lastIndex=0;var Ev=DY.exec(e.substring(Eu,Eu+2));return Ev?(Et.m=Ev[0]-1,Eu+=Ev[0].length):-1}function A1(Et,e,Eu){DY.lastIndex=0;var Ev=DY.exec(e.substring(Eu,Eu+2));return Ev?(Et.d=+Ev[0],Eu+=Ev[0].length):-1}function AL(Et,e,Eu){DY.lastIndex=0;var Ev=DY.exec(e.substring(Eu,Eu+2));return Ev?(Et.H=+Ev[0],Eu+=Ev[0].length):-1}function BW(Et,e,Eu){DY.lastIndex=0;var Ev=DY.exec(e.substring(Eu,Eu+2));return Ev?(Et.M=+Ev[0],Eu+=Ev[0].length):-1}function B6(Et,e,Eu){DY.lastIndex=0;var Ev=DY.exec(e.substring(Eu,Eu+2));return Ev?(Et.S=+Ev[0],Eu+=Ev[0].length):-1}function D9(Et,e,Eu){DY.lastIndex=0;var Ev=DY.exec(e.substring(Eu,Eu+3));return Ev?(Et.L=+Ev[0],Eu+=Ev[0].length):-1}var DY=/\s*\d+/;function EY(Et,e,Eu){var Ev=C.get(e.substring(Eu,Eu+=2).toLowerCase());return Ev==null?-1:(Et.p=Ev,Eu)}var C=d3.map({am:0,pm:1});function DU(Ew){var Ev=Ew.getTimezoneOffset(),Eu=Ev>0?"-":"+",Et=~~(Math.abs(Ev)/60),e=Math.abs(Ev)%60;return Eu+Aq(Et)+Aq(e)}d3.time.format.utc=function(Et){var e=d3.time.format(Et);function Eu(Ev){try{DM=EE;var Ew=new DM();Ew._=Ev;return e(Ew)}finally{DM=Date}}Eu.parse=function(Ew){try{DM=EE;var Ev=e.parse(Ew);return Ev&&Ev._}finally{DM=Date}};Eu.toString=e.toString;return Eu};var B2=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?Br:B2;function Br(e){return e.toISOString()}Br.parse=function(e){return new Date(e)};Br.toString=B2.toString;function BY(Ex,e,Et){function E0(E1){var E3=Ex(E1),E2=Ev(E3,1);return E1-E3<E2-E1?E3:E2}function Ez(E1){e(E1=Ex(new DM(E1-1)),1);return E1}function Ev(E2,E1){e(E2=new DM(+E2),E1);return E2}function Ew(E3,E2,E1){var E4=Ez(E3),E5=[];if(E1>1){while(E4<E2){if(!(Et(E4)%E1)){E5.push(new Date(+E4))}e(E4,1)}}else{while(E4<E2){E5.push(new Date(+E4)),e(E4,1)}}return E5}function Eu(E4,E3,E2){try{DM=EE;var E1=new EE();E1._=E4;return Ew(E1,E3,E2)}finally{DM=Date}}Ex.floor=Ex;Ex.round=E0;Ex.ceil=Ez;Ex.offset=Ev;Ex.range=Ew;var Ey=Ex.utc=B4(Ex);Ey.floor=Ey;Ey.round=B4(E0);Ey.ceil=B4(Ez);Ey.offset=B4(Ev);Ey.range=Eu;return Ex}function B4(e){return function(Eu,Et){try{DM=EE;var Ev=new EE();Ev._=Eu;return e(Ev,Et)._}finally{DM=Date}}}d3.time.second=BY(function(e){return new DM(Math.floor(e/1000)*1000)},function(e,Et){e.setTime(e.getTime()+Math.floor(Et)*1000)},function(e){return e.getSeconds()});d3.time.seconds=d3.time.second.range;d3.time.seconds.utc=d3.time.second.utc.range;d3.time.minute=BY(function(e){return new DM(Math.floor(e/60000)*60000)},function(e,Et){e.setTime(e.getTime()+Math.floor(Et)*60000)},function(e){return e.getMinutes()});d3.time.minutes=d3.time.minute.range;d3.time.minutes.utc=d3.time.minute.utc.range;d3.time.hour=BY(function(e){var Et=e.getTimezoneOffset()/60;return new DM((Math.floor(e/3600000-Et)+Et)*3600000)},function(e,Et){e.setTime(e.getTime()+Math.floor(Et)*3600000)},function(e){return e.getHours()});d3.time.hours=d3.time.hour.range;d3.time.hours.utc=d3.time.hour.utc.range;d3.time.day=BY(function(e){return new DM(e.getFullYear(),e.getMonth(),e.getDate())},function(e,Et){e.setDate(e.getDate()+Et)},function(e){return e.getDate()-1});d3.time.days=d3.time.day.range;d3.time.days.utc=d3.time.day.utc.range;d3.time.dayOfYear=function(e){var Et=d3.time.year(e);return Math.floor((e-Et)/86400000-(e.getTimezoneOffset()-Et.getTimezoneOffset())/1440)};d3_time_weekdays.forEach(function(Et,Eu){Et=Et.toLowerCase();Eu=7-Eu;var e=d3.time[Et]=BY(function(Ev){(Ev=d3.time.day(Ev)).setDate(Ev.getDate()-(Ev.getDay()+Eu)%7);return Ev},function(Ev,Ew){Ev.setDate(Ev.getDate()+Math.floor(Ew)*7)},function(Ew){var Ev=d3.time.year(Ew).getDay();return Math.floor((d3.time.dayOfYear(Ew)+(Ev+Eu)%7)/7)-(Ev!==Eu)});d3.time[Et+"s"]=e.range;d3.time[Et+"s"].utc=e.utc.range;d3.time[Et+"OfYear"]=function(Ew){var Ev=d3.time.year(Ew).getDay();return Math.floor((d3.time.dayOfYear(Ew)+(Ev+Eu)%7)/7)}});d3.time.week=d3.time.sunday;d3.time.weeks=d3.time.sunday.range;d3.time.weeks.utc=d3.time.sunday.utc.range;d3.time.weekOfYear=d3.time.sundayOfYear;d3.time.month=BY(function(e){return new DM(e.getFullYear(),e.getMonth(),1)},function(e,Et){e.setMonth(e.getMonth()+Et)},function(e){return e.getMonth()});d3.time.months=d3.time.month.range;d3.time.months.utc=d3.time.month.utc.range;d3.time.year=BY(function(e){return new DM(e.getFullYear(),0,1)},function(e,Et){e.setFullYear(e.getFullYear()+Et)},function(e){return e.getFullYear()});d3.time.years=d3.time.year.range;d3.time.years.utc=d3.time.year.utc.range;function Ag(e,Et,Eu){function Ev(Ew){return e(Ew)}Ev.invert=function(Ew){return DW(e.invert(Ew))};Ev.domain=function(Ew){if(!arguments.length){return e.domain().map(DW)}e.domain(Ew);return Ev};Ev.nice=function(Ew){var Ex=DR(Ev.domain());return Ev.domain([Ew.floor(Ex[0]),Ew.ceil(Ex[1])])};Ev.ticks=function(Ew,Ex){var E0=DR(Ev.domain());if(typeof Ew!=="function"){var Ez=E0[1]-E0[0],E1=Ez/Ew,Ey=d3.bisect(Cv,E1);if(Ey==Cv.length){return Et.year(E0,Ew)}if(!Ey){return e.ticks(Ew).map(DW)}if(Math.log(E1/Cv[Ey-1])<Math.log(Cv[Ey]/E1)){--Ey}Ew=Et[Ey];Ex=Ew[1];Ew=Ew[0].range}return Ew(E0[0],new Date(+E0[1]+1),Ex)};Ev.tickFormat=function(){return Eu};Ev.copy=function(){return Ag(e.copy(),Et,Eu)};return d3.rebind(Ev,e,"range","rangeRound","interpolate","clamp")}function DR(Et){var Eu=Et[0],e=Et[Et.length-1];return Eu<e?[Eu,e]:[e,Eu]}function DW(e){return new Date(e)}function BV(e){return function(Et){var Eu=e.length-1,Ev=e[Eu];while(!Ev[1](Et)){Ev=e[--Eu]}return Ev[0](Et)}}function B9(Et){var e=new Date(Et,0,1);e.setFullYear(Et);return e}function EF(Eu){var Ev=Eu.getFullYear(),Et=B9(Ev),e=B9(Ev+1);return Ev+(Eu-Et)/(e-Et)}var Cv=[1000,5000,15000,30000,60000,300000,900000,1800000,3600000,10800000,21600000,43200000,86400000,172800000,604800000,2592000000,7776000000,31536000000];var BL=[[d3.time.second,1],[d3.time.second,5],[d3.time.second,15],[d3.time.second,30],[d3.time.minute,1],[d3.time.minute,5],[d3.time.minute,15],[d3.time.minute,30],[d3.time.hour,1],[d3.time.hour,3],[d3.time.hour,6],[d3.time.hour,12],[d3.time.day,1],[d3.time.day,2],[d3.time.week,1],[d3.time.month,1],[d3.time.month,3],[d3.time.year,1]];var DF=[[d3.time.format("%Y"),function(e){return true}],[d3.time.format("%B"),function(e){return e.getMonth()}],[d3.time.format("%b %d"),function(e){return e.getDate()!=1}],[d3.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[d3.time.format("%I %p"),function(e){return e.getHours()}],[d3.time.format("%I:%M"),function(e){return e.getMinutes()}],[d3.time.format(":%S"),function(e){return e.getSeconds()}],[d3.time.format(".%L"),function(e){return e.getMilliseconds()}]];var BJ=d3.scale.linear(),m=BV(DF);BL.year=function(Et,e){return BJ.domain(Et.map(EF)).ticks(e).map(B9)};d3.time.scale=function(){return Ag(d3.scale.linear(),BL,m)};var Ej=BL.map(function(e){return[e[0].utc,e[1]]});var A7=[[d3.time.format.utc("%Y"),function(e){return true}],[d3.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[d3.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[d3.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[d3.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[d3.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[d3.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[d3.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]];var Cm=BV(A7);function Bc(Et){var e=new Date(Date.UTC(Et,0,1));e.setUTCFullYear(Et);return e}function Dg(Eu){var Ev=Eu.getUTCFullYear(),Et=Bc(Ev),e=Bc(Ev+1);return Ev+(Eu-Et)/(e-Et)}Ej.year=function(Et,e){return BJ.domain(Et.map(Dg)).ticks(e).map(Bc)};d3.time.scale.utc=function(){return Ag(d3.scale.linear(),Ej,Cm)}})();var Box2D={};(function(C,B){function A(){}if(!(Object.prototype.defineProperty instanceof Function)&&Object.prototype.__defineGetter__ instanceof Function&&Object.prototype.__defineSetter__ instanceof Function){Object.defineProperty=function(F,E,D){D.get instanceof Function&&F.__defineGetter__(E,D.get);D.set instanceof Function&&F.__defineSetter__(E,D.set)}}C.inherit=function(E,D){A.prototype=D.prototype;E.prototype=new A;E.prototype.constructor=E};C.generateCallback=function(E,D){return function(){D.apply(E,arguments)}};C.NVector=function(F){if(F===B){F=0}for(var E=Array(F||0),D=0;D<F;++D){E[D]=0}return E};C.is=function(E,D){if(E===null){return false}if(D instanceof Function&&E instanceof D){return true}if(E.constructor.__implements!=B&&E.constructor.__implements[D]){return true}return false};C.parseUInt=function(D){return Math.abs(parseInt(D))}})(Box2D);var Vector=Array,Vector_a2j_Number=Box2D.NVector;if(typeof Box2D==="undefined"){Box2D={}}if(typeof Box2D.Collision==="undefined"){Box2D.Collision={}}if(typeof Box2D.Collision.Shapes==="undefined"){Box2D.Collision.Shapes={}}if(typeof Box2D.Common==="undefined"){Box2D.Common={}}if(typeof Box2D.Common.Math==="undefined"){Box2D.Common.Math={}}if(typeof Box2D.Dynamics==="undefined"){Box2D.Dynamics={}}if(typeof Box2D.Dynamics.Contacts==="undefined"){Box2D.Dynamics.Contacts={}}if(typeof Box2D.Dynamics.Controllers==="undefined"){Box2D.Dynamics.Controllers={}}if(typeof Box2D.Dynamics.Joints==="undefined"){Box2D.Dynamics.Joints={}}(function(){function BN(){BN.b2AABB.apply(this,arguments)}function BM(){BM.b2Bound.apply(this,arguments)}function BG(){BG.b2BoundValues.apply(this,arguments);this.constructor===BG&&this.b2BoundValues.apply(this,arguments)}function AS(){AS.b2Collision.apply(this,arguments)}function AV(){AV.b2ContactID.apply(this,arguments);this.constructor===AV&&this.b2ContactID.apply(this,arguments)}function BU(){BU.b2ContactPoint.apply(this,arguments)}function A5(){A5.b2Distance.apply(this,arguments)}function Ad(){Ad.b2DistanceInput.apply(this,arguments)}function BT(){BT.b2DistanceOutput.apply(this,arguments)}function A9(){A9.b2DistanceProxy.apply(this,arguments)}function A4(){A4.b2DynamicTree.apply(this,arguments);this.constructor===A4&&this.b2DynamicTree.apply(this,arguments)}function BE(){BE.b2DynamicTreeBroadPhase.apply(this,arguments)}function BF(){BF.b2DynamicTreeNode.apply(this,arguments)}function BK(){BK.b2DynamicTreePair.apply(this,arguments)}function A3(){A3.b2Manifold.apply(this,arguments);this.constructor===A3&&this.b2Manifold.apply(this,arguments)}function A1(){A1.b2ManifoldPoint.apply(this,arguments);this.constructor===A1&&this.b2ManifoldPoint.apply(this,arguments)}function Aj(){Aj.b2Point.apply(this,arguments)}function AR(){AR.b2RayCastInput.apply(this,arguments);this.constructor===AR&&this.b2RayCastInput.apply(this,arguments)}function AX(){AX.b2RayCastOutput.apply(this,arguments)}function BQ(){BQ.b2Segment.apply(this,arguments)}function BL(){BL.b2SeparationFunction.apply(this,arguments)}function BC(){BC.b2Simplex.apply(this,arguments);this.constructor===BC&&this.b2Simplex.apply(this,arguments)}function BP(){BP.b2SimplexCache.apply(this,arguments)}function A8(){A8.b2SimplexVertex.apply(this,arguments)}function BD(){BD.b2TimeOfImpact.apply(this,arguments)}function A7(){A7.b2TOIInput.apply(this,arguments)}function BZ(){BZ.b2WorldManifold.apply(this,arguments);this.constructor===BZ&&this.b2WorldManifold.apply(this,arguments)}function Az(){Az.ClipVertex.apply(this,arguments)}function As(){As.Features.apply(this,arguments)}function An(){An.b2CircleShape.apply(this,arguments);this.constructor===An&&this.b2CircleShape.apply(this,arguments)}function Ai(){Ai.b2EdgeChainDef.apply(this,arguments);this.constructor===Ai&&this.b2EdgeChainDef.apply(this,arguments)}function Ak(){Ak.b2EdgeShape.apply(this,arguments);this.constructor===Ak&&this.b2EdgeShape.apply(this,arguments)}function Ae(){Ae.b2MassData.apply(this,arguments)}function Ac(){Ac.b2PolygonShape.apply(this,arguments);this.constructor===Ac&&this.b2PolygonShape.apply(this,arguments)}function Af(){Af.b2Shape.apply(this,arguments);this.constructor===Af&&this.b2Shape.apply(this,arguments)}function Aw(){Aw.b2Color.apply(this,arguments);this.constructor===Aw&&this.b2Color.apply(this,arguments)}function At(){At.b2Settings.apply(this,arguments)}function Ao(){Ao.b2Mat22.apply(this,arguments);this.constructor===Ao&&this.b2Mat22.apply(this,arguments)}function Av(){Av.b2Mat33.apply(this,arguments);this.constructor===Av&&this.b2Mat33.apply(this,arguments)}function Aq(){Aq.b2Math.apply(this,arguments)}function Ap(){Ap.b2Sweep.apply(this,arguments)}function Ah(){Ah.b2Transform.apply(this,arguments);this.constructor===Ah&&this.b2Transform.apply(this,arguments)}function Ab(){Ab.b2Vec2.apply(this,arguments);this.constructor===Ab&&this.b2Vec2.apply(this,arguments)}function AZ(){AZ.b2Vec3.apply(this,arguments);this.constructor===AZ&&this.b2Vec3.apply(this,arguments)}function AW(){AW.b2Body.apply(this,arguments);this.constructor===AW&&this.b2Body.apply(this,arguments)}function AY(){AY.b2BodyDef.apply(this,arguments);this.constructor===AY&&this.b2BodyDef.apply(this,arguments)}function AU(){AU.b2ContactFilter.apply(this,arguments)}function BS(){BS.b2ContactImpulse.apply(this,arguments)}function BH(){BH.b2ContactListener.apply(this,arguments)}function A6(){A6.b2ContactManager.apply(this,arguments);this.constructor===A6&&this.b2ContactManager.apply(this,arguments)}function BA(){BA.b2DebugDraw.apply(this,arguments);this.constructor===BA&&this.b2DebugDraw.apply(this,arguments)}function A2(){A2.b2DestructionListener.apply(this,arguments)}function Bf(){Bf.b2FilterData.apply(this,arguments)}function BB(){BB.b2Fixture.apply(this,arguments);this.constructor===BB&&this.b2Fixture.apply(this,arguments)}function Ag(){Ag.b2FixtureDef.apply(this,arguments);this.constructor===Ag&&this.b2FixtureDef.apply(this,arguments)}function AK(){AK.b2Island.apply(this,arguments);this.constructor===AK&&this.b2Island.apply(this,arguments)}function AE(){AE.b2TimeStep.apply(this,arguments)}function AC(){AC.b2World.apply(this,arguments);this.constructor===AC&&this.b2World.apply(this,arguments)}function Bn(){Bn.b2CircleContact.apply(this,arguments)}function Bk(){Bk.b2Contact.apply(this,arguments);this.constructor===Bk&&this.b2Contact.apply(this,arguments)}function Bb(){Bb.b2ContactConstraint.apply(this,arguments);this.constructor===Bb&&this.b2ContactConstraint.apply(this,arguments)}function Be(){Be.b2ContactConstraintPoint.apply(this,arguments)}function BR(){BR.b2ContactEdge.apply(this,arguments)}function BI(){BI.b2ContactFactory.apply(this,arguments);this.constructor===BI&&this.b2ContactFactory.apply(this,arguments)}function Au(){Au.b2ContactRegister.apply(this,arguments)}function AO(){AO.b2ContactResult.apply(this,arguments)}function Al(){Al.b2ContactSolver.apply(this,arguments);this.constructor===Al&&this.b2ContactSolver.apply(this,arguments)}function AG(){AG.b2EdgeAndCircleContact.apply(this,arguments)}function AL(){AL.b2NullContact.apply(this,arguments);this.constructor===AL&&this.b2NullContact.apply(this,arguments)}function Bp(){Bp.b2PolyAndCircleContact.apply(this,arguments)}function Bh(){Bh.b2PolyAndEdgeContact.apply(this,arguments)}function BW(){BW.b2PolygonContact.apply(this,arguments)}function AD(){AD.b2PositionSolverManifold.apply(this,arguments);this.constructor===AD&&this.b2PositionSolverManifold.apply(this,arguments)}function Ay(){Ay.b2BuoyancyController.apply(this,arguments)}function AQ(){AQ.b2ConstantAccelController.apply(this,arguments)}function AI(){AI.b2ConstantForceController.apply(this,arguments)}function AB(){AB.b2Controller.apply(this,arguments)}function Bj(){Bj.b2ControllerEdge.apply(this,arguments)}function BY(){BY.b2GravityController.apply(this,arguments)}function A0(){A0.b2TensorDampingController.apply(this,arguments)}function Bm(){Bm.b2DistanceJoint.apply(this,arguments);this.constructor===Bm&&this.b2DistanceJoint.apply(this,arguments)}function Bd(){Bd.b2DistanceJointDef.apply(this,arguments);this.constructor===Bd&&this.b2DistanceJointDef.apply(this,arguments)}function BO(){BO.b2FrictionJoint.apply(this,arguments);this.constructor===BO&&this.b2FrictionJoint.apply(this,arguments)}function Ar(){Ar.b2FrictionJointDef.apply(this,arguments);this.constructor===Ar&&this.b2FrictionJointDef.apply(this,arguments)}function AN(){AN.b2GearJoint.apply(this,arguments);this.constructor===AN&&this.b2GearJoint.apply(this,arguments)}function AF(){AF.b2GearJointDef.apply(this,arguments);this.constructor===AF&&this.b2GearJointDef.apply(this,arguments)}function AT(){AT.b2Jacobian.apply(this,arguments)}function Bo(){Bo.b2Joint.apply(this,arguments);this.constructor===Bo&&this.b2Joint.apply(this,arguments)}function Bg(){Bg.b2JointDef.apply(this,arguments);this.constructor===Bg&&this.b2JointDef.apply(this,arguments)}function AJ(){AJ.b2JointEdge.apply(this,arguments)}function BV(){BV.b2LineJoint.apply(this,arguments);this.constructor===BV&&this.b2LineJoint.apply(this,arguments)}function Ax(){Ax.b2LineJointDef.apply(this,arguments);this.constructor===Ax&&this.b2LineJointDef.apply(this,arguments)}function AP(){AP.b2MouseJoint.apply(this,arguments);this.constructor===AP&&this.b2MouseJoint.apply(this,arguments)}function AH(){AH.b2MouseJointDef.apply(this,arguments);this.constructor===AH&&this.b2MouseJointDef.apply(this,arguments)}function AA(){AA.b2PrismaticJoint.apply(this,arguments);this.constructor===AA&&this.b2PrismaticJoint.apply(this,arguments)}function Bi(){Bi.b2PrismaticJointDef.apply(this,arguments);this.constructor===Bi&&this.b2PrismaticJointDef.apply(this,arguments)}function BX(){BX.b2PulleyJoint.apply(this,arguments);this.constructor===BX&&this.b2PulleyJoint.apply(this,arguments)}function Bl(){Bl.b2PulleyJointDef.apply(this,arguments);this.constructor===Bl&&this.b2PulleyJointDef.apply(this,arguments)}function Bc(){Bc.b2RevoluteJoint.apply(this,arguments);this.constructor===Bc&&this.b2RevoluteJoint.apply(this,arguments)}function BJ(){BJ.b2RevoluteJointDef.apply(this,arguments);this.constructor===BJ&&this.b2RevoluteJointDef.apply(this,arguments)}function Am(){Am.b2WeldJoint.apply(this,arguments);this.constructor===Am&&this.b2WeldJoint.apply(this,arguments)}function AM(){AM.b2WeldJointDef.apply(this,arguments);this.constructor===AM&&this.b2WeldJointDef.apply(this,arguments)}Box2D.Collision.IBroadPhase="Box2D.Collision.IBroadPhase";Box2D.Collision.b2AABB=BN;Box2D.Collision.b2Bound=BM;Box2D.Collision.b2BoundValues=BG;Box2D.Collision.b2Collision=AS;Box2D.Collision.b2ContactID=AV;Box2D.Collision.b2ContactPoint=BU;Box2D.Collision.b2Distance=A5;Box2D.Collision.b2DistanceInput=Ad;Box2D.Collision.b2DistanceOutput=BT;Box2D.Collision.b2DistanceProxy=A9;Box2D.Collision.b2DynamicTree=A4;Box2D.Collision.b2DynamicTreeBroadPhase=BE;Box2D.Collision.b2DynamicTreeNode=BF;Box2D.Collision.b2DynamicTreePair=BK;Box2D.Collision.b2Manifold=A3;Box2D.Collision.b2ManifoldPoint=A1;Box2D.Collision.b2Point=Aj;Box2D.Collision.b2RayCastInput=AR;Box2D.Collision.b2RayCastOutput=AX;Box2D.Collision.b2Segment=BQ;Box2D.Collision.b2SeparationFunction=BL;Box2D.Collision.b2Simplex=BC;Box2D.Collision.b2SimplexCache=BP;Box2D.Collision.b2SimplexVertex=A8;Box2D.Collision.b2TimeOfImpact=BD;Box2D.Collision.b2TOIInput=A7;Box2D.Collision.b2WorldManifold=BZ;Box2D.Collision.ClipVertex=Az;Box2D.Collision.Features=As;Box2D.Collision.Shapes.b2CircleShape=An;Box2D.Collision.Shapes.b2EdgeChainDef=Ai;Box2D.Collision.Shapes.b2EdgeShape=Ak;Box2D.Collision.Shapes.b2MassData=Ae;Box2D.Collision.Shapes.b2PolygonShape=Ac;Box2D.Collision.Shapes.b2Shape=Af;Box2D.Common.b2internal="Box2D.Common.b2internal";Box2D.Common.b2Color=Aw;Box2D.Common.b2Settings=At;Box2D.Common.Math.b2Mat22=Ao;Box2D.Common.Math.b2Mat33=Av;Box2D.Common.Math.b2Math=Aq;Box2D.Common.Math.b2Sweep=Ap;Box2D.Common.Math.b2Transform=Ah;Box2D.Common.Math.b2Vec2=Ab;Box2D.Common.Math.b2Vec3=AZ;Box2D.Dynamics.b2Body=AW;Box2D.Dynamics.b2BodyDef=AY;Box2D.Dynamics.b2ContactFilter=AU;Box2D.Dynamics.b2ContactImpulse=BS;Box2D.Dynamics.b2ContactListener=BH;Box2D.Dynamics.b2ContactManager=A6;Box2D.Dynamics.b2DebugDraw=BA;Box2D.Dynamics.b2DestructionListener=A2;Box2D.Dynamics.b2FilterData=Bf;Box2D.Dynamics.b2Fixture=BB;Box2D.Dynamics.b2FixtureDef=Ag;Box2D.Dynamics.b2Island=AK;Box2D.Dynamics.b2TimeStep=AE;Box2D.Dynamics.b2World=AC;Box2D.Dynamics.Contacts.b2CircleContact=Bn;Box2D.Dynamics.Contacts.b2Contact=Bk;Box2D.Dynamics.Contacts.b2ContactConstraint=Bb;Box2D.Dynamics.Contacts.b2ContactConstraintPoint=Be;Box2D.Dynamics.Contacts.b2ContactEdge=BR;Box2D.Dynamics.Contacts.b2ContactFactory=BI;Box2D.Dynamics.Contacts.b2ContactRegister=Au;Box2D.Dynamics.Contacts.b2ContactResult=AO;Box2D.Dynamics.Contacts.b2ContactSolver=Al;Box2D.Dynamics.Contacts.b2EdgeAndCircleContact=AG;Box2D.Dynamics.Contacts.b2NullContact=AL;Box2D.Dynamics.Contacts.b2PolyAndCircleContact=Bp;Box2D.Dynamics.Contacts.b2PolyAndEdgeContact=Bh;Box2D.Dynamics.Contacts.b2PolygonContact=BW;Box2D.Dynamics.Contacts.b2PositionSolverManifold=AD;Box2D.Dynamics.Controllers.b2BuoyancyController=Ay;Box2D.Dynamics.Controllers.b2ConstantAccelController=AQ;Box2D.Dynamics.Controllers.b2ConstantForceController=AI;Box2D.Dynamics.Controllers.b2Controller=AB;Box2D.Dynamics.Controllers.b2ControllerEdge=Bj;Box2D.Dynamics.Controllers.b2GravityController=BY;Box2D.Dynamics.Controllers.b2TensorDampingController=A0;Box2D.Dynamics.Joints.b2DistanceJoint=Bm;Box2D.Dynamics.Joints.b2DistanceJointDef=Bd;Box2D.Dynamics.Joints.b2FrictionJoint=BO;Box2D.Dynamics.Joints.b2FrictionJointDef=Ar;Box2D.Dynamics.Joints.b2GearJoint=AN;Box2D.Dynamics.Joints.b2GearJointDef=AF;Box2D.Dynamics.Joints.b2Jacobian=AT;Box2D.Dynamics.Joints.b2Joint=Bo;Box2D.Dynamics.Joints.b2JointDef=Bg;Box2D.Dynamics.Joints.b2JointEdge=AJ;Box2D.Dynamics.Joints.b2LineJoint=BV;Box2D.Dynamics.Joints.b2LineJointDef=Ax;Box2D.Dynamics.Joints.b2MouseJoint=AP;Box2D.Dynamics.Joints.b2MouseJointDef=AH;Box2D.Dynamics.Joints.b2PrismaticJoint=AA;Box2D.Dynamics.Joints.b2PrismaticJointDef=Bi;Box2D.Dynamics.Joints.b2PulleyJoint=BX;Box2D.Dynamics.Joints.b2PulleyJointDef=Bl;Box2D.Dynamics.Joints.b2RevoluteJoint=Bc;Box2D.Dynamics.Joints.b2RevoluteJointDef=BJ;Box2D.Dynamics.Joints.b2WeldJoint=Am;Box2D.Dynamics.Joints.b2WeldJointDef=AM})();Box2D.postDefs=[];(function(){var AD=Box2D.Collision.Shapes.b2CircleShape,AC=Box2D.Collision.Shapes.b2PolygonShape,x=Box2D.Collision.Shapes.b2Shape,AK=Box2D.Common.b2Settings,AL=Box2D.Common.Math.b2Math,AH=Box2D.Common.Math.b2Sweep,X=Box2D.Common.Math.b2Transform,AO=Box2D.Common.Math.b2Vec2,AG=Box2D.Collision.b2AABB,f=Box2D.Collision.b2Bound,T=Box2D.Collision.b2BoundValues,s=Box2D.Collision.b2Collision,t=Box2D.Collision.b2ContactID,AA=Box2D.Collision.b2ContactPoint,P=Box2D.Collision.b2Distance,J=Box2D.Collision.b2DistanceInput,AS=Box2D.Collision.b2DistanceOutput,AJ=Box2D.Collision.b2DistanceProxy,AM=Box2D.Collision.b2DynamicTree,AF=Box2D.Collision.b2DynamicTreeBroadPhase,AB=Box2D.Collision.b2DynamicTreeNode,m=Box2D.Collision.b2DynamicTreePair,AE=Box2D.Collision.b2Manifold,e=Box2D.Collision.b2ManifoldPoint,r=Box2D.Collision.b2Point,b=Box2D.Collision.b2RayCastInput,AI=Box2D.Collision.b2RayCastOutput,C=Box2D.Collision.b2Segment,AW=Box2D.Collision.b2SeparationFunction,AU=Box2D.Collision.b2Simplex,AR=Box2D.Collision.b2SimplexCache,AT=Box2D.Collision.b2SimplexVertex,AP=Box2D.Collision.b2TimeOfImpact,AN=Box2D.Collision.b2TOIInput,AQ=Box2D.Collision.b2WorldManifold,AY=Box2D.Collision.ClipVertex,AX=Box2D.Collision.Features,AV=Box2D.Collision.IBroadPhase;AG.b2AABB=function(){this.lowerBound=new AO;this.upperBound=new AO};AG.prototype.IsValid=function(){var A=this.upperBound.y-this.lowerBound.y;return A=(A=this.upperBound.x-this.lowerBound.x>=0&&A>=0)&&this.lowerBound.IsValid()&&this.upperBound.IsValid()};AG.prototype.GetCenter=function(){return new AO((this.lowerBound.x+this.upperBound.x)/2,(this.lowerBound.y+this.upperBound.y)/2)};AG.prototype.GetExtents=function(){return new AO((this.upperBound.x-this.lowerBound.x)/2,(this.upperBound.y-this.lowerBound.y)/2)};AG.prototype.Contains=function(A){var B=true;return B=(B=(B=(B=B&&this.lowerBound.x<=A.lowerBound.x)&&this.lowerBound.y<=A.lowerBound.y)&&A.upperBound.x<=this.upperBound.x)&&A.upperBound.y<=this.upperBound.y};AG.prototype.RayCast=function(I,H){var G=-Number.MAX_VALUE,D=Number.MAX_VALUE,A=H.p1.x,O=H.p1.y,M=H.p2.x-H.p1.x,N=H.p2.y-H.p1.y,L=Math.abs(N),B=I.normal,K=0,E=0,F=K=0;F=0;if(Math.abs(M)<Number.MIN_VALUE){if(A<this.lowerBound.x||this.upperBound.x<A){return false}}else{K=1/M;E=(this.lowerBound.x-A)*K;K=(this.upperBound.x-A)*K;F=-1;if(E>K){F=E;E=K;K=F;F=1}if(E>G){B.x=F;B.y=0;G=E}D=Math.min(D,K);if(G>D){return false}}if(L<Number.MIN_VALUE){if(O<this.lowerBound.y||this.upperBound.y<O){return false}}else{K=1/N;E=(this.lowerBound.y-O)*K;K=(this.upperBound.y-O)*K;F=-1;if(E>K){F=E;E=K;K=F;F=1}if(E>G){B.y=F;B.x=0;G=E}D=Math.min(D,K);if(G>D){return false}}I.fraction=G;return true};AG.prototype.TestOverlap=function(A){var D=A.lowerBound.y-this.upperBound.y,B=this.lowerBound.y-A.upperBound.y;if(A.lowerBound.x-this.upperBound.x>0||D>0){return false}if(this.lowerBound.x-A.upperBound.x>0||B>0){return false}return true};AG.Combine=function(A,D){var B=new AG;B.Combine(A,D);return B};AG.prototype.Combine=function(A,B){this.lowerBound.x=Math.min(A.lowerBound.x,B.lowerBound.x);this.lowerBound.y=Math.min(A.lowerBound.y,B.lowerBound.y);this.upperBound.x=Math.max(A.upperBound.x,B.upperBound.x);this.upperBound.y=Math.max(A.upperBound.y,B.upperBound.y)};f.b2Bound=function(){};f.prototype.IsLower=function(){return(this.value&1)==0};f.prototype.IsUpper=function(){return(this.value&1)==1};f.prototype.Swap=function(B){var E=this.value,D=this.proxy,A=this.stabbingCount;this.value=B.value;this.proxy=B.proxy;this.stabbingCount=B.stabbingCount;B.value=E;B.proxy=D;B.stabbingCount=A};T.b2BoundValues=function(){};T.prototype.b2BoundValues=function(){this.lowerValues=new Vector_a2j_Number;this.lowerValues[0]=0;this.lowerValues[1]=0;this.upperValues=new Vector_a2j_Number;this.upperValues[0]=0;this.upperValues[1]=0};s.b2Collision=function(){};s.ClipSegmentToLine=function(F,E,D,B){if(B===undefined){B=0}var A,K=0;A=E[0];var H=A.v;A=E[1];var I=A.v,G=D.x*H.x+D.y*H.y-B;A=D.x*I.x+D.y*I.y-B;G<=0&&F[K++].Set(E[0]);A<=0&&F[K++].Set(E[1]);if(G*A<0){D=G/(G-A);A=F[K];A=A.v;A.x=H.x+D*(I.x-H.x);A.y=H.y+D*(I.y-H.y);A=F[K];A.id=(G>0?E[0]:E[1]).id;++K}return K};s.EdgeSeparation=function(K,I,H,E,A){if(H===undefined){H=0}parseInt(K.m_vertexCount);var Q=K.m_vertices;K=K.m_normals;var N=parseInt(E.m_vertexCount),O=E.m_vertices,M,B;M=I.R;B=K[H];K=M.col1.x*B.x+M.col2.x*B.y;E=M.col1.y*B.x+M.col2.y*B.y;M=A.R;var L=M.col1.x*K+M.col1.y*E;M=M.col2.x*K+M.col2.y*E;for(var F=0,G=Number.MAX_VALUE,D=0;D<N;++D){B=O[D];B=B.x*L+B.y*M;if(B<G){G=B;F=D}}B=Q[H];M=I.R;H=I.position.x+(M.col1.x*B.x+M.col2.x*B.y);I=I.position.y+(M.col1.y*B.x+M.col2.y*B.y);B=O[F];M=A.R;Q=A.position.x+(M.col1.x*B.x+M.col2.x*B.y);A=A.position.y+(M.col1.y*B.x+M.col2.y*B.y);Q-=H;A-=I;return Q*K+A*E};s.FindMaxSeparation=function(L,K,I,E,A){var R=parseInt(K.m_vertexCount),O=K.m_normals,Q,N;N=A.R;Q=E.m_centroid;var B=A.position.x+(N.col1.x*Q.x+N.col2.x*Q.y),M=A.position.y+(N.col1.y*Q.x+N.col2.y*Q.y);N=I.R;Q=K.m_centroid;B-=I.position.x+(N.col1.x*Q.x+N.col2.x*Q.y);M-=I.position.y+(N.col1.y*Q.x+N.col2.y*Q.y);N=B*I.R.col1.x+M*I.R.col1.y;M=B*I.R.col2.x+M*I.R.col2.y;B=0;for(var F=-Number.MAX_VALUE,H=0;H<R;++H){Q=O[H];Q=Q.x*N+Q.y*M;if(Q>F){F=Q;B=H}}O=s.EdgeSeparation(K,I,B,E,A);Q=parseInt(B-1>=0?B-1:R-1);N=s.EdgeSeparation(K,I,Q,E,A);M=parseInt(B+1<R?B+1:0);F=s.EdgeSeparation(K,I,M,E,A);var D=H=0,G=0;if(N>O&&N>F){G=-1;H=Q;D=N}else{if(F>O){G=1;H=M;D=F}else{L[0]=B;return O}}for(;;){B=G==-1?H-1>=0?H-1:R-1:H+1<R?H+1:0;O=s.EdgeSeparation(K,I,B,E,A);if(O>D){H=B;D=O}else{break}}L[0]=H;return D};s.FindIncidentEdge=function(H,G,F,D,A,N){if(D===undefined){D=0}parseInt(G.m_vertexCount);var L=G.m_normals,M=parseInt(A.m_vertexCount);G=A.m_vertices;A=A.m_normals;var K;K=F.R;F=L[D];L=K.col1.x*F.x+K.col2.x*F.y;var B=K.col1.y*F.x+K.col2.y*F.y;K=N.R;F=K.col1.x*L+K.col1.y*B;B=K.col2.x*L+K.col2.y*B;L=F;K=0;for(var I=Number.MAX_VALUE,E=0;E<M;++E){F=A[E];F=L*F.x+B*F.y;if(F<I){I=F;K=E}}A=parseInt(K);L=parseInt(A+1<M?A+1:0);M=H[0];F=G[A];K=N.R;M.v.x=N.position.x+(K.col1.x*F.x+K.col2.x*F.y);M.v.y=N.position.y+(K.col1.y*F.x+K.col2.y*F.y);M.id.features.referenceEdge=D;M.id.features.incidentEdge=A;M.id.features.incidentVertex=0;M=H[1];F=G[L];K=N.R;M.v.x=N.position.x+(K.col1.x*F.x+K.col2.x*F.y);M.v.y=N.position.y+(K.col1.y*F.x+K.col2.y*F.y);M.id.features.referenceEdge=D;M.id.features.incidentEdge=L;M.id.features.incidentVertex=1};s.MakeClipPointVector=function(){var A=new Vector(2);A[0]=new AY;A[1]=new AY;return A};s.CollidePolygons=function(M,K,I,E,A){var S;M.m_pointCount=0;var Q=K.m_radius+E.m_radius;S=0;s.s_edgeAO[0]=S;var R=s.FindMaxSeparation(s.s_edgeAO,K,I,E,A);S=s.s_edgeAO[0];if(!(R>Q)){var O=0;s.s_edgeBO[0]=O;var B=s.FindMaxSeparation(s.s_edgeBO,E,A,K,I);O=s.s_edgeBO[0];if(!(B>Q)){var N=0,F=0;if(B>0.98*R+0.001){R=E;E=K;K=A;I=I;N=O;M.m_type=AE.e_faceB;F=1}else{R=K;E=E;K=I;I=A;N=S;M.m_type=AE.e_faceA;F=0}S=s.s_incidentEdge;s.FindIncidentEdge(S,R,K,N,E,I);O=parseInt(R.m_vertexCount);A=R.m_vertices;R=A[N];var H;H=N+1<O?A[parseInt(N+1)]:A[0];N=s.s_localTangent;N.Set(H.x-R.x,H.y-R.y);N.Normalize();A=s.s_localNormal;A.x=N.y;A.y=-N.x;E=s.s_planePoint;E.Set(0.5*(R.x+H.x),0.5*(R.y+H.y));B=s.s_tangent;O=K.R;B.x=O.col1.x*N.x+O.col2.x*N.y;B.y=O.col1.y*N.x+O.col2.y*N.y;var D=s.s_tangent2;D.x=-B.x;D.y=-B.y;N=s.s_normal;N.x=B.y;N.y=-B.x;var G=s.s_v11,L=s.s_v12;G.x=K.position.x+(O.col1.x*R.x+O.col2.x*R.y);G.y=K.position.y+(O.col1.y*R.x+O.col2.y*R.y);L.x=K.position.x+(O.col1.x*H.x+O.col2.x*H.y);L.y=K.position.y+(O.col1.y*H.x+O.col2.y*H.y);K=N.x*G.x+N.y*G.y;O=B.x*L.x+B.y*L.y+Q;H=s.s_clipPoints1;R=s.s_clipPoints2;L=0;L=s.ClipSegmentToLine(H,S,D,-B.x*G.x-B.y*G.y+Q);if(!(L<2)){L=s.ClipSegmentToLine(R,H,B,O);if(!(L<2)){M.m_localPlaneNormal.SetV(A);M.m_localPoint.SetV(E);for(E=A=0;E<AK.b2_maxManifoldPoints;++E){S=R[E];if(N.x*S.v.x+N.y*S.v.y-K<=Q){B=M.m_points[A];O=I.R;D=S.v.x-I.position.x;G=S.v.y-I.position.y;B.m_localPoint.x=D*O.col1.x+G*O.col1.y;B.m_localPoint.y=D*O.col2.x+G*O.col2.y;B.m_id.Set(S.id);B.m_id.features.flip=F;++A}}M.m_pointCount=A}}}}};s.CollideCircles=function(B,I,H,A,G){B.m_pointCount=0;var F,D;F=H.R;D=I.m_p;var E=H.position.x+(F.col1.x*D.x+F.col2.x*D.y);H=H.position.y+(F.col1.y*D.x+F.col2.y*D.y);F=G.R;D=A.m_p;E=G.position.x+(F.col1.x*D.x+F.col2.x*D.y)-E;G=G.position.y+(F.col1.y*D.x+F.col2.y*D.y)-H;F=I.m_radius+A.m_radius;if(!(E*E+G*G>F*F)){B.m_type=AE.e_circles;B.m_localPoint.SetV(I.m_p);B.m_localPlaneNormal.SetZero();B.m_pointCount=1;B.m_points[0].m_localPoint.SetV(A.m_p);B.m_points[0].m_id.key=0}};s.CollidePolygonAndCircle=function(K,I,H,E,A){var Q=K.m_pointCount=0,N=0,O,M;M=A.R;O=E.m_p;var B=A.position.y+(M.col1.y*O.x+M.col2.y*O.y);Q=A.position.x+(M.col1.x*O.x+M.col2.x*O.y)-H.position.x;N=B-H.position.y;M=H.R;H=Q*M.col1.x+N*M.col1.y;M=Q*M.col2.x+N*M.col2.y;var L=0;B=-Number.MAX_VALUE;A=I.m_radius+E.m_radius;var F=parseInt(I.m_vertexCount),G=I.m_vertices;I=I.m_normals;for(var D=0;D<F;++D){O=G[D];Q=H-O.x;N=M-O.y;O=I[D];Q=O.x*Q+O.y*N;if(Q>A){return}if(Q>B){B=Q;L=D}}Q=parseInt(L);N=parseInt(Q+1<F?Q+1:0);O=G[Q];G=G[N];if(B<Number.MIN_VALUE){K.m_pointCount=1;K.m_type=AE.e_faceA;K.m_localPlaneNormal.SetV(I[L]);K.m_localPoint.x=0.5*(O.x+G.x);K.m_localPoint.y=0.5*(O.y+G.y)}else{B=(H-G.x)*(O.x-G.x)+(M-G.y)*(O.y-G.y);if((H-O.x)*(G.x-O.x)+(M-O.y)*(G.y-O.y)<=0){if((H-O.x)*(H-O.x)+(M-O.y)*(M-O.y)>A*A){return}K.m_pointCount=1;K.m_type=AE.e_faceA;K.m_localPlaneNormal.x=H-O.x;K.m_localPlaneNormal.y=M-O.y;K.m_localPlaneNormal.Normalize();K.m_localPoint.SetV(O)}else{if(B<=0){if((H-G.x)*(H-G.x)+(M-G.y)*(M-G.y)>A*A){return}K.m_pointCount=1;K.m_type=AE.e_faceA;K.m_localPlaneNormal.x=H-G.x;K.m_localPlaneNormal.y=M-G.y;K.m_localPlaneNormal.Normalize();K.m_localPoint.SetV(G)}else{L=0.5*(O.x+G.x);O=0.5*(O.y+G.y);B=(H-L)*I[Q].x+(M-O)*I[Q].y;if(B>A){return}K.m_pointCount=1;K.m_type=AE.e_faceA;K.m_localPlaneNormal.x=I[Q].x;K.m_localPlaneNormal.y=I[Q].y;K.m_localPlaneNormal.Normalize();K.m_localPoint.Set(L,O)}}}K.m_points[0].m_localPoint.SetV(E.m_p);K.m_points[0].m_id.key=0};s.TestOverlap=function(B,H){var G=H.lowerBound,A=B.upperBound,F=G.x-A.x,E=G.y-A.y;G=B.lowerBound;A=H.upperBound;var D=G.y-A.y;if(F>0||E>0){return false}if(G.x-A.x>0||D>0){return false}return true};Box2D.postDefs.push(function(){Box2D.Collision.b2Collision.s_incidentEdge=s.MakeClipPointVector();Box2D.Collision.b2Collision.s_clipPoints1=s.MakeClipPointVector();Box2D.Collision.b2Collision.s_clipPoints2=s.MakeClipPointVector();Box2D.Collision.b2Collision.s_edgeAO=new Vector_a2j_Number(1);Box2D.Collision.b2Collision.s_edgeBO=new Vector_a2j_Number(1);Box2D.Collision.b2Collision.s_localTangent=new AO;Box2D.Collision.b2Collision.s_localNormal=new AO;Box2D.Collision.b2Collision.s_planePoint=new AO;Box2D.Collision.b2Collision.s_normal=new AO;Box2D.Collision.b2Collision.s_tangent=new AO;Box2D.Collision.b2Collision.s_tangent2=new AO;Box2D.Collision.b2Collision.s_v11=new AO;Box2D.Collision.b2Collision.s_v12=new AO;Box2D.Collision.b2Collision.b2CollidePolyTempVec=new AO;Box2D.Collision.b2Collision.b2_nullFeature=255});t.b2ContactID=function(){this.features=new AX};t.prototype.b2ContactID=function(){this.features._m_id=this};t.prototype.Set=function(A){this.key=A._key};t.prototype.Copy=function(){var A=new t;A.key=this.key;return A};Object.defineProperty(t.prototype,"key",{enumerable:false,configurable:true,get:function(){return this._key}});Object.defineProperty(t.prototype,"key",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._key=A;this.features._referenceEdge=this._key&255;this.features._incidentEdge=(this._key&65280)>>8&255;this.features._incidentVertex=(this._key&16711680)>>16&255;this.features._flip=(this._key&4278190080)>>24&255}});AA.b2ContactPoint=function(){this.position=new AO;this.velocity=new AO;this.normal=new AO;this.id=new t};P.b2Distance=function(){};P.Distance=function(M,K,I){++P.b2_gjkCalls;var E=I.proxyA,A=I.proxyB,S=I.transformA,Q=I.transformB,R=P.s_simplex;R.ReadCache(K,E,S,A,Q);var O=R.m_vertices,B=P.s_saveA,N=P.s_saveB,F=0;R.GetClosestPoint().LengthSquared();for(var H=0,D,G=0;G<20;){F=R.m_count;for(H=0;H<F;H++){B[H]=O[H].indexA;N[H]=O[H].indexB}switch(R.m_count){case 1:break;case 2:R.Solve2();break;case 3:R.Solve3();break;default:AK.b2Assert(false)}if(R.m_count==3){break}D=R.GetClosestPoint();D.LengthSquared();H=R.GetSearchDirection();if(H.LengthSquared()<Number.MIN_VALUE*Number.MIN_VALUE){break}D=O[R.m_count];D.indexA=E.GetSupport(AL.MulTMV(S.R,H.GetNegative()));D.wA=AL.MulX(S,E.GetVertex(D.indexA));D.indexB=A.GetSupport(AL.MulTMV(Q.R,H));D.wB=AL.MulX(Q,A.GetVertex(D.indexB));D.w=AL.SubtractVV(D.wB,D.wA);++G;++P.b2_gjkIters;var L=false;for(H=0;H<F;H++){if(D.indexA==B[H]&&D.indexB==N[H]){L=true;break}}if(L){break}++R.m_count}P.b2_gjkMaxIters=AL.Max(P.b2_gjkMaxIters,G);R.GetWitnessPoints(M.pointA,M.pointB);M.distance=AL.SubtractVV(M.pointA,M.pointB).Length();M.iterations=G;R.WriteCache(K);if(I.useRadii){K=E.m_radius;A=A.m_radius;if(M.distance>K+A&&M.distance>Number.MIN_VALUE){M.distance-=K+A;I=AL.SubtractVV(M.pointB,M.pointA);I.Normalize();M.pointA.x+=K*I.x;M.pointA.y+=K*I.y;M.pointB.x-=A*I.x;M.pointB.y-=A*I.y}else{D=new AO;D.x=0.5*(M.pointA.x+M.pointB.x);D.y=0.5*(M.pointA.y+M.pointB.y);M.pointA.x=M.pointB.x=D.x;M.pointA.y=M.pointB.y=D.y;M.distance=0}}};Box2D.postDefs.push(function(){Box2D.Collision.b2Distance.s_simplex=new AU;Box2D.Collision.b2Distance.s_saveA=new Vector_a2j_Number(3);Box2D.Collision.b2Distance.s_saveB=new Vector_a2j_Number(3)});J.b2DistanceInput=function(){};AS.b2DistanceOutput=function(){this.pointA=new AO;this.pointB=new AO};AJ.b2DistanceProxy=function(){};AJ.prototype.Set=function(A){switch(A.GetType()){case x.e_circleShape:A=A instanceof AD?A:null;this.m_vertices=new Vector(1,true);this.m_vertices[0]=A.m_p;this.m_count=1;this.m_radius=A.m_radius;break;case x.e_polygonShape:A=A instanceof AC?A:null;this.m_vertices=A.m_vertices;this.m_count=A.m_vertexCount;this.m_radius=A.m_radius;break;default:AK.b2Assert(false)}};AJ.prototype.GetSupport=function(B){for(var F=0,E=this.m_vertices[0].x*B.x+this.m_vertices[0].y*B.y,A=1;A<this.m_count;++A){var D=this.m_vertices[A].x*B.x+this.m_vertices[A].y*B.y;if(D>E){F=A;E=D}}return F};AJ.prototype.GetSupportVertex=function(B){for(var F=0,E=this.m_vertices[0].x*B.x+this.m_vertices[0].y*B.y,A=1;A<this.m_count;++A){var D=this.m_vertices[A].x*B.x+this.m_vertices[A].y*B.y;if(D>E){F=A;E=D}}return this.m_vertices[F]};AJ.prototype.GetVertexCount=function(){return this.m_count};AJ.prototype.GetVertex=function(A){if(A===undefined){A=0}AK.b2Assert(0<=A&&A<this.m_count);return this.m_vertices[A]};AM.b2DynamicTree=function(){};AM.prototype.b2DynamicTree=function(){this.m_freeList=this.m_root=null;this.m_insertionCount=this.m_path=0};AM.prototype.CreateProxy=function(B,F){var E=this.AllocateNode(),A=AK.b2_aabbExtension,D=AK.b2_aabbExtension;E.aabb.lowerBound.x=B.lowerBound.x-A;E.aabb.lowerBound.y=B.lowerBound.y-D;E.aabb.upperBound.x=B.upperBound.x+A;E.aabb.upperBound.y=B.upperBound.y+D;E.userData=F;this.InsertLeaf(E);return E};AM.prototype.DestroyProxy=function(A){this.RemoveLeaf(A);this.FreeNode(A)};AM.prototype.MoveProxy=function(B,E,D){AK.b2Assert(B.IsLeaf());if(B.aabb.Contains(E)){return false}this.RemoveLeaf(B);var A=AK.b2_aabbExtension+AK.b2_aabbMultiplier*(D.x>0?D.x:-D.x);D=AK.b2_aabbExtension+AK.b2_aabbMultiplier*(D.y>0?D.y:-D.y);B.aabb.lowerBound.x=E.lowerBound.x-A;B.aabb.lowerBound.y=E.lowerBound.y-D;B.aabb.upperBound.x=E.upperBound.x+A;B.aabb.upperBound.y=E.upperBound.y+D;this.InsertLeaf(B);return true};AM.prototype.Rebalance=function(B){if(B===undefined){B=0}if(this.m_root!=null){for(var E=0;E<B;E++){for(var D=this.m_root,A=0;D.IsLeaf()==false;){D=this.m_path>>A&1?D.child2:D.child1;A=A+1&31}++this.m_path;this.RemoveLeaf(D);this.InsertLeaf(D)}}};AM.prototype.GetFatAABB=function(A){return A.aabb};AM.prototype.GetUserData=function(A){return A.userData};AM.prototype.Query=function(B,F){if(this.m_root!=null){var E=new Vector,A=0;for(E[A++]=this.m_root;A>0;){var D=E[--A];if(D.aabb.TestOverlap(F)){if(D.IsLeaf()){if(!B(D)){break}}else{E[A++]=D.child1;E[A++]=D.child2}}}}};AM.prototype.RayCast=function(H,G){if(this.m_root!=null){var F=G.p1,D=G.p2,A=AL.SubtractVV(F,D);A.Normalize();A=AL.CrossFV(1,A);var N=AL.AbsV(A),L=G.maxFraction,M=new AG,K=0,B=0;K=F.x+L*(D.x-F.x);B=F.y+L*(D.y-F.y);M.lowerBound.x=Math.min(F.x,K);M.lowerBound.y=Math.min(F.y,B);M.upperBound.x=Math.max(F.x,K);M.upperBound.y=Math.max(F.y,B);var I=new Vector,E=0;for(I[E++]=this.m_root;E>0;){L=I[--E];if(L.aabb.TestOverlap(M)!=false){K=L.aabb.GetCenter();B=L.aabb.GetExtents();if(!(Math.abs(A.x*(F.x-K.x)+A.y*(F.y-K.y))-N.x*B.x-N.y*B.y>0)){if(L.IsLeaf()){K=new b;K.p1=G.p1;K.p2=G.p2;K.maxFraction=G.maxFraction;L=H(K,L);if(L==0){break}if(L>0){K=F.x+L*(D.x-F.x);B=F.y+L*(D.y-F.y);M.lowerBound.x=Math.min(F.x,K);M.lowerBound.y=Math.min(F.y,B);M.upperBound.x=Math.max(F.x,K);M.upperBound.y=Math.max(F.y,B)}}else{I[E++]=L.child1;I[E++]=L.child2}}}}}};AM.prototype.AllocateNode=function(){if(this.m_freeList){var A=this.m_freeList;this.m_freeList=A.parent;A.parent=null;A.child1=null;A.child2=null;return A}return new AB};AM.prototype.FreeNode=function(A){A.parent=this.m_freeList;this.m_freeList=A};AM.prototype.InsertLeaf=function(B){++this.m_insertionCount;if(this.m_root==null){this.m_root=B;this.m_root.parent=null}else{var E=B.aabb.GetCenter(),D=this.m_root;if(D.IsLeaf()==false){do{var A=D.child1;D=D.child2;D=Math.abs((A.aabb.lowerBound.x+A.aabb.upperBound.x)/2-E.x)+Math.abs((A.aabb.lowerBound.y+A.aabb.upperBound.y)/2-E.y)<Math.abs((D.aabb.lowerBound.x+D.aabb.upperBound.x)/2-E.x)+Math.abs((D.aabb.lowerBound.y+D.aabb.upperBound.y)/2-E.y)?A:D}while(D.IsLeaf()==false)}E=D.parent;A=this.AllocateNode();A.parent=E;A.userData=null;A.aabb.Combine(B.aabb,D.aabb);if(E){if(D.parent.child1==D){E.child1=A}else{E.child2=A}A.child1=D;A.child2=B;D.parent=A;B.parent=A;do{if(E.aabb.Contains(A.aabb)){break}E.aabb.Combine(E.child1.aabb,E.child2.aabb);A=E;E=E.parent}while(E)}else{A.child1=D;A.child2=B;D.parent=A;this.m_root=B.parent=A}}};AM.prototype.RemoveLeaf=function(A){if(A==this.m_root){this.m_root=null}else{var D=A.parent,B=D.parent;A=D.child1==A?D.child2:D.child1;if(B){if(B.child1==D){B.child1=A}else{B.child2=A}A.parent=B;for(this.FreeNode(D);B;){D=B.aabb;B.aabb=AG.Combine(B.child1.aabb,B.child2.aabb);if(D.Contains(B.aabb)){break}B=B.parent}}else{this.m_root=A;A.parent=null;this.FreeNode(D)}}};AF.b2DynamicTreeBroadPhase=function(){this.m_tree=new AM;this.m_moveBuffer=new Vector;this.m_pairBuffer=new Vector;this.m_pairCount=0};AF.prototype.CreateProxy=function(A,D){var B=this.m_tree.CreateProxy(A,D);++this.m_proxyCount;this.BufferMove(B);return B};AF.prototype.DestroyProxy=function(A){this.UnBufferMove(A);--this.m_proxyCount;this.m_tree.DestroyProxy(A)};AF.prototype.MoveProxy=function(A,D,B){this.m_tree.MoveProxy(A,D,B)&&this.BufferMove(A)};AF.prototype.TestOverlap=function(B,E){var D=this.m_tree.GetFatAABB(B),A=this.m_tree.GetFatAABB(E);return D.TestOverlap(A)};AF.prototype.GetUserData=function(A){return this.m_tree.GetUserData(A)};AF.prototype.GetFatAABB=function(A){return this.m_tree.GetFatAABB(A)};AF.prototype.GetProxyCount=function(){return this.m_proxyCount};AF.prototype.UpdatePairs=function(B){var H=this;var G=H.m_pairCount=0,A;for(G=0;G<H.m_moveBuffer.length;++G){A=H.m_moveBuffer[G];var F=H.m_tree.GetFatAABB(A);H.m_tree.Query(function(K){if(K==A){return true}if(H.m_pairCount==H.m_pairBuffer.length){H.m_pairBuffer[H.m_pairCount]=new m}var I=H.m_pairBuffer[H.m_pairCount];I.proxyA=K<A?K:A;I.proxyB=K>=A?K:A;++H.m_pairCount;return true},F)}for(G=H.m_moveBuffer.length=0;G<H.m_pairCount;){F=H.m_pairBuffer[G];var E=H.m_tree.GetUserData(F.proxyA),D=H.m_tree.GetUserData(F.proxyB);B(E,D);for(++G;G<H.m_pairCount;){E=H.m_pairBuffer[G];if(E.proxyA!=F.proxyA||E.proxyB!=F.proxyB){break}++G}}};AF.prototype.Query=function(A,B){this.m_tree.Query(A,B)};AF.prototype.RayCast=function(A,B){this.m_tree.RayCast(A,B)};AF.prototype.Validate=function(){};AF.prototype.Rebalance=function(A){if(A===undefined){A=0}this.m_tree.Rebalance(A)};AF.prototype.BufferMove=function(A){this.m_moveBuffer[this.m_moveBuffer.length]=A};AF.prototype.UnBufferMove=function(A){this.m_moveBuffer.splice(parseInt(this.m_moveBuffer.indexOf(A)),1)};AF.prototype.ComparePairs=function(){return 0};AF.__implements={};AF.__implements[AV]=true;AB.b2DynamicTreeNode=function(){this.aabb=new AG};AB.prototype.IsLeaf=function(){return this.child1==null};m.b2DynamicTreePair=function(){};AE.b2Manifold=function(){this.m_pointCount=0};AE.prototype.b2Manifold=function(){this.m_points=new Vector(AK.b2_maxManifoldPoints);for(var A=0;A<AK.b2_maxManifoldPoints;A++){this.m_points[A]=new e}this.m_localPlaneNormal=new AO;this.m_localPoint=new AO};AE.prototype.Reset=function(){for(var A=0;A<AK.b2_maxManifoldPoints;A++){(this.m_points[A] instanceof e?this.m_points[A]:null).Reset()}this.m_localPlaneNormal.SetZero();this.m_localPoint.SetZero();this.m_pointCount=this.m_type=0};AE.prototype.Set=function(A){this.m_pointCount=A.m_pointCount;for(var B=0;B<AK.b2_maxManifoldPoints;B++){(this.m_points[B] instanceof e?this.m_points[B]:null).Set(A.m_points[B])}this.m_localPlaneNormal.SetV(A.m_localPlaneNormal);this.m_localPoint.SetV(A.m_localPoint);this.m_type=A.m_type};AE.prototype.Copy=function(){var A=new AE;A.Set(this);return A};Box2D.postDefs.push(function(){Box2D.Collision.b2Manifold.e_circles=1;Box2D.Collision.b2Manifold.e_faceA=2;Box2D.Collision.b2Manifold.e_faceB=4});e.b2ManifoldPoint=function(){this.m_localPoint=new AO;this.m_id=new t};e.prototype.b2ManifoldPoint=function(){this.Reset()};e.prototype.Reset=function(){this.m_localPoint.SetZero();this.m_tangentImpulse=this.m_normalImpulse=0;this.m_id.key=0};e.prototype.Set=function(A){this.m_localPoint.SetV(A.m_localPoint);this.m_normalImpulse=A.m_normalImpulse;this.m_tangentImpulse=A.m_tangentImpulse;this.m_id.Set(A.m_id)};r.b2Point=function(){this.p=new AO};r.prototype.Support=function(){return this.p};r.prototype.GetFirstVertex=function(){return this.p};b.b2RayCastInput=function(){this.p1=new AO;this.p2=new AO};b.prototype.b2RayCastInput=function(A,D,B){if(A===undefined){A=null}if(D===undefined){D=null}if(B===undefined){B=1}A&&this.p1.SetV(A);D&&this.p2.SetV(D);this.maxFraction=B};AI.b2RayCastOutput=function(){this.normal=new AO};C.b2Segment=function(){this.p1=new AO;this.p2=new AO};C.prototype.TestSegment=function(H,G,F,D){if(D===undefined){D=0}var A=F.p1,N=F.p2.x-A.x,L=F.p2.y-A.y;F=this.p2.y-this.p1.y;var M=-(this.p2.x-this.p1.x),K=100*Number.MIN_VALUE,B=-(N*F+L*M);if(B>K){var I=A.x-this.p1.x,E=A.y-this.p1.y;A=I*F+E*M;if(0<=A&&A<=D*B){D=-N*E+L*I;if(-K*B<=D&&D<=B*(1+K)){A/=B;D=Math.sqrt(F*F+M*M);F/=D;M/=D;H[0]=A;G.Set(F,M);return true}}}return false};C.prototype.Extend=function(A){this.ExtendForward(A);this.ExtendBackward(A)};C.prototype.ExtendForward=function(A){var D=this.p2.x-this.p1.x,B=this.p2.y-this.p1.y;A=Math.min(D>0?(A.upperBound.x-this.p1.x)/D:D<0?(A.lowerBound.x-this.p1.x)/D:Number.POSITIVE_INFINITY,B>0?(A.upperBound.y-this.p1.y)/B:B<0?(A.lowerBound.y-this.p1.y)/B:Number.POSITIVE_INFINITY);this.p2.x=this.p1.x+D*A;this.p2.y=this.p1.y+B*A};C.prototype.ExtendBackward=function(A){var D=-this.p2.x+this.p1.x,B=-this.p2.y+this.p1.y;A=Math.min(D>0?(A.upperBound.x-this.p2.x)/D:D<0?(A.lowerBound.x-this.p2.x)/D:Number.POSITIVE_INFINITY,B>0?(A.upperBound.y-this.p2.y)/B:B<0?(A.lowerBound.y-this.p2.y)/B:Number.POSITIVE_INFINITY);this.p1.x=this.p2.x+D*A;this.p1.y=this.p2.y+B*A};AW.b2SeparationFunction=function(){this.m_localPoint=new AO;this.m_axis=new AO};AW.prototype.Initialize=function(H,G,F,D,A){this.m_proxyA=G;this.m_proxyB=D;var N=parseInt(H.count);AK.b2Assert(0<N&&N<3);var L,M,K,B,I=B=K=D=G=0,E=0;I=0;if(N==1){this.m_type=AW.e_points;L=this.m_proxyA.GetVertex(H.indexA[0]);M=this.m_proxyB.GetVertex(H.indexB[0]);N=L;H=F.R;G=F.position.x+(H.col1.x*N.x+H.col2.x*N.y);D=F.position.y+(H.col1.y*N.x+H.col2.y*N.y);N=M;H=A.R;K=A.position.x+(H.col1.x*N.x+H.col2.x*N.y);B=A.position.y+(H.col1.y*N.x+H.col2.y*N.y);this.m_axis.x=K-G;this.m_axis.y=B-D;this.m_axis.Normalize()}else{if(H.indexB[0]==H.indexB[1]){this.m_type=AW.e_faceA;G=this.m_proxyA.GetVertex(H.indexA[0]);D=this.m_proxyA.GetVertex(H.indexA[1]);M=this.m_proxyB.GetVertex(H.indexB[0]);this.m_localPoint.x=0.5*(G.x+D.x);this.m_localPoint.y=0.5*(G.y+D.y);this.m_axis=AL.CrossVF(AL.SubtractVV(D,G),1);this.m_axis.Normalize();N=this.m_axis;H=F.R;I=H.col1.x*N.x+H.col2.x*N.y;E=H.col1.y*N.x+H.col2.y*N.y;N=this.m_localPoint;H=F.R;G=F.position.x+(H.col1.x*N.x+H.col2.x*N.y);D=F.position.y+(H.col1.y*N.x+H.col2.y*N.y);N=M;H=A.R;K=A.position.x+(H.col1.x*N.x+H.col2.x*N.y);B=A.position.y+(H.col1.y*N.x+H.col2.y*N.y);I=(K-G)*I+(B-D)*E}else{if(H.indexA[0]==H.indexA[0]){this.m_type=AW.e_faceB;K=this.m_proxyB.GetVertex(H.indexB[0]);B=this.m_proxyB.GetVertex(H.indexB[1]);L=this.m_proxyA.GetVertex(H.indexA[0]);this.m_localPoint.x=0.5*(K.x+B.x);this.m_localPoint.y=0.5*(K.y+B.y);this.m_axis=AL.CrossVF(AL.SubtractVV(B,K),1);this.m_axis.Normalize();N=this.m_axis;H=A.R;I=H.col1.x*N.x+H.col2.x*N.y;E=H.col1.y*N.x+H.col2.y*N.y;N=this.m_localPoint;H=A.R;K=A.position.x+(H.col1.x*N.x+H.col2.x*N.y);B=A.position.y+(H.col1.y*N.x+H.col2.y*N.y);N=L;H=F.R;G=F.position.x+(H.col1.x*N.x+H.col2.x*N.y);D=F.position.y+(H.col1.y*N.x+H.col2.y*N.y);I=(G-K)*I+(D-B)*E}else{G=this.m_proxyA.GetVertex(H.indexA[0]);D=this.m_proxyA.GetVertex(H.indexA[1]);K=this.m_proxyB.GetVertex(H.indexB[0]);B=this.m_proxyB.GetVertex(H.indexB[1]);AL.MulX(F,L);L=AL.MulMV(F.R,AL.SubtractVV(D,G));AL.MulX(A,M);I=AL.MulMV(A.R,AL.SubtractVV(B,K));A=L.x*L.x+L.y*L.y;M=I.x*I.x+I.y*I.y;H=AL.SubtractVV(I,L);F=L.x*H.x+L.y*H.y;H=I.x*H.x+I.y*H.y;L=L.x*I.x+L.y*I.y;E=A*M-L*L;I=0;if(E!=0){I=AL.Clamp((L*H-F*M)/E,0,1)}if((L*I+H)/M<0){I=AL.Clamp((L-F)/A,0,1)}L=new AO;L.x=G.x+I*(D.x-G.x);L.y=G.y+I*(D.y-G.y);M=new AO;M.x=K.x+I*(B.x-K.x);M.y=K.y+I*(B.y-K.y);if(I==0||I==1){this.m_type=AW.e_faceB;this.m_axis=AL.CrossVF(AL.SubtractVV(B,K),1);this.m_axis.Normalize();this.m_localPoint=M}else{this.m_type=AW.e_faceA;this.m_axis=AL.CrossVF(AL.SubtractVV(D,G),1);this.m_localPoint=L}}}I<0&&this.m_axis.NegativeSelf()}};AW.prototype.Evaluate=function(B,F){var E,A,D=0;switch(this.m_type){case AW.e_points:E=AL.MulTMV(B.R,this.m_axis);A=AL.MulTMV(F.R,this.m_axis.GetNegative());E=this.m_proxyA.GetSupportVertex(E);A=this.m_proxyB.GetSupportVertex(A);E=AL.MulX(B,E);A=AL.MulX(F,A);return D=(A.x-E.x)*this.m_axis.x+(A.y-E.y)*this.m_axis.y;case AW.e_faceA:D=AL.MulMV(B.R,this.m_axis);E=AL.MulX(B,this.m_localPoint);A=AL.MulTMV(F.R,D.GetNegative());A=this.m_proxyB.GetSupportVertex(A);A=AL.MulX(F,A);return D=(A.x-E.x)*D.x+(A.y-E.y)*D.y;case AW.e_faceB:D=AL.MulMV(F.R,this.m_axis);A=AL.MulX(F,this.m_localPoint);E=AL.MulTMV(B.R,D.GetNegative());E=this.m_proxyA.GetSupportVertex(E);E=AL.MulX(B,E);return D=(E.x-A.x)*D.x+(E.y-A.y)*D.y;default:AK.b2Assert(false);return 0}};Box2D.postDefs.push(function(){Box2D.Collision.b2SeparationFunction.e_points=1;Box2D.Collision.b2SeparationFunction.e_faceA=2;Box2D.Collision.b2SeparationFunction.e_faceB=4});AU.b2Simplex=function(){this.m_v1=new AT;this.m_v2=new AT;this.m_v3=new AT;this.m_vertices=new Vector(3)};AU.prototype.b2Simplex=function(){this.m_vertices[0]=this.m_v1;this.m_vertices[1]=this.m_v2;this.m_vertices[2]=this.m_v3};AU.prototype.ReadCache=function(G,F,E,D,A){AK.b2Assert(0<=G.count&&G.count<=3);var L,I;this.m_count=G.count;for(var K=this.m_vertices,H=0;H<this.m_count;H++){var B=K[H];B.indexA=G.indexA[H];B.indexB=G.indexB[H];L=F.GetVertex(B.indexA);I=D.GetVertex(B.indexB);B.wA=AL.MulX(E,L);B.wB=AL.MulX(A,I);B.w=AL.SubtractVV(B.wB,B.wA);B.a=0}if(this.m_count>1){G=G.metric;L=this.GetMetric();if(L<0.5*G||2*G<L||L<Number.MIN_VALUE){this.m_count=0}}if(this.m_count==0){B=K[0];B.indexA=0;B.indexB=0;L=F.GetVertex(0);I=D.GetVertex(0);B.wA=AL.MulX(E,L);B.wB=AL.MulX(A,I);B.w=AL.SubtractVV(B.wB,B.wA);this.m_count=1}};AU.prototype.WriteCache=function(A){A.metric=this.GetMetric();A.count=Box2D.parseUInt(this.m_count);for(var D=this.m_vertices,B=0;B<this.m_count;B++){A.indexA[B]=Box2D.parseUInt(D[B].indexA);A.indexB[B]=Box2D.parseUInt(D[B].indexB)}};AU.prototype.GetSearchDirection=function(){switch(this.m_count){case 1:return this.m_v1.w.GetNegative();case 2:var A=AL.SubtractVV(this.m_v2.w,this.m_v1.w);return AL.CrossVV(A,this.m_v1.w.GetNegative())>0?AL.CrossFV(1,A):AL.CrossVF(A,1);default:AK.b2Assert(false);return new AO}};AU.prototype.GetClosestPoint=function(){switch(this.m_count){case 0:AK.b2Assert(false);return new AO;case 1:return this.m_v1.w;case 2:return new AO(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y);default:AK.b2Assert(false);return new AO}};AU.prototype.GetWitnessPoints=function(A,B){switch(this.m_count){case 0:AK.b2Assert(false);break;case 1:A.SetV(this.m_v1.wA);B.SetV(this.m_v1.wB);break;case 2:A.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x;A.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y;B.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x;B.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:B.x=A.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+this.m_v3.a*this.m_v3.wA.x;B.y=A.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y;break;default:AK.b2Assert(false)}};AU.prototype.GetMetric=function(){switch(this.m_count){case 0:AK.b2Assert(false);return 0;case 1:return 0;case 2:return AL.SubtractVV(this.m_v1.w,this.m_v2.w).Length();case 3:return AL.CrossVV(AL.SubtractVV(this.m_v2.w,this.m_v1.w),AL.SubtractVV(this.m_v3.w,this.m_v1.w));default:AK.b2Assert(false);return 0}};AU.prototype.Solve2=function(){var A=this.m_v1.w,D=this.m_v2.w,B=AL.SubtractVV(D,A);A=-(A.x*B.x+A.y*B.y);if(A<=0){this.m_count=this.m_v1.a=1}else{D=D.x*B.x+D.y*B.y;if(D<=0){this.m_count=this.m_v2.a=1;this.m_v1.Set(this.m_v2)}else{B=1/(D+A);this.m_v1.a=D*B;this.m_v2.a=A*B;this.m_count=2}}};AU.prototype.Solve3=function(){var G=this.m_v1.w,F=this.m_v2.w,E=this.m_v3.w,D=AL.SubtractVV(F,G),A=AL.Dot(G,D),M=AL.Dot(F,D);A=-A;var K=AL.SubtractVV(E,G),L=AL.Dot(G,K),I=AL.Dot(E,K);L=-L;var B=AL.SubtractVV(E,F),H=AL.Dot(F,B);B=AL.Dot(E,B);H=-H;K=AL.CrossVV(D,K);D=K*AL.CrossVV(F,E);E=K*AL.CrossVV(E,G);G=K*AL.CrossVV(G,F);if(A<=0&&L<=0){this.m_count=this.m_v1.a=1}else{if(M>0&&A>0&&G<=0){I=1/(M+A);this.m_v1.a=M*I;this.m_v2.a=A*I;this.m_count=2}else{if(I>0&&L>0&&E<=0){M=1/(I+L);this.m_v1.a=I*M;this.m_v3.a=L*M;this.m_count=2;this.m_v2.Set(this.m_v3)}else{if(M<=0&&H<=0){this.m_count=this.m_v2.a=1;this.m_v1.Set(this.m_v2)}else{if(I<=0&&B<=0){this.m_count=this.m_v3.a=1;this.m_v1.Set(this.m_v3)}else{if(B>0&&H>0&&D<=0){M=1/(B+H);this.m_v2.a=B*M;this.m_v3.a=H*M;this.m_count=2;this.m_v1.Set(this.m_v3)}else{M=1/(D+E+G);this.m_v1.a=D*M;this.m_v2.a=E*M;this.m_v3.a=G*M;this.m_count=3}}}}}}};AR.b2SimplexCache=function(){this.indexA=new Vector_a2j_Number(3);this.indexB=new Vector_a2j_Number(3)};AT.b2SimplexVertex=function(){};AT.prototype.Set=function(A){this.wA.SetV(A.wA);this.wB.SetV(A.wB);this.w.SetV(A.w);this.a=A.a;this.indexA=A.indexA;this.indexB=A.indexB};AP.b2TimeOfImpact=function(){};AP.TimeOfImpact=function(N){++AP.b2_toiCalls;var L=N.proxyA,K=N.proxyB,E=N.sweepA,A=N.sweepB;AK.b2Assert(E.t0==A.t0);AK.b2Assert(1-E.t0>Number.MIN_VALUE);var U=L.m_radius+K.m_radius;N=N.tolerance;var R=0,S=0,Q=0;AP.s_cache.count=0;for(AP.s_distanceInput.useRadii=false;;){E.GetTransform(AP.s_xfA,R);A.GetTransform(AP.s_xfB,R);AP.s_distanceInput.proxyA=L;AP.s_distanceInput.proxyB=K;AP.s_distanceInput.transformA=AP.s_xfA;AP.s_distanceInput.transformB=AP.s_xfB;P.Distance(AP.s_distanceOutput,AP.s_cache,AP.s_distanceInput);if(AP.s_distanceOutput.distance<=0){R=1;break}AP.s_fcn.Initialize(AP.s_cache,L,AP.s_xfA,K,AP.s_xfB);var B=AP.s_fcn.Evaluate(AP.s_xfA,AP.s_xfB);if(B<=0){R=1;break}if(S==0){Q=B>U?AL.Max(U-N,0.75*U):AL.Max(B-N,0.02*U)}if(B-Q<0.5*N){if(S==0){R=1;break}break}var O=R,G=R,I=1;B=B;E.GetTransform(AP.s_xfA,I);A.GetTransform(AP.s_xfB,I);var D=AP.s_fcn.Evaluate(AP.s_xfA,AP.s_xfB);if(D>=Q){R=1;break}for(var H=0;;){var M=0;M=H&1?G+(Q-B)*(I-G)/(D-B):0.5*(G+I);E.GetTransform(AP.s_xfA,M);A.GetTransform(AP.s_xfB,M);var F=AP.s_fcn.Evaluate(AP.s_xfA,AP.s_xfB);if(AL.Abs(F-Q)<0.025*N){O=M;break}if(F>Q){G=M;B=F}else{I=M;D=F}++H;++AP.b2_toiRootIters;if(H==50){break}}AP.b2_toiMaxRootIters=AL.Max(AP.b2_toiMaxRootIters,H);if(O<(1+100*Number.MIN_VALUE)*R){break}R=O;S++;++AP.b2_toiIters;if(S==1000){break}}AP.b2_toiMaxIters=AL.Max(AP.b2_toiMaxIters,S);return R};Box2D.postDefs.push(function(){Box2D.Collision.b2TimeOfImpact.b2_toiCalls=0;Box2D.Collision.b2TimeOfImpact.b2_toiIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiMaxIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiRootIters=0;Box2D.Collision.b2TimeOfImpact.b2_toiMaxRootIters=0;Box2D.Collision.b2TimeOfImpact.s_cache=new AR;Box2D.Collision.b2TimeOfImpact.s_distanceInput=new J;Box2D.Collision.b2TimeOfImpact.s_xfA=new X;Box2D.Collision.b2TimeOfImpact.s_xfB=new X;Box2D.Collision.b2TimeOfImpact.s_fcn=new AW;Box2D.Collision.b2TimeOfImpact.s_distanceOutput=new AS});AN.b2TOIInput=function(){this.proxyA=new AJ;this.proxyB=new AJ;this.sweepA=new AH;this.sweepB=new AH};AQ.b2WorldManifold=function(){this.m_normal=new AO};AQ.prototype.b2WorldManifold=function(){this.m_points=new Vector(AK.b2_maxManifoldPoints);for(var A=0;A<AK.b2_maxManifoldPoints;A++){this.m_points[A]=new AO}};AQ.prototype.Initialize=function(I,H,G,D,A){if(G===undefined){G=0}if(A===undefined){A=0}if(I.m_pointCount!=0){var O=0,M,N,L=0,B=0,K=0,E=0,F=0;M=0;switch(I.m_type){case AE.e_circles:N=H.R;M=I.m_localPoint;O=H.position.x+N.col1.x*M.x+N.col2.x*M.y;H=H.position.y+N.col1.y*M.x+N.col2.y*M.y;N=D.R;M=I.m_points[0].m_localPoint;I=D.position.x+N.col1.x*M.x+N.col2.x*M.y;D=D.position.y+N.col1.y*M.x+N.col2.y*M.y;M=I-O;N=D-H;L=M*M+N*N;if(L>Number.MIN_VALUE*Number.MIN_VALUE){L=Math.sqrt(L);this.m_normal.x=M/L;this.m_normal.y=N/L}else{this.m_normal.x=1;this.m_normal.y=0}M=H+G*this.m_normal.y;D=D-A*this.m_normal.y;this.m_points[0].x=0.5*(O+G*this.m_normal.x+(I-A*this.m_normal.x));this.m_points[0].y=0.5*(M+D);break;case AE.e_faceA:N=H.R;M=I.m_localPlaneNormal;L=N.col1.x*M.x+N.col2.x*M.y;B=N.col1.y*M.x+N.col2.y*M.y;N=H.R;M=I.m_localPoint;K=H.position.x+N.col1.x*M.x+N.col2.x*M.y;E=H.position.y+N.col1.y*M.x+N.col2.y*M.y;this.m_normal.x=L;this.m_normal.y=B;for(O=0;O<I.m_pointCount;O++){N=D.R;M=I.m_points[O].m_localPoint;F=D.position.x+N.col1.x*M.x+N.col2.x*M.y;M=D.position.y+N.col1.y*M.x+N.col2.y*M.y;this.m_points[O].x=F+0.5*(G-(F-K)*L-(M-E)*B-A)*L;this.m_points[O].y=M+0.5*(G-(F-K)*L-(M-E)*B-A)*B}break;case AE.e_faceB:N=D.R;M=I.m_localPlaneNormal;L=N.col1.x*M.x+N.col2.x*M.y;B=N.col1.y*M.x+N.col2.y*M.y;N=D.R;M=I.m_localPoint;K=D.position.x+N.col1.x*M.x+N.col2.x*M.y;E=D.position.y+N.col1.y*M.x+N.col2.y*M.y;this.m_normal.x=-L;this.m_normal.y=-B;for(O=0;O<I.m_pointCount;O++){N=H.R;M=I.m_points[O].m_localPoint;F=H.position.x+N.col1.x*M.x+N.col2.x*M.y;M=H.position.y+N.col1.y*M.x+N.col2.y*M.y;this.m_points[O].x=F+0.5*(A-(F-K)*L-(M-E)*B-G)*L;this.m_points[O].y=M+0.5*(A-(F-K)*L-(M-E)*B-G)*B}}}};AY.ClipVertex=function(){this.v=new AO;this.id=new t};AY.prototype.Set=function(A){this.v.SetV(A.v);this.id.Set(A.id)};AX.Features=function(){};Object.defineProperty(AX.prototype,"referenceEdge",{enumerable:false,configurable:true,get:function(){return this._referenceEdge}});Object.defineProperty(AX.prototype,"referenceEdge",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._referenceEdge=A;this._m_id._key=this._m_id._key&4294967040|this._referenceEdge&255}});Object.defineProperty(AX.prototype,"incidentEdge",{enumerable:false,configurable:true,get:function(){return this._incidentEdge}});Object.defineProperty(AX.prototype,"incidentEdge",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._incidentEdge=A;this._m_id._key=this._m_id._key&4294902015|this._incidentEdge<<8&65280}});Object.defineProperty(AX.prototype,"incidentVertex",{enumerable:false,configurable:true,get:function(){return this._incidentVertex}});Object.defineProperty(AX.prototype,"incidentVertex",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._incidentVertex=A;this._m_id._key=this._m_id._key&4278255615|this._incidentVertex<<16&16711680}});Object.defineProperty(AX.prototype,"flip",{enumerable:false,configurable:true,get:function(){return this._flip}});Object.defineProperty(AX.prototype,"flip",{enumerable:false,configurable:true,set:function(A){if(A===undefined){A=0}this._flip=A;this._m_id._key=this._m_id._key&16777215|this._flip<<24&4278190080}})})();(function(){var f=Box2D.Common.b2Settings,e=Box2D.Collision.Shapes.b2CircleShape,X=Box2D.Collision.Shapes.b2EdgeChainDef,T=Box2D.Collision.Shapes.b2EdgeShape,b=Box2D.Collision.Shapes.b2MassData,H=Box2D.Collision.Shapes.b2PolygonShape,O=Box2D.Collision.Shapes.b2Shape,E=Box2D.Common.Math.b2Mat22,D=Box2D.Common.Math.b2Math,P=Box2D.Common.Math.b2Transform,N=Box2D.Common.Math.b2Vec2,R=Box2D.Collision.b2Distance,S=Box2D.Collision.b2DistanceInput,Z=Box2D.Collision.b2DistanceOutput,J=Box2D.Collision.b2DistanceProxy,C=Box2D.Collision.b2SimplexCache;Box2D.inherit(e,Box2D.Collision.Shapes.b2Shape);e.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;e.b2CircleShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments);this.m_p=new N};e.prototype.Copy=function(){var A=new e;A.Set(this);return A};e.prototype.Set=function(A){this.__super.Set.call(this,A);if(Box2D.is(A,e)){this.m_p.SetV((A instanceof e?A:null).m_p)}};e.prototype.TestPoint=function(A,G){var B=A.R,F=A.position.x+(B.col1.x*this.m_p.x+B.col2.x*this.m_p.y);B=A.position.y+(B.col1.y*this.m_p.x+B.col2.y*this.m_p.y);F=G.x-F;B=G.y-B;return F*F+B*B<=this.m_radius*this.m_radius};e.prototype.RayCast=function(B,K,M){var A=M.R,L=K.p1.x-(M.position.x+(A.col1.x*this.m_p.x+A.col2.x*this.m_p.y));M=K.p1.y-(M.position.y+(A.col1.y*this.m_p.x+A.col2.y*this.m_p.y));A=K.p2.x-K.p1.x;var G=K.p2.y-K.p1.y,Q=L*A+M*G,F=A*A+G*G,I=Q*Q-F*(L*L+M*M-this.m_radius*this.m_radius);if(I<0||F<Number.MIN_VALUE){return false}Q=-(Q+Math.sqrt(I));if(0<=Q&&Q<=K.maxFraction*F){Q/=F;B.fraction=Q;B.normal.x=L+Q*A;B.normal.y=M+Q*G;B.normal.Normalize();return true}return false};e.prototype.ComputeAABB=function(A,G){var B=G.R,F=G.position.x+(B.col1.x*this.m_p.x+B.col2.x*this.m_p.y);B=G.position.y+(B.col1.y*this.m_p.x+B.col2.y*this.m_p.y);A.lowerBound.Set(F-this.m_radius,B-this.m_radius);A.upperBound.Set(F+this.m_radius,B+this.m_radius)};e.prototype.ComputeMass=function(A,B){if(B===undefined){B=0}A.mass=B*f.b2_pi*this.m_radius*this.m_radius;A.center.SetV(this.m_p);A.I=A.mass*(0.5*this.m_radius*this.m_radius+(this.m_p.x*this.m_p.x+this.m_p.y*this.m_p.y))};e.prototype.ComputeSubmergedArea=function(A,K,B,I){if(K===undefined){K=0}B=D.MulX(B,this.m_p);var F=-(D.Dot(A,B)-K);if(F<-this.m_radius+Number.MIN_VALUE){return 0}if(F>this.m_radius){I.SetV(B);return Math.PI*this.m_radius*this.m_radius}K=this.m_radius*this.m_radius;var G=F*F;F=K*(Math.asin(F/this.m_radius)+Math.PI/2)+F*Math.sqrt(K-G);K=-2/3*Math.pow(K-G,1.5)/F;I.x=B.x+A.x*K;I.y=B.y+A.y*K;return F};e.prototype.GetLocalPosition=function(){return this.m_p};e.prototype.SetLocalPosition=function(A){this.m_p.SetV(A)};e.prototype.GetRadius=function(){return this.m_radius};e.prototype.SetRadius=function(A){if(A===undefined){A=0}this.m_radius=A};e.prototype.b2CircleShape=function(A){if(A===undefined){A=0}this.__super.b2Shape.call(this);this.m_type=O.e_circleShape;this.m_radius=A};X.b2EdgeChainDef=function(){};X.prototype.b2EdgeChainDef=function(){this.vertexCount=0;this.isALoop=true;this.vertices=[]};Box2D.inherit(T,Box2D.Collision.Shapes.b2Shape);T.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;T.b2EdgeShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments);this.s_supportVec=new N;this.m_v1=new N;this.m_v2=new N;this.m_coreV1=new N;this.m_coreV2=new N;this.m_normal=new N;this.m_direction=new N;this.m_cornerDir1=new N;this.m_cornerDir2=new N};T.prototype.TestPoint=function(){return false};T.prototype.RayCast=function(F,M,U){var B,Q=M.p2.x-M.p1.x,K=M.p2.y-M.p1.y;B=U.R;var V=U.position.x+(B.col1.x*this.m_v1.x+B.col2.x*this.m_v1.y),I=U.position.y+(B.col1.y*this.m_v1.x+B.col2.y*this.m_v1.y),L=U.position.y+(B.col1.y*this.m_v2.x+B.col2.y*this.m_v2.y)-I;U=-(U.position.x+(B.col1.x*this.m_v2.x+B.col2.x*this.m_v2.y)-V);B=100*Number.MIN_VALUE;var G=-(Q*L+K*U);if(G>B){V=M.p1.x-V;var A=M.p1.y-I;I=V*L+A*U;if(0<=I&&I<=M.maxFraction*G){M=-Q*A+K*V;if(-B*G<=M&&M<=G*(1+B)){I/=G;F.fraction=I;M=Math.sqrt(L*L+U*U);F.normal.x=L/M;F.normal.y=U/M;return true}}}return false};T.prototype.ComputeAABB=function(A,K){var B=K.R,I=K.position.x+(B.col1.x*this.m_v1.x+B.col2.x*this.m_v1.y),F=K.position.y+(B.col1.y*this.m_v1.x+B.col2.y*this.m_v1.y),G=K.position.x+(B.col1.x*this.m_v2.x+B.col2.x*this.m_v2.y);B=K.position.y+(B.col1.y*this.m_v2.x+B.col2.y*this.m_v2.y);if(I<G){A.lowerBound.x=I;A.upperBound.x=G}else{A.lowerBound.x=G;A.upperBound.x=I}if(F<B){A.lowerBound.y=F;A.upperBound.y=B}else{A.lowerBound.y=B;A.upperBound.y=F}};T.prototype.ComputeMass=function(A){A.mass=0;A.center.SetV(this.m_v1);A.I=0};T.prototype.ComputeSubmergedArea=function(A,L,B,K){if(L===undefined){L=0}var F=new N(A.x*L,A.y*L),I=D.MulX(B,this.m_v1);B=D.MulX(B,this.m_v2);var G=D.Dot(A,I)-L;A=D.Dot(A,B)-L;if(G>0){if(A>0){return 0}else{I.x=-A/(G-A)*I.x+G/(G-A)*B.x;I.y=-A/(G-A)*I.y+G/(G-A)*B.y}}else{if(A>0){B.x=-A/(G-A)*I.x+G/(G-A)*B.x;B.y=-A/(G-A)*I.y+G/(G-A)*B.y}}K.x=(F.x+I.x+B.x)/3;K.y=(F.y+I.y+B.y)/3;return 0.5*((I.x-F.x)*(B.y-F.y)-(I.y-F.y)*(B.x-F.x))};T.prototype.GetLength=function(){return this.m_length};T.prototype.GetVertex1=function(){return this.m_v1};T.prototype.GetVertex2=function(){return this.m_v2};T.prototype.GetCoreVertex1=function(){return this.m_coreV1};T.prototype.GetCoreVertex2=function(){return this.m_coreV2};T.prototype.GetNormalVector=function(){return this.m_normal};T.prototype.GetDirectionVector=function(){return this.m_direction};T.prototype.GetCorner1Vector=function(){return this.m_cornerDir1};T.prototype.GetCorner2Vector=function(){return this.m_cornerDir2};T.prototype.Corner1IsConvex=function(){return this.m_cornerConvex1};T.prototype.Corner2IsConvex=function(){return this.m_cornerConvex2};T.prototype.GetFirstVertex=function(A){var B=A.R;return new N(A.position.x+(B.col1.x*this.m_coreV1.x+B.col2.x*this.m_coreV1.y),A.position.y+(B.col1.y*this.m_coreV1.x+B.col2.y*this.m_coreV1.y))};T.prototype.GetNextEdge=function(){return this.m_nextEdge};T.prototype.GetPrevEdge=function(){return this.m_prevEdge};T.prototype.Support=function(A,L,B){if(L===undefined){L=0}if(B===undefined){B=0}var K=A.R,F=A.position.x+(K.col1.x*this.m_coreV1.x+K.col2.x*this.m_coreV1.y),I=A.position.y+(K.col1.y*this.m_coreV1.x+K.col2.y*this.m_coreV1.y),G=A.position.x+(K.col1.x*this.m_coreV2.x+K.col2.x*this.m_coreV2.y);A=A.position.y+(K.col1.y*this.m_coreV2.x+K.col2.y*this.m_coreV2.y);if(F*L+I*B>G*L+A*B){this.s_supportVec.x=F;this.s_supportVec.y=I}else{this.s_supportVec.x=G;this.s_supportVec.y=A}return this.s_supportVec};T.prototype.b2EdgeShape=function(A,B){this.__super.b2Shape.call(this);this.m_type=O.e_edgeShape;this.m_nextEdge=this.m_prevEdge=null;this.m_v1=A;this.m_v2=B;this.m_direction.Set(this.m_v2.x-this.m_v1.x,this.m_v2.y-this.m_v1.y);this.m_length=this.m_direction.Normalize();this.m_normal.Set(this.m_direction.y,-this.m_direction.x);this.m_coreV1.Set(-f.b2_toiSlop*(this.m_normal.x-this.m_direction.x)+this.m_v1.x,-f.b2_toiSlop*(this.m_normal.y-this.m_direction.y)+this.m_v1.y);this.m_coreV2.Set(-f.b2_toiSlop*(this.m_normal.x+this.m_direction.x)+this.m_v2.x,-f.b2_toiSlop*(this.m_normal.y+this.m_direction.y)+this.m_v2.y);this.m_cornerDir1=this.m_normal;this.m_cornerDir2.Set(-this.m_normal.x,-this.m_normal.y)};T.prototype.SetPrevEdge=function(A,G,B,F){this.m_prevEdge=A;this.m_coreV1=G;this.m_cornerDir1=B;this.m_cornerConvex1=F};T.prototype.SetNextEdge=function(A,G,B,F){this.m_nextEdge=A;this.m_coreV2=G;this.m_cornerDir2=B;this.m_cornerConvex2=F};b.b2MassData=function(){this.mass=0;this.center=new N(0,0);this.I=0};Box2D.inherit(H,Box2D.Collision.Shapes.b2Shape);H.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;H.b2PolygonShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments)};H.prototype.Copy=function(){var A=new H;A.Set(this);return A};H.prototype.Set=function(A){this.__super.Set.call(this,A);if(Box2D.is(A,H)){A=A instanceof H?A:null;this.m_centroid.SetV(A.m_centroid);this.m_vertexCount=A.m_vertexCount;this.Reserve(this.m_vertexCount);for(var B=0;B<this.m_vertexCount;B++){this.m_vertices[B].SetV(A.m_vertices[B]);this.m_normals[B].SetV(A.m_normals[B])}}};H.prototype.SetAsArray=function(A,I){if(I===undefined){I=0}var B=new Vector,G=0,F;for(G=0;G<A.length;++G){F=A[G];B.push(F)}this.SetAsVector(B,I)};H.AsArray=function(A,F){if(F===undefined){F=0}var B=new H;B.SetAsArray(A,F);return B};H.prototype.SetAsVector=function(A,I){if(I===undefined){I=0}if(I==0){I=A.length}f.b2Assert(2<=I);this.m_vertexCount=I;this.Reserve(I);var B=0;for(B=0;B<this.m_vertexCount;B++){this.m_vertices[B].SetV(A[B])}for(B=0;B<this.m_vertexCount;++B){var G=parseInt(B),F=parseInt(B+1<this.m_vertexCount?B+1:0);G=D.SubtractVV(this.m_vertices[F],this.m_vertices[G]);f.b2Assert(G.LengthSquared()>Number.MIN_VALUE);this.m_normals[B].SetV(D.CrossVF(G,1));this.m_normals[B].Normalize()}this.m_centroid=H.ComputeCentroid(this.m_vertices,this.m_vertexCount)};H.AsVector=function(A,F){if(F===undefined){F=0}var B=new H;B.SetAsVector(A,F);return B};H.prototype.SetAsBox=function(A,B){if(A===undefined){A=0}if(B===undefined){B=0}this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-A,-B);this.m_vertices[1].Set(A,-B);this.m_vertices[2].Set(A,B);this.m_vertices[3].Set(-A,B);this.m_normals[0].Set(0,-1);this.m_normals[1].Set(1,0);this.m_normals[2].Set(0,1);this.m_normals[3].Set(-1,0);this.m_centroid.SetZero()};H.AsBox=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}var B=new H;B.SetAsBox(A,F);return B};H.prototype.SetAsOrientedBox=function(A,G,B,F){if(A===undefined){A=0}if(G===undefined){G=0}if(B===undefined){B=null}if(F===undefined){F=0}this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-A,-G);this.m_vertices[1].Set(A,-G);this.m_vertices[2].Set(A,G);this.m_vertices[3].Set(-A,G);this.m_normals[0].Set(0,-1);this.m_normals[1].Set(1,0);this.m_normals[2].Set(0,1);this.m_normals[3].Set(-1,0);this.m_centroid=B;A=new P;A.position=B;A.R.Set(F);for(B=0;B<this.m_vertexCount;++B){this.m_vertices[B]=D.MulX(A,this.m_vertices[B]);this.m_normals[B]=D.MulMV(A.R,this.m_normals[B])}};H.AsOrientedBox=function(A,I,B,G){if(A===undefined){A=0}if(I===undefined){I=0}if(B===undefined){B=null}if(G===undefined){G=0}var F=new H;F.SetAsOrientedBox(A,I,B,G);return F};H.prototype.SetAsEdge=function(A,B){this.m_vertexCount=2;this.Reserve(2);this.m_vertices[0].SetV(A);this.m_vertices[1].SetV(B);this.m_centroid.x=0.5*(A.x+B.x);this.m_centroid.y=0.5*(A.y+B.y);this.m_normals[0]=D.CrossVF(D.SubtractVV(B,A),1);this.m_normals[0].Normalize();this.m_normals[1].x=-this.m_normals[0].x;this.m_normals[1].y=-this.m_normals[0].y};H.AsEdge=function(A,F){var B=new H;B.SetAsEdge(A,F);return B};H.prototype.TestPoint=function(A,M){var B;B=A.R;for(var L=M.x-A.position.x,F=M.y-A.position.y,K=L*B.col1.x+F*B.col1.y,I=L*B.col2.x+F*B.col2.y,G=0;G<this.m_vertexCount;++G){B=this.m_vertices[G];L=K-B.x;F=I-B.y;B=this.m_normals[G];if(B.x*L+B.y*F>0){return false}}return true};H.prototype.RayCast=function(G,U,W){var B=0,V=U.maxFraction,L=0,Y=0,K,M;L=U.p1.x-W.position.x;Y=U.p1.y-W.position.y;K=W.R;var I=L*K.col1.x+Y*K.col1.y,A=L*K.col2.x+Y*K.col2.y;L=U.p2.x-W.position.x;Y=U.p2.y-W.position.y;K=W.R;U=L*K.col1.x+Y*K.col1.y-I;K=L*K.col2.x+Y*K.col2.y-A;for(var F=parseInt(-1),Q=0;Q<this.m_vertexCount;++Q){M=this.m_vertices[Q];L=M.x-I;Y=M.y-A;M=this.m_normals[Q];L=M.x*L+M.y*Y;Y=M.x*U+M.y*K;if(Y==0){if(L<0){return false}}else{if(Y<0&&L<B*Y){B=L/Y;F=Q}else{if(Y>0&&L<V*Y){V=L/Y}}}if(V<B-Number.MIN_VALUE){return false}}if(F>=0){G.fraction=B;K=W.R;M=this.m_normals[F];G.normal.x=K.col1.x*M.x+K.col2.x*M.y;G.normal.y=K.col1.y*M.x+K.col2.y*M.y;return true}return false};H.prototype.ComputeAABB=function(B,L){for(var Q=L.R,A=this.m_vertices[0],M=L.position.x+(Q.col1.x*A.x+Q.col2.x*A.y),I=L.position.y+(Q.col1.y*A.x+Q.col2.y*A.y),U=M,G=I,K=1;K<this.m_vertexCount;++K){A=this.m_vertices[K];var F=L.position.x+(Q.col1.x*A.x+Q.col2.x*A.y);A=L.position.y+(Q.col1.y*A.x+Q.col2.y*A.y);M=M<F?M:F;I=I<A?I:A;U=U>F?U:F;G=G>A?G:A}B.lowerBound.x=M-this.m_radius;B.lowerBound.y=I-this.m_radius;B.upperBound.x=U+this.m_radius;B.upperBound.y=G+this.m_radius};H.prototype.ComputeMass=function(I,Y){if(Y===undefined){Y=0}if(this.m_vertexCount==2){I.center.x=0.5*(this.m_vertices[0].x+this.m_vertices[1].x);I.center.y=0.5*(this.m_vertices[0].y+this.m_vertices[1].y);I.mass=0;I.I=0}else{for(var m=0,B=0,g=0,U=0,n=1/3,M=0;M<this.m_vertexCount;++M){var V=this.m_vertices[M],L=M+1<this.m_vertexCount?this.m_vertices[parseInt(M+1)]:this.m_vertices[0],A=V.x-0,F=V.y-0,W=L.x-0,Q=L.y-0,G=A*Q-F*W,K=0.5*G;g+=K;m+=K*n*(0+V.x+L.x);B+=K*n*(0+V.y+L.y);V=A;F=F;W=W;Q=Q;U+=G*(n*(0.25*(V*V+W*V+W*W)+(0*V+0*W))+0+(n*(0.25*(F*F+Q*F+Q*Q)+(0*F+0*Q))+0))}I.mass=Y*g;m*=1/g;B*=1/g;I.center.Set(m,B);I.I=Y*U}};H.prototype.ComputeSubmergedArea=function(F,M,U,B){if(M===undefined){M=0}var Q=D.MulTMV(U.R,F),K=M-D.Dot(F,U.position),V=new Vector_a2j_Number,I=0,L=parseInt(-1);M=parseInt(-1);var G=false;for(F=F=0;F<this.m_vertexCount;++F){V[F]=D.Dot(Q,this.m_vertices[F])-K;var A=V[F]<-Number.MIN_VALUE;if(F>0){if(A){if(!G){L=F-1;I++}}else{if(G){M=F-1;I++}}}G=A}switch(I){case 0:if(G){F=new b;this.ComputeMass(F,1);B.SetV(D.MulX(U,F.center));return F.mass}else{return 0}case 1:if(L==-1){L=this.m_vertexCount-1}else{M=this.m_vertexCount-1}}F=parseInt((L+1)%this.m_vertexCount);Q=parseInt((M+1)%this.m_vertexCount);K=(0-V[L])/(V[F]-V[L]);V=(0-V[M])/(V[Q]-V[M]);L=new N(this.m_vertices[L].x*(1-K)+this.m_vertices[F].x*K,this.m_vertices[L].y*(1-K)+this.m_vertices[F].y*K);M=new N(this.m_vertices[M].x*(1-V)+this.m_vertices[Q].x*V,this.m_vertices[M].y*(1-V)+this.m_vertices[Q].y*V);V=0;K=new N;I=this.m_vertices[F];for(F=F;F!=Q;){F=(F+1)%this.m_vertexCount;G=F==Q?M:this.m_vertices[F];A=0.5*((I.x-L.x)*(G.y-L.y)-(I.y-L.y)*(G.x-L.x));V+=A;K.x+=A*(L.x+I.x+G.x)/3;K.y+=A*(L.y+I.y+G.y)/3;I=G}K.Multiply(1/V);B.SetV(D.MulX(U,K));return V};H.prototype.GetVertexCount=function(){return this.m_vertexCount};H.prototype.GetVertices=function(){return this.m_vertices};H.prototype.GetNormals=function(){return this.m_normals};H.prototype.GetSupport=function(A){for(var I=0,B=this.m_vertices[0].x*A.x+this.m_vertices[0].y*A.y,G=1;G<this.m_vertexCount;++G){var F=this.m_vertices[G].x*A.x+this.m_vertices[G].y*A.y;if(F>B){I=G;B=F}}return I};H.prototype.GetSupportVertex=function(A){for(var I=0,B=this.m_vertices[0].x*A.x+this.m_vertices[0].y*A.y,G=1;G<this.m_vertexCount;++G){var F=this.m_vertices[G].x*A.x+this.m_vertices[G].y*A.y;if(F>B){I=G;B=F}}return this.m_vertices[I]};H.prototype.Validate=function(){return false};H.prototype.b2PolygonShape=function(){this.__super.b2Shape.call(this);this.m_type=O.e_polygonShape;this.m_centroid=new N;this.m_vertices=new Vector;this.m_normals=new Vector};H.prototype.Reserve=function(A){if(A===undefined){A=0}for(var B=parseInt(this.m_vertices.length);B<A;B++){this.m_vertices[B]=new N;this.m_normals[B]=new N}};H.ComputeCentroid=function(B,K){if(K===undefined){K=0}for(var M=new N,A=0,L=1/3,G=0;G<K;++G){var Q=B[G],F=G+1<K?B[parseInt(G+1)]:B[0],I=0.5*((Q.x-0)*(F.y-0)-(Q.y-0)*(F.x-0));A+=I;M.x+=I*L*(0+Q.x+F.x);M.y+=I*L*(0+Q.y+F.y)}M.x*=1/A;M.y*=1/A;return M};H.ComputeOBB=function(g,K,M){if(M===undefined){M=0}var U=0,L=new Vector(M+1);for(U=0;U<M;++U){L[U]=K[U]}L[M]=L[0];K=Number.MAX_VALUE;for(U=1;U<=M;++U){var G=L[parseInt(U-1)],Q=L[U].x-G.x,F=L[U].y-G.y,I=Math.sqrt(Q*Q+F*F);Q/=I;F/=I;for(var B=-F,r=Q,A=I=Number.MAX_VALUE,p=-Number.MAX_VALUE,n=-Number.MAX_VALUE,Y=0;Y<M;++Y){var m=L[Y].x-G.x,W=L[Y].y-G.y,V=Q*m+F*W;m=B*m+r*W;if(V<I){I=V}if(m<A){A=m}if(V>p){p=V}if(m>n){n=m}}Y=(p-I)*(n-A);if(Y<0.95*K){K=Y;g.R.col1.x=Q;g.R.col1.y=F;g.R.col2.x=B;g.R.col2.y=r;Q=0.5*(I+p);F=0.5*(A+n);B=g.R;g.center.x=G.x+(B.col1.x*Q+B.col2.x*F);g.center.y=G.y+(B.col1.y*Q+B.col2.y*F);g.extents.x=0.5*(p-I);g.extents.y=0.5*(n-A)}}};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2PolygonShape.s_mat=new E});O.b2Shape=function(){};O.prototype.Copy=function(){return null};O.prototype.Set=function(A){this.m_radius=A.m_radius};O.prototype.GetType=function(){return this.m_type};O.prototype.TestPoint=function(){return false};O.prototype.RayCast=function(){return false};O.prototype.ComputeAABB=function(){};O.prototype.ComputeMass=function(){};O.prototype.ComputeSubmergedArea=function(){return 0};O.TestOverlap=function(A,I,B,G){var F=new S;F.proxyA=new J;F.proxyA.Set(A);F.proxyB=new J;F.proxyB.Set(B);F.transformA=I;F.transformB=G;F.useRadii=true;A=new C;A.count=0;I=new Z;R.Distance(I,A,F);return I.distance<10*Number.MIN_VALUE};O.prototype.b2Shape=function(){this.m_type=O.e_unknownShape;this.m_radius=f.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2Shape.e_unknownShape=parseInt(-1);Box2D.Collision.Shapes.b2Shape.e_circleShape=0;Box2D.Collision.Shapes.b2Shape.e_polygonShape=1;Box2D.Collision.Shapes.b2Shape.e_edgeShape=2;Box2D.Collision.Shapes.b2Shape.e_shapeTypeCount=3;Box2D.Collision.Shapes.b2Shape.e_hitCollide=1;Box2D.Collision.Shapes.b2Shape.e_missCollide=0;Box2D.Collision.Shapes.b2Shape.e_startsInsideCollide=parseInt(-1)})})();(function(){var C=Box2D.Common.b2Color,B=Box2D.Common.b2Settings,A=Box2D.Common.Math.b2Math;C.b2Color=function(){this._b=this._g=this._r=0};C.prototype.b2Color=function(F,E,D){if(F===undefined){F=0}if(E===undefined){E=0}if(D===undefined){D=0}this._r=Box2D.parseUInt(255*A.Clamp(F,0,1));this._g=Box2D.parseUInt(255*A.Clamp(E,0,1));this._b=Box2D.parseUInt(255*A.Clamp(D,0,1))};C.prototype.Set=function(F,E,D){if(F===undefined){F=0}if(E===undefined){E=0}if(D===undefined){D=0}this._r=Box2D.parseUInt(255*A.Clamp(F,0,1));this._g=Box2D.parseUInt(255*A.Clamp(E,0,1));this._b=Box2D.parseUInt(255*A.Clamp(D,0,1))};Object.defineProperty(C.prototype,"r",{enumerable:false,configurable:true,set:function(D){if(D===undefined){D=0}this._r=Box2D.parseUInt(255*A.Clamp(D,0,1))}});Object.defineProperty(C.prototype,"g",{enumerable:false,configurable:true,set:function(D){if(D===undefined){D=0}this._g=Box2D.parseUInt(255*A.Clamp(D,0,1))}});Object.defineProperty(C.prototype,"b",{enumerable:false,configurable:true,set:function(D){if(D===undefined){D=0}this._b=Box2D.parseUInt(255*A.Clamp(D,0,1))}});Object.defineProperty(C.prototype,"color",{enumerable:false,configurable:true,get:function(){return this._r<<16|this._g<<8|this._b}});B.b2Settings=function(){};B.b2MixFriction=function(E,D){if(E===undefined){E=0}if(D===undefined){D=0}return Math.sqrt(E*D)};B.b2MixRestitution=function(E,D){if(E===undefined){E=0}if(D===undefined){D=0}return E>D?E:D};B.b2Assert=function(D){if(!D){throw"Assertion Failed"}};Box2D.postDefs.push(function(){Box2D.Common.b2Settings.VERSION="2.1alpha";Box2D.Common.b2Settings.USHRT_MAX=65535;Box2D.Common.b2Settings.b2_pi=Math.PI;Box2D.Common.b2Settings.b2_maxManifoldPoints=2;Box2D.Common.b2Settings.b2_aabbExtension=0.1;Box2D.Common.b2Settings.b2_aabbMultiplier=2;Box2D.Common.b2Settings.b2_polygonRadius=2*B.b2_linearSlop;Box2D.Common.b2Settings.b2_linearSlop=0.005;Box2D.Common.b2Settings.b2_angularSlop=2/180*B.b2_pi;Box2D.Common.b2Settings.b2_toiSlop=8*B.b2_linearSlop;Box2D.Common.b2Settings.b2_maxTOIContactsPerIsland=32;Box2D.Common.b2Settings.b2_maxTOIJointsPerIsland=32;Box2D.Common.b2Settings.b2_velocityThreshold=1;Box2D.Common.b2Settings.b2_maxLinearCorrection=0.2;Box2D.Common.b2Settings.b2_maxAngularCorrection=8/180*B.b2_pi;Box2D.Common.b2Settings.b2_maxTranslation=2;Box2D.Common.b2Settings.b2_maxTranslationSquared=B.b2_maxTranslation*B.b2_maxTranslation;Box2D.Common.b2Settings.b2_maxRotation=0.5*B.b2_pi;Box2D.Common.b2Settings.b2_maxRotationSquared=B.b2_maxRotation*B.b2_maxRotation;Box2D.Common.b2Settings.b2_contactBaumgarte=0.2;Box2D.Common.b2Settings.b2_timeToSleep=0.5;Box2D.Common.b2Settings.b2_linearSleepTolerance=0.01;Box2D.Common.b2Settings.b2_angularSleepTolerance=2/180*B.b2_pi})})();(function(){var I=Box2D.Common.Math.b2Mat22,H=Box2D.Common.Math.b2Mat33,D=Box2D.Common.Math.b2Math,J=Box2D.Common.Math.b2Sweep,C=Box2D.Common.Math.b2Transform,B=Box2D.Common.Math.b2Vec2,E=Box2D.Common.Math.b2Vec3;I.b2Mat22=function(){this.col1=new B;this.col2=new B};I.prototype.b2Mat22=function(){this.SetIdentity()};I.FromAngle=function(A){if(A===undefined){A=0}var F=new I;F.Set(A);return F};I.FromVV=function(F,G){var A=new I;A.SetVV(F,G);return A};I.prototype.Set=function(A){if(A===undefined){A=0}var F=Math.cos(A);A=Math.sin(A);this.col1.x=F;this.col2.x=-A;this.col1.y=A;this.col2.y=F};I.prototype.SetVV=function(A,F){this.col1.SetV(A);this.col2.SetV(F)};I.prototype.Copy=function(){var A=new I;A.SetM(this);return A};I.prototype.SetM=function(A){this.col1.SetV(A.col1);this.col2.SetV(A.col2)};I.prototype.AddM=function(A){this.col1.x+=A.col1.x;this.col1.y+=A.col1.y;this.col2.x+=A.col2.x;this.col2.y+=A.col2.y};I.prototype.SetIdentity=function(){this.col1.x=1;this.col2.x=0;this.col1.y=0;this.col2.y=1};I.prototype.SetZero=function(){this.col1.x=0;this.col2.x=0;this.col1.y=0;this.col2.y=0};I.prototype.GetAngle=function(){return Math.atan2(this.col1.y,this.col1.x)};I.prototype.GetInverse=function(K){var O=this.col1.x,G=this.col2.x,F=this.col1.y,N=this.col2.y,A=O*N-G*F;if(A!=0){A=1/A}K.col1.x=A*N;K.col2.x=-A*G;K.col1.y=-A*F;K.col2.y=A*O;return K};I.prototype.Solve=function(O,R,N){if(R===undefined){R=0}if(N===undefined){N=0}var G=this.col1.x,P=this.col2.x,F=this.col1.y,K=this.col2.y,A=G*K-P*F;if(A!=0){A=1/A}O.x=A*(K*R-P*N);O.y=A*(G*N-F*R);return O};I.prototype.Abs=function(){this.col1.Abs();this.col2.Abs()};H.b2Mat33=function(){this.col1=new E;this.col2=new E;this.col3=new E};H.prototype.b2Mat33=function(F,G,A){if(F===undefined){F=null}if(G===undefined){G=null}if(A===undefined){A=null}if(!F&&!G&&!A){this.col1.SetZero();this.col2.SetZero();this.col3.SetZero()}else{this.col1.SetV(F);this.col2.SetV(G);this.col3.SetV(A)}};H.prototype.SetVVV=function(F,G,A){this.col1.SetV(F);this.col2.SetV(G);this.col3.SetV(A)};H.prototype.Copy=function(){return new H(this.col1,this.col2,this.col3)};H.prototype.SetM=function(A){this.col1.SetV(A.col1);this.col2.SetV(A.col2);this.col3.SetV(A.col3)};H.prototype.AddM=function(A){this.col1.x+=A.col1.x;this.col1.y+=A.col1.y;this.col1.z+=A.col1.z;this.col2.x+=A.col2.x;this.col2.y+=A.col2.y;this.col2.z+=A.col2.z;this.col3.x+=A.col3.x;this.col3.y+=A.col3.y;this.col3.z+=A.col3.z};H.prototype.SetIdentity=function(){this.col1.x=1;this.col2.x=0;this.col3.x=0;this.col1.y=0;this.col2.y=1;this.col3.y=0;this.col1.z=0;this.col2.z=0;this.col3.z=1};H.prototype.SetZero=function(){this.col1.x=0;this.col2.x=0;this.col3.x=0;this.col1.y=0;this.col2.y=0;this.col3.y=0;this.col1.z=0;this.col2.z=0;this.col3.z=0};H.prototype.Solve22=function(O,R,N){if(R===undefined){R=0}if(N===undefined){N=0}var G=this.col1.x,P=this.col2.x,F=this.col1.y,K=this.col2.y,A=G*K-P*F;if(A!=0){A=1/A}O.x=A*(K*R-P*N);O.y=A*(G*N-F*R);return O};H.prototype.Solve33=function(K,G,R,O){if(G===undefined){G=0}if(R===undefined){R=0}if(O===undefined){O=0}var S=this.col1.x,U=this.col1.y,X=this.col1.z,N=this.col2.x,F=this.col2.y,P=this.col2.z,T=this.col3.x,b=this.col3.y,A=this.col3.z,Z=S*(F*A-P*b)+U*(P*T-N*A)+X*(N*b-F*T);if(Z!=0){Z=1/Z}K.x=Z*(G*(F*A-P*b)+R*(P*T-N*A)+O*(N*b-F*T));K.y=Z*(S*(R*A-O*b)+U*(O*T-G*A)+X*(G*b-R*T));K.z=Z*(S*(F*O-P*R)+U*(P*G-N*O)+X*(N*R-F*G));return K};D.b2Math=function(){};D.IsValid=function(A){if(A===undefined){A=0}return isFinite(A)};D.Dot=function(A,F){return A.x*F.x+A.y*F.y};D.CrossVV=function(A,F){return A.x*F.y-A.y*F.x};D.CrossVF=function(A,F){if(F===undefined){F=0}return new B(F*A.y,-F*A.x)};D.CrossFV=function(A,F){if(A===undefined){A=0}return new B(-A*F.y,A*F.x)};D.MulMV=function(A,F){return new B(A.col1.x*F.x+A.col2.x*F.y,A.col1.y*F.x+A.col2.y*F.y)};D.MulTMV=function(A,F){return new B(D.Dot(F,A.col1),D.Dot(F,A.col2))};D.MulX=function(F,G){var A=D.MulMV(F.R,G);A.x+=F.position.x;A.y+=F.position.y;return A};D.MulXT=function(G,K){var F=D.SubtractVV(K,G.position),A=F.x*G.R.col1.x+F.y*G.R.col1.y;F.y=F.x*G.R.col2.x+F.y*G.R.col2.y;F.x=A;return F};D.AddVV=function(A,F){return new B(A.x+F.x,A.y+F.y)};D.SubtractVV=function(A,F){return new B(A.x-F.x,A.y-F.y)};D.Distance=function(G,K){var F=G.x-K.x,A=G.y-K.y;return Math.sqrt(F*F+A*A)};D.DistanceSquared=function(G,K){var F=G.x-K.x,A=G.y-K.y;return F*F+A*A};D.MulFV=function(A,F){if(A===undefined){A=0}return new B(A*F.x,A*F.y)};D.AddMM=function(A,F){return I.FromVV(D.AddVV(A.col1,F.col1),D.AddVV(A.col2,F.col2))};D.MulMM=function(A,F){return I.FromVV(D.MulMV(A,F.col1),D.MulMV(A,F.col2))};D.MulTMM=function(G,K){var F=new B(D.Dot(G.col1,K.col1),D.Dot(G.col2,K.col1)),A=new B(D.Dot(G.col1,K.col2),D.Dot(G.col2,K.col2));return I.FromVV(F,A)};D.Abs=function(A){if(A===undefined){A=0}return A>0?A:-A};D.AbsV=function(A){return new B(D.Abs(A.x),D.Abs(A.y))};D.AbsM=function(A){return I.FromVV(D.AbsV(A.col1),D.AbsV(A.col2))};D.Min=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}return A<F?A:F};D.MinV=function(A,F){return new B(D.Min(A.x,F.x),D.Min(A.y,F.y))};D.Max=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}return A>F?A:F};D.MaxV=function(A,F){return new B(D.Max(A.x,F.x),D.Max(A.y,F.y))};D.Clamp=function(F,G,A){if(F===undefined){F=0}if(G===undefined){G=0}if(A===undefined){A=0}return F<G?G:F>A?A:F};D.ClampV=function(F,G,A){return D.MaxV(G,D.MinV(F,A))};D.Swap=function(F,G){var A=F[0];F[0]=G[0];G[0]=A};D.Random=function(){return Math.random()*2-1};D.RandomRange=function(F,G){if(F===undefined){F=0}if(G===undefined){G=0}var A=Math.random();return A=(G-F)*A+F};D.NextPowerOfTwo=function(A){if(A===undefined){A=0}A|=A>>1&2147483647;A|=A>>2&1073741823;A|=A>>4&268435455;A|=A>>8&16777215;A|=A>>16&65535;return A+1};D.IsPowerOfTwo=function(A){if(A===undefined){A=0}return A>0&&(A&A-1)==0};Box2D.postDefs.push(function(){Box2D.Common.Math.b2Math.b2Vec2_zero=new B(0,0);Box2D.Common.Math.b2Math.b2Mat22_identity=I.FromVV(new B(1,0),new B(0,1));Box2D.Common.Math.b2Math.b2Transform_identity=new C(D.b2Vec2_zero,D.b2Mat22_identity)});J.b2Sweep=function(){this.localCenter=new B;this.c0=new B;this.c=new B};J.prototype.Set=function(A){this.localCenter.SetV(A.localCenter);this.c0.SetV(A.c0);this.c.SetV(A.c);this.a0=A.a0;this.a=A.a;this.t0=A.t0};J.prototype.Copy=function(){var A=new J;A.localCenter.SetV(this.localCenter);A.c0.SetV(this.c0);A.c.SetV(this.c);A.a0=this.a0;A.a=this.a;A.t0=this.t0;return A};J.prototype.GetTransform=function(F,G){if(G===undefined){G=0}F.position.x=(1-G)*this.c0.x+G*this.c.x;F.position.y=(1-G)*this.c0.y+G*this.c.y;F.R.Set((1-G)*this.a0+G*this.a);var A=F.R;F.position.x-=A.col1.x*this.localCenter.x+A.col2.x*this.localCenter.y;F.position.y-=A.col1.y*this.localCenter.x+A.col2.y*this.localCenter.y};J.prototype.Advance=function(A){if(A===undefined){A=0}if(this.t0<A&&1-this.t0>Number.MIN_VALUE){var F=(A-this.t0)/(1-this.t0);this.c0.x=(1-F)*this.c0.x+F*this.c.x;this.c0.y=(1-F)*this.c0.y+F*this.c.y;this.a0=(1-F)*this.a0+F*this.a;this.t0=A}};C.b2Transform=function(){this.position=new B;this.R=new I};C.prototype.b2Transform=function(A,F){if(A===undefined){A=null}if(F===undefined){F=null}if(A){this.position.SetV(A);this.R.SetM(F)}};C.prototype.Initialize=function(A,F){this.position.SetV(A);this.R.SetM(F)};C.prototype.SetIdentity=function(){this.position.SetZero();this.R.SetIdentity()};C.prototype.Set=function(A){this.position.SetV(A.position);this.R.SetM(A.R)};C.prototype.GetAngle=function(){return Math.atan2(this.R.col1.y,this.R.col1.x)};B.b2Vec2=function(){};B.prototype.b2Vec2=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}this.x=A;this.y=F};B.prototype.SetZero=function(){this.y=this.x=0};B.prototype.Set=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}this.x=A;this.y=F};B.prototype.SetV=function(A){this.x=A.x;this.y=A.y};B.prototype.GetNegative=function(){return new B(-this.x,-this.y)};B.prototype.NegativeSelf=function(){this.x=-this.x;this.y=-this.y};B.Make=function(A,F){if(A===undefined){A=0}if(F===undefined){F=0}return new B(A,F)};B.prototype.Copy=function(){return new B(this.x,this.y)};B.prototype.Add=function(A){this.x+=A.x;this.y+=A.y};B.prototype.Subtract=function(A){this.x-=A.x;this.y-=A.y};B.prototype.Multiply=function(A){if(A===undefined){A=0}this.x*=A;this.y*=A};B.prototype.MulM=function(A){var F=this.x;this.x=A.col1.x*F+A.col2.x*this.y;this.y=A.col1.y*F+A.col2.y*this.y};B.prototype.MulTM=function(A){var F=D.Dot(this,A.col1);this.y=D.Dot(this,A.col2);this.x=F};B.prototype.CrossVF=function(A){if(A===undefined){A=0}var F=this.x;this.x=A*this.y;this.y=-A*F};B.prototype.CrossFV=function(A){if(A===undefined){A=0}var F=this.x;this.x=-A*this.y;this.y=A*F};B.prototype.MinV=function(A){this.x=this.x<A.x?this.x:A.x;this.y=this.y<A.y?this.y:A.y};B.prototype.MaxV=function(A){this.x=this.x>A.x?this.x:A.x;this.y=this.y>A.y?this.y:A.y};B.prototype.Abs=function(){if(this.x<0){this.x=-this.x}if(this.y<0){this.y=-this.y}};B.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};B.prototype.LengthSquared=function(){return this.x*this.x+this.y*this.y};B.prototype.Normalize=function(){var A=Math.sqrt(this.x*this.x+this.y*this.y);if(A<Number.MIN_VALUE){return 0}var F=1/A;this.x*=F;this.y*=F;return A};B.prototype.IsValid=function(){return D.IsValid(this.x)&&D.IsValid(this.y)};E.b2Vec3=function(){};E.prototype.b2Vec3=function(F,G,A){if(F===undefined){F=0}if(G===undefined){G=0}if(A===undefined){A=0}this.x=F;this.y=G;this.z=A};E.prototype.SetZero=function(){this.x=this.y=this.z=0};E.prototype.Set=function(F,G,A){if(F===undefined){F=0}if(G===undefined){G=0}if(A===undefined){A=0}this.x=F;this.y=G;this.z=A};E.prototype.SetV=function(A){this.x=A.x;this.y=A.y;this.z=A.z};E.prototype.GetNegative=function(){return new E(-this.x,-this.y,-this.z)};E.prototype.NegativeSelf=function(){this.x=-this.x;this.y=-this.y;this.z=-this.z};E.prototype.Copy=function(){return new E(this.x,this.y,this.z)};E.prototype.Add=function(A){this.x+=A.x;this.y+=A.y;this.z+=A.z};E.prototype.Subtract=function(A){this.x-=A.x;this.y-=A.y;this.z-=A.z};E.prototype.Multiply=function(A){if(A===undefined){A=0}this.x*=A;this.y*=A;this.z*=A}})();(function(){var AG=Box2D.Common.Math.b2Math,AE=Box2D.Common.Math.b2Sweep,x=Box2D.Common.Math.b2Transform,AA=Box2D.Common.Math.b2Vec2,AD=Box2D.Common.b2Color,AL=Box2D.Common.b2Settings,X=Box2D.Collision.b2AABB,AM=Box2D.Collision.b2ContactPoint,AK=Box2D.Collision.b2DynamicTreeBroadPhase,f=Box2D.Collision.b2RayCastInput,T=Box2D.Collision.b2RayCastOutput,r=Box2D.Collision.Shapes.b2CircleShape,s=Box2D.Collision.Shapes.b2EdgeShape,AB=Box2D.Collision.Shapes.b2MassData,P=Box2D.Collision.Shapes.b2PolygonShape,J=Box2D.Collision.Shapes.b2Shape,AQ=Box2D.Dynamics.b2Body,t=Box2D.Dynamics.b2BodyDef,AF=Box2D.Dynamics.b2ContactFilter,AI=Box2D.Dynamics.b2ContactImpulse,AC=Box2D.Dynamics.b2ContactListener,g=Box2D.Dynamics.b2ContactManager,AH=Box2D.Dynamics.b2DebugDraw,e=Box2D.Dynamics.b2DestructionListener,m=Box2D.Dynamics.b2FilterData,b=Box2D.Dynamics.b2Fixture,AU=Box2D.Dynamics.b2FixtureDef,C=Box2D.Dynamics.b2Island,AT=Box2D.Dynamics.b2TimeStep,AS=Box2D.Dynamics.b2World,AP=Box2D.Dynamics.Contacts.b2Contact,AR=Box2D.Dynamics.Contacts.b2ContactFactory,AN=Box2D.Dynamics.Contacts.b2ContactSolver,AJ=Box2D.Dynamics.Joints.b2Joint,AO=Box2D.Dynamics.Joints.b2PulleyJoint;AQ.b2Body=function(){this.m_xf=new x;this.m_sweep=new AE;this.m_linearVelocity=new AA;this.m_force=new AA};AQ.prototype.connectEdges=function(B,G,D){if(D===undefined){D=0}var A=Math.atan2(G.GetDirectionVector().y,G.GetDirectionVector().x);D=AG.MulFV(Math.tan((A-D)*0.5),G.GetDirectionVector());D=AG.SubtractVV(D,G.GetNormalVector());D=AG.MulFV(AL.b2_toiSlop,D);D=AG.AddVV(D,G.GetVertex1());var F=AG.AddVV(B.GetDirectionVector(),G.GetDirectionVector());F.Normalize();var E=AG.Dot(B.GetDirectionVector(),G.GetNormalVector())>0;B.SetNextEdge(G,D,F,E);G.SetPrevEdge(B,D,F,E);return A};AQ.prototype.CreateFixture=function(A){if(this.m_world.IsLocked()==true){return null}var B=new b;B.Create(this,this.m_xf,A);this.m_flags&AQ.e_activeFlag&&B.CreateProxy(this.m_world.m_contactManager.m_broadPhase,this.m_xf);B.m_next=this.m_fixtureList;this.m_fixtureList=B;++this.m_fixtureCount;B.m_body=this;B.m_density>0&&this.ResetMassData();this.m_world.m_flags|=AS.e_newFixture;return B};AQ.prototype.CreateFixture2=function(A,D){if(D===undefined){D=0}var B=new AU;B.shape=A;B.density=D;return this.CreateFixture(B)};AQ.prototype.DestroyFixture=function(B){if(this.m_world.IsLocked()!=true){for(var F=this.m_fixtureList,D=null;F!=null;){if(F==B){if(D){D.m_next=B.m_next}else{this.m_fixtureList=B.m_next}break}D=F;F=F.m_next}for(F=this.m_contactList;F;){D=F.contact;F=F.next;var A=D.GetFixtureA(),E=D.GetFixtureB();if(B==A||B==E){this.m_world.m_contactManager.Destroy(D)}}this.m_flags&AQ.e_activeFlag&&B.DestroyProxy(this.m_world.m_contactManager.m_broadPhase);B.Destroy();B.m_body=null;B.m_next=null;--this.m_fixtureCount;this.ResetMassData()}};AQ.prototype.SetPositionAndAngle=function(B,E){if(E===undefined){E=0}var D;if(this.m_world.IsLocked()!=true){this.m_xf.R.Set(E);this.m_xf.position.SetV(B);D=this.m_xf.R;var A=this.m_sweep.localCenter;this.m_sweep.c.x=D.col1.x*A.x+D.col2.x*A.y;this.m_sweep.c.y=D.col1.y*A.x+D.col2.y*A.y;this.m_sweep.c.x+=this.m_xf.position.x;this.m_sweep.c.y+=this.m_xf.position.y;this.m_sweep.c0.SetV(this.m_sweep.c);this.m_sweep.a0=this.m_sweep.a=E;A=this.m_world.m_contactManager.m_broadPhase;for(D=this.m_fixtureList;D;D=D.m_next){D.Synchronize(A,this.m_xf,this.m_xf)}this.m_world.m_contactManager.FindNewContacts()}};AQ.prototype.SetTransform=function(A){this.SetPositionAndAngle(A.position,A.GetAngle())};AQ.prototype.GetTransform=function(){return this.m_xf};AQ.prototype.GetPosition=function(){return this.m_xf.position};AQ.prototype.SetPosition=function(A){this.SetPositionAndAngle(A,this.GetAngle())};AQ.prototype.GetAngle=function(){return this.m_sweep.a};AQ.prototype.SetAngle=function(A){if(A===undefined){A=0}this.SetPositionAndAngle(this.GetPosition(),A)};AQ.prototype.GetWorldCenter=function(){return this.m_sweep.c};AQ.prototype.GetLocalCenter=function(){return this.m_sweep.localCenter};AQ.prototype.SetLinearVelocity=function(A){this.m_type!=AQ.b2_staticBody&&this.m_linearVelocity.SetV(A)};AQ.prototype.GetLinearVelocity=function(){return this.m_linearVelocity};AQ.prototype.SetAngularVelocity=function(A){if(A===undefined){A=0}if(this.m_type!=AQ.b2_staticBody){this.m_angularVelocity=A}};AQ.prototype.GetAngularVelocity=function(){return this.m_angularVelocity};AQ.prototype.GetDefinition=function(){var A=new t;A.type=this.GetType();A.allowSleep=(this.m_flags&AQ.e_allowSleepFlag)==AQ.e_allowSleepFlag;A.angle=this.GetAngle();A.angularDamping=this.m_angularDamping;A.angularVelocity=this.m_angularVelocity;A.fixedRotation=(this.m_flags&AQ.e_fixedRotationFlag)==AQ.e_fixedRotationFlag;A.bullet=(this.m_flags&AQ.e_bulletFlag)==AQ.e_bulletFlag;A.awake=(this.m_flags&AQ.e_awakeFlag)==AQ.e_awakeFlag;A.linearDamping=this.m_linearDamping;A.linearVelocity.SetV(this.GetLinearVelocity());A.position=this.GetPosition();A.userData=this.GetUserData();return A};AQ.prototype.ApplyForce=function(A,B){if(this.m_type==AQ.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_force.x+=A.x;this.m_force.y+=A.y;this.m_torque+=(B.x-this.m_sweep.c.x)*A.y-(B.y-this.m_sweep.c.y)*A.x}};AQ.prototype.ApplyTorque=function(A){if(A===undefined){A=0}if(this.m_type==AQ.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_torque+=A}};AQ.prototype.ApplyImpulse=function(A,B){if(this.m_type==AQ.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_linearVelocity.x+=this.m_invMass*A.x;this.m_linearVelocity.y+=this.m_invMass*A.y;this.m_angularVelocity+=this.m_invI*((B.x-this.m_sweep.c.x)*A.y-(B.y-this.m_sweep.c.y)*A.x)}};AQ.prototype.Split=function(D){for(var I=this.GetLinearVelocity().Copy(),F=this.GetAngularVelocity(),B=this.GetWorldCenter(),H=this.m_world.CreateBody(this.GetDefinition()),G,A=this.m_fixtureList;A;){if(D(A)){var E=A.m_next;if(G){G.m_next=E}else{this.m_fixtureList=E}this.m_fixtureCount--;A.m_next=H.m_fixtureList;H.m_fixtureList=A;H.m_fixtureCount++;A.m_body=H;A=E}else{G=A;A=A.m_next}}this.ResetMassData();H.ResetMassData();G=this.GetWorldCenter();D=H.GetWorldCenter();G=AG.AddVV(I,AG.CrossFV(F,AG.SubtractVV(G,B)));I=AG.AddVV(I,AG.CrossFV(F,AG.SubtractVV(D,B)));this.SetLinearVelocity(G);H.SetLinearVelocity(I);this.SetAngularVelocity(F);H.SetAngularVelocity(F);this.SynchronizeFixtures();H.SynchronizeFixtures();return H};AQ.prototype.Merge=function(B){var F;for(F=B.m_fixtureList;F;){var D=F.m_next;B.m_fixtureCount--;F.m_next=this.m_fixtureList;this.m_fixtureList=F;this.m_fixtureCount++;F.m_body=E;F=D}A.m_fixtureCount=0;var A=this,E=B;A.GetWorldCenter();E.GetWorldCenter();A.GetLinearVelocity().Copy();E.GetLinearVelocity().Copy();A.GetAngularVelocity();E.GetAngularVelocity();A.ResetMassData();this.SynchronizeFixtures()};AQ.prototype.GetMass=function(){return this.m_mass};AQ.prototype.GetInertia=function(){return this.m_I};AQ.prototype.GetMassData=function(A){A.mass=this.m_mass;A.I=this.m_I;A.center.SetV(this.m_sweep.localCenter)};AQ.prototype.SetMassData=function(A){AL.b2Assert(this.m_world.IsLocked()==false);if(this.m_world.IsLocked()!=true){if(this.m_type==AQ.b2_dynamicBody){this.m_invI=this.m_I=this.m_invMass=0;this.m_mass=A.mass;if(this.m_mass<=0){this.m_mass=1}this.m_invMass=1/this.m_mass;if(A.I>0&&(this.m_flags&AQ.e_fixedRotationFlag)==0){this.m_I=A.I-this.m_mass*(A.center.x*A.center.x+A.center.y*A.center.y);this.m_invI=1/this.m_I}var B=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(A.center);this.m_sweep.c0.SetV(AG.MulX(this.m_xf,this.m_sweep.localCenter));this.m_sweep.c.SetV(this.m_sweep.c0);this.m_linearVelocity.x+=this.m_angularVelocity*-(this.m_sweep.c.y-B.y);this.m_linearVelocity.y+=this.m_angularVelocity*+(this.m_sweep.c.x-B.x)}}};AQ.prototype.ResetMassData=function(){this.m_invI=this.m_I=this.m_invMass=this.m_mass=0;this.m_sweep.localCenter.SetZero();if(!(this.m_type==AQ.b2_staticBody||this.m_type==AQ.b2_kinematicBody)){for(var A=AA.Make(0,0),D=this.m_fixtureList;D;D=D.m_next){if(D.m_density!=0){var B=D.GetMassData();this.m_mass+=B.mass;A.x+=B.center.x*B.mass;A.y+=B.center.y*B.mass;this.m_I+=B.I}}if(this.m_mass>0){this.m_invMass=1/this.m_mass;A.x*=this.m_invMass;A.y*=this.m_invMass}else{this.m_invMass=this.m_mass=1}if(this.m_I>0&&(this.m_flags&AQ.e_fixedRotationFlag)==0){this.m_I-=this.m_mass*(A.x*A.x+A.y*A.y);this.m_I*=this.m_inertiaScale;AL.b2Assert(this.m_I>0);this.m_invI=1/this.m_I}else{this.m_invI=this.m_I=0}D=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(A);this.m_sweep.c0.SetV(AG.MulX(this.m_xf,this.m_sweep.localCenter));this.m_sweep.c.SetV(this.m_sweep.c0);this.m_linearVelocity.x+=this.m_angularVelocity*-(this.m_sweep.c.y-D.y);this.m_linearVelocity.y+=this.m_angularVelocity*+(this.m_sweep.c.x-D.x)}};AQ.prototype.GetWorldPoint=function(A){var B=this.m_xf.R;A=new AA(B.col1.x*A.x+B.col2.x*A.y,B.col1.y*A.x+B.col2.y*A.y);A.x+=this.m_xf.position.x;A.y+=this.m_xf.position.y;return A};AQ.prototype.GetWorldVector=function(A){return AG.MulMV(this.m_xf.R,A)};AQ.prototype.GetLocalPoint=function(A){return AG.MulXT(this.m_xf,A)};AQ.prototype.GetLocalVector=function(A){return AG.MulTMV(this.m_xf.R,A)};AQ.prototype.GetLinearVelocityFromWorldPoint=function(A){return new AA(this.m_linearVelocity.x-this.m_angularVelocity*(A.y-this.m_sweep.c.y),this.m_linearVelocity.y+this.m_angularVelocity*(A.x-this.m_sweep.c.x))};AQ.prototype.GetLinearVelocityFromLocalPoint=function(A){var B=this.m_xf.R;A=new AA(B.col1.x*A.x+B.col2.x*A.y,B.col1.y*A.x+B.col2.y*A.y);A.x+=this.m_xf.position.x;A.y+=this.m_xf.position.y;return new AA(this.m_linearVelocity.x-this.m_angularVelocity*(A.y-this.m_sweep.c.y),this.m_linearVelocity.y+this.m_angularVelocity*(A.x-this.m_sweep.c.x))};AQ.prototype.GetLinearDamping=function(){return this.m_linearDamping};AQ.prototype.SetLinearDamping=function(A){if(A===undefined){A=0}this.m_linearDamping=A};AQ.prototype.GetAngularDamping=function(){return this.m_angularDamping};AQ.prototype.SetAngularDamping=function(A){if(A===undefined){A=0}this.m_angularDamping=A};AQ.prototype.SetType=function(A){if(A===undefined){A=0}if(this.m_type!=A){this.m_type=A;this.ResetMassData();if(this.m_type==AQ.b2_staticBody){this.m_linearVelocity.SetZero();this.m_angularVelocity=0}this.SetAwake(true);this.m_force.SetZero();this.m_torque=0;for(A=this.m_contactList;A;A=A.next){A.contact.FlagForFiltering()}}};AQ.prototype.GetType=function(){return this.m_type};AQ.prototype.SetBullet=function(A){if(A){this.m_flags|=AQ.e_bulletFlag}else{this.m_flags&=~AQ.e_bulletFlag}};AQ.prototype.IsBullet=function(){return(this.m_flags&AQ.e_bulletFlag)==AQ.e_bulletFlag};AQ.prototype.SetSleepingAllowed=function(A){if(A){this.m_flags|=AQ.e_allowSleepFlag}else{this.m_flags&=~AQ.e_allowSleepFlag;this.SetAwake(true)}};AQ.prototype.SetAwake=function(A){if(A){this.m_flags|=AQ.e_awakeFlag;this.m_sleepTime=0}else{this.m_flags&=~AQ.e_awakeFlag;this.m_sleepTime=0;this.m_linearVelocity.SetZero();this.m_angularVelocity=0;this.m_force.SetZero();this.m_torque=0}};AQ.prototype.IsAwake=function(){return(this.m_flags&AQ.e_awakeFlag)==AQ.e_awakeFlag};AQ.prototype.SetFixedRotation=function(A){if(A){this.m_flags|=AQ.e_fixedRotationFlag}else{this.m_flags&=~AQ.e_fixedRotationFlag}this.ResetMassData()};AQ.prototype.IsFixedRotation=function(){return(this.m_flags&AQ.e_fixedRotationFlag)==AQ.e_fixedRotationFlag};AQ.prototype.SetActive=function(A){if(A!=this.IsActive()){var B;if(A){this.m_flags|=AQ.e_activeFlag;A=this.m_world.m_contactManager.m_broadPhase;for(B=this.m_fixtureList;B;B=B.m_next){B.CreateProxy(A,this.m_xf)}}else{this.m_flags&=~AQ.e_activeFlag;A=this.m_world.m_contactManager.m_broadPhase;for(B=this.m_fixtureList;B;B=B.m_next){B.DestroyProxy(A)}for(A=this.m_contactList;A;){B=A;A=A.next;this.m_world.m_contactManager.Destroy(B.contact)}this.m_contactList=null}}};AQ.prototype.IsActive=function(){return(this.m_flags&AQ.e_activeFlag)==AQ.e_activeFlag};AQ.prototype.IsSleepingAllowed=function(){return(this.m_flags&AQ.e_allowSleepFlag)==AQ.e_allowSleepFlag};AQ.prototype.GetFixtureList=function(){return this.m_fixtureList};AQ.prototype.GetJointList=function(){return this.m_jointList};AQ.prototype.GetControllerList=function(){return this.m_controllerList};AQ.prototype.GetContactList=function(){return this.m_contactList};AQ.prototype.GetNext=function(){return this.m_next};AQ.prototype.GetUserData=function(){return this.m_userData};AQ.prototype.SetUserData=function(A){this.m_userData=A};AQ.prototype.GetWorld=function(){return this.m_world};AQ.prototype.b2Body=function(B,E){this.m_flags=0;if(B.bullet){this.m_flags|=AQ.e_bulletFlag}if(B.fixedRotation){this.m_flags|=AQ.e_fixedRotationFlag}if(B.allowSleep){this.m_flags|=AQ.e_allowSleepFlag}if(B.awake){this.m_flags|=AQ.e_awakeFlag}if(B.active){this.m_flags|=AQ.e_activeFlag}this.m_world=E;this.m_xf.position.SetV(B.position);this.m_xf.R.Set(B.angle);this.m_sweep.localCenter.SetZero();this.m_sweep.t0=1;this.m_sweep.a0=this.m_sweep.a=B.angle;var D=this.m_xf.R,A=this.m_sweep.localCenter;this.m_sweep.c.x=D.col1.x*A.x+D.col2.x*A.y;this.m_sweep.c.y=D.col1.y*A.x+D.col2.y*A.y;this.m_sweep.c.x+=this.m_xf.position.x;this.m_sweep.c.y+=this.m_xf.position.y;this.m_sweep.c0.SetV(this.m_sweep.c);this.m_contactList=this.m_controllerList=this.m_jointList=null;this.m_controllerCount=0;this.m_next=this.m_prev=null;this.m_linearVelocity.SetV(B.linearVelocity);this.m_angularVelocity=B.angularVelocity;this.m_linearDamping=B.linearDamping;this.m_angularDamping=B.angularDamping;this.m_force.Set(0,0);this.m_sleepTime=this.m_torque=0;this.m_type=B.type;if(this.m_type==AQ.b2_dynamicBody){this.m_invMass=this.m_mass=1}else{this.m_invMass=this.m_mass=0}this.m_invI=this.m_I=0;this.m_inertiaScale=B.inertiaScale;this.m_userData=B.userData;this.m_fixtureList=null;this.m_fixtureCount=0};AQ.prototype.SynchronizeFixtures=function(){var A=AQ.s_xf1;A.R.Set(this.m_sweep.a0);var D=A.R,B=this.m_sweep.localCenter;A.position.x=this.m_sweep.c0.x-(D.col1.x*B.x+D.col2.x*B.y);A.position.y=this.m_sweep.c0.y-(D.col1.y*B.x+D.col2.y*B.y);B=this.m_world.m_contactManager.m_broadPhase;for(D=this.m_fixtureList;D;D=D.m_next){D.Synchronize(B,A,this.m_xf)}};AQ.prototype.SynchronizeTransform=function(){this.m_xf.R.Set(this.m_sweep.a);var A=this.m_xf.R,B=this.m_sweep.localCenter;this.m_xf.position.x=this.m_sweep.c.x-(A.col1.x*B.x+A.col2.x*B.y);this.m_xf.position.y=this.m_sweep.c.y-(A.col1.y*B.x+A.col2.y*B.y)};AQ.prototype.ShouldCollide=function(A){if(this.m_type!=AQ.b2_dynamicBody&&A.m_type!=AQ.b2_dynamicBody){return false}for(var B=this.m_jointList;B;B=B.next){if(B.other==A){if(B.joint.m_collideConnected==false){return false}}}return true};AQ.prototype.Advance=function(A){if(A===undefined){A=0}this.m_sweep.Advance(A);this.m_sweep.c.SetV(this.m_sweep.c0);this.m_sweep.a=this.m_sweep.a0;this.SynchronizeTransform()};Box2D.postDefs.push(function(){Box2D.Dynamics.b2Body.s_xf1=new x;Box2D.Dynamics.b2Body.e_islandFlag=1;Box2D.Dynamics.b2Body.e_awakeFlag=2;Box2D.Dynamics.b2Body.e_allowSleepFlag=4;Box2D.Dynamics.b2Body.e_bulletFlag=8;Box2D.Dynamics.b2Body.e_fixedRotationFlag=16;Box2D.Dynamics.b2Body.e_activeFlag=32;Box2D.Dynamics.b2Body.b2_staticBody=0;Box2D.Dynamics.b2Body.b2_kinematicBody=1;Box2D.Dynamics.b2Body.b2_dynamicBody=2});t.b2BodyDef=function(){this.position=new AA;this.linearVelocity=new AA};t.prototype.b2BodyDef=function(){this.userData=null;this.position.Set(0,0);this.angle=0;this.linearVelocity.Set(0,0);this.angularDamping=this.linearDamping=this.angularVelocity=0;this.awake=this.allowSleep=true;this.bullet=this.fixedRotation=false;this.type=AQ.b2_staticBody;this.active=true;this.inertiaScale=1};AF.b2ContactFilter=function(){};AF.prototype.ShouldCollide=function(B,E){var D=B.GetFilterData(),A=E.GetFilterData();if(D.groupIndex==A.groupIndex&&D.groupIndex!=0){return D.groupIndex>0}return(D.maskBits&A.categoryBits)!=0&&(D.categoryBits&A.maskBits)!=0};AF.prototype.RayCollide=function(A,B){if(!A){return true}return this.ShouldCollide(A instanceof b?A:null,B)};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactFilter.b2_defaultFilter=new AF});AI.b2ContactImpulse=function(){this.normalImpulses=new Vector_a2j_Number(AL.b2_maxManifoldPoints);this.tangentImpulses=new Vector_a2j_Number(AL.b2_maxManifoldPoints)};AC.b2ContactListener=function(){};AC.prototype.BeginContact=function(){};AC.prototype.EndContact=function(){};AC.prototype.PreSolve=function(){};AC.prototype.PostSolve=function(){};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactListener.b2_defaultListener=new AC});g.b2ContactManager=function(){};g.prototype.b2ContactManager=function(){this.m_world=null;this.m_contactCount=0;this.m_contactFilter=AF.b2_defaultFilter;this.m_contactListener=AC.b2_defaultListener;this.m_contactFactory=new AR(this.m_allocator);this.m_broadPhase=new AK};g.prototype.AddPair=function(I,G){var D=I instanceof b?I:null,H=G instanceof b?G:null,F=D.GetBody(),E=H.GetBody();if(F!=E){for(var B=E.GetContactList();B;){if(B.other==F){var A=B.contact.GetFixtureA(),K=B.contact.GetFixtureB();if(A==D&&K==H){return}if(A==H&&K==D){return}}B=B.next}if(E.ShouldCollide(F)!=false){if(this.m_contactFilter.ShouldCollide(D,H)!=false){B=this.m_contactFactory.Create(D,H);D=B.GetFixtureA();H=B.GetFixtureB();F=D.m_body;E=H.m_body;B.m_prev=null;B.m_next=this.m_world.m_contactList;if(this.m_world.m_contactList!=null){this.m_world.m_contactList.m_prev=B}this.m_world.m_contactList=B;B.m_nodeA.contact=B;B.m_nodeA.other=E;B.m_nodeA.prev=null;B.m_nodeA.next=F.m_contactList;if(F.m_contactList!=null){F.m_contactList.prev=B.m_nodeA}F.m_contactList=B.m_nodeA;B.m_nodeB.contact=B;B.m_nodeB.other=F;B.m_nodeB.prev=null;B.m_nodeB.next=E.m_contactList;if(E.m_contactList!=null){E.m_contactList.prev=B.m_nodeB}E.m_contactList=B.m_nodeB;++this.m_world.m_contactCount}}}};g.prototype.FindNewContacts=function(){this.m_broadPhase.UpdatePairs(Box2D.generateCallback(this,this.AddPair))};g.prototype.Destroy=function(A){var D=A.GetFixtureA(),B=A.GetFixtureB();D=D.GetBody();B=B.GetBody();A.IsTouching()&&this.m_contactListener.EndContact(A);if(A.m_prev){A.m_prev.m_next=A.m_next}if(A.m_next){A.m_next.m_prev=A.m_prev}if(A==this.m_world.m_contactList){this.m_world.m_contactList=A.m_next}if(A.m_nodeA.prev){A.m_nodeA.prev.next=A.m_nodeA.next}if(A.m_nodeA.next){A.m_nodeA.next.prev=A.m_nodeA.prev}if(A.m_nodeA==D.m_contactList){D.m_contactList=A.m_nodeA.next}if(A.m_nodeB.prev){A.m_nodeB.prev.next=A.m_nodeB.next}if(A.m_nodeB.next){A.m_nodeB.next.prev=A.m_nodeB.prev}if(A.m_nodeB==B.m_contactList){B.m_contactList=A.m_nodeB.next}this.m_contactFactory.Destroy(A);--this.m_contactCount};g.prototype.Collide=function(){for(var B=this.m_world.m_contactList;B;){var F=B.GetFixtureA(),D=B.GetFixtureB(),A=F.GetBody(),E=D.GetBody();if(A.IsAwake()==false&&E.IsAwake()==false){B=B.GetNext()}else{if(B.m_flags&AP.e_filterFlag){if(E.ShouldCollide(A)==false){F=B;B=F.GetNext();this.Destroy(F);continue}if(this.m_contactFilter.ShouldCollide(F,D)==false){F=B;B=F.GetNext();this.Destroy(F);continue}B.m_flags&=~AP.e_filterFlag}if(this.m_broadPhase.TestOverlap(F.m_proxy,D.m_proxy)==false){F=B;B=F.GetNext();this.Destroy(F)}else{B.Update(this.m_contactListener);B=B.GetNext()}}}};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactManager.s_evalCP=new AM});AH.b2DebugDraw=function(){};AH.prototype.b2DebugDraw=function(){};AH.prototype.SetFlags=function(){};AH.prototype.GetFlags=function(){};AH.prototype.AppendFlags=function(){};AH.prototype.ClearFlags=function(){};AH.prototype.SetSprite=function(){};AH.prototype.GetSprite=function(){};AH.prototype.SetDrawScale=function(){};AH.prototype.GetDrawScale=function(){};AH.prototype.SetLineThickness=function(){};AH.prototype.GetLineThickness=function(){};AH.prototype.SetAlpha=function(){};AH.prototype.GetAlpha=function(){};AH.prototype.SetFillAlpha=function(){};AH.prototype.GetFillAlpha=function(){};AH.prototype.SetXFormScale=function(){};AH.prototype.GetXFormScale=function(){};AH.prototype.DrawPolygon=function(){};AH.prototype.DrawSolidPolygon=function(){};AH.prototype.DrawCircle=function(){};AH.prototype.DrawSolidCircle=function(){};AH.prototype.DrawSegment=function(){};AH.prototype.DrawTransform=function(){};Box2D.postDefs.push(function(){Box2D.Dynamics.b2DebugDraw.e_shapeBit=1;Box2D.Dynamics.b2DebugDraw.e_jointBit=2;Box2D.Dynamics.b2DebugDraw.e_aabbBit=4;Box2D.Dynamics.b2DebugDraw.e_pairBit=8;Box2D.Dynamics.b2DebugDraw.e_centerOfMassBit=16;Box2D.Dynamics.b2DebugDraw.e_controllerBit=32});e.b2DestructionListener=function(){};e.prototype.SayGoodbyeJoint=function(){};e.prototype.SayGoodbyeFixture=function(){};m.b2FilterData=function(){this.categoryBits=1;this.maskBits=65535;this.groupIndex=0};m.prototype.Copy=function(){var A=new m;A.categoryBits=this.categoryBits;A.maskBits=this.maskBits;A.groupIndex=this.groupIndex;return A};b.b2Fixture=function(){this.m_filter=new m};b.prototype.GetType=function(){return this.m_shape.GetType()};b.prototype.GetShape=function(){return this.m_shape};b.prototype.SetSensor=function(B){if(this.m_isSensor!=B){this.m_isSensor=B;if(this.m_body!=null){for(B=this.m_body.GetContactList();B;){var E=B.contact,D=E.GetFixtureA(),A=E.GetFixtureB();if(D==this||A==this){E.SetSensor(D.IsSensor()||A.IsSensor())}B=B.next}}}};b.prototype.IsSensor=function(){return this.m_isSensor};b.prototype.SetFilterData=function(B){this.m_filter=B.Copy();if(!this.m_body){for(B=this.m_body.GetContactList();B;){var E=B.contact,D=E.GetFixtureA(),A=E.GetFixtureB();if(D==this||A==this){E.FlagForFiltering()}B=B.next}}};b.prototype.GetFilterData=function(){return this.m_filter.Copy()};b.prototype.GetBody=function(){return this.m_body};b.prototype.GetNext=function(){return this.m_next};b.prototype.GetUserData=function(){return this.m_userData};b.prototype.SetUserData=function(A){this.m_userData=A};b.prototype.TestPoint=function(A){return this.m_shape.TestPoint(this.m_body.GetTransform(),A)};b.prototype.RayCast=function(A,B){return this.m_shape.RayCast(A,B,this.m_body.GetTransform())};b.prototype.GetMassData=function(A){if(A===undefined){A=null}if(A==null){A=new AB}this.m_shape.ComputeMass(A,this.m_density);return A};b.prototype.SetDensity=function(A){if(A===undefined){A=0}this.m_density=A};b.prototype.GetDensity=function(){return this.m_density};b.prototype.GetFriction=function(){return this.m_friction};b.prototype.SetFriction=function(A){if(A===undefined){A=0}this.m_friction=A};b.prototype.GetRestitution=function(){return this.m_restitution};b.prototype.SetRestitution=function(A){if(A===undefined){A=0}this.m_restitution=A};b.prototype.GetAABB=function(){return this.m_aabb};b.prototype.b2Fixture=function(){this.m_aabb=new X;this.m_shape=this.m_next=this.m_body=this.m_userData=null;this.m_restitution=this.m_friction=this.m_density=0};b.prototype.Create=function(A,D,B){this.m_userData=B.userData;this.m_friction=B.friction;this.m_restitution=B.restitution;this.m_body=A;this.m_next=null;this.m_filter=B.filter.Copy();this.m_isSensor=B.isSensor;this.m_shape=B.shape.Copy();this.m_density=B.density};b.prototype.Destroy=function(){this.m_shape=null};b.prototype.CreateProxy=function(A,B){this.m_shape.ComputeAABB(this.m_aabb,B);this.m_proxy=A.CreateProxy(this.m_aabb,this)};b.prototype.DestroyProxy=function(A){if(this.m_proxy!=null){A.DestroyProxy(this.m_proxy);this.m_proxy=null}};b.prototype.Synchronize=function(B,F,D){if(this.m_proxy){var A=new X,E=new X;this.m_shape.ComputeAABB(A,F);this.m_shape.ComputeAABB(E,D);this.m_aabb.Combine(A,E);F=AG.SubtractVV(D.position,F.position);B.MoveProxy(this.m_proxy,this.m_aabb,F)}};AU.b2FixtureDef=function(){this.filter=new m};AU.prototype.b2FixtureDef=function(){this.userData=this.shape=null;this.friction=0.2;this.density=this.restitution=0;this.filter.categoryBits=1;this.filter.maskBits=65535;this.filter.groupIndex=0;this.isSensor=false};C.b2Island=function(){};C.prototype.b2Island=function(){this.m_bodies=new Vector;this.m_contacts=new Vector;this.m_joints=new Vector};C.prototype.Initialize=function(D,H,E,B,G,F){if(D===undefined){D=0}if(H===undefined){H=0}if(E===undefined){E=0}var A=0;this.m_bodyCapacity=D;this.m_contactCapacity=H;this.m_jointCapacity=E;this.m_jointCount=this.m_contactCount=this.m_bodyCount=0;this.m_allocator=B;this.m_listener=G;this.m_contactSolver=F;for(A=this.m_bodies.length;A<D;A++){this.m_bodies[A]=null}for(A=this.m_contacts.length;A<H;A++){this.m_contacts[A]=null}for(A=this.m_joints.length;A<E;A++){this.m_joints[A]=null}};C.prototype.Clear=function(){this.m_jointCount=this.m_contactCount=this.m_bodyCount=0};C.prototype.Solve=function(D,I,F){var B=0,H=0,G;for(B=0;B<this.m_bodyCount;++B){H=this.m_bodies[B];if(H.GetType()==AQ.b2_dynamicBody){H.m_linearVelocity.x+=D.dt*(I.x+H.m_invMass*H.m_force.x);H.m_linearVelocity.y+=D.dt*(I.y+H.m_invMass*H.m_force.y);H.m_angularVelocity+=D.dt*H.m_invI*H.m_torque;H.m_linearVelocity.Multiply(AG.Clamp(1-D.dt*H.m_linearDamping,0,1));H.m_angularVelocity*=AG.Clamp(1-D.dt*H.m_angularDamping,0,1)}}this.m_contactSolver.Initialize(D,this.m_contacts,this.m_contactCount,this.m_allocator);I=this.m_contactSolver;I.InitVelocityConstraints(D);for(B=0;B<this.m_jointCount;++B){G=this.m_joints[B];G.InitVelocityConstraints(D)}for(B=0;B<D.velocityIterations;++B){for(H=0;H<this.m_jointCount;++H){G=this.m_joints[H];G.SolveVelocityConstraints(D)}I.SolveVelocityConstraints()}for(B=0;B<this.m_jointCount;++B){G=this.m_joints[B];G.FinalizeVelocityConstraints()}I.FinalizeVelocityConstraints();for(B=0;B<this.m_bodyCount;++B){H=this.m_bodies[B];if(H.GetType()!=AQ.b2_staticBody){var A=D.dt*H.m_linearVelocity.x,E=D.dt*H.m_linearVelocity.y;if(A*A+E*E>AL.b2_maxTranslationSquared){H.m_linearVelocity.Normalize();H.m_linearVelocity.x*=AL.b2_maxTranslation*D.inv_dt;H.m_linearVelocity.y*=AL.b2_maxTranslation*D.inv_dt}A=D.dt*H.m_angularVelocity;if(A*A>AL.b2_maxRotationSquared){H.m_angularVelocity=H.m_angularVelocity<0?-AL.b2_maxRotation*D.inv_dt:AL.b2_maxRotation*D.inv_dt}H.m_sweep.c0.SetV(H.m_sweep.c);H.m_sweep.a0=H.m_sweep.a;H.m_sweep.c.x+=D.dt*H.m_linearVelocity.x;H.m_sweep.c.y+=D.dt*H.m_linearVelocity.y;H.m_sweep.a+=D.dt*H.m_angularVelocity;H.SynchronizeTransform()}}for(B=0;B<D.positionIterations;++B){A=I.SolvePositionConstraints(AL.b2_contactBaumgarte);E=true;for(H=0;H<this.m_jointCount;++H){G=this.m_joints[H];G=G.SolvePositionConstraints(AL.b2_contactBaumgarte);E=E&&G}if(A&&E){break}}this.Report(I.m_constraints);if(F){F=Number.MAX_VALUE;I=AL.b2_linearSleepTolerance*AL.b2_linearSleepTolerance;A=AL.b2_angularSleepTolerance*AL.b2_angularSleepTolerance;for(B=0;B<this.m_bodyCount;++B){H=this.m_bodies[B];if(H.GetType()!=AQ.b2_staticBody){if((H.m_flags&AQ.e_allowSleepFlag)==0){F=H.m_sleepTime=0}if((H.m_flags&AQ.e_allowSleepFlag)==0||H.m_angularVelocity*H.m_angularVelocity>A||AG.Dot(H.m_linearVelocity,H.m_linearVelocity)>I){F=H.m_sleepTime=0}else{H.m_sleepTime+=D.dt;F=AG.Min(F,H.m_sleepTime)}}}if(F>=AL.b2_timeToSleep){for(B=0;B<this.m_bodyCount;++B){H=this.m_bodies[B];H.SetAwake(false)}}}};C.prototype.SolveTOI=function(D){var H=0,E=0;this.m_contactSolver.Initialize(D,this.m_contacts,this.m_contactCount,this.m_allocator);var B=this.m_contactSolver;for(H=0;H<this.m_jointCount;++H){this.m_joints[H].InitVelocityConstraints(D)}for(H=0;H<D.velocityIterations;++H){B.SolveVelocityConstraints();for(E=0;E<this.m_jointCount;++E){this.m_joints[E].SolveVelocityConstraints(D)}}for(H=0;H<this.m_bodyCount;++H){E=this.m_bodies[H];if(E.GetType()!=AQ.b2_staticBody){var G=D.dt*E.m_linearVelocity.x,F=D.dt*E.m_linearVelocity.y;if(G*G+F*F>AL.b2_maxTranslationSquared){E.m_linearVelocity.Normalize();E.m_linearVelocity.x*=AL.b2_maxTranslation*D.inv_dt;E.m_linearVelocity.y*=AL.b2_maxTranslation*D.inv_dt}G=D.dt*E.m_angularVelocity;if(G*G>AL.b2_maxRotationSquared){E.m_angularVelocity=E.m_angularVelocity<0?-AL.b2_maxRotation*D.inv_dt:AL.b2_maxRotation*D.inv_dt}E.m_sweep.c0.SetV(E.m_sweep.c);E.m_sweep.a0=E.m_sweep.a;E.m_sweep.c.x+=D.dt*E.m_linearVelocity.x;E.m_sweep.c.y+=D.dt*E.m_linearVelocity.y;E.m_sweep.a+=D.dt*E.m_angularVelocity;E.SynchronizeTransform()}}for(H=0;H<D.positionIterations;++H){G=B.SolvePositionConstraints(0.75);F=true;for(E=0;E<this.m_jointCount;++E){var A=this.m_joints[E].SolvePositionConstraints(AL.b2_contactBaumgarte);F=F&&A}if(G&&F){break}}this.Report(B.m_constraints)};C.prototype.Report=function(B){if(this.m_listener!=null){for(var F=0;F<this.m_contactCount;++F){for(var D=this.m_contacts[F],A=B[F],E=0;E<A.pointCount;++E){C.s_impulse.normalImpulses[E]=A.points[E].normalImpulse;C.s_impulse.tangentImpulses[E]=A.points[E].tangentImpulse}this.m_listener.PostSolve(D,C.s_impulse)}}};C.prototype.AddBody=function(A){A.m_islandIndex=this.m_bodyCount;this.m_bodies[this.m_bodyCount++]=A};C.prototype.AddContact=function(A){this.m_contacts[this.m_contactCount++]=A};C.prototype.AddJoint=function(A){this.m_joints[this.m_jointCount++]=A};Box2D.postDefs.push(function(){Box2D.Dynamics.b2Island.s_impulse=new AI});AT.b2TimeStep=function(){};AT.prototype.Set=function(A){this.dt=A.dt;this.inv_dt=A.inv_dt;this.positionIterations=A.positionIterations;this.velocityIterations=A.velocityIterations;this.warmStarting=A.warmStarting};AS.b2World=function(){this.s_stack=new Vector;this.m_contactManager=new g;this.m_contactSolver=new AN;this.m_island=new C};AS.prototype.b2World=function(A,B){this.m_controllerList=this.m_jointList=this.m_contactList=this.m_bodyList=this.m_debugDraw=this.m_destructionListener=null;this.m_controllerCount=this.m_jointCount=this.m_contactCount=this.m_bodyCount=0;AS.m_warmStarting=true;AS.m_continuousPhysics=true;this.m_allowSleep=B;this.m_gravity=A;this.m_inv_dt0=0;this.m_contactManager.m_world=this;this.m_groundBody=this.CreateBody(new t)};AS.prototype.SetDestructionListener=function(A){this.m_destructionListener=A};AS.prototype.SetContactFilter=function(A){this.m_contactManager.m_contactFilter=A};AS.prototype.SetContactListener=function(A){this.m_contactManager.m_contactListener=A};AS.prototype.SetDebugDraw=function(A){this.m_debugDraw=A};AS.prototype.SetBroadPhase=function(B){var E=this.m_contactManager.m_broadPhase;this.m_contactManager.m_broadPhase=B;for(var D=this.m_bodyList;D;D=D.m_next){for(var A=D.m_fixtureList;A;A=A.m_next){A.m_proxy=B.CreateProxy(E.GetFatAABB(A.m_proxy),A)}}};AS.prototype.Validate=function(){this.m_contactManager.m_broadPhase.Validate()};AS.prototype.GetProxyCount=function(){return this.m_contactManager.m_broadPhase.GetProxyCount()};AS.prototype.CreateBody=function(A){if(this.IsLocked()==true){return null}A=new AQ(A,this);A.m_prev=null;if(A.m_next=this.m_bodyList){this.m_bodyList.m_prev=A}this.m_bodyList=A;++this.m_bodyCount;return A};AS.prototype.DestroyBody=function(A){if(this.IsLocked()!=true){for(var D=A.m_jointList;D;){var B=D;D=D.next;this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(B.joint);this.DestroyJoint(B.joint)}for(D=A.m_controllerList;D;){B=D;D=D.nextController;B.controller.RemoveBody(A)}for(D=A.m_contactList;D;){B=D;D=D.next;this.m_contactManager.Destroy(B.contact)}A.m_contactList=null;for(D=A.m_fixtureList;D;){B=D;D=D.m_next;this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(B);B.DestroyProxy(this.m_contactManager.m_broadPhase);B.Destroy()}A.m_fixtureList=null;A.m_fixtureCount=0;if(A.m_prev){A.m_prev.m_next=A.m_next}if(A.m_next){A.m_next.m_prev=A.m_prev}if(A==this.m_bodyList){this.m_bodyList=A.m_next}--this.m_bodyCount}};AS.prototype.CreateJoint=function(B){var E=AJ.Create(B,null);E.m_prev=null;if(E.m_next=this.m_jointList){this.m_jointList.m_prev=E}this.m_jointList=E;++this.m_jointCount;E.m_edgeA.joint=E;E.m_edgeA.other=E.m_bodyB;E.m_edgeA.prev=null;if(E.m_edgeA.next=E.m_bodyA.m_jointList){E.m_bodyA.m_jointList.prev=E.m_edgeA}E.m_bodyA.m_jointList=E.m_edgeA;E.m_edgeB.joint=E;E.m_edgeB.other=E.m_bodyA;E.m_edgeB.prev=null;if(E.m_edgeB.next=E.m_bodyB.m_jointList){E.m_bodyB.m_jointList.prev=E.m_edgeB}E.m_bodyB.m_jointList=E.m_edgeB;var D=B.bodyA,A=B.bodyB;if(B.collideConnected==false){for(B=A.GetContactList();B;){B.other==D&&B.contact.FlagForFiltering();B=B.next}}return E};AS.prototype.DestroyJoint=function(B){var E=B.m_collideConnected;if(B.m_prev){B.m_prev.m_next=B.m_next}if(B.m_next){B.m_next.m_prev=B.m_prev}if(B==this.m_jointList){this.m_jointList=B.m_next}var D=B.m_bodyA,A=B.m_bodyB;D.SetAwake(true);A.SetAwake(true);if(B.m_edgeA.prev){B.m_edgeA.prev.next=B.m_edgeA.next}if(B.m_edgeA.next){B.m_edgeA.next.prev=B.m_edgeA.prev}if(B.m_edgeA==D.m_jointList){D.m_jointList=B.m_edgeA.next}B.m_edgeA.prev=null;B.m_edgeA.next=null;if(B.m_edgeB.prev){B.m_edgeB.prev.next=B.m_edgeB.next}if(B.m_edgeB.next){B.m_edgeB.next.prev=B.m_edgeB.prev}if(B.m_edgeB==A.m_jointList){A.m_jointList=B.m_edgeB.next}B.m_edgeB.prev=null;B.m_edgeB.next=null;AJ.Destroy(B,null);--this.m_jointCount;if(E==false){for(B=A.GetContactList();B;){B.other==D&&B.contact.FlagForFiltering();B=B.next}}};AS.prototype.AddController=function(A){A.m_next=this.m_controllerList;A.m_prev=null;this.m_controllerList=A;A.m_world=this;this.m_controllerCount++;return A};AS.prototype.RemoveController=function(A){if(A.m_prev){A.m_prev.m_next=A.m_next}if(A.m_next){A.m_next.m_prev=A.m_prev}if(this.m_controllerList==A){this.m_controllerList=A.m_next}this.m_controllerCount--};AS.prototype.CreateController=function(A){if(A.m_world!=this){throw Error("Controller can only be a member of one world")}A.m_next=this.m_controllerList;A.m_prev=null;if(this.m_controllerList){this.m_controllerList.m_prev=A}this.m_controllerList=A;++this.m_controllerCount;A.m_world=this;return A};AS.prototype.DestroyController=function(A){A.Clear();if(A.m_next){A.m_next.m_prev=A.m_prev}if(A.m_prev){A.m_prev.m_next=A.m_next}if(A==this.m_controllerList){this.m_controllerList=A.m_next}--this.m_controllerCount};AS.prototype.SetWarmStarting=function(A){AS.m_warmStarting=A};AS.prototype.SetContinuousPhysics=function(A){AS.m_continuousPhysics=A};AS.prototype.GetBodyCount=function(){return this.m_bodyCount};AS.prototype.GetJointCount=function(){return this.m_jointCount};AS.prototype.GetContactCount=function(){return this.m_contactCount};AS.prototype.SetGravity=function(A){this.m_gravity=A};AS.prototype.GetGravity=function(){return this.m_gravity};AS.prototype.GetGroundBody=function(){return this.m_groundBody};AS.prototype.Step=function(B,E,D){if(B===undefined){B=0}if(E===undefined){E=0}if(D===undefined){D=0}if(this.m_flags&AS.e_newFixture){this.m_contactManager.FindNewContacts();this.m_flags&=~AS.e_newFixture}this.m_flags|=AS.e_locked;var A=AS.s_timestep2;A.dt=B;A.velocityIterations=E;A.positionIterations=D;A.inv_dt=B>0?1/B:0;A.dtRatio=this.m_inv_dt0*B;A.warmStarting=AS.m_warmStarting;this.m_contactManager.Collide();A.dt>0&&this.Solve(A);AS.m_continuousPhysics&&A.dt>0&&this.SolveTOI(A);if(A.dt>0){this.m_inv_dt0=A.inv_dt}this.m_flags&=~AS.e_locked};AS.prototype.ClearForces=function(){for(var A=this.m_bodyList;A;A=A.m_next){A.m_force.SetZero();A.m_torque=0}};AS.prototype.DrawDebugData=function(){if(this.m_debugDraw!=null){this.m_debugDraw.m_sprite.graphics.clear();var D=this.m_debugDraw.GetFlags(),H,E,B;new AA;new AA;new AA;var G;new X;new X;G=[new AA,new AA,new AA,new AA];var F=new AD(0,0,0);if(D&AH.e_shapeBit){for(H=this.m_bodyList;H;H=H.m_next){G=H.m_xf;for(E=H.GetFixtureList();E;E=E.m_next){B=E.GetShape();if(H.IsActive()==false){F.Set(0.5,0.5,0.3)}else{if(H.GetType()==AQ.b2_staticBody){F.Set(0.5,0.9,0.5)}else{if(H.GetType()==AQ.b2_kinematicBody){F.Set(0.5,0.5,0.9)}else{H.IsAwake()==false?F.Set(0.6,0.6,0.6):F.Set(0.9,0.7,0.7)}}}this.DrawShape(B,G,F)}}}if(D&AH.e_jointBit){for(H=this.m_jointList;H;H=H.m_next){this.DrawJoint(H)}}if(D&AH.e_controllerBit){for(H=this.m_controllerList;H;H=H.m_next){H.Draw(this.m_debugDraw)}}if(D&AH.e_pairBit){F.Set(0.3,0.9,0.9);for(H=this.m_contactManager.m_contactList;H;H=H.GetNext()){B=H.GetFixtureA();E=H.GetFixtureB();B=B.GetAABB().GetCenter();E=E.GetAABB().GetCenter();this.m_debugDraw.DrawSegment(B,E,F)}}if(D&AH.e_aabbBit){B=this.m_contactManager.m_broadPhase;G=[new AA,new AA,new AA,new AA];for(H=this.m_bodyList;H;H=H.GetNext()){if(H.IsActive()!=false){for(E=H.GetFixtureList();E;E=E.GetNext()){var A=B.GetFatAABB(E.m_proxy);G[0].Set(A.lowerBound.x,A.lowerBound.y);G[1].Set(A.upperBound.x,A.lowerBound.y);G[2].Set(A.upperBound.x,A.upperBound.y);G[3].Set(A.lowerBound.x,A.upperBound.y);this.m_debugDraw.DrawPolygon(G,4,F)}}}}if(D&AH.e_centerOfMassBit){for(H=this.m_bodyList;H;H=H.m_next){G=AS.s_xf;G.R=H.m_xf.R;G.position=H.GetWorldCenter();this.m_debugDraw.DrawTransform(G)}}}};AS.prototype.QueryAABB=function(A,D){var B=this.m_contactManager.m_broadPhase;B.Query(function(E){return A(B.GetUserData(E))},D)};AS.prototype.QueryShape=function(B,F,D){if(D===undefined){D=null}if(D==null){D=new x;D.SetIdentity()}var A=this.m_contactManager.m_broadPhase,E=new X;F.ComputeAABB(E,D);A.Query(function(G){G=A.GetUserData(G) instanceof b?A.GetUserData(G):null;if(J.TestOverlap(F,D,G.GetShape(),G.GetBody().GetTransform())){return B(G)}return true},E)};AS.prototype.QueryPoint=function(B,E){var D=this.m_contactManager.m_broadPhase,A=new X;A.lowerBound.Set(E.x-AL.b2_linearSlop,E.y-AL.b2_linearSlop);A.upperBound.Set(E.x+AL.b2_linearSlop,E.y+AL.b2_linearSlop);D.Query(function(F){F=D.GetUserData(F) instanceof b?D.GetUserData(F):null;if(F.TestPoint(E)){return B(F)}return true},A)};AS.prototype.RayCast=function(B,G,D){var A=this.m_contactManager.m_broadPhase,F=new T,E=new f(G,D);A.RayCast(function(H,M){var L=A.GetUserData(M);L=L instanceof b?L:null;if(L.RayCast(F,H)){var I=F.fraction,K=new AA((1-I)*G.x+I*D.x,(1-I)*G.y+I*D.y);return B(L,K,F.normal,I)}return H.maxFraction},E)};AS.prototype.RayCastOne=function(A,D){var B;this.RayCast(function(F,H,G,E){if(E===undefined){E=0}B=F;return E},A,D);return B};AS.prototype.RayCastAll=function(A,D){var B=new Vector;this.RayCast(function(E){B[B.length]=E;return 1},A,D);return B};AS.prototype.GetBodyList=function(){return this.m_bodyList};AS.prototype.GetJointList=function(){return this.m_jointList};AS.prototype.GetContactList=function(){return this.m_contactList};AS.prototype.IsLocked=function(){return(this.m_flags&AS.e_locked)>0};AS.prototype.Solve=function(D){for(var I,F=this.m_controllerList;F;F=F.m_next){F.Step(D)}F=this.m_island;F.Initialize(this.m_bodyCount,this.m_contactCount,this.m_jointCount,null,this.m_contactManager.m_contactListener,this.m_contactSolver);for(I=this.m_bodyList;I;I=I.m_next){I.m_flags&=~AQ.e_islandFlag}for(var B=this.m_contactList;B;B=B.m_next){B.m_flags&=~AP.e_islandFlag}for(B=this.m_jointList;B;B=B.m_next){B.m_islandFlag=false}parseInt(this.m_bodyCount);B=this.s_stack;for(var H=this.m_bodyList;H;H=H.m_next){if(!(H.m_flags&AQ.e_islandFlag)){if(!(H.IsAwake()==false||H.IsActive()==false)){if(H.GetType()!=AQ.b2_staticBody){F.Clear();var G=0;B[G++]=H;for(H.m_flags|=AQ.e_islandFlag;G>0;){I=B[--G];F.AddBody(I);I.IsAwake()==false&&I.SetAwake(true);if(I.GetType()!=AQ.b2_staticBody){for(var A,E=I.m_contactList;E;E=E.next){if(!(E.contact.m_flags&AP.e_islandFlag)){if(!(E.contact.IsSensor()==true||E.contact.IsEnabled()==false||E.contact.IsTouching()==false)){F.AddContact(E.contact);E.contact.m_flags|=AP.e_islandFlag;A=E.other;if(!(A.m_flags&AQ.e_islandFlag)){B[G++]=A;A.m_flags|=AQ.e_islandFlag}}}}for(I=I.m_jointList;I;I=I.next){if(I.joint.m_islandFlag!=true){A=I.other;if(A.IsActive()!=false){F.AddJoint(I.joint);I.joint.m_islandFlag=true;if(!(A.m_flags&AQ.e_islandFlag)){B[G++]=A;A.m_flags|=AQ.e_islandFlag}}}}}}F.Solve(D,this.m_gravity,this.m_allowSleep);for(G=0;G<F.m_bodyCount;++G){I=F.m_bodies[G];if(I.GetType()==AQ.b2_staticBody){I.m_flags&=~AQ.e_islandFlag}}}}}}for(G=0;G<B.length;++G){if(!B[G]){break}B[G]=null}for(I=this.m_bodyList;I;I=I.m_next){I.IsAwake()==false||I.IsActive()==false||I.GetType()!=AQ.b2_staticBody&&I.SynchronizeFixtures()}this.m_contactManager.FindNewContacts()};AS.prototype.SolveTOI=function(I){var G,D,H,F=this.m_island;F.Initialize(this.m_bodyCount,AL.b2_maxTOIContactsPerIsland,AL.b2_maxTOIJointsPerIsland,null,this.m_contactManager.m_contactListener,this.m_contactSolver);var E=AS.s_queue;for(G=this.m_bodyList;G;G=G.m_next){G.m_flags&=~AQ.e_islandFlag;G.m_sweep.t0=0}for(H=this.m_contactList;H;H=H.m_next){H.m_flags&=~(AP.e_toiFlag|AP.e_islandFlag)}for(H=this.m_jointList;H;H=H.m_next){H.m_islandFlag=false}for(;;){var B=null,A=1;for(H=this.m_contactList;H;H=H.m_next){if(!(H.IsSensor()==true||H.IsEnabled()==false||H.IsContinuous()==false)){G=1;if(H.m_flags&AP.e_toiFlag){G=H.m_toi}else{G=H.m_fixtureA;D=H.m_fixtureB;G=G.m_body;D=D.m_body;if((G.GetType()!=AQ.b2_dynamicBody||G.IsAwake()==false)&&(D.GetType()!=AQ.b2_dynamicBody||D.IsAwake()==false)){continue}var K=G.m_sweep.t0;if(G.m_sweep.t0<D.m_sweep.t0){K=D.m_sweep.t0;G.m_sweep.Advance(K)}else{if(D.m_sweep.t0<G.m_sweep.t0){K=G.m_sweep.t0;D.m_sweep.Advance(K)}}G=H.ComputeTOI(G.m_sweep,D.m_sweep);AL.b2Assert(0<=G&&G<=1);if(G>0&&G<1){G=(1-G)*K+G;if(G>1){G=1}}H.m_toi=G;H.m_flags|=AP.e_toiFlag}if(Number.MIN_VALUE<G&&G<A){B=H;A=G}}}if(B==null||1-100*Number.MIN_VALUE<A){break}G=B.m_fixtureA;D=B.m_fixtureB;G=G.m_body;D=D.m_body;AS.s_backupA.Set(G.m_sweep);AS.s_backupB.Set(D.m_sweep);G.Advance(A);D.Advance(A);B.Update(this.m_contactManager.m_contactListener);B.m_flags&=~AP.e_toiFlag;if(B.IsSensor()==true||B.IsEnabled()==false){G.m_sweep.Set(AS.s_backupA);D.m_sweep.Set(AS.s_backupB);G.SynchronizeTransform();D.SynchronizeTransform()}else{if(B.IsTouching()!=false){G=G;if(G.GetType()!=AQ.b2_dynamicBody){G=D}F.Clear();B=H=0;E[H+B++]=G;for(G.m_flags|=AQ.e_islandFlag;B>0;){G=E[H++];--B;F.AddBody(G);G.IsAwake()==false&&G.SetAwake(true);if(G.GetType()==AQ.b2_dynamicBody){for(D=G.m_contactList;D;D=D.next){if(F.m_contactCount==F.m_contactCapacity){break}if(!(D.contact.m_flags&AP.e_islandFlag)){if(!(D.contact.IsSensor()==true||D.contact.IsEnabled()==false||D.contact.IsTouching()==false)){F.AddContact(D.contact);D.contact.m_flags|=AP.e_islandFlag;K=D.other;if(!(K.m_flags&AQ.e_islandFlag)){if(K.GetType()!=AQ.b2_staticBody){K.Advance(A);K.SetAwake(true)}E[H+B]=K;++B;K.m_flags|=AQ.e_islandFlag}}}}for(G=G.m_jointList;G;G=G.next){if(F.m_jointCount!=F.m_jointCapacity){if(G.joint.m_islandFlag!=true){K=G.other;if(K.IsActive()!=false){F.AddJoint(G.joint);G.joint.m_islandFlag=true;if(!(K.m_flags&AQ.e_islandFlag)){if(K.GetType()!=AQ.b2_staticBody){K.Advance(A);K.SetAwake(true)}E[H+B]=K;++B;K.m_flags|=AQ.e_islandFlag}}}}}}}H=AS.s_timestep;H.warmStarting=false;H.dt=(1-A)*I.dt;H.inv_dt=1/H.dt;H.dtRatio=0;H.velocityIterations=I.velocityIterations;H.positionIterations=I.positionIterations;F.SolveTOI(H);for(A=A=0;A<F.m_bodyCount;++A){G=F.m_bodies[A];G.m_flags&=~AQ.e_islandFlag;if(G.IsAwake()!=false){if(G.GetType()==AQ.b2_dynamicBody){G.SynchronizeFixtures();for(D=G.m_contactList;D;D=D.next){D.contact.m_flags&=~AP.e_toiFlag}}}}for(A=0;A<F.m_contactCount;++A){H=F.m_contacts[A];H.m_flags&=~(AP.e_toiFlag|AP.e_islandFlag)}for(A=0;A<F.m_jointCount;++A){H=F.m_joints[A];H.m_islandFlag=false}this.m_contactManager.FindNewContacts()}}}};AS.prototype.DrawJoint=function(D){var I=D.GetBodyA(),F=D.GetBodyB(),B=I.m_xf.position,H=F.m_xf.position,G=D.GetAnchorA(),A=D.GetAnchorB(),E=AS.s_jointColor;switch(D.m_type){case AJ.e_distanceJoint:this.m_debugDraw.DrawSegment(G,A,E);break;case AJ.e_pulleyJoint:I=D instanceof AO?D:null;D=I.GetGroundAnchorA();I=I.GetGroundAnchorB();this.m_debugDraw.DrawSegment(D,G,E);this.m_debugDraw.DrawSegment(I,A,E);this.m_debugDraw.DrawSegment(D,I,E);break;case AJ.e_mouseJoint:this.m_debugDraw.DrawSegment(G,A,E);break;default:I!=this.m_groundBody&&this.m_debugDraw.DrawSegment(B,G,E);this.m_debugDraw.DrawSegment(G,A,E);F!=this.m_groundBody&&this.m_debugDraw.DrawSegment(H,A,E)}};AS.prototype.DrawShape=function(B,G,D){switch(B.m_type){case J.e_circleShape:var A=B instanceof r?B:null;this.m_debugDraw.DrawSolidCircle(AG.MulX(G,A.m_p),A.m_radius,G.R.col1,D);break;case J.e_polygonShape:A=0;A=B instanceof P?B:null;B=parseInt(A.GetVertexCount());var F=A.GetVertices(),E=new Vector(B);for(A=0;A<B;++A){E[A]=AG.MulX(G,F[A])}this.m_debugDraw.DrawSolidPolygon(E,B,D);break;case J.e_edgeShape:A=B instanceof s?B:null;this.m_debugDraw.DrawSegment(AG.MulX(G,A.GetVertex1()),AG.MulX(G,A.GetVertex2()),D)}};Box2D.postDefs.push(function(){Box2D.Dynamics.b2World.s_timestep2=new AT;Box2D.Dynamics.b2World.s_xf=new x;Box2D.Dynamics.b2World.s_backupA=new AE;Box2D.Dynamics.b2World.s_backupB=new AE;Box2D.Dynamics.b2World.s_timestep=new AT;Box2D.Dynamics.b2World.s_queue=new Vector;Box2D.Dynamics.b2World.s_jointColor=new AD(0.5,0.8,0.8);Box2D.Dynamics.b2World.e_newFixture=1;Box2D.Dynamics.b2World.e_locked=2})})();(function(){var AE=Box2D.Collision.Shapes.b2CircleShape,AC=Box2D.Collision.Shapes.b2EdgeShape,s=Box2D.Collision.Shapes.b2PolygonShape,t=Box2D.Collision.Shapes.b2Shape,AB=Box2D.Dynamics.Contacts.b2CircleContact,AI=Box2D.Dynamics.Contacts.b2Contact,X=Box2D.Dynamics.Contacts.b2ContactConstraint,AJ=Box2D.Dynamics.Contacts.b2ContactConstraintPoint,AH=Box2D.Dynamics.Contacts.b2ContactEdge,f=Box2D.Dynamics.Contacts.b2ContactFactory,T=Box2D.Dynamics.Contacts.b2ContactRegister,n=Box2D.Dynamics.Contacts.b2ContactResult,o=Box2D.Dynamics.Contacts.b2ContactSolver,x=Box2D.Dynamics.Contacts.b2EdgeAndCircleContact,P=Box2D.Dynamics.Contacts.b2NullContact,J=Box2D.Dynamics.Contacts.b2PolyAndCircleContact,AL=Box2D.Dynamics.Contacts.b2PolyAndEdgeContact,r=Box2D.Dynamics.Contacts.b2PolygonContact,AD=Box2D.Dynamics.Contacts.b2PositionSolverManifold,AG=Box2D.Dynamics.b2Body,AA=Box2D.Dynamics.b2TimeStep,g=Box2D.Common.b2Settings,AF=Box2D.Common.Math.b2Mat22,e=Box2D.Common.Math.b2Math,m=Box2D.Common.Math.b2Vec2,b=Box2D.Collision.b2Collision,AO=Box2D.Collision.b2ContactID,C=Box2D.Collision.b2Manifold,AN=Box2D.Collision.b2TimeOfImpact,AM=Box2D.Collision.b2TOIInput,AK=Box2D.Collision.b2WorldManifold;Box2D.inherit(AB,Box2D.Dynamics.Contacts.b2Contact);AB.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;AB.b2CircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};AB.Create=function(){return new AB};AB.Destroy=function(){};AB.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B)};AB.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();b.CollideCircles(this.m_manifold,this.m_fixtureA.GetShape() instanceof AE?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AE?this.m_fixtureB.GetShape():null,B.m_xf)};AI.b2Contact=function(){this.m_nodeA=new AH;this.m_nodeB=new AH;this.m_manifold=new C;this.m_oldManifold=new C};AI.prototype.GetManifold=function(){return this.m_manifold};AI.prototype.GetWorldManifold=function(B){var E=this.m_fixtureA.GetBody(),D=this.m_fixtureB.GetBody(),F=this.m_fixtureA.GetShape(),A=this.m_fixtureB.GetShape();B.Initialize(this.m_manifold,E.GetTransform(),F.m_radius,D.GetTransform(),A.m_radius)};AI.prototype.IsTouching=function(){return(this.m_flags&AI.e_touchingFlag)==AI.e_touchingFlag};AI.prototype.IsContinuous=function(){return(this.m_flags&AI.e_continuousFlag)==AI.e_continuousFlag};AI.prototype.SetSensor=function(A){if(A){this.m_flags|=AI.e_sensorFlag}else{this.m_flags&=~AI.e_sensorFlag}};AI.prototype.IsSensor=function(){return(this.m_flags&AI.e_sensorFlag)==AI.e_sensorFlag};AI.prototype.SetEnabled=function(A){if(A){this.m_flags|=AI.e_enabledFlag}else{this.m_flags&=~AI.e_enabledFlag}};AI.prototype.IsEnabled=function(){return(this.m_flags&AI.e_enabledFlag)==AI.e_enabledFlag};AI.prototype.GetNext=function(){return this.m_next};AI.prototype.GetFixtureA=function(){return this.m_fixtureA};AI.prototype.GetFixtureB=function(){return this.m_fixtureB};AI.prototype.FlagForFiltering=function(){this.m_flags|=AI.e_filterFlag};AI.prototype.b2Contact=function(){};AI.prototype.Reset=function(A,D){if(A===undefined){A=null}if(D===undefined){D=null}this.m_flags=AI.e_enabledFlag;if(!A||!D){this.m_fixtureB=this.m_fixtureA=null}else{if(A.IsSensor()||D.IsSensor()){this.m_flags|=AI.e_sensorFlag}var B=A.GetBody(),E=D.GetBody();if(B.GetType()!=AG.b2_dynamicBody||B.IsBullet()||E.GetType()!=AG.b2_dynamicBody||E.IsBullet()){this.m_flags|=AI.e_continuousFlag}this.m_fixtureA=A;this.m_fixtureB=D;this.m_manifold.m_pointCount=0;this.m_next=this.m_prev=null;this.m_nodeA.contact=null;this.m_nodeA.prev=null;this.m_nodeA.next=null;this.m_nodeA.other=null;this.m_nodeB.contact=null;this.m_nodeB.prev=null;this.m_nodeB.next=null;this.m_nodeB.other=null}};AI.prototype.Update=function(E){var B=this.m_oldManifold;this.m_oldManifold=this.m_manifold;this.m_manifold=B;this.m_flags|=AI.e_enabledFlag;var A=false;B=(this.m_flags&AI.e_touchingFlag)==AI.e_touchingFlag;var D=this.m_fixtureA.m_body,L=this.m_fixtureB.m_body,I=this.m_fixtureA.m_aabb.TestOverlap(this.m_fixtureB.m_aabb);if(this.m_flags&AI.e_sensorFlag){if(I){A=this.m_fixtureA.GetShape();I=this.m_fixtureB.GetShape();D=D.GetTransform();L=L.GetTransform();A=t.TestOverlap(A,D,I,L)}this.m_manifold.m_pointCount=0}else{if(D.GetType()!=AG.b2_dynamicBody||D.IsBullet()||L.GetType()!=AG.b2_dynamicBody||L.IsBullet()){this.m_flags|=AI.e_continuousFlag}else{this.m_flags&=~AI.e_continuousFlag}if(I){this.Evaluate();A=this.m_manifold.m_pointCount>0;for(I=0;I<this.m_manifold.m_pointCount;++I){var F=this.m_manifold.m_points[I];F.m_normalImpulse=0;F.m_tangentImpulse=0;for(var K=F.m_id,H=0;H<this.m_oldManifold.m_pointCount;++H){var G=this.m_oldManifold.m_points[H];if(G.m_id.key==K.key){F.m_normalImpulse=G.m_normalImpulse;F.m_tangentImpulse=G.m_tangentImpulse;break}}}}else{this.m_manifold.m_pointCount=0}if(A!=B){D.SetAwake(true);L.SetAwake(true)}}if(A){this.m_flags|=AI.e_touchingFlag}else{this.m_flags&=~AI.e_touchingFlag}B==false&&A==true&&E.BeginContact(this);B==true&&A==false&&E.EndContact(this);(this.m_flags&AI.e_sensorFlag)==0&&E.PreSolve(this,this.m_oldManifold)};AI.prototype.Evaluate=function(){};AI.prototype.ComputeTOI=function(A,B){AI.s_input.proxyA.Set(this.m_fixtureA.GetShape());AI.s_input.proxyB.Set(this.m_fixtureB.GetShape());AI.s_input.sweepA=A;AI.s_input.sweepB=B;AI.s_input.tolerance=g.b2_linearSlop;return AN.TimeOfImpact(AI.s_input)};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2Contact.e_sensorFlag=1;Box2D.Dynamics.Contacts.b2Contact.e_continuousFlag=2;Box2D.Dynamics.Contacts.b2Contact.e_islandFlag=4;Box2D.Dynamics.Contacts.b2Contact.e_toiFlag=8;Box2D.Dynamics.Contacts.b2Contact.e_touchingFlag=16;Box2D.Dynamics.Contacts.b2Contact.e_enabledFlag=32;Box2D.Dynamics.Contacts.b2Contact.e_filterFlag=64;Box2D.Dynamics.Contacts.b2Contact.s_input=new AM});X.b2ContactConstraint=function(){this.localPlaneNormal=new m;this.localPoint=new m;this.normal=new m;this.normalMass=new AF;this.K=new AF};X.prototype.b2ContactConstraint=function(){this.points=new Vector(g.b2_maxManifoldPoints);for(var A=0;A<g.b2_maxManifoldPoints;A++){this.points[A]=new AJ}};AJ.b2ContactConstraintPoint=function(){this.localPoint=new m;this.rA=new m;this.rB=new m};AH.b2ContactEdge=function(){};f.b2ContactFactory=function(){};f.prototype.b2ContactFactory=function(A){this.m_allocator=A;this.InitializeRegisters()};f.prototype.AddType=function(A,D,B,E){if(B===undefined){B=0}if(E===undefined){E=0}this.m_registers[B][E].createFcn=A;this.m_registers[B][E].destroyFcn=D;this.m_registers[B][E].primary=true;if(B!=E){this.m_registers[E][B].createFcn=A;this.m_registers[E][B].destroyFcn=D;this.m_registers[E][B].primary=false}};f.prototype.InitializeRegisters=function(){this.m_registers=new Vector(t.e_shapeTypeCount);for(var A=0;A<t.e_shapeTypeCount;A++){this.m_registers[A]=new Vector(t.e_shapeTypeCount);for(var B=0;B<t.e_shapeTypeCount;B++){this.m_registers[A][B]=new T}}this.AddType(AB.Create,AB.Destroy,t.e_circleShape,t.e_circleShape);this.AddType(J.Create,J.Destroy,t.e_polygonShape,t.e_circleShape);this.AddType(r.Create,r.Destroy,t.e_polygonShape,t.e_polygonShape);this.AddType(x.Create,x.Destroy,t.e_edgeShape,t.e_circleShape);this.AddType(AL.Create,AL.Destroy,t.e_polygonShape,t.e_edgeShape)};f.prototype.Create=function(A,D){var B=parseInt(A.GetType()),E=parseInt(D.GetType());B=this.m_registers[B][E];if(B.pool){E=B.pool;B.pool=E.m_next;B.poolCount--;E.Reset(A,D);return E}E=B.createFcn;if(E!=null){if(B.primary){E=E(this.m_allocator);E.Reset(A,D)}else{E=E(this.m_allocator);E.Reset(D,A)}return E}else{return null}};f.prototype.Destroy=function(A){if(A.m_manifold.m_pointCount>0){A.m_fixtureA.m_body.SetAwake(true);A.m_fixtureB.m_body.SetAwake(true)}var D=parseInt(A.m_fixtureA.GetType()),B=parseInt(A.m_fixtureB.GetType());D=this.m_registers[D][B];D.poolCount++;A.m_next=D.pool;D.pool=A;D=D.destroyFcn;D(A,this.m_allocator)};T.b2ContactRegister=function(){};n.b2ContactResult=function(){this.position=new m;this.normal=new m;this.id=new AO};o.b2ContactSolver=function(){this.m_step=new AA;this.m_constraints=new Vector};o.prototype.b2ContactSolver=function(){};o.prototype.Initialize=function(V,R,O,S){if(O===undefined){O=0}var l;this.m_step.Set(V);this.m_allocator=S;V=0;for(this.m_constraintCount=O;this.m_constraints.length<this.m_constraintCount;){this.m_constraints[this.m_constraints.length]=new X}for(V=0;V<O;++V){l=R[V];S=l.m_fixtureA;var h=l.m_fixtureB,W=S.m_shape.m_radius,k=h.m_shape.m_radius,Z=S.m_body,Y=h.m_body,U=l.GetManifold(),N=g.b2MixFriction(S.GetFriction(),h.GetFriction()),L=g.b2MixRestitution(S.GetRestitution(),h.GetRestitution()),I=Z.m_linearVelocity.x,K=Z.m_linearVelocity.y,H=Y.m_linearVelocity.x,M=Y.m_linearVelocity.y,G=Z.m_angularVelocity,B=Y.m_angularVelocity;g.b2Assert(U.m_pointCount>0);o.s_worldManifold.Initialize(U,Z.m_xf,W,Y.m_xf,k);h=o.s_worldManifold.m_normal.x;l=o.s_worldManifold.m_normal.y;S=this.m_constraints[V];S.bodyA=Z;S.bodyB=Y;S.manifold=U;S.normal.x=h;S.normal.y=l;S.pointCount=U.m_pointCount;S.friction=N;S.restitution=L;S.localPlaneNormal.x=U.m_localPlaneNormal.x;S.localPlaneNormal.y=U.m_localPlaneNormal.y;S.localPoint.x=U.m_localPoint.x;S.localPoint.y=U.m_localPoint.y;S.radius=W+k;S.type=U.m_type;for(W=0;W<S.pointCount;++W){N=U.m_points[W];k=S.points[W];k.normalImpulse=N.m_normalImpulse;k.tangentImpulse=N.m_tangentImpulse;k.localPoint.SetV(N.m_localPoint);N=k.rA.x=o.s_worldManifold.m_points[W].x-Z.m_sweep.c.x;L=k.rA.y=o.s_worldManifold.m_points[W].y-Z.m_sweep.c.y;var F=k.rB.x=o.s_worldManifold.m_points[W].x-Y.m_sweep.c.x,A=k.rB.y=o.s_worldManifold.m_points[W].y-Y.m_sweep.c.y,D=N*l-L*h,E=F*l-A*h;D*=D;E*=E;k.normalMass=1/(Z.m_invMass+Y.m_invMass+Z.m_invI*D+Y.m_invI*E);var Q=Z.m_mass*Z.m_invMass+Y.m_mass*Y.m_invMass;Q+=Z.m_mass*Z.m_invI*D+Y.m_mass*Y.m_invI*E;k.equalizedMass=1/Q;E=l;Q=-h;D=N*Q-L*E;E=F*Q-A*E;D*=D;E*=E;k.tangentMass=1/(Z.m_invMass+Y.m_invMass+Z.m_invI*D+Y.m_invI*E);k.velocityBias=0;N=S.normal.x*(H+-B*A-I- -G*L)+S.normal.y*(M+B*F-K-G*N);if(N<-g.b2_velocityThreshold){k.velocityBias+=-S.restitution*N}}if(S.pointCount==2){M=S.points[0];H=S.points[1];U=Z.m_invMass;Z=Z.m_invI;I=Y.m_invMass;Y=Y.m_invI;K=M.rA.x*l-M.rA.y*h;M=M.rB.x*l-M.rB.y*h;G=H.rA.x*l-H.rA.y*h;H=H.rB.x*l-H.rB.y*h;h=U+I+Z*K*K+Y*M*M;l=U+I+Z*G*G+Y*H*H;Y=U+I+Z*K*G+Y*M*H;if(h*h<100*(h*l-Y*Y)){S.K.col1.Set(h,Y);S.K.col2.Set(Y,l);S.K.GetInverse(S.normalMass)}else{S.pointCount=1}}}};o.prototype.InitVelocityConstraints=function(N){for(var K=0;K<this.m_constraintCount;++K){var I=this.m_constraints[K],L=I.bodyA,V=I.bodyB,S=L.m_invMass,O=L.m_invI,U=V.m_invMass,R=V.m_invI,Q=I.normal.x,M=I.normal.y,H=M,F=-Q,D=0,E=0;if(N.warmStarting){E=I.pointCount;for(D=0;D<E;++D){var B=I.points[D];B.normalImpulse*=N.dtRatio;B.tangentImpulse*=N.dtRatio;var G=B.normalImpulse*Q+B.tangentImpulse*H,A=B.normalImpulse*M+B.tangentImpulse*F;L.m_angularVelocity-=O*(B.rA.x*A-B.rA.y*G);L.m_linearVelocity.x-=S*G;L.m_linearVelocity.y-=S*A;V.m_angularVelocity+=R*(B.rB.x*A-B.rB.y*G);V.m_linearVelocity.x+=U*G;V.m_linearVelocity.y+=U*A}}else{E=I.pointCount;for(D=0;D<E;++D){L=I.points[D];L.normalImpulse=0;L.tangentImpulse=0}}}};o.prototype.SolveVelocityConstraints=function(){for(var V=0,R,O=0,S=0,l=0,h=S=S=O=O=0,W=O=O=0,k=O=l=0,Z=0,Y,U=0;U<this.m_constraintCount;++U){l=this.m_constraints[U];var N=l.bodyA,L=l.bodyB,I=N.m_angularVelocity,K=L.m_angularVelocity,H=N.m_linearVelocity,M=L.m_linearVelocity,G=N.m_invMass,B=N.m_invI,F=L.m_invMass,A=L.m_invI;k=l.normal.x;var D=Z=l.normal.y;Y=-k;W=l.friction;for(V=0;V<l.pointCount;V++){R=l.points[V];O=M.x-K*R.rB.y-H.x+I*R.rA.y;S=M.y+K*R.rB.x-H.y-I*R.rA.x;O=O*D+S*Y;O=R.tangentMass*-O;S=W*R.normalImpulse;S=e.Clamp(R.tangentImpulse+O,-S,S);O=S-R.tangentImpulse;h=O*D;O=O*Y;H.x-=G*h;H.y-=G*O;I-=B*(R.rA.x*O-R.rA.y*h);M.x+=F*h;M.y+=F*O;K+=A*(R.rB.x*O-R.rB.y*h);R.tangentImpulse=S}parseInt(l.pointCount);if(l.pointCount==1){R=l.points[0];O=M.x+-K*R.rB.y-H.x- -I*R.rA.y;S=M.y+K*R.rB.x-H.y-I*R.rA.x;l=O*k+S*Z;O=-R.normalMass*(l-R.velocityBias);S=R.normalImpulse+O;S=S>0?S:0;O=S-R.normalImpulse;h=O*k;O=O*Z;H.x-=G*h;H.y-=G*O;I-=B*(R.rA.x*O-R.rA.y*h);M.x+=F*h;M.y+=F*O;K+=A*(R.rB.x*O-R.rB.y*h);R.normalImpulse=S}else{R=l.points[0];V=l.points[1];O=R.normalImpulse;W=V.normalImpulse;var E=(M.x-K*R.rB.y-H.x+I*R.rA.y)*k+(M.y+K*R.rB.x-H.y-I*R.rA.x)*Z,Q=(M.x-K*V.rB.y-H.x+I*V.rA.y)*k+(M.y+K*V.rB.x-H.y-I*V.rA.x)*Z;S=E-R.velocityBias;h=Q-V.velocityBias;Y=l.K;S-=Y.col1.x*O+Y.col2.x*W;for(h-=Y.col1.y*O+Y.col2.y*W;;){Y=l.normalMass;D=-(Y.col1.x*S+Y.col2.x*h);Y=-(Y.col1.y*S+Y.col2.y*h);if(D>=0&&Y>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}D=-R.normalMass*S;Y=0;Q=l.K.col1.y*D+h;if(D>=0&&Q>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}D=0;Y=-V.normalMass*h;E=l.K.col2.x*Y+S;if(Y>=0&&E>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}Y=D=0;E=S;Q=h;if(E>=0&&Q>=0){O=D-O;W=Y-W;l=O*k;O=O*Z;k=W*k;Z=W*Z;H.x-=G*(l+k);H.y-=G*(O+Z);I-=B*(R.rA.x*O-R.rA.y*l+V.rA.x*Z-V.rA.y*k);M.x+=F*(l+k);M.y+=F*(O+Z);K+=A*(R.rB.x*O-R.rB.y*l+V.rB.x*Z-V.rB.y*k);R.normalImpulse=D;V.normalImpulse=Y;break}break}}N.m_angularVelocity=I;L.m_angularVelocity=K}};o.prototype.FinalizeVelocityConstraints=function(){for(var B=0;B<this.m_constraintCount;++B){for(var E=this.m_constraints[B],D=E.manifold,G=0;G<E.pointCount;++G){var A=D.m_points[G],F=E.points[G];A.m_normalImpulse=F.normalImpulse;A.m_tangentImpulse=F.tangentImpulse}}};o.prototype.SolvePositionConstraints=function(N){if(N===undefined){N=0}for(var K=0,I=0;I<this.m_constraintCount;I++){var L=this.m_constraints[I],V=L.bodyA,S=L.bodyB,O=V.m_mass*V.m_invMass,U=V.m_mass*V.m_invI,R=S.m_mass*S.m_invMass,Q=S.m_mass*S.m_invI;o.s_psm.Initialize(L);for(var M=o.s_psm.m_normal,H=0;H<L.pointCount;H++){var F=L.points[H],D=o.s_psm.m_points[H],E=o.s_psm.m_separations[H],B=D.x-V.m_sweep.c.x,G=D.y-V.m_sweep.c.y,A=D.x-S.m_sweep.c.x;D=D.y-S.m_sweep.c.y;K=K<E?K:E;E=e.Clamp(N*(E+g.b2_linearSlop),-g.b2_maxLinearCorrection,0);E=-F.equalizedMass*E;F=E*M.x;E=E*M.y;V.m_sweep.c.x-=O*F;V.m_sweep.c.y-=O*E;V.m_sweep.a-=U*(B*E-G*F);V.SynchronizeTransform();S.m_sweep.c.x+=R*F;S.m_sweep.c.y+=R*E;S.m_sweep.a+=Q*(A*E-D*F);S.SynchronizeTransform()}}return K>-1.5*g.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2ContactSolver.s_worldManifold=new AK;Box2D.Dynamics.Contacts.b2ContactSolver.s_psm=new AD});Box2D.inherit(x,Box2D.Dynamics.Contacts.b2Contact);x.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;x.b2EdgeAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};x.Create=function(){return new x};x.Destroy=function(){};x.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B)};x.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();this.b2CollideEdgeAndCircle(this.m_manifold,this.m_fixtureA.GetShape() instanceof AC?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AE?this.m_fixtureB.GetShape():null,B.m_xf)};x.prototype.b2CollideEdgeAndCircle=function(){};Box2D.inherit(P,Box2D.Dynamics.Contacts.b2Contact);P.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;P.b2NullContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};P.prototype.b2NullContact=function(){this.__super.b2Contact.call(this)};P.prototype.Evaluate=function(){};Box2D.inherit(J,Box2D.Dynamics.Contacts.b2Contact);J.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;J.b2PolyAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};J.Create=function(){return new J};J.Destroy=function(){};J.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B);g.b2Assert(A.GetType()==t.e_polygonShape);g.b2Assert(B.GetType()==t.e_circleShape)};J.prototype.Evaluate=function(){var A=this.m_fixtureA.m_body,B=this.m_fixtureB.m_body;b.CollidePolygonAndCircle(this.m_manifold,this.m_fixtureA.GetShape() instanceof s?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AE?this.m_fixtureB.GetShape():null,B.m_xf)};Box2D.inherit(AL,Box2D.Dynamics.Contacts.b2Contact);AL.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;AL.b2PolyAndEdgeContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};AL.Create=function(){return new AL};AL.Destroy=function(){};AL.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B);g.b2Assert(A.GetType()==t.e_polygonShape);g.b2Assert(B.GetType()==t.e_edgeShape)};AL.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();this.b2CollidePolyAndEdge(this.m_manifold,this.m_fixtureA.GetShape() instanceof s?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AC?this.m_fixtureB.GetShape():null,B.m_xf)};AL.prototype.b2CollidePolyAndEdge=function(){};Box2D.inherit(r,Box2D.Dynamics.Contacts.b2Contact);r.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;r.b2PolygonContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};r.Create=function(){return new r};r.Destroy=function(){};r.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B)};r.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();b.CollidePolygons(this.m_manifold,this.m_fixtureA.GetShape() instanceof s?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof s?this.m_fixtureB.GetShape():null,B.m_xf)};AD.b2PositionSolverManifold=function(){};AD.prototype.b2PositionSolverManifold=function(){this.m_normal=new m;this.m_separations=new Vector_a2j_Number(g.b2_maxManifoldPoints);this.m_points=new Vector(g.b2_maxManifoldPoints);for(var A=0;A<g.b2_maxManifoldPoints;A++){this.m_points[A]=new m}};AD.prototype.Initialize=function(D){g.b2Assert(D.pointCount>0);var G=0,F=0,I=0,B,H=0,E=0;switch(D.type){case C.e_circles:B=D.bodyA.m_xf.R;I=D.localPoint;G=D.bodyA.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);F=D.bodyA.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);B=D.bodyB.m_xf.R;I=D.points[0].localPoint;H=D.bodyB.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);B=D.bodyB.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);I=H-G;E=B-F;var A=I*I+E*E;if(A>Number.MIN_VALUE*Number.MIN_VALUE){A=Math.sqrt(A);this.m_normal.x=I/A;this.m_normal.y=E/A}else{this.m_normal.x=1;this.m_normal.y=0}this.m_points[0].x=0.5*(G+H);this.m_points[0].y=0.5*(F+B);this.m_separations[0]=I*this.m_normal.x+E*this.m_normal.y-D.radius;break;case C.e_faceA:B=D.bodyA.m_xf.R;I=D.localPlaneNormal;this.m_normal.x=B.col1.x*I.x+B.col2.x*I.y;this.m_normal.y=B.col1.y*I.x+B.col2.y*I.y;B=D.bodyA.m_xf.R;I=D.localPoint;H=D.bodyA.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);E=D.bodyA.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);B=D.bodyB.m_xf.R;for(G=0;G<D.pointCount;++G){I=D.points[G].localPoint;F=D.bodyB.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);I=D.bodyB.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);this.m_separations[G]=(F-H)*this.m_normal.x+(I-E)*this.m_normal.y-D.radius;this.m_points[G].x=F;this.m_points[G].y=I}break;case C.e_faceB:B=D.bodyB.m_xf.R;I=D.localPlaneNormal;this.m_normal.x=B.col1.x*I.x+B.col2.x*I.y;this.m_normal.y=B.col1.y*I.x+B.col2.y*I.y;B=D.bodyB.m_xf.R;I=D.localPoint;H=D.bodyB.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);E=D.bodyB.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);B=D.bodyA.m_xf.R;for(G=0;G<D.pointCount;++G){I=D.points[G].localPoint;F=D.bodyA.m_xf.position.x+(B.col1.x*I.x+B.col2.x*I.y);I=D.bodyA.m_xf.position.y+(B.col1.y*I.x+B.col2.y*I.y);this.m_separations[G]=(F-H)*this.m_normal.x+(I-E)*this.m_normal.y-D.radius;this.m_points[G].Set(F,I)}this.m_normal.x*=-1;this.m_normal.y*=-1}};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2PositionSolverManifold.circlePointA=new m;Box2D.Dynamics.Contacts.b2PositionSolverManifold.circlePointB=new m})})();(function(){var P=Box2D.Common.Math.b2Mat22,O=Box2D.Common.Math.b2Math,M=Box2D.Common.Math.b2Vec2,L=Box2D.Common.b2Color,N=Box2D.Dynamics.Controllers.b2BuoyancyController,E=Box2D.Dynamics.Controllers.b2ConstantAccelController,I=Box2D.Dynamics.Controllers.b2ConstantForceController,D=Box2D.Dynamics.Controllers.b2Controller,C=Box2D.Dynamics.Controllers.b2ControllerEdge,J=Box2D.Dynamics.Controllers.b2GravityController,H=Box2D.Dynamics.Controllers.b2TensorDampingController;Box2D.inherit(N,Box2D.Dynamics.Controllers.b2Controller);N.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;N.b2BuoyancyController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.normal=new M(0,-1);this.density=this.offset=0;this.velocity=new M(0,0);this.linearDrag=2;this.angularDrag=1;this.useDensity=false;this.useWorldGravity=true;this.gravity=null};N.prototype.Step=function(){if(this.m_bodyList){if(this.useWorldGravity){this.gravity=this.GetWorld().GetGravity().Copy()}for(var K=this.m_bodyList;K;K=K.nextBody){var R=K.body;if(R.IsAwake()!=false){for(var S=new M,F=new M,B=0,G=0,Q=R.GetFixtureList();Q;Q=Q.GetNext()){var U=new M,A=Q.GetShape().ComputeSubmergedArea(this.normal,this.offset,R.GetTransform(),U);B+=A;S.x+=A*U.x;S.y+=A*U.y;var T=0;T=1;G+=A*T;F.x+=A*U.x*T;F.y+=A*U.y*T}S.x/=B;S.y/=B;F.x/=G;F.y/=G;if(!(B<Number.MIN_VALUE)){G=this.gravity.GetNegative();G.Multiply(this.density*B);R.ApplyForce(G,F);F=R.GetLinearVelocityFromWorldPoint(S);F.Subtract(this.velocity);F.Multiply(-this.linearDrag*B);R.ApplyForce(F,S);R.ApplyTorque(-R.GetInertia()/R.GetMass()*B*R.GetAngularVelocity()*this.angularDrag)}}}}};N.prototype.Draw=function(G){var B=new M,F=new M;B.x=this.normal.x*this.offset+this.normal.y*1000;B.y=this.normal.y*this.offset-this.normal.x*1000;F.x=this.normal.x*this.offset-this.normal.y*1000;F.y=this.normal.y*this.offset+this.normal.x*1000;var A=new L(0,0,1);G.DrawSegment(B,F,A)};Box2D.inherit(E,Box2D.Dynamics.Controllers.b2Controller);E.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;E.b2ConstantAccelController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.A=new M(0,0)};E.prototype.Step=function(F){F=new M(this.A.x*F.dt,this.A.y*F.dt);for(var A=this.m_bodyList;A;A=A.nextBody){var B=A.body;B.IsAwake()&&B.SetLinearVelocity(new M(B.GetLinearVelocity().x+F.x,B.GetLinearVelocity().y+F.y))}};Box2D.inherit(I,Box2D.Dynamics.Controllers.b2Controller);I.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;I.b2ConstantForceController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.F=new M(0,0)};I.prototype.Step=function(){for(var B=this.m_bodyList;B;B=B.nextBody){var A=B.body;A.IsAwake()&&A.ApplyForce(this.F,A.GetWorldCenter())}};D.b2Controller=function(){};D.prototype.Step=function(){};D.prototype.Draw=function(){};D.prototype.AddBody=function(B){var A=new C;A.controller=this;A.body=B;A.nextBody=this.m_bodyList;A.prevBody=null;this.m_bodyList=A;if(A.nextBody){A.nextBody.prevBody=A}this.m_bodyCount++;A.nextController=B.m_controllerList;A.prevController=null;B.m_controllerList=A;if(A.nextController){A.nextController.prevController=A}B.m_controllerCount++};D.prototype.RemoveBody=function(B){for(var A=B.m_controllerList;A&&A.controller!=this;){A=A.nextController}if(A.prevBody){A.prevBody.nextBody=A.nextBody}if(A.nextBody){A.nextBody.prevBody=A.prevBody}if(A.nextController){A.nextController.prevController=A.prevController}if(A.prevController){A.prevController.nextController=A.nextController}if(this.m_bodyList==A){this.m_bodyList=A.nextBody}if(B.m_controllerList==A){B.m_controllerList=A.nextController}B.m_controllerCount--;this.m_bodyCount--};D.prototype.Clear=function(){for(;this.m_bodyList;){this.RemoveBody(this.m_bodyList.body)}};D.prototype.GetNext=function(){return this.m_next};D.prototype.GetWorld=function(){return this.m_world};D.prototype.GetBodyList=function(){return this.m_bodyList};C.b2ControllerEdge=function(){};Box2D.inherit(J,Box2D.Dynamics.Controllers.b2Controller);J.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;J.b2GravityController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.G=1;this.invSqr=true};J.prototype.Step=function(){var K=null,R=null,S=null,F=0,B=null,G=null,Q=null,U=0,A=0,T=0;U=null;if(this.invSqr){for(K=this.m_bodyList;K;K=K.nextBody){R=K.body;S=R.GetWorldCenter();F=R.GetMass();for(B=this.m_bodyList;B!=K;B=B.nextBody){G=B.body;Q=G.GetWorldCenter();U=Q.x-S.x;A=Q.y-S.y;T=U*U+A*A;if(!(T<Number.MIN_VALUE)){U=new M(U,A);U.Multiply(this.G/T/Math.sqrt(T)*F*G.GetMass());R.IsAwake()&&R.ApplyForce(U,S);U.Multiply(-1);G.IsAwake()&&G.ApplyForce(U,Q)}}}}else{for(K=this.m_bodyList;K;K=K.nextBody){R=K.body;S=R.GetWorldCenter();F=R.GetMass();for(B=this.m_bodyList;B!=K;B=B.nextBody){G=B.body;Q=G.GetWorldCenter();U=Q.x-S.x;A=Q.y-S.y;T=U*U+A*A;if(!(T<Number.MIN_VALUE)){U=new M(U,A);U.Multiply(this.G/T*F*G.GetMass());R.IsAwake()&&R.ApplyForce(U,S);U.Multiply(-1);G.IsAwake()&&G.ApplyForce(U,Q)}}}}};Box2D.inherit(H,Box2D.Dynamics.Controllers.b2Controller);H.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;H.b2TensorDampingController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.T=new P;this.maxTimestep=0};H.prototype.SetAxisAligned=function(B,A){if(B===undefined){B=0}if(A===undefined){A=0}this.T.col1.x=-B;this.T.col1.y=0;this.T.col2.x=0;this.T.col2.y=-A;this.maxTimestep=B>0||A>0?1/Math.max(B,A):0};H.prototype.Step=function(G){G=G.dt;if(!(G<=Number.MIN_VALUE)){if(G>this.maxTimestep&&this.maxTimestep>0){G=this.maxTimestep}for(var B=this.m_bodyList;B;B=B.nextBody){var F=B.body;if(F.IsAwake()){var A=F.GetWorldVector(O.MulMV(this.T,F.GetLocalVector(F.GetLinearVelocity())));F.SetLinearVelocity(new M(F.GetLinearVelocity().x+A.x*G,F.GetLinearVelocity().y+A.y*G))}}}}})();(function(){var AC=Box2D.Common.b2Settings,AA=Box2D.Common.Math.b2Mat22,o=Box2D.Common.Math.b2Mat33,r=Box2D.Common.Math.b2Math,x=Box2D.Common.Math.b2Vec2,AG=Box2D.Common.Math.b2Vec3,X=Box2D.Dynamics.Joints.b2DistanceJoint,AH=Box2D.Dynamics.Joints.b2DistanceJointDef,AF=Box2D.Dynamics.Joints.b2FrictionJoint,f=Box2D.Dynamics.Joints.b2FrictionJointDef,T=Box2D.Dynamics.Joints.b2GearJoint,l=Box2D.Dynamics.Joints.b2GearJointDef,m=Box2D.Dynamics.Joints.b2Jacobian,s=Box2D.Dynamics.Joints.b2Joint,P=Box2D.Dynamics.Joints.b2JointDef,J=Box2D.Dynamics.Joints.b2JointEdge,AI=Box2D.Dynamics.Joints.b2LineJoint,n=Box2D.Dynamics.Joints.b2LineJointDef,AB=Box2D.Dynamics.Joints.b2MouseJoint,AE=Box2D.Dynamics.Joints.b2MouseJointDef,t=Box2D.Dynamics.Joints.b2PrismaticJoint,g=Box2D.Dynamics.Joints.b2PrismaticJointDef,AD=Box2D.Dynamics.Joints.b2PulleyJoint,e=Box2D.Dynamics.Joints.b2PulleyJointDef,h=Box2D.Dynamics.Joints.b2RevoluteJoint,b=Box2D.Dynamics.Joints.b2RevoluteJointDef,AJ=Box2D.Dynamics.Joints.b2WeldJoint,C=Box2D.Dynamics.Joints.b2WeldJointDef;Box2D.inherit(X,Box2D.Dynamics.Joints.b2Joint);X.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;X.b2DistanceJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new x;this.m_localAnchor2=new x;this.m_u=new x};X.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};X.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};X.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new x(A*this.m_impulse*this.m_u.x,A*this.m_impulse*this.m_u.y)};X.prototype.GetReactionTorque=function(){return 0};X.prototype.GetLength=function(){return this.m_length};X.prototype.SetLength=function(A){if(A===undefined){A=0}this.m_length=A};X.prototype.GetFrequency=function(){return this.m_frequencyHz};X.prototype.SetFrequency=function(A){if(A===undefined){A=0}this.m_frequencyHz=A};X.prototype.GetDampingRatio=function(){return this.m_dampingRatio};X.prototype.SetDampingRatio=function(A){if(A===undefined){A=0}this.m_dampingRatio=A};X.prototype.b2DistanceJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_length=A.length;this.m_frequencyHz=A.frequencyHz;this.m_dampingRatio=A.dampingRatio;this.m_bias=this.m_gamma=this.m_impulse=0};X.prototype.InitVelocityConstraints=function(I){var G,E=0,F=this.m_bodyA,B=this.m_bodyB;G=F.m_xf.R;var A=this.m_localAnchor1.x-F.m_sweep.localCenter.x,D=this.m_localAnchor1.y-F.m_sweep.localCenter.y;E=G.col1.x*A+G.col2.x*D;D=G.col1.y*A+G.col2.y*D;A=E;G=B.m_xf.R;var M=this.m_localAnchor2.x-B.m_sweep.localCenter.x,K=this.m_localAnchor2.y-B.m_sweep.localCenter.y;E=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=E;this.m_u.x=B.m_sweep.c.x+M-F.m_sweep.c.x-A;this.m_u.y=B.m_sweep.c.y+K-F.m_sweep.c.y-D;E=Math.sqrt(this.m_u.x*this.m_u.x+this.m_u.y*this.m_u.y);E>AC.b2_linearSlop?this.m_u.Multiply(1/E):this.m_u.SetZero();G=A*this.m_u.y-D*this.m_u.x;var H=M*this.m_u.y-K*this.m_u.x;G=F.m_invMass+F.m_invI*G*G+B.m_invMass+B.m_invI*H*H;this.m_mass=G!=0?1/G:0;if(this.m_frequencyHz>0){E=E-this.m_length;H=2*Math.PI*this.m_frequencyHz;var L=this.m_mass*H*H;this.m_gamma=I.dt*(2*this.m_mass*this.m_dampingRatio*H+I.dt*L);this.m_gamma=this.m_gamma!=0?1/this.m_gamma:0;this.m_bias=E*I.dt*L*this.m_gamma;this.m_mass=G+this.m_gamma;this.m_mass=this.m_mass!=0?1/this.m_mass:0}if(I.warmStarting){this.m_impulse*=I.dtRatio;I=this.m_impulse*this.m_u.x;G=this.m_impulse*this.m_u.y;F.m_linearVelocity.x-=F.m_invMass*I;F.m_linearVelocity.y-=F.m_invMass*G;F.m_angularVelocity-=F.m_invI*(A*G-D*I);B.m_linearVelocity.x+=B.m_invMass*I;B.m_linearVelocity.y+=B.m_invMass*G;B.m_angularVelocity+=B.m_invI*(M*G-K*I)}else{this.m_impulse=0}};X.prototype.SolveVelocityConstraints=function(){var H,E=this.m_bodyA,B=this.m_bodyB;H=E.m_xf.R;var D=this.m_localAnchor1.x-E.m_sweep.localCenter.x,G=this.m_localAnchor1.y-E.m_sweep.localCenter.y,F=H.col1.x*D+H.col2.x*G;G=H.col1.y*D+H.col2.y*G;D=F;H=B.m_xf.R;var I=this.m_localAnchor2.x-B.m_sweep.localCenter.x,A=this.m_localAnchor2.y-B.m_sweep.localCenter.y;F=H.col1.x*I+H.col2.x*A;A=H.col1.y*I+H.col2.y*A;I=F;F=-this.m_mass*(this.m_u.x*(B.m_linearVelocity.x+-B.m_angularVelocity*A-(E.m_linearVelocity.x+-E.m_angularVelocity*G))+this.m_u.y*(B.m_linearVelocity.y+B.m_angularVelocity*I-(E.m_linearVelocity.y+E.m_angularVelocity*D))+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=F;H=F*this.m_u.x;F=F*this.m_u.y;E.m_linearVelocity.x-=E.m_invMass*H;E.m_linearVelocity.y-=E.m_invMass*F;E.m_angularVelocity-=E.m_invI*(D*F-G*H);B.m_linearVelocity.x+=B.m_invMass*H;B.m_linearVelocity.y+=B.m_invMass*F;B.m_angularVelocity+=B.m_invI*(I*F-A*H)};X.prototype.SolvePositionConstraints=function(){var I;if(this.m_frequencyHz>0){return true}var G=this.m_bodyA,E=this.m_bodyB;I=G.m_xf.R;var F=this.m_localAnchor1.x-G.m_sweep.localCenter.x,B=this.m_localAnchor1.y-G.m_sweep.localCenter.y,A=I.col1.x*F+I.col2.x*B;B=I.col1.y*F+I.col2.y*B;F=A;I=E.m_xf.R;var D=this.m_localAnchor2.x-E.m_sweep.localCenter.x,L=this.m_localAnchor2.y-E.m_sweep.localCenter.y;A=I.col1.x*D+I.col2.x*L;L=I.col1.y*D+I.col2.y*L;D=A;A=E.m_sweep.c.x+D-G.m_sweep.c.x-F;var K=E.m_sweep.c.y+L-G.m_sweep.c.y-B;I=Math.sqrt(A*A+K*K);A/=I;K/=I;I=I-this.m_length;I=r.Clamp(I,-AC.b2_maxLinearCorrection,AC.b2_maxLinearCorrection);var H=-this.m_mass*I;this.m_u.Set(A,K);A=H*this.m_u.x;K=H*this.m_u.y;G.m_sweep.c.x-=G.m_invMass*A;G.m_sweep.c.y-=G.m_invMass*K;G.m_sweep.a-=G.m_invI*(F*K-B*A);E.m_sweep.c.x+=E.m_invMass*A;E.m_sweep.c.y+=E.m_invMass*K;E.m_sweep.a+=E.m_invI*(D*K-L*A);G.SynchronizeTransform();E.SynchronizeTransform();return r.Abs(I)<AC.b2_linearSlop};Box2D.inherit(AH,Box2D.Dynamics.Joints.b2JointDef);AH.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;AH.b2DistanceJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new x;this.localAnchorB=new x};AH.prototype.b2DistanceJointDef=function(){this.__super.b2JointDef.call(this);this.type=s.e_distanceJoint;this.length=1;this.dampingRatio=this.frequencyHz=0};AH.prototype.Initialize=function(E,D,A,B){this.bodyA=E;this.bodyB=D;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(A));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(B));E=B.x-A.x;A=B.y-A.y;this.length=Math.sqrt(E*E+A*A);this.dampingRatio=this.frequencyHz=0};Box2D.inherit(AF,Box2D.Dynamics.Joints.b2Joint);AF.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AF.b2FrictionJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new x;this.m_localAnchorB=new x;this.m_linearMass=new AA;this.m_linearImpulse=new x};AF.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};AF.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)};AF.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new x(A*this.m_linearImpulse.x,A*this.m_linearImpulse.y)};AF.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_angularImpulse};AF.prototype.SetMaxForce=function(A){if(A===undefined){A=0}this.m_maxForce=A};AF.prototype.GetMaxForce=function(){return this.m_maxForce};AF.prototype.SetMaxTorque=function(A){if(A===undefined){A=0}this.m_maxTorque=A};AF.prototype.GetMaxTorque=function(){return this.m_maxTorque};AF.prototype.b2FrictionJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchorA.SetV(A.localAnchorA);this.m_localAnchorB.SetV(A.localAnchorB);this.m_linearMass.SetZero();this.m_angularMass=0;this.m_linearImpulse.SetZero();this.m_angularImpulse=0;this.m_maxForce=A.maxForce;this.m_maxTorque=A.maxTorque};AF.prototype.InitVelocityConstraints=function(K){var G,E=0,F=this.m_bodyA,B=this.m_bodyB;G=F.m_xf.R;var A=this.m_localAnchorA.x-F.m_sweep.localCenter.x,D=this.m_localAnchorA.y-F.m_sweep.localCenter.y;E=G.col1.x*A+G.col2.x*D;D=G.col1.y*A+G.col2.y*D;A=E;G=B.m_xf.R;var N=this.m_localAnchorB.x-B.m_sweep.localCenter.x,L=this.m_localAnchorB.y-B.m_sweep.localCenter.y;E=G.col1.x*N+G.col2.x*L;L=G.col1.y*N+G.col2.y*L;N=E;G=F.m_invMass;E=B.m_invMass;var H=F.m_invI,M=B.m_invI,I=new AA;I.col1.x=G+E;I.col2.x=0;I.col1.y=0;I.col2.y=G+E;I.col1.x+=H*D*D;I.col2.x+=-H*A*D;I.col1.y+=-H*A*D;I.col2.y+=H*A*A;I.col1.x+=M*L*L;I.col2.x+=-M*N*L;I.col1.y+=-M*N*L;I.col2.y+=M*N*N;I.GetInverse(this.m_linearMass);this.m_angularMass=H+M;if(this.m_angularMass>0){this.m_angularMass=1/this.m_angularMass}if(K.warmStarting){this.m_linearImpulse.x*=K.dtRatio;this.m_linearImpulse.y*=K.dtRatio;this.m_angularImpulse*=K.dtRatio;K=this.m_linearImpulse;F.m_linearVelocity.x-=G*K.x;F.m_linearVelocity.y-=G*K.y;F.m_angularVelocity-=H*(A*K.y-D*K.x+this.m_angularImpulse);B.m_linearVelocity.x+=E*K.x;B.m_linearVelocity.y+=E*K.y;B.m_angularVelocity+=M*(N*K.y-L*K.x+this.m_angularImpulse)}else{this.m_linearImpulse.SetZero();this.m_angularImpulse=0}};AF.prototype.SolveVelocityConstraints=function(R){var M,K=0,L=this.m_bodyA,G=this.m_bodyB,F=L.m_linearVelocity,H=L.m_angularVelocity,V=G.m_linearVelocity,S=G.m_angularVelocity,N=L.m_invMass,U=G.m_invMass,Q=L.m_invI,O=G.m_invI;M=L.m_xf.R;var I=this.m_localAnchorA.x-L.m_sweep.localCenter.x,E=this.m_localAnchorA.y-L.m_sweep.localCenter.y;K=M.col1.x*I+M.col2.x*E;E=M.col1.y*I+M.col2.y*E;I=K;M=G.m_xf.R;var D=this.m_localAnchorB.x-G.m_sweep.localCenter.x,A=this.m_localAnchorB.y-G.m_sweep.localCenter.y;K=M.col1.x*D+M.col2.x*A;A=M.col1.y*D+M.col2.y*A;D=K;M=0;K=-this.m_angularMass*(S-H);var B=this.m_angularImpulse;M=R.dt*this.m_maxTorque;this.m_angularImpulse=r.Clamp(this.m_angularImpulse+K,-M,M);K=this.m_angularImpulse-B;H-=Q*K;S+=O*K;M=r.MulMV(this.m_linearMass,new x(-(V.x-S*A-F.x+H*E),-(V.y+S*D-F.y-H*I)));K=this.m_linearImpulse.Copy();this.m_linearImpulse.Add(M);M=R.dt*this.m_maxForce;if(this.m_linearImpulse.LengthSquared()>M*M){this.m_linearImpulse.Normalize();this.m_linearImpulse.Multiply(M)}M=r.SubtractVV(this.m_linearImpulse,K);F.x-=N*M.x;F.y-=N*M.y;H-=Q*(I*M.y-E*M.x);V.x+=U*M.x;V.y+=U*M.y;S+=O*(D*M.y-A*M.x);L.m_angularVelocity=H;G.m_angularVelocity=S};AF.prototype.SolvePositionConstraints=function(){return true};Box2D.inherit(f,Box2D.Dynamics.Joints.b2JointDef);f.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;f.b2FrictionJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new x;this.localAnchorB=new x};f.prototype.b2FrictionJointDef=function(){this.__super.b2JointDef.call(this);this.type=s.e_frictionJoint;this.maxTorque=this.maxForce=0};f.prototype.Initialize=function(D,B,A){this.bodyA=D;this.bodyB=B;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(A));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(A))};Box2D.inherit(T,Box2D.Dynamics.Joints.b2Joint);T.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;T.b2GearJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new x;this.m_groundAnchor2=new x;this.m_localAnchor1=new x;this.m_localAnchor2=new x;this.m_J=new m};T.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};T.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};T.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new x(A*this.m_impulse*this.m_J.linearB.x,A*this.m_impulse*this.m_J.linearB.y)};T.prototype.GetReactionTorque=function(F){if(F===undefined){F=0}var D=this.m_bodyB.m_xf.R,A=this.m_localAnchor1.x-this.m_bodyB.m_sweep.localCenter.x,B=this.m_localAnchor1.y-this.m_bodyB.m_sweep.localCenter.y,E=D.col1.x*A+D.col2.x*B;B=D.col1.y*A+D.col2.y*B;A=E;return F*(this.m_impulse*this.m_J.angularB-A*this.m_impulse*this.m_J.linearB.y+B*this.m_impulse*this.m_J.linearB.x)};T.prototype.GetRatio=function(){return this.m_ratio};T.prototype.SetRatio=function(A){if(A===undefined){A=0}this.m_ratio=A};T.prototype.b2GearJoint=function(F){this.__super.b2Joint.call(this,F);var D=parseInt(F.joint1.m_type),A=parseInt(F.joint2.m_type);this.m_prismatic2=this.m_revolute2=this.m_prismatic1=this.m_revolute1=null;var B=0,E=0;this.m_ground1=F.joint1.GetBodyA();this.m_bodyA=F.joint1.GetBodyB();if(D==s.e_revoluteJoint){this.m_revolute1=F.joint1 instanceof h?F.joint1:null;this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1);this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2);B=this.m_revolute1.GetJointAngle()}else{this.m_prismatic1=F.joint1 instanceof t?F.joint1:null;this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1);this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2);B=this.m_prismatic1.GetJointTranslation()}this.m_ground2=F.joint2.GetBodyA();this.m_bodyB=F.joint2.GetBodyB();if(A==s.e_revoluteJoint){this.m_revolute2=F.joint2 instanceof h?F.joint2:null;this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1);this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2);E=this.m_revolute2.GetJointAngle()}else{this.m_prismatic2=F.joint2 instanceof t?F.joint2:null;this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1);this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2);E=this.m_prismatic2.GetJointTranslation()}this.m_ratio=F.ratio;this.m_constant=B+this.m_ratio*E;this.m_impulse=0};T.prototype.InitVelocityConstraints=function(I){var G=this.m_ground1,E=this.m_ground2,F=this.m_bodyA,B=this.m_bodyB,A=0,D=0,M=0,K=0,H=M=0,L=0;this.m_J.SetZero();if(this.m_revolute1){this.m_J.angularA=-1;L+=F.m_invI}else{G=G.m_xf.R;D=this.m_prismatic1.m_localXAxis1;A=G.col1.x*D.x+G.col2.x*D.y;D=G.col1.y*D.x+G.col2.y*D.y;G=F.m_xf.R;M=this.m_localAnchor1.x-F.m_sweep.localCenter.x;K=this.m_localAnchor1.y-F.m_sweep.localCenter.y;H=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=H;M=M*D-K*A;this.m_J.linearA.Set(-A,-D);this.m_J.angularA=-M;L+=F.m_invMass+F.m_invI*M*M}if(this.m_revolute2){this.m_J.angularB=-this.m_ratio;L+=this.m_ratio*this.m_ratio*B.m_invI}else{G=E.m_xf.R;D=this.m_prismatic2.m_localXAxis1;A=G.col1.x*D.x+G.col2.x*D.y;D=G.col1.y*D.x+G.col2.y*D.y;G=B.m_xf.R;M=this.m_localAnchor2.x-B.m_sweep.localCenter.x;K=this.m_localAnchor2.y-B.m_sweep.localCenter.y;H=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=H;M=M*D-K*A;this.m_J.linearB.Set(-this.m_ratio*A,-this.m_ratio*D);this.m_J.angularB=-this.m_ratio*M;L+=this.m_ratio*this.m_ratio*(B.m_invMass+B.m_invI*M*M)}this.m_mass=L>0?1/L:0;if(I.warmStarting){F.m_linearVelocity.x+=F.m_invMass*this.m_impulse*this.m_J.linearA.x;F.m_linearVelocity.y+=F.m_invMass*this.m_impulse*this.m_J.linearA.y;F.m_angularVelocity+=F.m_invI*this.m_impulse*this.m_J.angularA;B.m_linearVelocity.x+=B.m_invMass*this.m_impulse*this.m_J.linearB.x;B.m_linearVelocity.y+=B.m_invMass*this.m_impulse*this.m_J.linearB.y;B.m_angularVelocity+=B.m_invI*this.m_impulse*this.m_J.angularB}else{this.m_impulse=0}};T.prototype.SolveVelocityConstraints=function(){var D=this.m_bodyA,B=this.m_bodyB,A=-this.m_mass*this.m_J.Compute(D.m_linearVelocity,D.m_angularVelocity,B.m_linearVelocity,B.m_angularVelocity);this.m_impulse+=A;D.m_linearVelocity.x+=D.m_invMass*A*this.m_J.linearA.x;D.m_linearVelocity.y+=D.m_invMass*A*this.m_J.linearA.y;D.m_angularVelocity+=D.m_invI*A*this.m_J.angularA;B.m_linearVelocity.x+=B.m_invMass*A*this.m_J.linearB.x;B.m_linearVelocity.y+=B.m_invMass*A*this.m_J.linearB.y;B.m_angularVelocity+=B.m_invI*A*this.m_J.angularB};T.prototype.SolvePositionConstraints=function(){var E=this.m_bodyA,D=this.m_bodyB,A=0,B=0;A=this.m_revolute1?this.m_revolute1.GetJointAngle():this.m_prismatic1.GetJointTranslation();B=this.m_revolute2?this.m_revolute2.GetJointAngle():this.m_prismatic2.GetJointTranslation();A=-this.m_mass*(this.m_constant-(A+this.m_ratio*B));E.m_sweep.c.x+=E.m_invMass*A*this.m_J.linearA.x;E.m_sweep.c.y+=E.m_invMass*A*this.m_J.linearA.y;E.m_sweep.a+=E.m_invI*A*this.m_J.angularA;D.m_sweep.c.x+=D.m_invMass*A*this.m_J.linearB.x;D.m_sweep.c.y+=D.m_invMass*A*this.m_J.linearB.y;D.m_sweep.a+=D.m_invI*A*this.m_J.angularB;E.SynchronizeTransform();D.SynchronizeTransform();return 0<AC.b2_linearSlop};Box2D.inherit(l,Box2D.Dynamics.Joints.b2JointDef);l.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;l.b2GearJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments)};l.prototype.b2GearJointDef=function(){this.__super.b2JointDef.call(this);this.type=s.e_gearJoint;this.joint2=this.joint1=null;this.ratio=1};m.b2Jacobian=function(){this.linearA=new x;this.linearB=new x};m.prototype.SetZero=function(){this.linearA.SetZero();this.angularA=0;this.linearB.SetZero();this.angularB=0};m.prototype.Set=function(E,D,A,B){if(D===undefined){D=0}if(B===undefined){B=0}this.linearA.SetV(E);this.angularA=D;this.linearB.SetV(A);this.angularB=B};m.prototype.Compute=function(E,D,A,B){if(D===undefined){D=0}if(B===undefined){B=0}return this.linearA.x*E.x+this.linearA.y*E.y+this.angularA*D+(this.linearB.x*A.x+this.linearB.y*A.y)+this.angularB*B};s.b2Joint=function(){this.m_edgeA=new J;this.m_edgeB=new J;this.m_localCenterA=new x;this.m_localCenterB=new x};s.prototype.GetType=function(){return this.m_type};s.prototype.GetAnchorA=function(){return null};s.prototype.GetAnchorB=function(){return null};s.prototype.GetReactionForce=function(){return null};s.prototype.GetReactionTorque=function(){return 0};s.prototype.GetBodyA=function(){return this.m_bodyA};s.prototype.GetBodyB=function(){return this.m_bodyB};s.prototype.GetNext=function(){return this.m_next};s.prototype.GetUserData=function(){return this.m_userData};s.prototype.SetUserData=function(A){this.m_userData=A};s.prototype.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()};s.Create=function(B){var A=null;switch(B.type){case s.e_distanceJoint:A=new X(B instanceof AH?B:null);break;case s.e_mouseJoint:A=new AB(B instanceof AE?B:null);break;case s.e_prismaticJoint:A=new t(B instanceof g?B:null);break;case s.e_revoluteJoint:A=new h(B instanceof b?B:null);break;case s.e_pulleyJoint:A=new AD(B instanceof e?B:null);break;case s.e_gearJoint:A=new T(B instanceof l?B:null);break;case s.e_lineJoint:A=new AI(B instanceof n?B:null);break;case s.e_weldJoint:A=new AJ(B instanceof C?B:null);break;case s.e_frictionJoint:A=new AF(B instanceof f?B:null)}return A};s.Destroy=function(){};s.prototype.b2Joint=function(A){AC.b2Assert(A.bodyA!=A.bodyB);this.m_type=A.type;this.m_next=this.m_prev=null;this.m_bodyA=A.bodyA;this.m_bodyB=A.bodyB;this.m_collideConnected=A.collideConnected;this.m_islandFlag=false;this.m_userData=A.userData};s.prototype.InitVelocityConstraints=function(){};s.prototype.SolveVelocityConstraints=function(){};s.prototype.FinalizeVelocityConstraints=function(){};s.prototype.SolvePositionConstraints=function(){return false};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2Joint.e_unknownJoint=0;Box2D.Dynamics.Joints.b2Joint.e_revoluteJoint=1;Box2D.Dynamics.Joints.b2Joint.e_prismaticJoint=2;Box2D.Dynamics.Joints.b2Joint.e_distanceJoint=3;Box2D.Dynamics.Joints.b2Joint.e_pulleyJoint=4;Box2D.Dynamics.Joints.b2Joint.e_mouseJoint=5;Box2D.Dynamics.Joints.b2Joint.e_gearJoint=6;Box2D.Dynamics.Joints.b2Joint.e_lineJoint=7;Box2D.Dynamics.Joints.b2Joint.e_weldJoint=8;Box2D.Dynamics.Joints.b2Joint.e_frictionJoint=9;Box2D.Dynamics.Joints.b2Joint.e_inactiveLimit=0;Box2D.Dynamics.Joints.b2Joint.e_atLowerLimit=1;Box2D.Dynamics.Joints.b2Joint.e_atUpperLimit=2;Box2D.Dynamics.Joints.b2Joint.e_equalLimits=3});P.b2JointDef=function(){};P.prototype.b2JointDef=function(){this.type=s.e_unknownJoint;this.bodyB=this.bodyA=this.userData=null;this.collideConnected=false};J.b2JointEdge=function(){};Box2D.inherit(AI,Box2D.Dynamics.Joints.b2Joint);AI.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AI.b2LineJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new x;this.m_localAnchor2=new x;this.m_localXAxis1=new x;this.m_localYAxis1=new x;this.m_axis=new x;this.m_perp=new x;this.m_K=new AA;this.m_impulse=new x};AI.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};AI.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};AI.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new x(A*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x),A*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y))};AI.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.y};AI.prototype.GetJointTranslation=function(){var E=this.m_bodyA,D=this.m_bodyB,A=E.GetWorldPoint(this.m_localAnchor1),B=D.GetWorldPoint(this.m_localAnchor2);D=B.x-A.x;A=B.y-A.y;E=E.GetWorldVector(this.m_localXAxis1);return E.x*D+E.y*A};AI.prototype.GetJointSpeed=function(){var I=this.m_bodyA,G=this.m_bodyB,E;E=I.m_xf.R;var F=this.m_localAnchor1.x-I.m_sweep.localCenter.x,B=this.m_localAnchor1.y-I.m_sweep.localCenter.y,A=E.col1.x*F+E.col2.x*B;B=E.col1.y*F+E.col2.y*B;F=A;E=G.m_xf.R;var D=this.m_localAnchor2.x-G.m_sweep.localCenter.x,M=this.m_localAnchor2.y-G.m_sweep.localCenter.y;A=E.col1.x*D+E.col2.x*M;M=E.col1.y*D+E.col2.y*M;D=A;E=G.m_sweep.c.x+D-(I.m_sweep.c.x+F);A=G.m_sweep.c.y+M-(I.m_sweep.c.y+B);var K=I.GetWorldVector(this.m_localXAxis1),H=I.m_linearVelocity,L=G.m_linearVelocity;I=I.m_angularVelocity;G=G.m_angularVelocity;return E*-I*K.y+A*I*K.x+(K.x*(L.x+-G*M-H.x- -I*B)+K.y*(L.y+G*D-H.y-I*F))};AI.prototype.IsLimitEnabled=function(){return this.m_enableLimit};AI.prototype.EnableLimit=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableLimit=A};AI.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};AI.prototype.GetUpperLimit=function(){return this.m_upperTranslation};AI.prototype.SetLimits=function(B,A){if(B===undefined){B=0}if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_lowerTranslation=B;this.m_upperTranslation=A};AI.prototype.IsMotorEnabled=function(){return this.m_enableMotor};AI.prototype.EnableMotor=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableMotor=A};AI.prototype.SetMotorSpeed=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=A};AI.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};AI.prototype.SetMaxMotorForce=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_maxMotorForce=A};AI.prototype.GetMaxMotorForce=function(){return this.m_maxMotorForce};AI.prototype.GetMotorForce=function(){return this.m_motorImpulse};AI.prototype.b2LineJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_localXAxis1.SetV(A.localAxisA);this.m_localYAxis1.x=-this.m_localXAxis1.y;this.m_localYAxis1.y=this.m_localXAxis1.x;this.m_impulse.SetZero();this.m_motorImpulse=this.m_motorMass=0;this.m_lowerTranslation=A.lowerTranslation;this.m_upperTranslation=A.upperTranslation;this.m_maxMotorForce=A.maxMotorForce;this.m_motorSpeed=A.motorSpeed;this.m_enableLimit=A.enableLimit;this.m_enableMotor=A.enableMotor;this.m_limitState=s.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};AI.prototype.InitVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F,B=0;this.m_localCenterA.SetV(G.GetLocalCenter());this.m_localCenterB.SetV(E.GetLocalCenter());var A=G.GetTransform();E.GetTransform();F=G.m_xf.R;var D=this.m_localAnchor1.x-this.m_localCenterA.x,L=this.m_localAnchor1.y-this.m_localCenterA.y;B=F.col1.x*D+F.col2.x*L;L=F.col1.y*D+F.col2.y*L;D=B;F=E.m_xf.R;var K=this.m_localAnchor2.x-this.m_localCenterB.x,H=this.m_localAnchor2.y-this.m_localCenterB.y;B=F.col1.x*K+F.col2.x*H;H=F.col1.y*K+F.col2.y*H;K=B;F=E.m_sweep.c.x+K-G.m_sweep.c.x-D;B=E.m_sweep.c.y+H-G.m_sweep.c.y-L;this.m_invMassA=G.m_invMass;this.m_invMassB=E.m_invMass;this.m_invIA=G.m_invI;this.m_invIB=E.m_invI;this.m_axis.SetV(r.MulMV(A.R,this.m_localXAxis1));this.m_a1=(F+D)*this.m_axis.y-(B+L)*this.m_axis.x;this.m_a2=K*this.m_axis.y-H*this.m_axis.x;this.m_motorMass=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_a1*this.m_a1+this.m_invIB*this.m_a2*this.m_a2;this.m_motorMass=this.m_motorMass>Number.MIN_VALUE?1/this.m_motorMass:0;this.m_perp.SetV(r.MulMV(A.R,this.m_localYAxis1));this.m_s1=(F+D)*this.m_perp.y-(B+L)*this.m_perp.x;this.m_s2=K*this.m_perp.y-H*this.m_perp.x;A=this.m_invMassA;D=this.m_invMassB;L=this.m_invIA;K=this.m_invIB;this.m_K.col1.x=A+D+L*this.m_s1*this.m_s1+K*this.m_s2*this.m_s2;this.m_K.col1.y=L*this.m_s1*this.m_a1+K*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=A+D+L*this.m_a1*this.m_a1+K*this.m_a2*this.m_a2;if(this.m_enableLimit){F=this.m_axis.x*F+this.m_axis.y*B;if(r.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AC.b2_linearSlop){this.m_limitState=s.e_equalLimits}else{if(F<=this.m_lowerTranslation){if(this.m_limitState!=s.e_atLowerLimit){this.m_limitState=s.e_atLowerLimit;this.m_impulse.y=0}}else{if(F>=this.m_upperTranslation){if(this.m_limitState!=s.e_atUpperLimit){this.m_limitState=s.e_atUpperLimit;this.m_impulse.y=0}}else{this.m_limitState=s.e_inactiveLimit;this.m_impulse.y=0}}}}else{this.m_limitState=s.e_inactiveLimit}if(this.m_enableMotor==false){this.m_motorImpulse=0}if(I.warmStarting){this.m_impulse.x*=I.dtRatio;this.m_impulse.y*=I.dtRatio;this.m_motorImpulse*=I.dtRatio;I=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x;F=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y;B=this.m_impulse.x*this.m_s1+(this.m_motorImpulse+this.m_impulse.y)*this.m_a1;A=this.m_impulse.x*this.m_s2+(this.m_motorImpulse+this.m_impulse.y)*this.m_a2;G.m_linearVelocity.x-=this.m_invMassA*I;G.m_linearVelocity.y-=this.m_invMassA*F;G.m_angularVelocity-=this.m_invIA*B;E.m_linearVelocity.x+=this.m_invMassB*I;E.m_linearVelocity.y+=this.m_invMassB*F;E.m_angularVelocity+=this.m_invIB*A}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};AI.prototype.SolveVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F=G.m_linearVelocity,B=G.m_angularVelocity,A=E.m_linearVelocity,D=E.m_angularVelocity,M=0,K=0,H=0,L=0;if(this.m_enableMotor&&this.m_limitState!=s.e_equalLimits){L=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B));M=this.m_motorImpulse;K=I.dt*this.m_maxMotorForce;this.m_motorImpulse=r.Clamp(this.m_motorImpulse+L,-K,K);L=this.m_motorImpulse-M;M=L*this.m_axis.x;K=L*this.m_axis.y;H=L*this.m_a1;L=L*this.m_a2;F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L}K=this.m_perp.x*(A.x-F.x)+this.m_perp.y*(A.y-F.y)+this.m_s2*D-this.m_s1*B;if(this.m_enableLimit&&this.m_limitState!=s.e_inactiveLimit){H=this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B;M=this.m_impulse.Copy();I=this.m_K.Solve(new x,-K,-H);this.m_impulse.Add(I);if(this.m_limitState==s.e_atLowerLimit){this.m_impulse.y=r.Max(this.m_impulse.y,0)}else{if(this.m_limitState==s.e_atUpperLimit){this.m_impulse.y=r.Min(this.m_impulse.y,0)}}K=-K-(this.m_impulse.y-M.y)*this.m_K.col2.x;H=0;H=this.m_K.col1.x!=0?K/this.m_K.col1.x+M.x:M.x;this.m_impulse.x=H;I.x=this.m_impulse.x-M.x;I.y=this.m_impulse.y-M.y;M=I.x*this.m_perp.x+I.y*this.m_axis.x;K=I.x*this.m_perp.y+I.y*this.m_axis.y;H=I.x*this.m_s1+I.y*this.m_a1;L=I.x*this.m_s2+I.y*this.m_a2}else{I=0;I=this.m_K.col1.x!=0?-K/this.m_K.col1.x:0;this.m_impulse.x+=I;M=I*this.m_perp.x;K=I*this.m_perp.y;H=I*this.m_s1;L=I*this.m_s2}F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L;G.m_linearVelocity.SetV(F);G.m_angularVelocity=B;E.m_linearVelocity.SetV(A);E.m_angularVelocity=D};AI.prototype.SolvePositionConstraints=function(){var N=this.m_bodyA,I=this.m_bodyB,G=N.m_sweep.c,H=N.m_sweep.a,D=I.m_sweep.c,B=I.m_sweep.a,E,R=0,O=0,K=0,Q=0,M=E=0,L=0;O=false;var F=0,A=AA.FromAngle(H);K=AA.FromAngle(B);E=A;L=this.m_localAnchor1.x-this.m_localCenterA.x;var U=this.m_localAnchor1.y-this.m_localCenterA.y;R=E.col1.x*L+E.col2.x*U;U=E.col1.y*L+E.col2.y*U;L=R;E=K;K=this.m_localAnchor2.x-this.m_localCenterB.x;Q=this.m_localAnchor2.y-this.m_localCenterB.y;R=E.col1.x*K+E.col2.x*Q;Q=E.col1.y*K+E.col2.y*Q;K=R;E=D.x+K-G.x-L;R=D.y+Q-G.y-U;if(this.m_enableLimit){this.m_axis=r.MulMV(A,this.m_localXAxis1);this.m_a1=(E+L)*this.m_axis.y-(R+U)*this.m_axis.x;this.m_a2=K*this.m_axis.y-Q*this.m_axis.x;var S=this.m_axis.x*E+this.m_axis.y*R;if(r.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AC.b2_linearSlop){F=r.Clamp(S,-AC.b2_maxLinearCorrection,AC.b2_maxLinearCorrection);M=r.Abs(S);O=true}else{if(S<=this.m_lowerTranslation){F=r.Clamp(S-this.m_lowerTranslation+AC.b2_linearSlop,-AC.b2_maxLinearCorrection,0);M=this.m_lowerTranslation-S;O=true}else{if(S>=this.m_upperTranslation){F=r.Clamp(S-this.m_upperTranslation+AC.b2_linearSlop,0,AC.b2_maxLinearCorrection);M=S-this.m_upperTranslation;O=true}}}}this.m_perp=r.MulMV(A,this.m_localYAxis1);this.m_s1=(E+L)*this.m_perp.y-(R+U)*this.m_perp.x;this.m_s2=K*this.m_perp.y-Q*this.m_perp.x;A=new x;U=this.m_perp.x*E+this.m_perp.y*R;M=r.Max(M,r.Abs(U));L=0;if(O){O=this.m_invMassA;K=this.m_invMassB;Q=this.m_invIA;E=this.m_invIB;this.m_K.col1.x=O+K+Q*this.m_s1*this.m_s1+E*this.m_s2*this.m_s2;this.m_K.col1.y=Q*this.m_s1*this.m_a1+E*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=O+K+Q*this.m_a1*this.m_a1+E*this.m_a2*this.m_a2;this.m_K.Solve(A,-U,-F)}else{O=this.m_invMassA;K=this.m_invMassB;Q=this.m_invIA;E=this.m_invIB;F=O+K+Q*this.m_s1*this.m_s1+E*this.m_s2*this.m_s2;O=0;O=F!=0?-U/F:0;A.x=O;A.y=0}F=A.x*this.m_perp.x+A.y*this.m_axis.x;O=A.x*this.m_perp.y+A.y*this.m_axis.y;U=A.x*this.m_s1+A.y*this.m_a1;A=A.x*this.m_s2+A.y*this.m_a2;G.x-=this.m_invMassA*F;G.y-=this.m_invMassA*O;H-=this.m_invIA*U;D.x+=this.m_invMassB*F;D.y+=this.m_invMassB*O;B+=this.m_invIB*A;N.m_sweep.a=H;I.m_sweep.a=B;N.SynchronizeTransform();I.SynchronizeTransform();return M<=AC.b2_linearSlop&&L<=AC.b2_angularSlop};Box2D.inherit(n,Box2D.Dynamics.Joints.b2JointDef);n.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;n.b2LineJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new x;this.localAnchorB=new x;this.localAxisA=new x};n.prototype.b2LineJointDef=function(){this.__super.b2JointDef.call(this);this.type=s.e_lineJoint;this.localAxisA.Set(1,0);this.enableLimit=false;this.upperTranslation=this.lowerTranslation=0;this.enableMotor=false;this.motorSpeed=this.maxMotorForce=0};n.prototype.Initialize=function(E,D,A,B){this.bodyA=E;this.bodyB=D;this.localAnchorA=this.bodyA.GetLocalPoint(A);this.localAnchorB=this.bodyB.GetLocalPoint(A);this.localAxisA=this.bodyA.GetLocalVector(B)};Box2D.inherit(AB,Box2D.Dynamics.Joints.b2Joint);AB.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AB.b2MouseJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.K=new AA;this.K1=new AA;this.K2=new AA;this.m_localAnchor=new x;this.m_target=new x;this.m_impulse=new x;this.m_mass=new AA;this.m_C=new x};AB.prototype.GetAnchorA=function(){return this.m_target};AB.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor)};AB.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new x(A*this.m_impulse.x,A*this.m_impulse.y)};AB.prototype.GetReactionTorque=function(){return 0};AB.prototype.GetTarget=function(){return this.m_target};AB.prototype.SetTarget=function(A){this.m_bodyB.IsAwake()==false&&this.m_bodyB.SetAwake(true);this.m_target=A};AB.prototype.GetMaxForce=function(){return this.m_maxForce};AB.prototype.SetMaxForce=function(A){if(A===undefined){A=0}this.m_maxForce=A};AB.prototype.GetFrequency=function(){return this.m_frequencyHz};AB.prototype.SetFrequency=function(A){if(A===undefined){A=0}this.m_frequencyHz=A};AB.prototype.GetDampingRatio=function(){return this.m_dampingRatio};AB.prototype.SetDampingRatio=function(A){if(A===undefined){A=0}this.m_dampingRatio=A};AB.prototype.b2MouseJoint=function(E){this.__super.b2Joint.call(this,E);this.m_target.SetV(E.target);var D=this.m_target.x-this.m_bodyB.m_xf.position.x,A=this.m_target.y-this.m_bodyB.m_xf.position.y,B=this.m_bodyB.m_xf.R;this.m_localAnchor.x=D*B.col1.x+A*B.col1.y;this.m_localAnchor.y=D*B.col2.x+A*B.col2.y;this.m_maxForce=E.maxForce;this.m_impulse.SetZero();this.m_frequencyHz=E.frequencyHz;this.m_dampingRatio=E.dampingRatio;this.m_gamma=this.m_beta=0};AB.prototype.InitVelocityConstraints=function(G){var D=this.m_bodyB,A=D.GetMass(),B=2*Math.PI*this.m_frequencyHz,F=A*B*B;this.m_gamma=G.dt*(2*A*this.m_dampingRatio*B+G.dt*F);this.m_gamma=this.m_gamma!=0?1/this.m_gamma:0;this.m_beta=G.dt*F*this.m_gamma;F=D.m_xf.R;A=this.m_localAnchor.x-D.m_sweep.localCenter.x;B=this.m_localAnchor.y-D.m_sweep.localCenter.y;var E=F.col1.x*A+F.col2.x*B;B=F.col1.y*A+F.col2.y*B;A=E;F=D.m_invMass;E=D.m_invI;this.K1.col1.x=F;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=F;this.K2.col1.x=E*B*B;this.K2.col2.x=-E*A*B;this.K2.col1.y=-E*A*B;this.K2.col2.y=E*A*A;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.col1.x+=this.m_gamma;this.K.col2.y+=this.m_gamma;this.K.GetInverse(this.m_mass);this.m_C.x=D.m_sweep.c.x+A-this.m_target.x;this.m_C.y=D.m_sweep.c.y+B-this.m_target.y;D.m_angularVelocity*=0.98;this.m_impulse.x*=G.dtRatio;this.m_impulse.y*=G.dtRatio;D.m_linearVelocity.x+=F*this.m_impulse.x;D.m_linearVelocity.y+=F*this.m_impulse.y;D.m_angularVelocity+=E*(A*this.m_impulse.y-B*this.m_impulse.x)};AB.prototype.SolveVelocityConstraints=function(H){var E=this.m_bodyB,B,D=0,G=0;B=E.m_xf.R;var F=this.m_localAnchor.x-E.m_sweep.localCenter.x,I=this.m_localAnchor.y-E.m_sweep.localCenter.y;D=B.col1.x*F+B.col2.x*I;I=B.col1.y*F+B.col2.y*I;F=D;D=E.m_linearVelocity.x+-E.m_angularVelocity*I;var A=E.m_linearVelocity.y+E.m_angularVelocity*F;B=this.m_mass;D=D+this.m_beta*this.m_C.x+this.m_gamma*this.m_impulse.x;G=A+this.m_beta*this.m_C.y+this.m_gamma*this.m_impulse.y;A=-(B.col1.x*D+B.col2.x*G);G=-(B.col1.y*D+B.col2.y*G);B=this.m_impulse.x;D=this.m_impulse.y;this.m_impulse.x+=A;this.m_impulse.y+=G;H=H.dt*this.m_maxForce;this.m_impulse.LengthSquared()>H*H&&this.m_impulse.Multiply(H/this.m_impulse.Length());A=this.m_impulse.x-B;G=this.m_impulse.y-D;E.m_linearVelocity.x+=E.m_invMass*A;E.m_linearVelocity.y+=E.m_invMass*G;E.m_angularVelocity+=E.m_invI*(F*G-I*A)};AB.prototype.SolvePositionConstraints=function(){return true};Box2D.inherit(AE,Box2D.Dynamics.Joints.b2JointDef);AE.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;AE.b2MouseJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.target=new x};AE.prototype.b2MouseJointDef=function(){this.__super.b2JointDef.call(this);this.type=s.e_mouseJoint;this.maxForce=0;this.frequencyHz=5;this.dampingRatio=0.7};Box2D.inherit(t,Box2D.Dynamics.Joints.b2Joint);t.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;t.b2PrismaticJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new x;this.m_localAnchor2=new x;this.m_localXAxis1=new x;this.m_localYAxis1=new x;this.m_axis=new x;this.m_perp=new x;this.m_K=new o;this.m_impulse=new AG};t.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};t.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};t.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new x(A*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),A*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y))};t.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.y};t.prototype.GetJointTranslation=function(){var E=this.m_bodyA,D=this.m_bodyB,A=E.GetWorldPoint(this.m_localAnchor1),B=D.GetWorldPoint(this.m_localAnchor2);D=B.x-A.x;A=B.y-A.y;E=E.GetWorldVector(this.m_localXAxis1);return E.x*D+E.y*A};t.prototype.GetJointSpeed=function(){var I=this.m_bodyA,G=this.m_bodyB,E;E=I.m_xf.R;var F=this.m_localAnchor1.x-I.m_sweep.localCenter.x,B=this.m_localAnchor1.y-I.m_sweep.localCenter.y,A=E.col1.x*F+E.col2.x*B;B=E.col1.y*F+E.col2.y*B;F=A;E=G.m_xf.R;var D=this.m_localAnchor2.x-G.m_sweep.localCenter.x,M=this.m_localAnchor2.y-G.m_sweep.localCenter.y;A=E.col1.x*D+E.col2.x*M;M=E.col1.y*D+E.col2.y*M;D=A;E=G.m_sweep.c.x+D-(I.m_sweep.c.x+F);A=G.m_sweep.c.y+M-(I.m_sweep.c.y+B);var K=I.GetWorldVector(this.m_localXAxis1),H=I.m_linearVelocity,L=G.m_linearVelocity;I=I.m_angularVelocity;G=G.m_angularVelocity;return E*-I*K.y+A*I*K.x+(K.x*(L.x+-G*M-H.x- -I*B)+K.y*(L.y+G*D-H.y-I*F))};t.prototype.IsLimitEnabled=function(){return this.m_enableLimit};t.prototype.EnableLimit=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableLimit=A};t.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};t.prototype.GetUpperLimit=function(){return this.m_upperTranslation};t.prototype.SetLimits=function(B,A){if(B===undefined){B=0}if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_lowerTranslation=B;this.m_upperTranslation=A};t.prototype.IsMotorEnabled=function(){return this.m_enableMotor};t.prototype.EnableMotor=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableMotor=A};t.prototype.SetMotorSpeed=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=A};t.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};t.prototype.SetMaxMotorForce=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_maxMotorForce=A};t.prototype.GetMotorForce=function(){return this.m_motorImpulse};t.prototype.b2PrismaticJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_localXAxis1.SetV(A.localAxisA);this.m_localYAxis1.x=-this.m_localXAxis1.y;this.m_localYAxis1.y=this.m_localXAxis1.x;this.m_refAngle=A.referenceAngle;this.m_impulse.SetZero();this.m_motorImpulse=this.m_motorMass=0;this.m_lowerTranslation=A.lowerTranslation;this.m_upperTranslation=A.upperTranslation;this.m_maxMotorForce=A.maxMotorForce;this.m_motorSpeed=A.motorSpeed;this.m_enableLimit=A.enableLimit;this.m_enableMotor=A.enableMotor;this.m_limitState=s.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};t.prototype.InitVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F,B=0;this.m_localCenterA.SetV(G.GetLocalCenter());this.m_localCenterB.SetV(E.GetLocalCenter());var A=G.GetTransform();E.GetTransform();F=G.m_xf.R;var D=this.m_localAnchor1.x-this.m_localCenterA.x,L=this.m_localAnchor1.y-this.m_localCenterA.y;B=F.col1.x*D+F.col2.x*L;L=F.col1.y*D+F.col2.y*L;D=B;F=E.m_xf.R;var K=this.m_localAnchor2.x-this.m_localCenterB.x,H=this.m_localAnchor2.y-this.m_localCenterB.y;B=F.col1.x*K+F.col2.x*H;H=F.col1.y*K+F.col2.y*H;K=B;F=E.m_sweep.c.x+K-G.m_sweep.c.x-D;B=E.m_sweep.c.y+H-G.m_sweep.c.y-L;this.m_invMassA=G.m_invMass;this.m_invMassB=E.m_invMass;this.m_invIA=G.m_invI;this.m_invIB=E.m_invI;this.m_axis.SetV(r.MulMV(A.R,this.m_localXAxis1));this.m_a1=(F+D)*this.m_axis.y-(B+L)*this.m_axis.x;this.m_a2=K*this.m_axis.y-H*this.m_axis.x;this.m_motorMass=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_a1*this.m_a1+this.m_invIB*this.m_a2*this.m_a2;if(this.m_motorMass>Number.MIN_VALUE){this.m_motorMass=1/this.m_motorMass}this.m_perp.SetV(r.MulMV(A.R,this.m_localYAxis1));this.m_s1=(F+D)*this.m_perp.y-(B+L)*this.m_perp.x;this.m_s2=K*this.m_perp.y-H*this.m_perp.x;A=this.m_invMassA;D=this.m_invMassB;L=this.m_invIA;K=this.m_invIB;this.m_K.col1.x=A+D+L*this.m_s1*this.m_s1+K*this.m_s2*this.m_s2;this.m_K.col1.y=L*this.m_s1+K*this.m_s2;this.m_K.col1.z=L*this.m_s1*this.m_a1+K*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=L+K;this.m_K.col2.z=L*this.m_a1+K*this.m_a2;this.m_K.col3.x=this.m_K.col1.z;this.m_K.col3.y=this.m_K.col2.z;this.m_K.col3.z=A+D+L*this.m_a1*this.m_a1+K*this.m_a2*this.m_a2;if(this.m_enableLimit){F=this.m_axis.x*F+this.m_axis.y*B;if(r.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AC.b2_linearSlop){this.m_limitState=s.e_equalLimits}else{if(F<=this.m_lowerTranslation){if(this.m_limitState!=s.e_atLowerLimit){this.m_limitState=s.e_atLowerLimit;this.m_impulse.z=0}}else{if(F>=this.m_upperTranslation){if(this.m_limitState!=s.e_atUpperLimit){this.m_limitState=s.e_atUpperLimit;this.m_impulse.z=0}}else{this.m_limitState=s.e_inactiveLimit;this.m_impulse.z=0}}}}else{this.m_limitState=s.e_inactiveLimit}if(this.m_enableMotor==false){this.m_motorImpulse=0}if(I.warmStarting){this.m_impulse.x*=I.dtRatio;this.m_impulse.y*=I.dtRatio;this.m_motorImpulse*=I.dtRatio;I=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x;F=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y;B=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1;A=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;G.m_linearVelocity.x-=this.m_invMassA*I;G.m_linearVelocity.y-=this.m_invMassA*F;G.m_angularVelocity-=this.m_invIA*B;E.m_linearVelocity.x+=this.m_invMassB*I;E.m_linearVelocity.y+=this.m_invMassB*F;E.m_angularVelocity+=this.m_invIB*A}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};t.prototype.SolveVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F=G.m_linearVelocity,B=G.m_angularVelocity,A=E.m_linearVelocity,D=E.m_angularVelocity,M=0,K=0,H=0,L=0;if(this.m_enableMotor&&this.m_limitState!=s.e_equalLimits){L=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B));M=this.m_motorImpulse;I=I.dt*this.m_maxMotorForce;this.m_motorImpulse=r.Clamp(this.m_motorImpulse+L,-I,I);L=this.m_motorImpulse-M;M=L*this.m_axis.x;K=L*this.m_axis.y;H=L*this.m_a1;L=L*this.m_a2;F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L}H=this.m_perp.x*(A.x-F.x)+this.m_perp.y*(A.y-F.y)+this.m_s2*D-this.m_s1*B;K=D-B;if(this.m_enableLimit&&this.m_limitState!=s.e_inactiveLimit){I=this.m_axis.x*(A.x-F.x)+this.m_axis.y*(A.y-F.y)+this.m_a2*D-this.m_a1*B;M=this.m_impulse.Copy();I=this.m_K.Solve33(new AG,-H,-K,-I);this.m_impulse.Add(I);if(this.m_limitState==s.e_atLowerLimit){this.m_impulse.z=r.Max(this.m_impulse.z,0)}else{if(this.m_limitState==s.e_atUpperLimit){this.m_impulse.z=r.Min(this.m_impulse.z,0)}}H=-H-(this.m_impulse.z-M.z)*this.m_K.col3.x;K=-K-(this.m_impulse.z-M.z)*this.m_K.col3.y;K=this.m_K.Solve22(new x,H,K);K.x+=M.x;K.y+=M.y;this.m_impulse.x=K.x;this.m_impulse.y=K.y;I.x=this.m_impulse.x-M.x;I.y=this.m_impulse.y-M.y;I.z=this.m_impulse.z-M.z;M=I.x*this.m_perp.x+I.z*this.m_axis.x;K=I.x*this.m_perp.y+I.z*this.m_axis.y;H=I.x*this.m_s1+I.y+I.z*this.m_a1;L=I.x*this.m_s2+I.y+I.z*this.m_a2}else{I=this.m_K.Solve22(new x,-H,-K);this.m_impulse.x+=I.x;this.m_impulse.y+=I.y;M=I.x*this.m_perp.x;K=I.x*this.m_perp.y;H=I.x*this.m_s1+I.y;L=I.x*this.m_s2+I.y}F.x-=this.m_invMassA*M;F.y-=this.m_invMassA*K;B-=this.m_invIA*H;A.x+=this.m_invMassB*M;A.y+=this.m_invMassB*K;D+=this.m_invIB*L;G.m_linearVelocity.SetV(F);G.m_angularVelocity=B;E.m_linearVelocity.SetV(A);E.m_angularVelocity=D};t.prototype.SolvePositionConstraints=function(){var N=this.m_bodyA,I=this.m_bodyB,G=N.m_sweep.c,H=N.m_sweep.a,D=I.m_sweep.c,B=I.m_sweep.a,E,R=0,O=0,K=0,Q=R=E=0,M=0;O=false;var L=0,F=AA.FromAngle(H),A=AA.FromAngle(B);E=F;M=this.m_localAnchor1.x-this.m_localCenterA.x;var U=this.m_localAnchor1.y-this.m_localCenterA.y;R=E.col1.x*M+E.col2.x*U;U=E.col1.y*M+E.col2.y*U;M=R;E=A;A=this.m_localAnchor2.x-this.m_localCenterB.x;K=this.m_localAnchor2.y-this.m_localCenterB.y;R=E.col1.x*A+E.col2.x*K;K=E.col1.y*A+E.col2.y*K;A=R;E=D.x+A-G.x-M;R=D.y+K-G.y-U;if(this.m_enableLimit){this.m_axis=r.MulMV(F,this.m_localXAxis1);this.m_a1=(E+M)*this.m_axis.y-(R+U)*this.m_axis.x;this.m_a2=A*this.m_axis.y-K*this.m_axis.x;var S=this.m_axis.x*E+this.m_axis.y*R;if(r.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AC.b2_linearSlop){L=r.Clamp(S,-AC.b2_maxLinearCorrection,AC.b2_maxLinearCorrection);Q=r.Abs(S);O=true}else{if(S<=this.m_lowerTranslation){L=r.Clamp(S-this.m_lowerTranslation+AC.b2_linearSlop,-AC.b2_maxLinearCorrection,0);Q=this.m_lowerTranslation-S;O=true}else{if(S>=this.m_upperTranslation){L=r.Clamp(S-this.m_upperTranslation+AC.b2_linearSlop,0,AC.b2_maxLinearCorrection);Q=S-this.m_upperTranslation;O=true}}}}this.m_perp=r.MulMV(F,this.m_localYAxis1);this.m_s1=(E+M)*this.m_perp.y-(R+U)*this.m_perp.x;this.m_s2=A*this.m_perp.y-K*this.m_perp.x;F=new AG;U=this.m_perp.x*E+this.m_perp.y*R;A=B-H-this.m_refAngle;Q=r.Max(Q,r.Abs(U));M=r.Abs(A);if(O){O=this.m_invMassA;K=this.m_invMassB;E=this.m_invIA;R=this.m_invIB;this.m_K.col1.x=O+K+E*this.m_s1*this.m_s1+R*this.m_s2*this.m_s2;this.m_K.col1.y=E*this.m_s1+R*this.m_s2;this.m_K.col1.z=E*this.m_s1*this.m_a1+R*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=E+R;this.m_K.col2.z=E*this.m_a1+R*this.m_a2;this.m_K.col3.x=this.m_K.col1.z;this.m_K.col3.y=this.m_K.col2.z;this.m_K.col3.z=O+K+E*this.m_a1*this.m_a1+R*this.m_a2*this.m_a2;this.m_K.Solve33(F,-U,-A,-L)}else{O=this.m_invMassA;K=this.m_invMassB;E=this.m_invIA;R=this.m_invIB;L=E*this.m_s1+R*this.m_s2;S=E+R;this.m_K.col1.Set(O+K+E*this.m_s1*this.m_s1+R*this.m_s2*this.m_s2,L,0);this.m_K.col2.Set(L,S,0);L=this.m_K.Solve22(new x,-U,-A);F.x=L.x;F.y=L.y;F.z=0}L=F.x*this.m_perp.x+F.z*this.m_axis.x;O=F.x*this.m_perp.y+F.z*this.m_axis.y;U=F.x*this.m_s1+F.y+F.z*this.m_a1;F=F.x*this.m_s2+F.y+F.z*this.m_a2;G.x-=this.m_invMassA*L;G.y-=this.m_invMassA*O;H-=this.m_invIA*U;D.x+=this.m_invMassB*L;D.y+=this.m_invMassB*O;B+=this.m_invIB*F;N.m_sweep.a=H;I.m_sweep.a=B;N.SynchronizeTransform();I.SynchronizeTransform();return Q<=AC.b2_linearSlop&&M<=AC.b2_angularSlop};Box2D.inherit(g,Box2D.Dynamics.Joints.b2JointDef);g.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;g.b2PrismaticJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new x;this.localAnchorB=new x;this.localAxisA=new x};g.prototype.b2PrismaticJointDef=function(){this.__super.b2JointDef.call(this);this.type=s.e_prismaticJoint;this.localAxisA.Set(1,0);this.referenceAngle=0;this.enableLimit=false;this.upperTranslation=this.lowerTranslation=0;this.enableMotor=false;this.motorSpeed=this.maxMotorForce=0};g.prototype.Initialize=function(E,D,A,B){this.bodyA=E;this.bodyB=D;this.localAnchorA=this.bodyA.GetLocalPoint(A);this.localAnchorB=this.bodyB.GetLocalPoint(A);this.localAxisA=this.bodyA.GetLocalVector(B);this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()};Box2D.inherit(AD,Box2D.Dynamics.Joints.b2Joint);AD.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AD.b2PulleyJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new x;this.m_groundAnchor2=new x;this.m_localAnchor1=new x;this.m_localAnchor2=new x;this.m_u1=new x;this.m_u2=new x};AD.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};AD.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};AD.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new x(A*this.m_impulse*this.m_u2.x,A*this.m_impulse*this.m_u2.y)};AD.prototype.GetReactionTorque=function(){return 0};AD.prototype.GetGroundAnchorA=function(){var A=this.m_ground.m_xf.position.Copy();A.Add(this.m_groundAnchor1);return A};AD.prototype.GetGroundAnchorB=function(){var A=this.m_ground.m_xf.position.Copy();A.Add(this.m_groundAnchor2);return A};AD.prototype.GetLength1=function(){var B=this.m_bodyA.GetWorldPoint(this.m_localAnchor1),A=B.x-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x);B=B.y-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y);return Math.sqrt(A*A+B*B)};AD.prototype.GetLength2=function(){var B=this.m_bodyB.GetWorldPoint(this.m_localAnchor2),A=B.x-(this.m_ground.m_xf.position.x+this.m_groundAnchor2.x);B=B.y-(this.m_ground.m_xf.position.y+this.m_groundAnchor2.y);return Math.sqrt(A*A+B*B)};AD.prototype.GetRatio=function(){return this.m_ratio};AD.prototype.b2PulleyJoint=function(A){this.__super.b2Joint.call(this,A);this.m_ground=this.m_bodyA.m_world.m_groundBody;this.m_groundAnchor1.x=A.groundAnchorA.x-this.m_ground.m_xf.position.x;this.m_groundAnchor1.y=A.groundAnchorA.y-this.m_ground.m_xf.position.y;this.m_groundAnchor2.x=A.groundAnchorB.x-this.m_ground.m_xf.position.x;this.m_groundAnchor2.y=A.groundAnchorB.y-this.m_ground.m_xf.position.y;this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_ratio=A.ratio;this.m_constant=A.lengthA+this.m_ratio*A.lengthB;this.m_maxLength1=r.Min(A.maxLengthA,this.m_constant-this.m_ratio*AD.b2_minPulleyLength);this.m_maxLength2=r.Min(A.maxLengthB,(this.m_constant-AD.b2_minPulleyLength)/this.m_ratio);this.m_limitImpulse2=this.m_limitImpulse1=this.m_impulse=0};AD.prototype.InitVelocityConstraints=function(I){var G=this.m_bodyA,E=this.m_bodyB,F;F=G.m_xf.R;var B=this.m_localAnchor1.x-G.m_sweep.localCenter.x,A=this.m_localAnchor1.y-G.m_sweep.localCenter.y,D=F.col1.x*B+F.col2.x*A;A=F.col1.y*B+F.col2.y*A;B=D;F=E.m_xf.R;var M=this.m_localAnchor2.x-E.m_sweep.localCenter.x,K=this.m_localAnchor2.y-E.m_sweep.localCenter.y;D=F.col1.x*M+F.col2.x*K;K=F.col1.y*M+F.col2.y*K;M=D;F=E.m_sweep.c.x+M;D=E.m_sweep.c.y+K;var H=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,L=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y;this.m_u1.Set(G.m_sweep.c.x+B-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x),G.m_sweep.c.y+A-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y));this.m_u2.Set(F-H,D-L);F=this.m_u1.Length();D=this.m_u2.Length();F>AC.b2_linearSlop?this.m_u1.Multiply(1/F):this.m_u1.SetZero();D>AC.b2_linearSlop?this.m_u2.Multiply(1/D):this.m_u2.SetZero();if(this.m_constant-F-this.m_ratio*D>0){this.m_state=s.e_inactiveLimit;this.m_impulse=0}else{this.m_state=s.e_atUpperLimit}if(F<this.m_maxLength1){this.m_limitState1=s.e_inactiveLimit;this.m_limitImpulse1=0}else{this.m_limitState1=s.e_atUpperLimit}if(D<this.m_maxLength2){this.m_limitState2=s.e_inactiveLimit;this.m_limitImpulse2=0}else{this.m_limitState2=s.e_atUpperLimit}F=B*this.m_u1.y-A*this.m_u1.x;D=M*this.m_u2.y-K*this.m_u2.x;this.m_limitMass1=G.m_invMass+G.m_invI*F*F;this.m_limitMass2=E.m_invMass+E.m_invI*D*D;this.m_pulleyMass=this.m_limitMass1+this.m_ratio*this.m_ratio*this.m_limitMass2;this.m_limitMass1=1/this.m_limitMass1;this.m_limitMass2=1/this.m_limitMass2;this.m_pulleyMass=1/this.m_pulleyMass;if(I.warmStarting){this.m_impulse*=I.dtRatio;this.m_limitImpulse1*=I.dtRatio;this.m_limitImpulse2*=I.dtRatio;I=(-this.m_impulse-this.m_limitImpulse1)*this.m_u1.x;F=(-this.m_impulse-this.m_limitImpulse1)*this.m_u1.y;D=(-this.m_ratio*this.m_impulse-this.m_limitImpulse2)*this.m_u2.x;H=(-this.m_ratio*this.m_impulse-this.m_limitImpulse2)*this.m_u2.y;G.m_linearVelocity.x+=G.m_invMass*I;G.m_linearVelocity.y+=G.m_invMass*F;G.m_angularVelocity+=G.m_invI*(B*F-A*I);E.m_linearVelocity.x+=E.m_invMass*D;E.m_linearVelocity.y+=E.m_invMass*H;E.m_angularVelocity+=E.m_invI*(M*H-K*D)}else{this.m_limitImpulse2=this.m_limitImpulse1=this.m_impulse=0}};AD.prototype.SolveVelocityConstraints=function(){var I=this.m_bodyA,G=this.m_bodyB,E;E=I.m_xf.R;var F=this.m_localAnchor1.x-I.m_sweep.localCenter.x,B=this.m_localAnchor1.y-I.m_sweep.localCenter.y,A=E.col1.x*F+E.col2.x*B;B=E.col1.y*F+E.col2.y*B;F=A;E=G.m_xf.R;var D=this.m_localAnchor2.x-G.m_sweep.localCenter.x,L=this.m_localAnchor2.y-G.m_sweep.localCenter.y;A=E.col1.x*D+E.col2.x*L;L=E.col1.y*D+E.col2.y*L;D=A;var K=A=E=0,H=0;E=H=E=H=K=A=E=0;if(this.m_state==s.e_atUpperLimit){E=I.m_linearVelocity.x+-I.m_angularVelocity*B;A=I.m_linearVelocity.y+I.m_angularVelocity*F;K=G.m_linearVelocity.x+-G.m_angularVelocity*L;H=G.m_linearVelocity.y+G.m_angularVelocity*D;E=-(this.m_u1.x*E+this.m_u1.y*A)-this.m_ratio*(this.m_u2.x*K+this.m_u2.y*H);H=this.m_pulleyMass*-E;E=this.m_impulse;this.m_impulse=r.Max(0,this.m_impulse+H);H=this.m_impulse-E;E=-H*this.m_u1.x;A=-H*this.m_u1.y;K=-this.m_ratio*H*this.m_u2.x;H=-this.m_ratio*H*this.m_u2.y;I.m_linearVelocity.x+=I.m_invMass*E;I.m_linearVelocity.y+=I.m_invMass*A;I.m_angularVelocity+=I.m_invI*(F*A-B*E);G.m_linearVelocity.x+=G.m_invMass*K;G.m_linearVelocity.y+=G.m_invMass*H;G.m_angularVelocity+=G.m_invI*(D*H-L*K)}if(this.m_limitState1==s.e_atUpperLimit){E=I.m_linearVelocity.x+-I.m_angularVelocity*B;A=I.m_linearVelocity.y+I.m_angularVelocity*F;E=-(this.m_u1.x*E+this.m_u1.y*A);H=-this.m_limitMass1*E;E=this.m_limitImpulse1;this.m_limitImpulse1=r.Max(0,this.m_limitImpulse1+H);H=this.m_limitImpulse1-E;E=-H*this.m_u1.x;A=-H*this.m_u1.y;I.m_linearVelocity.x+=I.m_invMass*E;I.m_linearVelocity.y+=I.m_invMass*A;I.m_angularVelocity+=I.m_invI*(F*A-B*E)}if(this.m_limitState2==s.e_atUpperLimit){K=G.m_linearVelocity.x+-G.m_angularVelocity*L;H=G.m_linearVelocity.y+G.m_angularVelocity*D;E=-(this.m_u2.x*K+this.m_u2.y*H);H=-this.m_limitMass2*E;E=this.m_limitImpulse2;this.m_limitImpulse2=r.Max(0,this.m_limitImpulse2+H);H=this.m_limitImpulse2-E;K=-H*this.m_u2.x;H=-H*this.m_u2.y;G.m_linearVelocity.x+=G.m_invMass*K;G.m_linearVelocity.y+=G.m_invMass*H;G.m_angularVelocity+=G.m_invI*(D*H-L*K)}};AD.prototype.SolvePositionConstraints=function(){var N=this.m_bodyA,I=this.m_bodyB,G,H=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,D=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,B=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,E=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y,R=0,O=0,K=0,Q=0,M=G=0,L=0,F=0,A=M=F=G=M=G=0;if(this.m_state==s.e_atUpperLimit){G=N.m_xf.R;R=this.m_localAnchor1.x-N.m_sweep.localCenter.x;O=this.m_localAnchor1.y-N.m_sweep.localCenter.y;M=G.col1.x*R+G.col2.x*O;O=G.col1.y*R+G.col2.y*O;R=M;G=I.m_xf.R;K=this.m_localAnchor2.x-I.m_sweep.localCenter.x;Q=this.m_localAnchor2.y-I.m_sweep.localCenter.y;M=G.col1.x*K+G.col2.x*Q;Q=G.col1.y*K+G.col2.y*Q;K=M;G=N.m_sweep.c.x+R;M=N.m_sweep.c.y+O;L=I.m_sweep.c.x+K;F=I.m_sweep.c.y+Q;this.m_u1.Set(G-H,M-D);this.m_u2.Set(L-B,F-E);G=this.m_u1.Length();M=this.m_u2.Length();G>AC.b2_linearSlop?this.m_u1.Multiply(1/G):this.m_u1.SetZero();M>AC.b2_linearSlop?this.m_u2.Multiply(1/M):this.m_u2.SetZero();G=this.m_constant-G-this.m_ratio*M;A=r.Max(A,-G);G=r.Clamp(G+AC.b2_linearSlop,-AC.b2_maxLinearCorrection,0);F=-this.m_pulleyMass*G;G=-F*this.m_u1.x;M=-F*this.m_u1.y;L=-this.m_ratio*F*this.m_u2.x;F=-this.m_ratio*F*this.m_u2.y;N.m_sweep.c.x+=N.m_invMass*G;N.m_sweep.c.y+=N.m_invMass*M;N.m_sweep.a+=N.m_invI*(R*M-O*G);I.m_sweep.c.x+=I.m_invMass*L;I.m_sweep.c.y+=I.m_invMass*F;I.m_sweep.a+=I.m_invI*(K*F-Q*L);N.SynchronizeTransform();I.SynchronizeTransform()}if(this.m_limitState1==s.e_atUpperLimit){G=N.m_xf.R;R=this.m_localAnchor1.x-N.m_sweep.localCenter.x;O=this.m_localAnchor1.y-N.m_sweep.localCenter.y;M=G.col1.x*R+G.col2.x*O;O=G.col1.y*R+G.col2.y*O;R=M;G=N.m_sweep.c.x+R;M=N.m_sweep.c.y+O;this.m_u1.Set(G-H,M-D);G=this.m_u1.Length();if(G>AC.b2_linearSlop){this.m_u1.x*=1/G;this.m_u1.y*=1/G}else{this.m_u1.SetZero()}G=this.m_maxLength1-G;A=r.Max(A,-G);G=r.Clamp(G+AC.b2_linearSlop,-AC.b2_maxLinearCorrection,0);F=-this.m_limitMass1*G;G=-F*this.m_u1.x;M=-F*this.m_u1.y;N.m_sweep.c.x+=N.m_invMass*G;N.m_sweep.c.y+=N.m_invMass*M;N.m_sweep.a+=N.m_invI*(R*M-O*G);N.SynchronizeTransform()}if(this.m_limitState2==s.e_atUpperLimit){G=I.m_xf.R;K=this.m_localAnchor2.x-I.m_sweep.localCenter.x;Q=this.m_localAnchor2.y-I.m_sweep.localCenter.y;M=G.col1.x*K+G.col2.x*Q;Q=G.col1.y*K+G.col2.y*Q;K=M;L=I.m_sweep.c.x+K;F=I.m_sweep.c.y+Q;this.m_u2.Set(L-B,F-E);M=this.m_u2.Length();if(M>AC.b2_linearSlop){this.m_u2.x*=1/M;this.m_u2.y*=1/M}else{this.m_u2.SetZero()}G=this.m_maxLength2-M;A=r.Max(A,-G);G=r.Clamp(G+AC.b2_linearSlop,-AC.b2_maxLinearCorrection,0);F=-this.m_limitMass2*G;L=-F*this.m_u2.x;F=-F*this.m_u2.y;I.m_sweep.c.x+=I.m_invMass*L;I.m_sweep.c.y+=I.m_invMass*F;I.m_sweep.a+=I.m_invI*(K*F-Q*L);I.SynchronizeTransform()}return A<AC.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2PulleyJoint.b2_minPulleyLength=2});Box2D.inherit(e,Box2D.Dynamics.Joints.b2JointDef);e.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;e.b2PulleyJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.groundAnchorA=new x;this.groundAnchorB=new x;this.localAnchorA=new x;this.localAnchorB=new x};e.prototype.b2PulleyJointDef=function(){this.__super.b2JointDef.call(this);this.type=s.e_pulleyJoint;this.groundAnchorA.Set(-1,1);this.groundAnchorB.Set(1,1);this.localAnchorA.Set(-1,0);this.localAnchorB.Set(1,0);this.maxLengthB=this.lengthB=this.maxLengthA=this.lengthA=0;this.ratio=1;this.collideConnected=true};e.prototype.Initialize=function(G,D,A,B,F,E,H){if(H===undefined){H=0}this.bodyA=G;this.bodyB=D;this.groundAnchorA.SetV(A);this.groundAnchorB.SetV(B);this.localAnchorA=this.bodyA.GetLocalPoint(F);this.localAnchorB=this.bodyB.GetLocalPoint(E);G=F.x-A.x;A=F.y-A.y;this.lengthA=Math.sqrt(G*G+A*A);A=E.x-B.x;B=E.y-B.y;this.lengthB=Math.sqrt(A*A+B*B);this.ratio=H;H=this.lengthA+this.ratio*this.lengthB;this.maxLengthA=H-this.ratio*AD.b2_minPulleyLength;this.maxLengthB=(H-AD.b2_minPulleyLength)/this.ratio};Box2D.inherit(h,Box2D.Dynamics.Joints.b2Joint);h.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;h.b2RevoluteJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.K=new AA;this.K1=new AA;this.K2=new AA;this.K3=new AA;this.impulse3=new AG;this.impulse2=new x;this.reduced=new x;this.m_localAnchor1=new x;this.m_localAnchor2=new x;this.m_impulse=new AG;this.m_mass=new o};h.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};h.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};h.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new x(A*this.m_impulse.x,A*this.m_impulse.y)};h.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.z};h.prototype.GetJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle};h.prototype.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity};h.prototype.IsLimitEnabled=function(){return this.m_enableLimit};h.prototype.EnableLimit=function(A){this.m_enableLimit=A};h.prototype.GetLowerLimit=function(){return this.m_lowerAngle};h.prototype.GetUpperLimit=function(){return this.m_upperAngle};h.prototype.SetLimits=function(B,A){if(B===undefined){B=0}if(A===undefined){A=0}this.m_lowerAngle=B;this.m_upperAngle=A};h.prototype.IsMotorEnabled=function(){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);return this.m_enableMotor};h.prototype.EnableMotor=function(A){this.m_enableMotor=A};h.prototype.SetMotorSpeed=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=A};h.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};h.prototype.SetMaxMotorTorque=function(A){if(A===undefined){A=0}this.m_maxMotorTorque=A};h.prototype.GetMotorTorque=function(){return this.m_maxMotorTorque};h.prototype.b2RevoluteJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchor1.SetV(A.localAnchorA);this.m_localAnchor2.SetV(A.localAnchorB);this.m_referenceAngle=A.referenceAngle;this.m_impulse.SetZero();this.m_motorImpulse=0;this.m_lowerAngle=A.lowerAngle;this.m_upperAngle=A.upperAngle;this.m_maxMotorTorque=A.maxMotorTorque;this.m_motorSpeed=A.motorSpeed;this.m_enableLimit=A.enableLimit;this.m_enableMotor=A.enableMotor;this.m_limitState=s.e_inactiveLimit};h.prototype.InitVelocityConstraints=function(K){var G=this.m_bodyA,E=this.m_bodyB,F,B=0;F=G.m_xf.R;var A=this.m_localAnchor1.x-G.m_sweep.localCenter.x,D=this.m_localAnchor1.y-G.m_sweep.localCenter.y;B=F.col1.x*A+F.col2.x*D;D=F.col1.y*A+F.col2.y*D;A=B;F=E.m_xf.R;var N=this.m_localAnchor2.x-E.m_sweep.localCenter.x,L=this.m_localAnchor2.y-E.m_sweep.localCenter.y;B=F.col1.x*N+F.col2.x*L;L=F.col1.y*N+F.col2.y*L;N=B;F=G.m_invMass;B=E.m_invMass;var H=G.m_invI,M=E.m_invI;this.m_mass.col1.x=F+B+D*D*H+L*L*M;this.m_mass.col2.x=-D*A*H-L*N*M;this.m_mass.col3.x=-D*H-L*M;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=F+B+A*A*H+N*N*M;this.m_mass.col3.y=A*H+N*M;this.m_mass.col1.z=this.m_mass.col3.x;this.m_mass.col2.z=this.m_mass.col3.y;this.m_mass.col3.z=H+M;this.m_motorMass=1/(H+M);if(this.m_enableMotor==false){this.m_motorImpulse=0}if(this.m_enableLimit){var I=E.m_sweep.a-G.m_sweep.a-this.m_referenceAngle;if(r.Abs(this.m_upperAngle-this.m_lowerAngle)<2*AC.b2_angularSlop){this.m_limitState=s.e_equalLimits}else{if(I<=this.m_lowerAngle){if(this.m_limitState!=s.e_atLowerLimit){this.m_impulse.z=0}this.m_limitState=s.e_atLowerLimit}else{if(I>=this.m_upperAngle){if(this.m_limitState!=s.e_atUpperLimit){this.m_impulse.z=0}this.m_limitState=s.e_atUpperLimit}else{this.m_limitState=s.e_inactiveLimit;this.m_impulse.z=0}}}}else{this.m_limitState=s.e_inactiveLimit}if(K.warmStarting){this.m_impulse.x*=K.dtRatio;this.m_impulse.y*=K.dtRatio;this.m_motorImpulse*=K.dtRatio;K=this.m_impulse.x;I=this.m_impulse.y;G.m_linearVelocity.x-=F*K;G.m_linearVelocity.y-=F*I;G.m_angularVelocity-=H*(A*I-D*K+this.m_motorImpulse+this.m_impulse.z);E.m_linearVelocity.x+=B*K;E.m_linearVelocity.y+=B*I;E.m_angularVelocity+=M*(N*I-L*K+this.m_motorImpulse+this.m_impulse.z)}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};h.prototype.SolveVelocityConstraints=function(N){var I=this.m_bodyA,G=this.m_bodyB,H=0,D=H=0,B=0,E=0,R=0,O=I.m_linearVelocity,K=I.m_angularVelocity,Q=G.m_linearVelocity,M=G.m_angularVelocity,L=I.m_invMass,F=G.m_invMass,A=I.m_invI,U=G.m_invI;if(this.m_enableMotor&&this.m_limitState!=s.e_equalLimits){D=this.m_motorMass*-(M-K-this.m_motorSpeed);B=this.m_motorImpulse;E=N.dt*this.m_maxMotorTorque;this.m_motorImpulse=r.Clamp(this.m_motorImpulse+D,-E,E);D=this.m_motorImpulse-B;K-=A*D;M+=U*D}if(this.m_enableLimit&&this.m_limitState!=s.e_inactiveLimit){N=I.m_xf.R;D=this.m_localAnchor1.x-I.m_sweep.localCenter.x;B=this.m_localAnchor1.y-I.m_sweep.localCenter.y;H=N.col1.x*D+N.col2.x*B;B=N.col1.y*D+N.col2.y*B;D=H;N=G.m_xf.R;E=this.m_localAnchor2.x-G.m_sweep.localCenter.x;R=this.m_localAnchor2.y-G.m_sweep.localCenter.y;H=N.col1.x*E+N.col2.x*R;R=N.col1.y*E+N.col2.y*R;E=H;N=Q.x+-M*R-O.x- -K*B;var S=Q.y+M*E-O.y-K*D;this.m_mass.Solve33(this.impulse3,-N,-S,-(M-K));if(this.m_limitState==s.e_equalLimits){this.m_impulse.Add(this.impulse3)}else{if(this.m_limitState==s.e_atLowerLimit){H=this.m_impulse.z+this.impulse3.z;if(H<0){this.m_mass.Solve22(this.reduced,-N,-S);this.impulse3.x=this.reduced.x;this.impulse3.y=this.reduced.y;this.impulse3.z=-this.m_impulse.z;this.m_impulse.x+=this.reduced.x;this.m_impulse.y+=this.reduced.y;this.m_impulse.z=0}}else{if(this.m_limitState==s.e_atUpperLimit){H=this.m_impulse.z+this.impulse3.z;if(H>0){this.m_mass.Solve22(this.reduced,-N,-S);this.impulse3.x=this.reduced.x;this.impulse3.y=this.reduced.y;this.impulse3.z=-this.m_impulse.z;this.m_impulse.x+=this.reduced.x;this.m_impulse.y+=this.reduced.y;this.m_impulse.z=0}}}}O.x-=L*this.impulse3.x;O.y-=L*this.impulse3.y;K-=A*(D*this.impulse3.y-B*this.impulse3.x+this.impulse3.z);Q.x+=F*this.impulse3.x;Q.y+=F*this.impulse3.y;M+=U*(E*this.impulse3.y-R*this.impulse3.x+this.impulse3.z)}else{N=I.m_xf.R;D=this.m_localAnchor1.x-I.m_sweep.localCenter.x;B=this.m_localAnchor1.y-I.m_sweep.localCenter.y;H=N.col1.x*D+N.col2.x*B;B=N.col1.y*D+N.col2.y*B;D=H;N=G.m_xf.R;E=this.m_localAnchor2.x-G.m_sweep.localCenter.x;R=this.m_localAnchor2.y-G.m_sweep.localCenter.y;H=N.col1.x*E+N.col2.x*R;R=N.col1.y*E+N.col2.y*R;E=H;this.m_mass.Solve22(this.impulse2,-(Q.x+-M*R-O.x- -K*B),-(Q.y+M*E-O.y-K*D));this.m_impulse.x+=this.impulse2.x;this.m_impulse.y+=this.impulse2.y;O.x-=L*this.impulse2.x;O.y-=L*this.impulse2.y;K-=A*(D*this.impulse2.y-B*this.impulse2.x);Q.x+=F*this.impulse2.x;Q.y+=F*this.impulse2.y;M+=U*(E*this.impulse2.y-R*this.impulse2.x)}I.m_linearVelocity.SetV(O);I.m_angularVelocity=K;G.m_linearVelocity.SetV(Q);G.m_angularVelocity=M};h.prototype.SolvePositionConstraints=function(){var N=0,I,G=this.m_bodyA,H=this.m_bodyB,D=0,B=I=0,E=0,R=0;if(this.m_enableLimit&&this.m_limitState!=s.e_inactiveLimit){N=H.m_sweep.a-G.m_sweep.a-this.m_referenceAngle;var O=0;if(this.m_limitState==s.e_equalLimits){N=r.Clamp(N-this.m_lowerAngle,-AC.b2_maxAngularCorrection,AC.b2_maxAngularCorrection);O=-this.m_motorMass*N;D=r.Abs(N)}else{if(this.m_limitState==s.e_atLowerLimit){N=N-this.m_lowerAngle;D=-N;N=r.Clamp(N+AC.b2_angularSlop,-AC.b2_maxAngularCorrection,0);O=-this.m_motorMass*N}else{if(this.m_limitState==s.e_atUpperLimit){D=N=N-this.m_upperAngle;N=r.Clamp(N-AC.b2_angularSlop,0,AC.b2_maxAngularCorrection);O=-this.m_motorMass*N}}}G.m_sweep.a-=G.m_invI*O;H.m_sweep.a+=H.m_invI*O;G.SynchronizeTransform();H.SynchronizeTransform()}I=G.m_xf.R;O=this.m_localAnchor1.x-G.m_sweep.localCenter.x;N=this.m_localAnchor1.y-G.m_sweep.localCenter.y;B=I.col1.x*O+I.col2.x*N;N=I.col1.y*O+I.col2.y*N;O=B;I=H.m_xf.R;var K=this.m_localAnchor2.x-H.m_sweep.localCenter.x,Q=this.m_localAnchor2.y-H.m_sweep.localCenter.y;B=I.col1.x*K+I.col2.x*Q;Q=I.col1.y*K+I.col2.y*Q;K=B;E=H.m_sweep.c.x+K-G.m_sweep.c.x-O;R=H.m_sweep.c.y+Q-G.m_sweep.c.y-N;var M=E*E+R*R;I=Math.sqrt(M);B=G.m_invMass;var L=H.m_invMass,F=G.m_invI,A=H.m_invI,S=10*AC.b2_linearSlop;if(M>S*S){M=1/(B+L);E=M*-E;R=M*-R;G.m_sweep.c.x-=0.5*B*E;G.m_sweep.c.y-=0.5*B*R;H.m_sweep.c.x+=0.5*L*E;H.m_sweep.c.y+=0.5*L*R;E=H.m_sweep.c.x+K-G.m_sweep.c.x-O;R=H.m_sweep.c.y+Q-G.m_sweep.c.y-N}this.K1.col1.x=B+L;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=B+L;this.K2.col1.x=F*N*N;this.K2.col2.x=-F*O*N;this.K2.col1.y=-F*O*N;this.K2.col2.y=F*O*O;this.K3.col1.x=A*Q*Q;this.K3.col2.x=-A*K*Q;this.K3.col1.y=-A*K*Q;this.K3.col2.y=A*K*K;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.AddM(this.K3);this.K.Solve(h.tImpulse,-E,-R);E=h.tImpulse.x;R=h.tImpulse.y;G.m_sweep.c.x-=G.m_invMass*E;G.m_sweep.c.y-=G.m_invMass*R;G.m_sweep.a-=G.m_invI*(O*R-N*E);H.m_sweep.c.x+=H.m_invMass*E;H.m_sweep.c.y+=H.m_invMass*R;H.m_sweep.a+=H.m_invI*(K*R-Q*E);G.SynchronizeTransform();H.SynchronizeTransform();return I<=AC.b2_linearSlop&&D<=AC.b2_angularSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2RevoluteJoint.tImpulse=new x});Box2D.inherit(b,Box2D.Dynamics.Joints.b2JointDef);b.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;b.b2RevoluteJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new x;this.localAnchorB=new x};b.prototype.b2RevoluteJointDef=function(){this.__super.b2JointDef.call(this);this.type=s.e_revoluteJoint;this.localAnchorA.Set(0,0);this.localAnchorB.Set(0,0);this.motorSpeed=this.maxMotorTorque=this.upperAngle=this.lowerAngle=this.referenceAngle=0;this.enableMotor=this.enableLimit=false};b.prototype.Initialize=function(D,B,A){this.bodyA=D;this.bodyB=B;this.localAnchorA=this.bodyA.GetLocalPoint(A);this.localAnchorB=this.bodyB.GetLocalPoint(A);this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()};Box2D.inherit(AJ,Box2D.Dynamics.Joints.b2Joint);AJ.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AJ.b2WeldJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new x;this.m_localAnchorB=new x;this.m_impulse=new AG;this.m_mass=new o};AJ.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};AJ.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)};AJ.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new x(A*this.m_impulse.x,A*this.m_impulse.y)};AJ.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.z};AJ.prototype.b2WeldJoint=function(A){this.__super.b2Joint.call(this,A);this.m_localAnchorA.SetV(A.localAnchorA);this.m_localAnchorB.SetV(A.localAnchorB);this.m_referenceAngle=A.referenceAngle;this.m_impulse.SetZero();this.m_mass=new o};AJ.prototype.InitVelocityConstraints=function(I){var G,E=0,F=this.m_bodyA,B=this.m_bodyB;G=F.m_xf.R;var A=this.m_localAnchorA.x-F.m_sweep.localCenter.x,D=this.m_localAnchorA.y-F.m_sweep.localCenter.y;E=G.col1.x*A+G.col2.x*D;D=G.col1.y*A+G.col2.y*D;A=E;G=B.m_xf.R;var M=this.m_localAnchorB.x-B.m_sweep.localCenter.x,K=this.m_localAnchorB.y-B.m_sweep.localCenter.y;E=G.col1.x*M+G.col2.x*K;K=G.col1.y*M+G.col2.y*K;M=E;G=F.m_invMass;E=B.m_invMass;var H=F.m_invI,L=B.m_invI;this.m_mass.col1.x=G+E+D*D*H+K*K*L;this.m_mass.col2.x=-D*A*H-K*M*L;this.m_mass.col3.x=-D*H-K*L;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=G+E+A*A*H+M*M*L;this.m_mass.col3.y=A*H+M*L;this.m_mass.col1.z=this.m_mass.col3.x;this.m_mass.col2.z=this.m_mass.col3.y;this.m_mass.col3.z=H+L;if(I.warmStarting){this.m_impulse.x*=I.dtRatio;this.m_impulse.y*=I.dtRatio;this.m_impulse.z*=I.dtRatio;F.m_linearVelocity.x-=G*this.m_impulse.x;F.m_linearVelocity.y-=G*this.m_impulse.y;F.m_angularVelocity-=H*(A*this.m_impulse.y-D*this.m_impulse.x+this.m_impulse.z);B.m_linearVelocity.x+=E*this.m_impulse.x;B.m_linearVelocity.y+=E*this.m_impulse.y;B.m_angularVelocity+=L*(M*this.m_impulse.y-K*this.m_impulse.x+this.m_impulse.z)}else{this.m_impulse.SetZero()}};AJ.prototype.SolveVelocityConstraints=function(){var R,M=0,K=this.m_bodyA,L=this.m_bodyB,G=K.m_linearVelocity,F=K.m_angularVelocity,H=L.m_linearVelocity,V=L.m_angularVelocity,S=K.m_invMass,N=L.m_invMass,U=K.m_invI,Q=L.m_invI;R=K.m_xf.R;var O=this.m_localAnchorA.x-K.m_sweep.localCenter.x,I=this.m_localAnchorA.y-K.m_sweep.localCenter.y;M=R.col1.x*O+R.col2.x*I;I=R.col1.y*O+R.col2.y*I;O=M;R=L.m_xf.R;var E=this.m_localAnchorB.x-L.m_sweep.localCenter.x,D=this.m_localAnchorB.y-L.m_sweep.localCenter.y;M=R.col1.x*E+R.col2.x*D;D=R.col1.y*E+R.col2.y*D;E=M;R=H.x-V*D-G.x+F*I;M=H.y+V*E-G.y-F*O;var A=V-F,B=new AG;this.m_mass.Solve33(B,-R,-M,-A);this.m_impulse.Add(B);G.x-=S*B.x;G.y-=S*B.y;F-=U*(O*B.y-I*B.x+B.z);H.x+=N*B.x;H.y+=N*B.y;V+=Q*(E*B.y-D*B.x+B.z);K.m_angularVelocity=F;L.m_angularVelocity=V};AJ.prototype.SolvePositionConstraints=function(){var N,I=0,G=this.m_bodyA,H=this.m_bodyB;N=G.m_xf.R;var D=this.m_localAnchorA.x-G.m_sweep.localCenter.x,B=this.m_localAnchorA.y-G.m_sweep.localCenter.y;I=N.col1.x*D+N.col2.x*B;B=N.col1.y*D+N.col2.y*B;D=I;N=H.m_xf.R;var E=this.m_localAnchorB.x-H.m_sweep.localCenter.x,R=this.m_localAnchorB.y-H.m_sweep.localCenter.y;I=N.col1.x*E+N.col2.x*R;R=N.col1.y*E+N.col2.y*R;E=I;N=G.m_invMass;I=H.m_invMass;var O=G.m_invI,K=H.m_invI,Q=H.m_sweep.c.x+E-G.m_sweep.c.x-D,M=H.m_sweep.c.y+R-G.m_sweep.c.y-B,L=H.m_sweep.a-G.m_sweep.a-this.m_referenceAngle,F=10*AC.b2_linearSlop,A=Math.sqrt(Q*Q+M*M),S=r.Abs(L);if(A>F){O*=1;K*=1}this.m_mass.col1.x=N+I+B*B*O+R*R*K;this.m_mass.col2.x=-B*D*O-R*E*K;this.m_mass.col3.x=-B*O-R*K;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=N+I+D*D*O+E*E*K;this.m_mass.col3.y=D*O+E*K;this.m_mass.col1.z=this.m_mass.col3.x;this.m_mass.col2.z=this.m_mass.col3.y;this.m_mass.col3.z=O+K;F=new AG;this.m_mass.Solve33(F,-Q,-M,-L);G.m_sweep.c.x-=N*F.x;G.m_sweep.c.y-=N*F.y;G.m_sweep.a-=O*(D*F.y-B*F.x+F.z);H.m_sweep.c.x+=I*F.x;H.m_sweep.c.y+=I*F.y;H.m_sweep.a+=K*(E*F.y-R*F.x+F.z);G.SynchronizeTransform();H.SynchronizeTransform();return A<=AC.b2_linearSlop&&S<=AC.b2_angularSlop};Box2D.inherit(C,Box2D.Dynamics.Joints.b2JointDef);C.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;C.b2WeldJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new x;this.localAnchorB=new x};C.prototype.b2WeldJointDef=function(){this.__super.b2JointDef.call(this);this.type=s.e_weldJoint;this.referenceAngle=0};C.prototype.Initialize=function(D,B,A){this.bodyA=D;this.bodyB=B;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(A));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(A));this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()}})();(function(){var A=Box2D.Dynamics.b2DebugDraw;A.b2DebugDraw=function(){this.m_xformScale=this.m_fillAlpha=this.m_alpha=this.m_lineThickness=this.m_drawScale=1;var B=this;this.m_sprite={graphics:{clear:function(){B.m_ctx.clearRect(0,0,B.m_ctx.canvas.width,B.m_ctx.canvas.height)}}}};A.prototype._color=function(C,B){return"rgba("+((C&16711680)>>16)+","+((C&65280)>>8)+","+(C&255)+","+B+")"};A.prototype.b2DebugDraw=function(){this.m_drawFlags=0};A.prototype.SetFlags=function(B){if(B===undefined){B=0}this.m_drawFlags=B};A.prototype.GetFlags=function(){return this.m_drawFlags};A.prototype.AppendFlags=function(B){if(B===undefined){B=0}this.m_drawFlags|=B};A.prototype.ClearFlags=function(B){if(B===undefined){B=0}this.m_drawFlags&=~B};A.prototype.SetSprite=function(B){this.m_ctx=B};A.prototype.GetSprite=function(){return this.m_ctx};A.prototype.SetDrawScale=function(B){if(B===undefined){B=0}this.m_drawScale=B};A.prototype.GetDrawScale=function(){return this.m_drawScale};A.prototype.SetLineThickness=function(B){if(B===undefined){B=0}this.m_lineThickness=B;this.m_ctx.strokeWidth=B};A.prototype.GetLineThickness=function(){return this.m_lineThickness};A.prototype.SetAlpha=function(B){if(B===undefined){B=0}this.m_alpha=B};A.prototype.GetAlpha=function(){return this.m_alpha};A.prototype.SetFillAlpha=function(B){if(B===undefined){B=0}this.m_fillAlpha=B};A.prototype.GetFillAlpha=function(){return this.m_fillAlpha};A.prototype.SetXFormScale=function(B){if(B===undefined){B=0}this.m_xformScale=B};A.prototype.GetXFormScale=function(){return this.m_xformScale};A.prototype.DrawPolygon=function(E,D,F){if(D){var C=this.m_ctx,B=this.m_drawScale;C.beginPath();C.strokeStyle=this._color(F.color,this.m_alpha);C.moveTo(E[0].x*B,E[0].y*B);for(F=1;F<D;F++){C.lineTo(E[F].x*B,E[F].y*B)}C.lineTo(E[0].x*B,E[0].y*B);C.closePath();C.stroke()}};A.prototype.DrawSolidPolygon=function(E,D,F){if(D){var C=this.m_ctx,B=this.m_drawScale;C.beginPath();C.strokeStyle=this._color(F.color,this.m_alpha);C.fillStyle=this._color(F.color,this.m_fillAlpha);C.moveTo(E[0].x*B,E[0].y*B);for(F=1;F<D;F++){C.lineTo(E[F].x*B,E[F].y*B)}C.lineTo(E[0].x*B,E[0].y*B);C.closePath();C.fill();C.stroke()}};A.prototype.DrawCircle=function(E,D,F){if(D){var C=this.m_ctx,B=this.m_drawScale;C.beginPath();C.strokeStyle=this._color(F.color,this.m_alpha);C.arc(E.x*B,E.y*B,D*B,0,Math.PI*2,true);C.closePath();C.stroke()}};A.prototype.DrawSolidCircle=function(H,E,L,D){if(E){var C=this.m_ctx,F=this.m_drawScale,I=H.x*F,J=H.y*F;C.moveTo(0,0);C.beginPath();C.strokeStyle=this._color(D.color,this.m_alpha);C.fillStyle=this._color(D.color,this.m_fillAlpha);C.arc(I,J,E*F,0,Math.PI*2,true);C.moveTo(I,J);C.lineTo((H.x+L.x*E)*F,(H.y+L.y*E)*F);C.closePath();C.fill();C.stroke()}};A.prototype.DrawSegment=function(E,D,F){var C=this.m_ctx,B=this.m_drawScale;C.strokeStyle=this._color(F.color,this.m_alpha);C.beginPath();C.moveTo(E.x*B,E.y*B);C.lineTo(D.x*B,D.y*B);C.closePath();C.stroke()};A.prototype.DrawTransform=function(C){var B=this.m_ctx,D=this.m_drawScale;B.beginPath();B.strokeStyle=this._color(16711680,this.m_alpha);B.moveTo(C.position.x*D,C.position.y*D);B.lineTo((C.position.x+this.m_xformScale*C.R.col1.x)*D,(C.position.y+this.m_xformScale*C.R.col1.y)*D);B.strokeStyle=this._color(65280,this.m_alpha);B.moveTo(C.position.x*D,C.position.y*D);B.lineTo((C.position.x+this.m_xformScale*C.R.col2.x)*D,(C.position.y+this.m_xformScale*C.R.col2.y)*D);B.closePath();B.stroke()}})();var i;for(i=0;i<Box2D.postDefs.length;++i){Box2D.postDefs[i]()}delete Box2D.postDefs;(function(B){B.fn.vs=function(){};B.fn._vs={};B.fn._vs.token={};B.fn._vs.draw={};B.fn._vs.stream={};B.fn._vs.chart={};B.fn._vs.phy={};B.fn._vs.decay={};B.fn._vs.flocculate={};B.fn._vs.strata={};B.fn._vs.aggregate={};var A=function(E,O){this.token=B.fn._vs.token;this.draw=B.fn._vs.draw;this.stream=B.fn._vs.stream;this.chart=B.fn._vs.chart;this.phy=B.fn._vs.phy;this.decay=B.fn._vs.decay;this.flocculate=B.fn._vs.flocculate;this.strata=B.fn._vs.strata;this.requestAnimFrame;this.mouse={};this.mouse.x=0;this.mouse.y=0;this.mouse.isMouseDragging=false;this.mouse.isMouseDown=false;this.mouse.selectedBody=null;this.dataFlow=[];this.chartPhySetup={};this.tokens=[];this.world=null;this.ctx=null;var D=B(E);var M=this;var L=[];var N;var C;var H={x:0,y:0,width:290.5,height:300.5,DOMelement:null,chart:{x:undefined,y:undefined,width:undefined,height:undefined,colorRange:d3.scale.category10(),scale:d3.scale,type:"StackedAreaChart",spacer:5,column:3,wallColor:"rgba(230,230,230,0)",label:true,radius:10},data:{model:[{label:"Column A"},{label:"Column B"},{label:"Column C"},],strata:[[{initValue:100,label:"Strata 1 col A"}],[{initValue:20,label:"Strata 1 col B"}],[{initValue:175,label:"Strata 2 col C"}]],token:[{timestamp:1,category:1,value:1,userdata:{},callback:{}}],tokenPast:0,stream:{provider:"generator",refresh:10000/8,now:0},},sedimentation:{token:{size:{original:4,minimum:2},visible:true},incoming:{strategy:1,point:[{x:50,y:0},{x:100,y:0},{x:150,y:0}],target:[{x:50,y:0},{x:100,y:0},{x:150,y:0}]},granulate:{visible:false},flocculate:{number:1,action:"buffer",strategy:"Size",bufferSize:5,bufferTime:1000,bufferHeight:50,bufferFrameRate:25,buffer:[]},suspension:{height:null,incomming:"top",decay:{power:1.001},refresh:200},accumulation:{height:null},aggregation:{height:0,maxData:0,invertStrata:false},},options:{refresh:1000/25,panel:false,scale:30,layout:false,canvasFirst:true}};this.now=function(){return(new Date().getTime())};this.globalDecay=function(P){if(typeof(P)=="undefined"){return this.settings.sedimentation.suspension.decay.power}else{return this.settings.sedimentation.suspension.decay.power=P}};this.getWorld=function(){return this.world};this.chartUpdate=function(P,R){var Q={cat:P,y:R};this.chart[this.settings.chart.type](M,"update",Q)};this.flocculateTokens=function(P){return this.flocculate.update(M,P)};this.flocculateAll=function(){return this.flocculate.all(M)};this.addToken=function(P){return this.token.addToken(M,P)};this.selectAll=function(P,Q){return this.token.selectAll(M,P,Q)};this.select=function(P,Q){return this.token.select(M,P,Q)};this.updateAll=function(P){var Q=this.chart.updateAll(M,key,value);return Q};this.update=function(P,Q){var R=this.chart.update(M,P,Q);return R};function J(S,R){var Q={};for(var P in S){Q[P]=S[P]}for(var P in R){Q[P]=R[P]}return Q}J(H,O);if(O.data!=undefined){H.data=O.data}this.settings=B.extend(true,H,O);this.settings.DOMelement=E;if(typeof(this.settings.chart.width)=="undefined"){this.settings.chart.width=this.settings.width}if(typeof(this.settings.chart.x)=="undefined"){this.settings.chart.x=0}if(typeof(this.settings.chart.y)=="undefined"){this.settings.chart.y=0}if(typeof(this.settings.chart.height)=="undefined"){this.settings.chart.height=this.settings.height}if(typeof(this.settings.stream)=="undefined"){this.settings.stream={}}if(typeof(this.settings.stream.now)=="undefined"){this.settings.stream.now=0}if(typeof(this.settings.stream.provider)=="undefined"){this.settings.stream.provider="generator"}if(typeof(this.settings.stream.refresh)=="undefined"){this.settings.stream.refresh=1000}if(typeof(this.settings.data.tokenPast)=="undefined"){this.settings.data.tokenPast=0}if(typeof(this.settings.data.tokens)=="undefined"){this.settings.data.tokens=[]}if(typeof(this.settings.data.strata)!="undefined"&&this.settings.data.strata.length!=0){if(typeof(this.settings.sedimentation.aggregation)=="undefined"){this.settings.sedimentation.aggregation={}}if(typeof(this.settings.sedimentation.aggregation.height)=="undefined"){this.settings.sedimentation.aggregation.height=this.settings.chart.height/2}if(typeof(this.settings.sedimentation.aggregation.maxData)=="undefined"){this.settings.sedimentation.aggregation.maxData=10}}this.init=function(){this.requestAnimFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(W,V){window.setTimeout(W,1000/60)}})();this.world=new this.phy.b2World(new this.phy.b2Vec2(0,0),true);var Q=E.appendChild(document.createElement("div"));Q.id="box_sediviz_"+I();Q.width=this.settings.width;Q.height=this.settings.height;this.settings.DOMelement=Q;C=Q.appendChild(document.createElement("canvas"));C.id="canvas";C.width=this.settings.width;C.height=this.settings.height;C.style.position="absolute";this.ctx=C.getContext("2d");this.chart[this.settings.chart.type](M,"init");this.stream.init(M);this.flocculate.init(M);this.stream.update(M);this.token.init(M);this.strata.init(this);window.setInterval(function(){M.update(M)},M.settings.options.refresh/2);window.setInterval(function(){M.draw.update(M)},M.settings.options.refresh);window.setInterval(function(){M.decay.update(M)},M.settings.sedimentation.suspension.refresh);M.strata.update(M);this.getBodyAtMouse=function(b){var V=b.mouse.x/b.settings.options.scale;var Z=b.mouse.y/b.settings.options.scale;var Y=new b.phy.b2Vec2(V,Z);var W=new b.phy.b2AABB();var X=0.001;W.lowerBound.Set(V-X,Z-X);W.upperBound.Set(V+X,Z+X);b.mouse.selectedToken=null;b.world.QueryAABB(function(e){return T(e,b,Y)},W);return b.mouse.selectedToken};function T(W,X,V){X.mouse.selectedToken=W;if(W.GetBody().GetType()!=X.phy.b2Body.b2_staticBody){if(W.GetShape().TestPoint(W.GetBody().GetTransform(),V)){X.mouse.selectedToken=W;return false}}return true}this.handleMouseMove=function(V,W){canvasPosition=F(W.settings.DOMelement);W.mouse.x=(V.clientX-(canvasPosition.offsetLeft-this.getScrollPosition()[0]));W.mouse.y=(V.clientY-(canvasPosition.offsetTop-this.getScrollPosition()[1]))};this.getScrollPosition=function(){return Array((document.documentElement&&document.documentElement.scrollLeft)||window.pageXOffset||M.pageXOffset||document.body.scrollLeft,(document.documentElement&&document.documentElement.scrollTop)||window.pageYOffset||M.pageYOffset||document.body.scrollTop)};document.addEventListener("mousemove",function(V){S(V,M)});document.addEventListener("mouseup",function(V){U(V,M)});document.addEventListener("mousedown",function(V){R(V,M)});function P(Y,b){var W=b.getBodyAtMouse(b);if(W!=null){if(typeof(W.m_userData)!="undefined"){if(typeof(W.m_userData.callback)!="undefined"){if(typeof(W.m_userData.callback.mouseover)=="function"){var V=b.select("ID",W.m_userData.ID);W.m_userData.callback.mouseover(V)}if(typeof(W.m_userData.callback.mouseout)=="function"){var V=b.select("ID",W.m_userData.ID);var Z;var X=function(){var f=Z;var h=V;var e=b;var g=W;return function(){var k=e.getBodyAtMouse(e);var l=false;if(k!=null){if(typeof(k.m_userData)!="undefined"){if(k.m_userData.ID==h.attr("ID")){l=false}else{l=true}}else{l=true}}else{l=true}if(l){g.m_userData.callback.mouseout(h);clearInterval(Z)}}};Z=window.setInterval(X(),100)}}}}}function R(X,Y){Y.mouse.isMouseDown=true;Y.handleMouseMove(X,Y);var W=Y.getBodyAtMouse(Y);if(W!=null){if(typeof(W.m_userData)!="undefined"){if(typeof(W.m_userData.callback)!="undefined"){if(typeof(W.m_userData.callback.onclick)=="function"){var V=Y.select("ID",W.m_userData.ID);W.m_userData.callback.onclick(V)}}}}}function U(V,W){W.mouse.isMouseDown=false}function S(V,W){if(W.mouse.isMouseDown){W.mouse.isMouseDragging=true;W.mouse.x=V.clientX;W.mouse.y=V.clientY}else{W.handleMouseMove(V,W);P("move",W)}}};this.mouse.update=function(Q){if(isMouseDown&&(!mouseJoint)){var P=getBodyAtMouse();if(P){var R=new b2MouseJointDef();R.bodyA=world.GetGroundBody();R.bodyB=P;R.target.Set(mouseX,mouseY);R.collideConnected=true;R.maxForce=300*P.GetMass();mouseJoint=world.CreateJoint(R);P.SetAwake(true)}}if(mouseJoint){if(isMouseDown){mouseJoint.SetTarget(new b2Vec2(mouseX,mouseY))}else{world.DestroyJoint(mouseJoint);mouseJoint=null}}};this.update=function(P){this.world.Step(1/60,10,10);this.world.DrawDebugData();this.world.ClearForces()};var G=function(){ctx.fillStyle="rgb(200,0,0)";this.ctx.font="14pt Calibri,Geneva,Arial";this.ctx.fillText("Canvas ready for Visual Sedimentation ",10,20);window.setInterval(B.fn.vs.draw.refresh(ctx,world,this.settings),this.settings.options.refresh);console.log("draw Init ")};var F=function(R){var Q=R.offsetTop;var P=R.offsetLeft;while(R=R.offsetParent){Q+=R.offsetTop;P+=R.offsetLeft}return{offsetLeft:P,offsetTop:Q}};var I=function(){var P=function(){return Math.floor(Math.random()*65536).toString(16)};return(P()+P()+"-"+P()+"-"+P()+"-"+P()+"-"+P()+P()+P())};function K(Q){if(null==Q||"object"!=typeof Q){return Q}var R=Q.constructor();for(var P in Q){if(Q.hasOwnProperty(P)){R[P]=Q[P]}}return R}this.utile={};this.utile.GUID=I;this.utile.clone=K;this.settings=B.extend(this.settings,{}||{});this.init()};B.fn.vs=function(C){if(!arguments.length){var C={}}return this.each(function(){var D=B(this);if(D.data("VisualSedimentation")){return}var E=new A(this,C);D.data("visualSedimentation",E)})}})(jQuery);(function(A){A.fn._vs.phy={b2Vec2:Box2D.Common.Math.b2Vec2,b2AABB:Box2D.Collision.b2AABB,b2BodyDef:Box2D.Dynamics.b2BodyDef,b2Body:Box2D.Dynamics.b2Body,b2FixtureDef:Box2D.Dynamics.b2FixtureDef,b2Fixture:Box2D.Dynamics.b2Fixture,b2World:Box2D.Dynamics.b2World,b2MassData:Box2D.Collision.Shapes.b2MassData,b2PolygonShape:Box2D.Collision.Shapes.b2PolygonShape,b2CircleShape:Box2D.Collision.Shapes.b2CircleShape,b2DebugDraw:Box2D.Dynamics.b2DebugDraw,b2MouseJointDef:Box2D.Dynamics.Joints.b2MouseJointDef,b2Shape:Box2D.Collision.Shapes.b2Shape,b2DistanceJointDef:Box2D.Dynamics.Joints.b2DistanceJointDef,b2RevoluteJointDef:Box2D.Dynamics.Joints.b2RevoluteJointDef,b2Joint:Box2D.Dynamics.Joints.b2Joint,b2PrismaticJointDef:Box2D.Dynamics.Joints.b2PrismaticJointDef,b2ContactListener:Box2D.Dynamics.b2ContactListener,b2Settings:Box2D.Common.b2Settings}})(jQuery);(function(A){A.fn.vs.chart={}})(jQuery);(function(A){A.fn._vs.draw={settings:{draw:{trail:1,showLayout:false}},update:function(D){if(this.settings.draw.trail==1){D.ctx.clearRect(0,0,D.ctx.canvas.clientWidth,D.ctx.canvas.clientHeight)}else{debugDrawChart(0,0,ctx.canvas.clientWidth,ctx.canvas.clientHeight,"rgba(255,255,255,"+this.settings.draw.trail+")",ctx)}for(var B=D.world.GetBodyList();B;B=B.GetNext()){for(var C=B.GetFixtureList();C!=null;C=C.GetNext()){this.drawShape(D,C)}}if(this.settings.draw.showLayout==true){this.debugDrawChart(chart.position.x,chart.position.y,chart.position.width,chart.position.height,"rgba(255,0,0,0.2)",ctx)}},debugDrawChart:function(B,G,D,F,E,C){C.save();C.translate(0,0);C.fillStyle=E;C.beginPath();C.rect(B,G,D,F);C.closePath();C.strokeStyle="#000";C.lineWidth=0.5;C.stroke();C.restore()},clippedBackgroundImage:function(C,D,B,E){C.save();C.clip();C.drawImage(D,B-(D.height/2),E-(D.width/2),D.width,D.height);C.restore()},haveTexture:function(C){var B=false;if(typeof(C.m_userData.texture)!="undefined"){if(typeof(C.m_userData.texture.img)!="undefined"){if(C.m_userData.texture.img.complete){B=true}}}return B},drawShape:function(K,F){var Q=F.GetBody();var R=Q.GetPosition();var P=Q.GetAngle();var D=9;var C=10;var S=K.settings.options.scale;F.m_userData.x=Q.GetWorldCenter().x*S;F.m_userData.y=Q.GetWorldCenter().y*S;if(typeof(F.m_userData.callback)!="undefined"){if(typeof(F.m_userData.callback.draw)=="function"){var E=K.select("ID",F.m_userData.ID);F.m_userData.callback.draw(E)}}switch(F.GetType()){case 0:switch(F.m_userData){case null:K.ctx.fillStyle="rgba(255,0,0,1)";break;default:K.ctx.fillStyle=F.m_userData.fillStyle;break}var B=F.m_shape.m_radius;if(K.settings.sedimentation.token.visible==true){K.ctx.save();K.ctx.translate(R.x*S,R.y*S);K.ctx.rotate(P);K.ctx.beginPath();var O=(B/C*D)*S;if(typeof(F.m_userData.strokeStyle)!="undefined"){K.ctx.strokeStyle=F.m_userData.strokeStyle}else{K.ctx.strokeStyle="rgba(0,0,0,0)"}if(typeof(F.m_userData.lineWidth)!="undefined"){K.ctx.lineWidth=F.m_userData.lineWidth}else{K.ctx.lineWidth=0}K.ctx.arc(0,0,O,0,Math.PI*2,true);if(this.haveTexture(F)){this.clippedBackgroundImage(K.ctx,F.m_userData.texture.img,0,0)}K.ctx.closePath();if(K.settings.options.layout==true){K.ctx.strokeStyle="#000";K.ctx.lineWidth=0.5;K.ctx.stroke()}else{if(!this.haveTexture(F)){K.ctx.fill()}K.ctx.stroke()}K.ctx.restore()}break;case 1:switch(F.m_userData){case null:K.ctx.fillStyle="rgba(255,0,0,1)";break;default:K.ctx.fillStyle=F.m_userData.fillStyle;break}var I=F.m_shape.m_vertices[0].x*S;var G=F.m_shape.m_vertices[0].y*S;var J=R.x*S-F.m_shape.m_vertices[0].x*S;var H=R.y*S-F.m_shape.m_vertices[0].y*S;K.ctx.save();K.ctx.translate(R.x*S,R.y*S);K.ctx.rotate(P);K.ctx.beginPath();if(typeof(F.m_userData.strokeStyle)!="undefined"){K.ctx.strokeStyle=F.m_userData.strokeStyle}else{K.ctx.strokeStyle=F.m_userData.fillStyle}if(typeof(F.m_userData.lineWidth)!="undefined"){K.ctx.lineWidth=F.m_userData.lineWidth}else{K.ctx.lineWidth=0}for(var N=0;N<F.m_shape.m_vertices.length;N++){var M=F.m_shape.m_vertices;K.ctx.moveTo((M[0].x)*S,(M[0].y)*S);for(var L=1;L<M.length;L++){K.ctx.lineTo((M[L].x)*S,(M[L].y)*S)}K.ctx.lineTo((M[0].x)*S,(M[0].y)*S)}K.ctx.closePath();K.ctx.fill();if(K.settings.options.layout==true){K.ctx.lineWidth=0.1;K.ctx.strokeStyle="rgb(0,0,0)";K.ctx.stroke()}else{K.ctx.stroke()}K.ctx.restore();break;case 2:break;K.ctx.fillStyle="rgb(0,0,0)"}}}})(jQuery);(function(A){A.fn._vs.token={colorRange:function(){},init:function(B){this.colorRange=B.settings.chart.colorRange},ID:function(B){B.settings.data.tokenPast+=1;return B.settings.data.tokenPast},selectAll:function(G,D,F){var B=[];var E=false;B.flocculate=function(){var H=[];B.forEach(function(I){q=I.flocculate();H.push(q)});return H};B.attr=function(H,J,K){var I=[];B.forEach(function(L){q=L.attr(H,J,K);I.push(q)});return I};B.b2dObj=function(H,J,K){var I=[];B.forEach(function(L){q=L.myobj;I.push(q)});return I};if(typeof(F)=="undefined"&&typeof(D)=="undefined"){E=true}for(var C=G.tokens.length-1;C>=0;C--){if(G.tokens[C].attr(D)==F||E==true){B.push(G.tokens[C])}}return B},select:function(E,C,D){result=[];if(typeof(D)=="undefined"&&typeof(C)=="undefined"){return E.tokens}else{for(var B=E.tokens.length-1;B>=0;B--){if(E.tokens[B].attr(C)==D){result.push(E.tokens[B]);break}}}if(typeof(result[0])=="undefined"){return false}else{return result[0]}},addToken:function(H,G){var C={x:50,y:50,t:null,category:1,state:0,size:10,fillStyle:"###",strokeStyle:"rgba(0,0,0,0)",lineWidth:0,texture:undefined,shape:{type:"round"},userdata:{},callback:{},phy:{density:10,friction:0,restitution:0},targets:[],elbow:{}};var B=null;var D=null;var F=function(){};if(typeof(G)=="undefined"){F.setting=C;F.setting.ID=this.ID(H)}else{F.setting=G;if(typeof(F.setting.phy)=="undefined"){F.setting.phy=C.phy}if(typeof(F.setting.t)=="undefined"){F.setting.t=H.settings.stream.now}if(typeof(F.setting.x)=="undefined"){F.setting.x=H.settings.sedimentation.incoming.point[G.category].x+(Math.random()*2)}if(typeof(F.setting.y)=="undefined"){F.setting.y=H.settings.sedimentation.incoming.point[G.category].y+(Math.random()*2)}if(typeof(F.setting.size)=="undefined"){F.setting.size=H.settings.sedimentation.token.size.original}if(typeof(F.setting.targets)=="undefined"){F.setting.targets=[]}F.setting.ID=F.setting.ID=this.ID(H);if(typeof(F.setting.state)=="undefined"){F.setting.state=0}if(typeof(F.setting.shape)=="undefined"){F.setting.shape=C.shape}}F.myobj=this.create(H,F.setting);F.flocculate=function(){H.tokens.indexOf(this);H.flocculate.destroyIt(H,this);return this};F.attr=function(I,J,K){if(typeof(J)=="undefined"){if(typeof(this[I])!="undefined"){return this[I]()}else{return this.myobj.m_userData[I]}}else{if(typeof(this[I])!="undefined"){this[I](J,K)}else{this.myobj.m_userData[I]=J}}return this};F.callback=function(I,J){if(!arguments.length){return this.myobj.m_userData.callback}if(typeof(this.myobj.m_userData.callback[I])=="function"){return this.myobj.m_userData.callback[I](J)}else{return function(K){console.log("callback undefined")}}};F.size=function(I){if(this.myobj!=null&&this.attr("state")<2){if(!arguments.length){return this.myobj.m_shape.m_radius*this.myobj.m_userData.scale}this.myobj.m_shape.m_radius=I/this.myobj.m_userData.scale}};F.b2dObj=function(){if(this.myobj!=null&&this.attr("state")<2){return this.myobj}};F.texture=function(I){if(!arguments.length){return this.myobj.m_userData.texture.img.src}console.log("texture",I);this.myobj.m_userData.texture={};this.myobj.m_userData.texture.img=new Image();this.myobj.m_userData.texture.img.src=I};H.tokens.push(F);H.decay.tokens.push(F);if(typeof(this.myobj.m_userData.callback)!="undefined"){if(typeof(this.myobj.m_userData.callback.suspension)=="function"){var E=H.select("ID",F.setting.ID);this.myobj.m_userData.callback.suspension(E)}}return F},create:function(H,C){C.scale=scale=H.settings.options.scale;var G=C.x/scale+(Math.random()*0.1);var D=C.y/scale+(Math.random()*0.1);var F=new Box2D.Dynamics.b2FixtureDef;F.density=0.1;F.friction=0;F.restitution=0;if(C.shape.type=="round"){F.shape=new Box2D.Collision.Shapes.b2CircleShape(C.size/scale)}else{if(C.shape.type=="polygons"){F=this.setPolygons(H,C,F)}else{if(C.shape.type=="box"){F.shape=new Box2D.Collision.Shapes.b2PolygonShape;F.shape.SetAsBox(C.shape.width/scale,C.shape.height/scale)}}}var B=new Box2D.Dynamics.b2BodyDef;B.type=Box2D.Dynamics.b2Body.b2_dynamicBody;B.position.x=C.x/scale;B.position.y=C.y/scale;this.myobj=H.world.CreateBody(B).CreateFixture(F);if(typeof(C.texture)!="undefined"){C.texture.img=new Image();C.texture.img.src=C.texture.src}if(typeof(C.impulse)!="undefined"){this.applyImpulse(this.myobj,C.impulse.angle,C.impulse.power)}if(typeof(C.fillStyle)=="undefined"){C.fillStyle=this.colorRange(C.category)}if(typeof(C.lineWidth)=="undefined"){C.lineWidth=0}if(typeof(C.type)=="undefined"){C.type="token"}if(typeof(C.callback)=="undefined"){C.callback={}}this.myobj.m_userData=C;this.myobj.attr=this.attr;this.myobj.m_userData.mouse={};this.myobj.m_userData.mouse.over=false;this.myobj.m_userData.mouse.down=false;this.myobj.m_userData.mouse.dragging=false;this.myobj.m_userData.mouse.statebefore=false;this.myobj.m_userData.state=1;if(C.targets.length==0&&H.settings.chart.type=="CircleLayout"){C.targets[0]={x:H.settings.sedimentation.incoming.target[C.category].x,y:H.settings.sedimentation.incoming.target[C.category].y}}if(C.targets.length>0){var E=new H.phy.b2MouseJointDef();E.bodyA=H.world.GetGroundBody();E.bodyB=this.myobj.GetBody();E.target.Set(G,D);E.collideConnected=true;E.maxForce=50*this.myobj.GetBody().GetMass();mouseJoint=H.world.CreateJoint(E);mouseJoint.SetTarget(new H.phy.b2Vec2(C.targets[0].x/scale,C.targets[0].y/scale))}return this.myobj},applyImpulse:function(D,E,C){var B=D.GetBody();B.ApplyImpulse(new Box2D.Common.Math.b2Vec2(Math.cos(E*(Math.PI/180))*C,Math.sin(E*(Math.PI/180))*C),B.GetWorldCenter())},setPolygons:function(F,D,E){E.shape=new Box2D.Collision.Shapes.b2PolygonShape;if(D.shape.points==null){D.shape.points=[{x:-1,y:-1},{x:1,y:-1},{x:-1,y:-1},{x:1,y:-1}]}for(var C=0;C<D.shape.points.length;C++){var B=new Box2D.Common.Math.b2Vec2();B.Set(D.shape.points[C].x/scale,D.shape.points[C].y/scale);D.shape.points[C]=B}E.shape.SetAsArray(D.shape.points,D.shape.points.length);return E},createDataBarBall:function(I,B,H,E,F){var G=new Box2D.Dynamics.b2FixtureDef;G.density=10;G.friction=0.5;G.restitution=0.2;G.shape=new Box2D.Collision.Shapes.b2CircleShape(E/I.settings.options.scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=B/I.settings.options.scale;D.position.y=H/I.settings.options.scale;var C=I.world.CreateBody(D).CreateFixture(G);C.m_userData={type:"BarChartBall",familyID:"family",fillColor:this.colorRange(F)};return C},createBox:function(I,K,J,D,L,F,C,G){if(typeof(G)=="undefined"){G=true}var B=new b2FixtureDef;if(!G){B.density=100}B.friction=0.6;B.restitution=0.3;var E=new b2BodyDef;E.type=b2Body.b2_staticBody;E.angle=F;B.shape=new b2PolygonShape;B.shape.SetAsBox(D/scale,L/scale);E.position.Set(K/scale,J/scale);var H=I.CreateBody(E).CreateFixture(B);H.m_userData={type:"Wall",fillColor:C};console.log(H.m_userData);return H},createBoxPie:function(I,E,K,J,D,L,G,C){var F=new b2BodyDef;F.type=Box2D.Dynamics.b2Body.b2_dynamicBody;var B=new Box2D.Dynamics.b2FixtureDef;B.shape=new b2PolygonShape;B.shape.SetAsBox(D/scale,L/scale);B.density=1000000;B.friction=0.5;B.restitution=0.2;F.position.Set(K/scale,J/scale);F.angle=0;var H=I.CreateBody(F).CreateFixture(B);H.m_userData={type:"Wall",fillColor:C};return H},createBox0D:function(H,C,I,F,B,G){if(typeof(G)=="undefined"){G=true}var E=new b2BoxDef();E.restitution=-0.6;E.friction=0.3;if(!G){E.density=0.01}E.extents.Set(F,B);var D=new b2BodyDef();D.AddShape(E);D.position.Set(C,I);return H.CreateBody(D)},createHiddenBox:function(G,I,H,B,J,D){if(typeof(D)=="undefined"){D=true}var E=new b2BoxDef();E.restitution=0.6;E.friction=0.3;if(!D){E.density=1}E.extents.Set(B,J);var C=new b2BodyDef();C.AddShape(E);C.position.Set(I,H);var F=G.CreateBody(C);F.m_shapeList.visibility="hidden";console.log(F);return F},createBigBall:function(E,B,G){var F=new Box2D.Dynamics.b2FixtureDef;F.density=1000000;F.friction=0.5;F.restitution=0.2;F.shape=new Box2D.Collision.Shapes.b2CircleShape(20/30);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=B;D.position.y=G;var C=E.CreateBody(D).CreateFixture(F);return C},createPieBox:function(G,J,I,C,K,L,D,M){M=A.extend(true,{density:10000000,friction:1,restitution:0.2,linearDamping:0,angularDamping:0,gravityScale:0,type:b2Body.b2_dynamicBody},M);var B=new b2BodyDef();var E=new b2FixtureDef;E.density=M.density;E.friction=M.friction;E.restitution=M.restitution;E.shape=new b2PolygonShape();E.shape.SetAsBox(C/scale,K/scale);B.position.Set(J/scale,I/scale);B.linearDamping=M.linearDamping;B.angularDamping=M.angularDamping;B.angle=L;B.type=M.type;var H=G.CreateBody(B);var F=H.CreateFixture(E);F.m_userData={type:"box",familyID:null,fillColor:D};return H},createDataBallTarget:function(H,L,I,M,K,N,F){var G=M/scale+(Math.random()*0.1);var C=K/scale+(Math.random()*0.1);var B=new Box2D.Dynamics.b2FixtureDef;B.density=0.1;B.friction=0;B.restitution=0;B.shape=new Box2D.Collision.Shapes.b2CircleShape(N/scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=G;D.position.y=C;var E=H.CreateBody(D).CreateFixture(B);var J=new b2MouseJointDef();J.bodyA=H.GetGroundBody();J.bodyB=E.GetBody();J.target.Set(G,C);J.collideConnected=true;J.maxForce=50*E.GetBody().GetMass();mouseJoint=H.CreateJoint(J);mouseJoint.SetTarget(new b2Vec2(L/scale,I/scale));E.m_userData={type:"PieBall",familyID:F,fillColor:colorScale(F)};categorys[F].value+=1;categorys[F].joins.push(mouseJoint);return E},createDataBallPie:function(H,I,M,K,N,F){console.log(I);var G=categorys[F].incomingPoint.x/scale+(Math.random()*2/scale);var C=categorys[F].incomingPoint.y/scale;var B=new Box2D.Dynamics.b2FixtureDef;B.density=0.1;B.friction=0;B.restitution=0;B.shape=new Box2D.Collision.Shapes.b2CircleShape(N/scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=G;D.position.y=C;var L=H.CreateBody(D);L.m_userData={type:"PieBall",familyID:F,fillColor:categorys[F].color};listBodies.push(L);var E=L.CreateFixture(B);var J=new b2MouseJointDef();J.bodyA=H.GetGroundBody();J.bodyB=E.GetBody();J.target.Set(G,C);J.collideConnected=true;J.maxForce=100*E.GetBody().GetMass();mouseJoint=H.CreateJoint(J);mouseJoint.SetTarget(new b2Vec2(I.position.x/scale,I.position.y/scale));E.m_userData={type:"PieBall",familyID:F,fillColor:colorScale(F)};categorys[F].value+=1;return E},createDataBall:function(H,B,G,E){var F=new Box2D.Dynamics.b2FixtureDef;F.density=1;F.friction=0.5;F.restitution=0.2;F.shape=new Box2D.Collision.Shapes.b2CircleShape(E/H.settings.options.scale);var D=new Box2D.Dynamics.b2BodyDef;D.type=Box2D.Dynamics.b2Body.b2_dynamicBody;D.position.x=B;D.position.y=G;var C=H.world.CreateBody(D).CreateFixture(F);C.m_userData={type:"PieBall",familyID:"family",fillColor:"rgb(200,0,0)"};return C},}})(jQuery);(function(A){A.fn._vs.stream={i:null,buffer:[],speed:10000/6,strategy:null,type:null,init:function(B){this.speed=B.settings.data.stream.refresh;type=B.settings.data.stream.provider},push:function(C){console.log(C);for(var B=C.length-1;B>=0;B--){buffer.push(C)}},update:function(C){if(type=="generator"){for(var B=0;B<C.settings.data.model.length;B++){C.dataFlow[B]=setInterval((function(D,E){return function(){E.settings.data.stream.now++;var F=E.chart[E.settings.chart.type](E,"token",D);E.addToken(F)}})(B,C),this.speed)}}else{if(type=="tokens"){C.dataFlow[0]=setInterval((function(D,E){return function(){E.settings.data.stream.now++;for(var F=0;F<E.settings.data.tokens.length;F++){if(E.settings.data.tokens[F].t==E.settings.data.stream.now){E.addToken(E.settings.data.tokens[F])}}}})(B,C),this.speed)}else{}}},generator:function(C,B){},test:function(B){B.tokens.push(B.token.createDataBarBall(B,(B.settings.sedimentation.incoming[i].x+(Math.random()*2)),(B.settings.sedimentation.incoming[i].y+(Math.random()*1)),B.settings.sedimentation.token.size,i))},setSpeed:function(D,C){speedFlow=C;for(var B=0;B<categorys.length;B++){window.clearInterval(dataFlow[B])}window.clearInterval(decayFlow);dataFlow(categorys)}}})(jQuery);(function(A){A.fn._vs.decay={tokens:[],update:function(G){var D=1;var J=G.settings.sedimentation.suspension.height;var K=G.settings.height;var H=G.settings.sedimentation.token.size/4;var B=G.settings.sedimentation.suspension.decay.power;var E=G.settings.options.scale;var F=G.settings.sedimentation.token.size.minimum;if(B==null){var B=0}for(var I=0;I<this.tokens.length;I++){var C=this.tokens[I].attr("size");if(B!=0){this.tokens[I].attr("size",C/B)}if(C<=F){if(G.settings.sedimentation.flocculate.strategy!=null){G.flocculate.destroyIt(G,this.tokens[I]);G.strata.update(G)}}}}}})(jQuery);(function(A){A.fn._vs.flocculate={buffer:[],init:function(C){console.log("init flocculate",C);for(var B=0;B<C.settings.data.model.length;B++){this.buffer[B]=[];console.log(B)}},addtobuffer:function(C,B){c=B.attr("category");bufferSize=C.settings.sedimentation.flocculate.bufferSize;this.buffer[c].push(B);C.decay.tokens.splice(C.decay.tokens.indexOf(B),1);B.attr("callback","bufferFlocculation",B);if(this.buffer[c].length>bufferSize){this.update(C,c,bufferSize)}},destroyIt:function(D,C){C.attr("callback","flocculation",C);C.attr("state",2);var B=D.world.DestroyBody(C.myobj.GetBody());return B},update:function(E,D,B){if(E.settings.sedimentation.flocculate.number==1){while(this.buffer[D].length>B){var C=this.buffer[D].shift();this.destroyIt(E,C)}}else{while(this.buffer[D].length>E.settings.sedimentation.flocculate.number){var C=this.buffer[D].shift();this.destroyIt(E,C)}}},disapear:function(C,B){window.setInterval(function(){B.update(self)},self.settings.options.refresh/2)},all:function(C){console.log(C.settings.data);for(var B=C.decay.tokens-1;B>=0;B--){console.log(C.decay.tokens);this.update(C,B,C.tokens.length)}},strategy:function(){if(flocullateBuffer.length>0){if(chart.flocullate.strategy=="Size"&&flocullateBuffer.length>=chart.flocullate.bufferSize){console.log(flocullateBuffer.length);flocullateByArray(flocullateBuffer)}else{if(chart.flocullate.strategy=="Time"){}else{if(chart.flocullate.strategy=="Height"){}}}}}}})(jQuery);(function(A){A.fn._vs.aggregate={defaultSettings:{},strata_layers:function(H,G,B,D){var F=d3.scale.linear().domain([1,B-2]).range([Math.PI/2,2*Math.PI-Math.PI/2]);var C=d3.scale.pow().exponent(10).domain([0,B]).range([0,1]);return d3.range(G).map(function(I){var J=5*Math.random();return d3.range(B).map(function(L){if(H.settings.sedimentation.aggregation.strataType=="sin"){if(I==1){return 20}var K=5+J*5*Math.sin(F(L))+(I*50);if(K<0){return -K}else{return K}}else{if(H.settings.sedimentation.aggregation.strataType=="log"){return I+1}else{if(typeof(D)=="undefined"){D=0}return H.settings.data.strata[D][I].value}}}).map(E)});function E(J,I){return{x:I,y:Math.max(0,J)}}},init:function(L){if(typeof(L.settings.data.strata)=="undefined"||L.settings.data.strata.length==0||L.settings.data.strata[0].length==0){return}var M=L.token.colorRange;if(L.settings.chart.type=="StackedAreaChart"){var E=L.settings.chart.width/L.settings.data.model.length,O=L.settings.sedimentation.aggregation.height;var G=d3.select("#"+L.settings.DOMelement.id).append("div").attr("class","vis").style("z-index",10).append("svg").attr("width",L.settings.width).attr("height",L.settings.height).append("g").attr("transform","translate("+L.settings.chart.x+","+L.settings.chart.y+")");var Q=G.selectAll("g.gcol").data(L.settings.data.strata,function(V){return[V]}).enter().append("g").attr("transform",function(W,V){return"translate("+(V*E)+", "+(L.settings.chart.height-L.settings.sedimentation.aggregation.height)+")"}).attr("class",function(W,V){return"gcol col_"+V});var U=L.settings.data.strata.map(function(V){return{value:V[0].value}});var R=L.settings.data.strata[0].length,S=20;smx=S-1,smy=0;var D=0;var T=d3.svg.area().x(function(V){return L.settings.chart.spacer+V.x*(E-2*L.settings.chart.spacer)/smx}).y0(function(V){return(O-V.y0*D)}).y1(function(V){return(O-(V.y+V.y0)*D)});var K=[];var B=Q.selectAll("gpath").data(function(X,V){var W=d3.layout.stack().offset("expand")(L.aggregate.strata_layers(L,X.length,S,V));smy=d3.max(W,function(Y){return d3.max(Y,function(Z){return Z.y0+Z.y})});W.map(function(Y){Y.map(function(Z){Z.col=V;return Z})});return W}).enter().append("g").attr("class","gpath");B.append("path").attr("d",function(W,V){D=L.settings.chart.height-L.chart.getPosition(L)[W[0].col].y;return T(W)}).style("fill",function(W,V){if(L.settings.data.strata[W[0].col][V].texture!=null){return"url(#RectanglePattern_"+W[0].col+"_"+V+")"}else{return d3.rgb(M(W[0].col)).darker(L.settings.data.strata[W[0].col].length/2-(V+1)/2)}}).attr("class",function(W,V){return"layer"}).attr("class",function(W,V){return"col_"+W[0].col+" layer_"+V});var C=E/1;var I=C;for(var F=0;F<L.settings.data.strata.length;F++){for(var J=0;J<L.settings.data.strata[F].length;J++){if(L.settings.data.strata[F][J].texture!=null){var P=G.append("pattern").attr("id","RectanglePattern_"+F+"_"+J).attr("height",I).attr("width",C).attr("patternTransform","translate(0, 0) scale("+L.settings.data.strata[F][J].texture.size+", "+L.settings.data.strata[F][J].texture.size+") rotate(0)").attr("patternUnits","userSpaceOnUse");P.append("image").attr("x",0).attr("y",0).attr("height",I).attr("width",C).attr("xlink:href",function(){return L.settings.data.strata[F][J].texture.url})}}}}else{if(L.settings.chart.type=="CircleLayout"){var H=d3.select("#"+L.settings.DOMelement.id).append("div").attr("class","vis").attr("width",L.settings.width).attr("height",L.settings.height).append("svg").attr("width",L.settings.width).attr("height",L.settings.height);if(typeof(L.settings.chart.treeLayout)!="undefined"){for(var N=0;N<L.settings.data.model.length;N++){var U=L.settings.data.strata[N];var M=function(V){return L.token.colorRange(N)};L.aggregate.create_pie_chart(L,U,H,U[0].value,M,((N+1/2))*L.settings.chart.width/(L.settings.data.model.length)+L.settings.chart.x,L.settings.chart.y+L.settings.chart.height/6)}}else{var U=L.settings.data.strata.map(function(V){return{value:V[0].value}});console.log(L.settings.data.strata,U);var M=L.token.colorRange;L.aggregate.create_pie_chart(L,U,H,L.settings.chart.radius,M,L.settings.chart.x+L.settings.chart.width/2,L.settings.chart.y+L.settings.chart.height/2)}}}},create_pie_chart:function(O,T,K,J,P,N,M){var H=O.settings.width/O.settings.data.model.length,R=O.settings.sedimentation.aggregation.height;var G=d3.scale.linear().domain([0,O.settings.data.strata.length-1]).range([0,O.settings.width]);var F=d3.scale.linear().domain([0,d3.max(T,function(U){return U.value})]).rangeRound([0,R]);var C=O.settings.width,B=O.settings.height,I=O.settings.sedimentation.aggregation.height;labelr=J+30,donut=d3.layout.pie().sort(null),arc=d3.svg.arc().innerRadius(0).outerRadius(J);var L=Math.random();K.append("g.arcs_"+L).attr("class","arcs_"+L);var E=K.selectAll(".arcs").data(donut(T.map(function(V,U){return V.value}))).enter().append("svg:g").attr("transform","translate("+N+","+M+")");var D=0;var S=d3.svg.area().x(function(U){return O.settings.chart.spacer+U.x*(H-2*O.settings.chart.spacer)/smx}).y0(function(U){return(R-U.y0*D)}).y1(function(U){return(R-(U.y+U.y0)*D)});var Q=E.append("path").attr("fill",function(V,U){return P(U)}).attr("d",function(V,U){return arc(V)}).each(function(U){this._current=U})},update:function(K){if(typeof(K.settings.data.strata)=="undefined"||K.settings.data.strata.length==0||K.settings.data.strata[0].length==0){return}var N=K.settings.chart.width/K.settings.data.model.length;var I=K.settings.sedimentation.aggregation.height;var M=d3.scale.linear().domain([0,K.settings.data.strata.length-1]).range([0,K.settings.width]);var H=K.settings.data.strata.map(function(P){return{value:P[0].value}});var O=K.settings.data.strata.map(function(R){for(var P=0,Q=0;P<R.length;P++){Q+=R[P].value}return Q});var L=d3.scale.linear().domain([0,d3.max(O)]).range([0,K.settings.sedimentation.aggregation.height]);var E=K.settings.data.strata[0].length,F=20;smx=F-1,smy=0;var G=0;var D=d3.svg.area().x(function(P){return K.settings.chart.spacer+P.x*(N-2*K.settings.chart.spacer)/smx}).y0(function(P){return(I-P.y0*G)}).y1(function(P){return(I-(P.y+P.y0)*G)});var C=d3.select("svg");var J=C.selectAll(".gcol");J.data(K.settings.data.strata,function(Q,P){return[Q]});var B=J.selectAll(".gpath").data(function(R,P){var Q=d3.layout.stack().offset("expand")(K.aggregate.strata_layers(K,R.length,F,P));smy=d3.max(Q,function(S){return d3.max(S,function(T){return T.y0+T.y})});Q.map(function(S){S.map(function(T){T.col=P;return T})});return Q});B.select("path").transition().duration(100).attr("d",function(Q,P){K.chartUpdate(P,-L(O[P])-(I-K.settings.chart.height));G=K.settings.chart.height-K.chart.getPosition(K)[Q[0].col].y;return D(Q)})}}})(jQuery);(function(A){A.fn._vs.chart.StackedAreaChart=function(F,E,D){var C;this.init=function(G){console.log("StackedAreaChart Init");gravity=new G.phy.b2Vec2(0.001,10);G.world.m_gravity=gravity;G.chartPhySetup={grounds:[],wall:[]};this.setupChartPhysics(G)};this.setupChartPhysics=function(L){var M=L.settings.chart.spacer;console.log(L.settings.chart);var O=(L.settings.chart.width/L.settings.data.model.length);var H=M;var P=L.settings.chart.height/2+L.settings.chart.y;var N=L.settings.chart.height-L.settings.sedimentation.aggregation.height;console.log(N);var I=0;for(var K=0;K<L.settings.data.model.length;K++){L.settings.data.model[K].value=0;if(typeof(L.settings.data.strata)!="undefined"){if(typeof(L.settings.data.strata[K])!="undefined"){for(var J=0;J<L.settings.data.strata[K].length;J++){L.settings.data.model[K].value+=L.settings.data.strata[K][J].value}}}I+=L.settings.data.model[K].value}for(var K=0;K<L.settings.data.model.length+1;K++){var G=L.settings.chart.x+(K*O);L.chartPhySetup.wall[K]=this.createMyChartBox(L,G,P,H,L.settings.chart.height/2,"wall",L.settings.chart.wallColor);console.log(G,P);if(K<L.settings.data.model.length){L.settings.sedimentation.incoming.point[K]={x:G+(O/2),y:L.settings.y}}if(K<L.settings.data.model.length){L.chartPhySetup.grounds[K]=this.createMyChartBox(L,G+(O/2),L.settings.chart.height+L.settings.chart.y+L.settings.sedimentation.aggregation.height,O/2,L.settings.chart.height,"lift","rgba(250,250,250,0)");this.update(L,{cat:K,y:L.settings.chart.height})}}};this.token=function(J,G){var I=G;var H={x:(J.settings.sedimentation.incoming.point[I].x+(Math.random()*2)),y:(J.settings.sedimentation.incoming.point[I].y+(Math.random()*1)),t:J.now(),size:J.settings.sedimentation.token.size.original,category:I,lineWidth:0,};return H};this.createMyChartBox=function(M,P,O,Q,L,N,J){var I=M.settings.options.scale;var G=new M.phy.b2FixtureDef;G.density=1;G.friction=0.5;G.restitution=0.2;var H=new M.phy.b2BodyDef;H.type=M.phy.b2Body.b2_staticBody;G.shape=new M.phy.b2PolygonShape;G.shape.SetAsBox(Q/I,L/I);H.position.Set(P/I,O/I);var K=M.world.CreateBody(H).CreateFixture(G);K.m_userData={type:N,fillStyle:J,w:Q,h:L,x:P,y:O};return K};this.update=function(K,J){var I={cat:0,y:0};if(K.chartPhySetup.grounds[J.cat]!=null){var H=K.chartPhySetup.grounds[J.cat].GetBody();var G=H.GetWorldCenter();G.y=(J.y+K.settings.chart.height+K.settings.chart.y+K.settings.sedimentation.aggregation.height)/K.settings.options.scale;H.SetPosition(G)}};this.getPositionOld=function(I){var G=[];for(var H=0;H<I.chartPhySetup.grounds.length;H++){myElement=I.chartPhySetup.grounds[H];myBody=myElement.GetBody();G.push({x:(myBody.GetWorldCenter().x*I.settings.options.scale),y:(myBody.GetWorldCenter().y*I.settings.options.scale),a:myBody.GetAngle(),w:myElement.m_userData.w,h:myElement.m_userData.h,r:myElement.m_userData.r,})}return G};this.getPosition=function(I){var G=[];for(var H=0;H<I.chartPhySetup.grounds.length;H++){myElement=I.chartPhySetup.grounds[H];myBody=myElement.GetBody();G.push({x:(myBody.GetWorldCenter().x*I.settings.options.scale),y:(myBody.GetWorldCenter().y*I.settings.options.scale)-I.settings.chart.height-I.settings.chart.y,a:myBody.GetAngle(),w:myElement.m_userData.w,h:myElement.m_userData.h,r:myElement.m_userData.r,})}return G};if(typeof(E)!=undefined){var B=this[E](F,D);if(typeof(B)!=undefined){return B}}}})(jQuery);(function(A){A.fn._vs.chart.CircleLayout=function(I,M,Q){var H;var K;var J;var G;var N=[];var E=0;var I;this.init=function(U,S){console.log("Circle Layout Init");this._this=U;gravity=new U.phy.b2Vec2(0,0);U.world.m_gravity=gravity;U.chartPhySetup={grounds:[],wall:[]};this.treeLayout=U.settings.chart.treeLayout;for(var T=0;T<U.settings.data.model.length;T++){U.settings.data.strata[T][0].value=U.settings.data.strata[T][0].initValue}for(var T=0;T<U.settings.data.model.length;T++){U.settings.data.model[T].value=0;for(var R=0;R<U.settings.data.strata[T].length;R++){U.settings.data.model[T].value+=U.settings.data.strata[T][R].value}N.push(U.settings.data.model[T].value);E+=U.settings.data.model[T].value}if(this.treeLayout){console.log("ici");this.setupBubbleChartPhysics(U)}else{this.setupPieChartPhysics(U)}};this.setupPieChartPhysics=function(X){console.log("w",X.settings.width);var S=X.settings.chart.radius;K=X.settings.chart.width/2+X.settings.chart.x;J=X.settings.chart.height/2+X.settings.chart.y;var V=O(K,J,S,X.settings.chart.wallColor);for(var U=0;U<X.settings.data.model.length;U++){X.settings.sedimentation.incoming.target[U]={x:K,y:J}}var R=[];var T=X.settings.chart.spacer;var W=0;console.log("tdv",E);if(E==0){for(var U=0;U<X.settings.data.length;U++){N[U]=1}E=N.length}for(var U=0;U<N.length;U++){v=N[U];a2=((v/2+W)/E)*360-90;W+=v;a=(W/E)*360-90;c=L(a2,S*5,K,J);console.log(c);X.settings.sedimentation.incoming.point[U]=c;X.chartPhySetup.grounds[U]=this.createBox(X,K,J,T,S,a,S,"wall",X.settings.chart.wallColor)}console.log("w",X.settings.chart.width)};this.update=function(Y,U){console.log("update");var T={cat:0,r:0};U.r-=90;var W=(U.r+90)*(Math.PI/180);var X=L(U.r,Y.settings.chart.radius,Y.settings.chart.width/2+Y.settings.chart.x,Y.settings.chart.height/2+Y.settings.chart.y);if(Y.chartPhySetup.grounds[U.cat]!=null){var S=Y.chartPhySetup.grounds[U.cat].GetBody();var R=S.GetWorldCenter();var V=S.GetAngle();R.y=X.y/Y.settings.options.scale;R.x=X.x/Y.settings.options.scale;V=W;S.SetPosition(R);S.SetAngle(V)}};this.token=function(U,R){var T=R;var S={x:(U.settings.sedimentation.incoming.point[T].x+(Math.random()*2)),y:(U.settings.sedimentation.incoming.point[T].y+(Math.random()*1)),t:U.now(),size:U.settings.sedimentation.token.size.original,category:T,phy:{density:10,friction:0,restitution:0},targets:[{x:U.settings.sedimentation.incoming.target[T].x,y:U.settings.sedimentation.incoming.target[T].y}]};return S};function L(T,S,X,U){j=T*Math.PI/180;var R=(Math.cos(j)*S)+X;var W=(Math.sin(j)*S)+U;var V={x:R,y:W};return V}function O(W,V,R,T){var Y=I.settings.options.scale;var X=new I.phy.b2FixtureDef;X.density=1;X.friction=0.5;X.restitution=0.2;var S=new I.phy.b2BodyDef;X.shape=new I.phy.b2CircleShape(R/Y);S.position.Set(W/Y,V/Y);var U=I.world.CreateBody(S).CreateFixture(X);U.m_userData={type:"wall",familyID:null,fillStyle:T,strokeStyle:T,r:R};return U}this.createBox=function(Z,k,f,l,Y,g,R,e,W){var V=Z.settings.options.scale;var S=new Z.phy.b2FixtureDef;var b=L(g,R,k,f);S.density=1;S.friction=0.5;S.restitution=0.2;var U=new Z.phy.b2BodyDef;var T=(g+90)*(Math.PI/180);U.angle=T;U.type=Z.phy.b2Body.b2_staticBody;S.shape=new Z.phy.b2PolygonShape;S.shape.SetAsBox(l/V,Y/V);U.position.Set(b.x/V,b.y/V);var X=Z.world.CreateBody(U).CreateFixture(S);X.m_userData={type:e,fillStyle:W,w:l,h:Y,r:R};return X};this.getPosition=function(T){var R=[];for(var S=0;S<T.chartPhySetup.grounds.length;S++){myElement=T.chartPhySetup.grounds[S];myBody=myElement.GetBody();R.push({x:(myBody.GetWorldCenter().x*T.settings.options.scale),y:(myBody.GetWorldCenter().y*T.settings.options.scale),a:myBody.GetAngle(),w:myElement.m_userData.w,h:myElement.m_userData.h,r:myElement.m_userData.r,})}return R};this.setupBubbleChartPhysics=function(Y){console.log("setupBubbleChartPhysics");var V=(Y.settings.chart.width/Y.settings.data.model.length);var T=Y.settings.chart.spacer;var S=Y.settings.chart.height/2+Y.settings.y+T;var W=0;var X=0;var R=Y.settings.chart.column;for(var U=0;U<Y.settings.data.model.length;U++){X=Y.settings.chart.x+(U%R*T)+(T/2);W=Y.settings.chart.y+Math.floor(U/R)*T+(T/2);Y.settings.sedimentation.incoming.target[U]={x:X,y:W};O[U]=C(X,W,Y.settings.chart.spacer,U);Y.settings.data.model[U].incomingPoint={x:X,y:W}}};function C(b,W,X,S){console.log("CreatMyBubblePivot",b,W,X,S);var U=I.settings.options.scale;var R=new I.phy.b2FixtureDef;var Z=d3.scale.category10();R.density=10000;R.friction=0;R.restitution=0;var V=new I.phy.b2BodyDef;R.shape=new I.phy.b2CircleShape(X*U);V.position.Set(b/U,W/U);var T=I.world.CreateBody(V);var Y=T.CreateFixture(R);console.log(S,Z(S));Y.m_userData={type:"BubblePivot",familyID:S,fillStyle:I.settings.chart.wallColor};console.log(S,Y);Y.m_shape.m_radius=I.settings.data.model[S].value/U;return Y}this.getPivotPosition=function(T){if(typeof(T)!="undefined"){return this.pivot}else{var R=[];for(var S=0;S<I.settings.data.model.length;S++){R.push(I.settings.data.model[S])}return R}};function D(S,U,T){var R=O[T].GetBody();R.SetPosition(new b2Vec2(S/scale,U/scale));I.settings.data.model[T].incomingPoint.x=S;I.settings.data.model[T].incomingPoint.y=U;setFlowSpeed(speedFlow)}function B(R,U,T){for(var S=0;S<categorys[T].joins.length;S++){categorys[T].joins[S].SetTarget(new b2Vec2(R/scale,U/scale))}}function F(R,S){O[S].m_shape.m_radius=R}if(typeof(M)!=undefined){var P=this[M](I,Q);if(typeof(P)!=undefined){return P}}}})(jQuery);