--- a/integ/iri-buzz.html Mon May 06 14:57:50 2013 +0200
+++ b/integ/iri-buzz.html Mon May 06 18:38:13 2013 +0200
@@ -112,10 +112,8 @@
<div class="comment-list"></div>
</div>
-<script src="js/libs/jquery-1.7.1.min.js"></script>
-
<script src="renkan/lib/underscore-min.js"></script>
-<script src="js/vs/_VisualSedimentation.js"></script>
+<script src="iri/js/vs.0.1-min.js"></script>
<script src="js/libs/jquery-ui-1.8.21.custom.min.js"></script>
--- a/integ/iri-cadeaux.html Mon May 06 14:57:50 2013 +0200
+++ b/integ/iri-cadeaux.html Mon May 06 18:38:13 2013 +0200
@@ -155,7 +155,7 @@
<li class="gift_movie" data-gift-id="cinecard-00">
<a class="gift_poster gift_new" href="#" title="L'Etrange histoire de Benjamin Button">
- <img src="http://images.allocine.fr/r_640_600/b_1_d6d6d6/medias/nmedia/18/67/78/06/19028560.jpg" width="151" height="204" alt="Affiche du film" />
+ <img src="http://images.allocine.fr/r_150_200/b_1_d6d6d6/medias/nmedia/18/67/78/06/19028560.jpg" width="150" height="200" alt="Affiche du film" />
</a>
<ul class="gift_info">
<li class="gift_movie_title">
@@ -177,7 +177,7 @@
<li class="gift_movie" data-gift-id="cinecard-01">
<a class="gift_poster" href="#" title="Vous allez rencontrer un bel et sombre inconnu">
- <img src="http://fr.web.img2.acsta.net/r_640_600/b_1_d6d6d6/medias/nmedia/18/79/08/93/19492940.jpg" width="151" height="204" alt="Affiche du film" />
+ <img src="http://fr.web.img2.acsta.net/r_150_200/b_1_d6d6d6/medias/nmedia/18/79/08/93/19492940.jpg" width="150" height="200" alt="Affiche du film" />
</a>
<ul class="gift_info">
<li class="gift_movie_title">
@@ -206,7 +206,7 @@
<li class="gift_movie">
<a class="gift_poster" href="#" title="Men In Black III">
- <img src="http://fr.web.img3.acsta.net/r_640_600/b_1_d6d6d6/medias/nmedia/18/89/36/03/20072335.jpg" width="151" height="204" alt="Affiche du film" />
+ <img src="http://fr.web.img3.acsta.net/r_150_200/b_1_d6d6d6/medias/nmedia/18/89/36/03/20072335.jpg" width="150" height="200" alt="Affiche du film" />
</a>
<ul class="gift_info">
<li class="gift_movie_title">
@@ -228,7 +228,7 @@
<li class="gift_movie" data-gift-id="cinecard-02">
<a class="gift_poster" href="#" title="Intouchables">
- <img src="http://fr.web.img2.acsta.net/r_640_600/b_1_d6d6d6/medias/nmedia/18/82/69/17/19806656.jpg" width="151" height="204" alt="Affiche du film" />
+ <img src="http://fr.web.img2.acsta.net/r_150_200/b_1_d6d6d6/medias/nmedia/18/82/69/17/19806656.jpg" width="150" height="200" alt="Affiche du film" />
</a>
<ul class="gift_info">
<li class="gift_movie_title">
@@ -250,7 +250,7 @@
<li class="gift_movie" data-gift-id="cinecard-00">
<a class="gift_poster" href="#" title="L'Etrange histoire de Benjamin Button">
- <img src="http://images.allocine.fr/r_640_600/b_1_d6d6d6/medias/nmedia/18/67/78/06/19028560.jpg" width="151" height="204" alt="Affiche du film" />
+ <img src="http://images.allocine.fr/r_150_200/b_1_d6d6d6/medias/nmedia/18/67/78/06/19028560.jpg" width="150" height="200" alt="Affiche du film" />
</a>
<ul class="gift_info">
<li class="gift_movie_title">
@@ -272,7 +272,7 @@
<li class="gift_movie">
<a class="gift_poster" href="#" title="Vous allez rencontrer un bel et sombre inconnu">
- <img src="http://fr.web.img2.acsta.net/r_640_600/b_1_d6d6d6/medias/nmedia/18/79/08/93/19492940.jpg" width="151" height="204" alt="Affiche du film" />
+ <img src="http://fr.web.img2.acsta.net/r_150_200/b_1_d6d6d6/medias/nmedia/18/79/08/93/19492940.jpg" width="150" height="200" alt="Affiche du film" />
</a>
<ul class="gift_info">
<li class="gift_movie_title">
@@ -353,8 +353,6 @@
<!-- custom scrollbars plugin -->
<script src="js/jquery.mCustomScrollbar.js"></script>
-<script src="js/script.js"></script>
-
<!--
IRI: Scripts
-->
@@ -364,7 +362,6 @@
</script>
<!-- RENKAN -->
-<script src="renkan/lib/jquery.mousewheel.min.js"></script>
<script src="renkan/lib/underscore-min.js"></script>
<script src="renkan/lib/backbone.js"></script>
<script src="renkan/lib/backbone-relational.js"></script>
--- a/integ/iri-creation-cinecard.html Mon May 06 14:57:50 2013 +0200
+++ b/integ/iri-creation-cinecard.html Mon May 06 18:38:13 2013 +0200
@@ -149,7 +149,6 @@
<script src="js/libs/jquery-1.7.1.min.js"></script>
<script src="js/libs/jquery-ui-1.8.21.custom.min.js"></script>
-<script type='text/javascript' src='js/jquery.simplemodal.js'></script>
<script type="text/javascript" src="js/jquery.jcarousel.min.js"></script>
<!-- mousewheel plugin -->
<script src="js/jquery.mousewheel.min.js"></script>
@@ -184,7 +183,6 @@
<!-- RENKAN -->
-<script src="renkan/lib/jquery.mousewheel.min.js"></script>
<script src="renkan/lib/underscore-min.js"></script>
<script src="renkan/lib/backbone.js"></script>
<script src="renkan/lib/backbone-relational.js"></script>
--- a/integ/iri/css/iri-cadeaux.css Mon May 06 14:57:50 2013 +0200
+++ b/integ/iri/css/iri-cadeaux.css Mon May 06 18:38:13 2013 +0200
@@ -38,7 +38,7 @@
}
.gift_info {
- margin-left: 182px; width: 200px; color: #CCCCCC;
+ margin-left: 180px; width: 200px; color: #CCCCCC;
}
.gift_info li {
--- a/integ/iri/js/iri-buzz.js Mon May 06 14:57:50 2013 +0200
+++ b/integ/iri/js/iri-buzz.js Mon May 06 18:38:13 2013 +0200
@@ -282,7 +282,7 @@
}, 200);
}
- console.log(barChartSettings);
+ //console.log(barChartSettings);
var barChart = $("#data-viz").vs(barChartSettings).data('visualSedimentation');
--- a/integ/iri/js/iri-lecture-cinecard.js Mon May 06 14:57:50 2013 +0200
+++ b/integ/iri/js/iri-lecture-cinecard.js Mon May 06 18:38:13 2013 +0200
@@ -1,4 +1,11 @@
$(function() {
+
+ $('.msg_box i.close').click(function(){
+ $(this).parent().animate({"opacity":"0"},300,function(){
+ $(this).slideUp();
+ });
+ });
+
$(".cinecard_lightbox_background").click(function() {
$("#renkan_container").children().remove();
$(".cinecard_wrap").hide();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/integ/iri/js/vs.0.1-min.js Mon May 06 18:38:13 2013 +0200
@@ -0,0 +1,35 @@
+/*
+ * 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(Au,AD){function A6(){if(!AM.isReady){try{AE.documentElement.doScroll("left")}catch(A){setTimeout(A6,1);return}AM.ready()}}function AB(F,A){A.src?AM.ajax({url:A.src,async:false,dataType:"script"}):AM.globalEval(A.text||A.textContent||A.innerHTML||"");A.parentNode&&A.parentNode.removeChild(A)}function AU(F,A,O,K,L,G){var J=F.length;if(typeof A==="object"){for(var N in A){AU(F,N,A[N],K,L,O)}return F}if(O!==AD){K=!G&&K&&AM.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):AD}function Al(){return(new Date).getTime()}function AT(){return false}function AR(){return true}function Aq(F,A,G){G[0].type=F;return AM.event.handle.apply(A,G)}function AL(R){var Q,P=[],N=[],O=arguments,K,L,F,J,G,A;L=AM.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(Af,"")===R.type?N.push(L.selector):T.splice(J--,1)}K=AM(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=AM(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 x(F,A){return"live."+(F&&F!=="*"?F+".":"")+A.replace(/\./g,"`").replace(/ /g,"&")}function e(A){return !A||!A.parentNode||A.parentNode.nodeType===11}function BN(F,A){var G=0;A.each(function(){if(this.nodeName===(F[G]&&F[G].nodeName)){var L=AM.data(F[G++]),N=AM.data(this,L);if(L=L&&L.events){delete N.handle;N.events={};for(var J in L){for(var K in L[J]){AM.event.add(this,J,L[J][K],L[J][K].data)}}}}})}function A9(F,A,L){var J,K,G;A=A&&A[0]?A[0].ownerDocument||A[0]:AE;if(F.length===1&&typeof F[0]==="string"&&F[0].length<512&&A===AE&&!Av.test(F[0])&&(AM.support.checkClone||!AP.test(F[0]))){K=true;if(G=AM.fragments[F[0]]){if(G!==1){J=G}}}if(!J){J=A.createDocumentFragment();AM.clean(F,A,J,L)}if(K){AM.fragments[F[0]]=G?J:1}return{fragment:J,cacheable:K}}function Ai(F,A){var G={};AM.each(AA.concat.apply([],AA.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 AM=function(F,A){return new AM.fn.init(F,A)},k=Au.jQuery,D=Au.$,AE=Au.document,AX,BD=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Az=/^.[^:#\[\.,]*$/,AS=/\S/,AC=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,l=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Ad=navigator.userAgent,C=false,AZ=[],Ah,A7=Object.prototype.toString,A1=Object.prototype.hasOwnProperty,Ae=Array.prototype.push,AY=Array.prototype.slice,BC=Array.prototype.indexOf;AM.fn=AM.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=AE;this[0]=AE.body;this.selector="body";this.length=1;return this}if(typeof F==="string"){if((J=BD.exec(F))&&(J[1]||!A)){if(J[1]){G=A?A.ownerDocument||A:AE;if(F=l.exec(F)){if(AM.isPlainObject(A)){F=[AE.createElement(F[1])];AM.fn.attr.call(F,A,true)}else{F=[G.createElement(F[1])]}}else{F=A9([J[1]],[G]);F=(F.cacheable?F.fragment.cloneNode(true):F.fragment).childNodes}return AM.merge(this,F)}else{if(A=AE.getElementById(J[2])){if(A.id!==J[2]){return AX.find(F)}this.length=1;this[0]=A}this.context=AE;this.selector=F;return this}}else{if(!A&&/^\w+$/.test(F)){this.selector=F;this.context=AE;F=AE.getElementsByTagName(F);return AM.merge(this,F)}else{return !A||A.jquery?(A||AX).find(F):AM(A).find(F)}}}else{if(AM.isFunction(F)){return AX.ready(F)}}if(F.selector!==AD){this.selector=F.selector;this.context=F.context}return AM.makeArray(F,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return AY.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=AM();AM.isArray(F)?Ae.apply(G,F):AM.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 AM.each(this,F,A)},ready:function(A){AM.bindReady();if(AM.isReady){A.call(AE,AM)}else{AZ&&AZ.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(AY.apply(this,arguments),"slice",AY.call(arguments).join(","))},map:function(A){return this.pushStack(AM.map(this,function(F,G){return A.call(F,G,F)}))},end:function(){return this.prevObject||AM(null)},push:Ae,sort:[].sort,splice:[].splice};AM.fn.init.prototype=AM.fn;AM.extend=AM.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"&&!AM.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&&(AM.isPlainObject(N)||AM.isArray(N))){J=J&&(AM.isPlainObject(J)||AM.isArray(J))?J:AM.isArray(N)?[]:{};F[G]=AM.extend(K,J,N)}else{if(N!==AD){F[G]=N}}}}}}return F};AM.extend({noConflict:function(A){Au.$=D;if(A){Au.jQuery=k}return AM},isReady:false,ready:function(){if(!AM.isReady){if(!AE.body){return setTimeout(AM.ready,13)}AM.isReady=true;if(AZ){for(var F,A=0;F=AZ[A++];){F.call(AE,AM)}AZ=null}AM.fn.triggerHandler&&AM(AE).triggerHandler("ready")}},bindReady:function(){if(!C){C=true;if(AE.readyState==="complete"){return AM.ready()}if(AE.addEventListener){AE.addEventListener("DOMContentLoaded",Ah,false);Au.addEventListener("load",AM.ready,false)}else{if(AE.attachEvent){AE.attachEvent("onreadystatechange",Ah);Au.attachEvent("onload",AM.ready);var F=false;try{F=Au.frameElement==null}catch(A){}AE.documentElement.doScroll&&F&&A6()}}}},isFunction:function(A){return A7.call(A)==="[object Function]"},isArray:function(A){return A7.call(A)==="[object Array]"},isPlainObject:function(F){if(!F||A7.call(F)!=="[object Object]"||F.nodeType||F.setInterval){return false}if(F.constructor&&!A1.call(F,"constructor")&&!A1.call(F.constructor.prototype,"isPrototypeOf")){return false}var A;for(A in F){}return A===AD||A1.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=AM.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 Au.JSON&&Au.JSON.parse?Au.JSON.parse(A):(new Function("return "+A))()}else{AM.error("Invalid JSON: "+A)}},noop:function(){},globalEval:function(F){if(F&&AS.test(F)){var A=AE.getElementsByTagName("head")[0]||AE.documentElement,G=AE.createElement("script");G.type="text/javascript";if(AM.support.scriptEval){G.appendChild(AE.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===AD||AM.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(AC,"")},makeArray:function(F,A){A=A||[];if(F!=null){F.length==null||typeof F==="string"||AM.isFunction(F)||typeof F!=="function"&&F.setInterval?Ae.call(A,F):AM.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]!==AD;){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=AD}else{if(A&&!AM.isFunction(A)){G=A;A=AD}}}if(!A&&F){A=function(){return F.apply(G||this,arguments)}}if(F){A.guid=F.guid=F.guid||A.guid||AM.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:{}});Ad=AM.uaMatch(Ad);if(Ad.browser){AM.browser[Ad.browser]=true;AM.browser.version=Ad.version}if(AM.browser.webkit){AM.browser.safari=true}if(BC){AM.inArray=function(F,A){return BC.call(A,F)}}AX=AM(AE);if(AE.addEventListener){Ah=function(){AE.removeEventListener("DOMContentLoaded",Ah,false);AM.ready()}}else{if(AE.attachEvent){Ah=function(){if(AE.readyState==="complete"){AE.detachEvent("onreadystatechange",Ah);AM.ready()}}}}(function(){AM.support={};var P=AE.documentElement,O=AE.createElement("script"),N=AE.createElement("div"),K="script"+Al();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)){AM.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:AE.createElement("select").appendChild(AE.createElement("option")).selected,parentNode:N.removeChild(N.appendChild(AE.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};O.type="text/javascript";try{O.appendChild(AE.createTextNode("window."+K+"=1;"))}catch(J){}P.insertBefore(O,P.firstChild);if(Au[K]){AM.support.scriptEval=true;delete Au[K]}try{delete O.test}catch(A){AM.support.deleteExpando=false}P.removeChild(O);if(N.attachEvent&&N.fireEvent){N.attachEvent("onclick",function F(){AM.support.noCloneEvent=false;N.detachEvent("onclick",F)});N.cloneNode(true).fireEvent("onclick")}N=AE.createElement("div");N.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";P=AE.createDocumentFragment();P.appendChild(N.firstChild);AM.support.checkClone=P.cloneNode(true).cloneNode(true).lastChild.checked;AM(function(){var Q=AE.createElement("div");Q.style.width=Q.style.paddingLeft="1px";AE.body.appendChild(Q);AM.boxModel=AM.support.boxModel=Q.offsetWidth===2;AE.body.removeChild(Q).style.display="none"});P=function(Q){var T=AE.createElement("div");Q="on"+Q;var R=Q in T;if(!R){T.setAttribute(Q,"return;");R=typeof T[Q]==="function"}return R};AM.support.submitBubbles=P("submit");AM.support.changeBubbles=P("change");P=O=N=L=G=null}})();AM.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var An="jQuery"+Al(),E=0,Ay={};AM.extend({cache:{},expando:An,noData:{embed:true,object:true,applet:true},data:function(F,A,K){if(!(F.nodeName&&AM.noData[F.nodeName.toLowerCase()])){F=F==Au?Ay:F;var G=F[An],J=AM.cache;if(!G&&typeof A==="string"&&K===AD){return null}G||(G=++E);if(typeof A==="object"){F[An]=G;J[G]=AM.extend(true,{},A)}else{if(!J[G]){F[An]=G;J[G]={}}}F=J[G];if(K!==AD){F[A]=K}return typeof A==="string"?F[A]:F}},removeData:function(F,A){if(!(F.nodeName&&AM.noData[F.nodeName.toLowerCase()])){F=F==Au?Ay:F;var K=F[An],G=AM.cache,J=G[K];if(A){if(J){delete J[A];AM.isEmptyObject(J)&&AM.removeData(F)}}else{if(AM.support.deleteExpando){delete F[AM.expando]}else{F.removeAttribute&&F.removeAttribute(AM.expando)}delete G[K]}}}});AM.fn.extend({data:function(F,A){if(typeof F==="undefined"&&this.length){return AM.data(this[0])}else{if(typeof F==="object"){return this.each(function(){AM.data(this,F)})}}var J=F.split(".");J[1]=J[1]?"."+J[1]:"";if(A===AD){var G=this.triggerHandler("getData"+J[1]+"!",[J[0]]);if(G===AD&&this.length){G=AM.data(this[0],F)}return G===AD&&J[1]?this.data(J[0]):G}else{return this.trigger("setData"+J[1]+"!",[J[0],A]).each(function(){AM.data(this,F,A)})}},removeData:function(A){return this.each(function(){AM.removeData(this,A)})}});AM.extend({queue:function(F,A,J){if(F){A=(A||"fx")+"queue";var G=AM.data(F,A);if(!J){return G||[]}if(!G||AM.isArray(J)){G=AM.data(F,A,AM.makeArray(J))}else{G.push(J)}return G}},dequeue:function(F,A){A=A||"fx";var J=AM.queue(F,A),G=J.shift();if(G==="inprogress"){G=J.shift()}if(G){A==="fx"&&J.unshift("inprogress");G.call(F,function(){AM.dequeue(F,A)})}}});AM.fn.extend({queue:function(F,A){if(typeof F!=="string"){A=F;F="fx"}if(A===AD){return AM.queue(this[0],F)}return this.each(function(){var G=AM.queue(this,F,A);F==="fx"&&G[0]!=="inprogress"&&AM.dequeue(this,F)})},dequeue:function(A){return this.each(function(){AM.dequeue(this,A)})},delay:function(F,A){F=AM.fx?AM.fx.speeds[F]||F:F;A=A||"fx";return this.queue(A,function(){var G=this;setTimeout(function(){AM.dequeue(G,A)},F)})},clearQueue:function(A){return this.queue(A||"fx",[])}});var BI=/[\n\t]/g,AG=/\s+/,BE=/\r/g,As=/href|src|style/,A0=/(button|input)/i,Ac=/(button|input|object|select|textarea)/i,AF=/^(a|area)$/i,A4=/radio|checkbox/;AM.fn.extend({attr:function(F,A){return AU(this,F,A,true,AM.attr)},removeAttr:function(A){return this.each(function(){AM.attr(this,A,"");this.nodeType===1&&this.removeAttribute(A)})},addClass:function(P){if(AM.isFunction(P)){return this.each(function(R){var Q=AM(this);Q.addClass(P.call(this,R,Q.attr("class")))})}if(P&&typeof P==="string"){for(var O=(P||"").split(AG),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=AM.trim(J)}else{L.className=P}}}}return this},removeClass:function(F){if(AM.isFunction(F)){return this.each(function(P){var Q=AM(this);Q.removeClass(F.call(this,P,Q.attr("class")))})}if(F&&typeof F==="string"||F===AD){for(var A=(F||"").split(AG),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(BI," "),J=0,N=A.length;J<N;J++){G=G.replace(" "+A[J]+" "," ")}L.className=AM.trim(G)}else{L.className=""}}}}return this},toggleClass:function(F,A){var J=typeof F,G=typeof A==="boolean";if(AM.isFunction(F)){return this.each(function(L){var K=AM(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=AM(this),P=A,K=F.split(AG);O=K[L++];){P=G?P:!N.hasClass(O);N[P?"addClass":"removeClass"](O)}}else{if(J==="undefined"||J==="boolean"){this.className&&AM.data(this,"__className__",this.className);this.className=this.className||F===false?"":AM.data(this,"__className__")||""}}})},hasClass:function(F){F=" "+F+" ";for(var A=0,G=this.length;A<G;A++){if((" "+this[A].className+" ").replace(BI," ").indexOf(F)>-1){return true}}return false},val:function(F){if(F===AD){var A=this[0];if(A){if(AM.nodeName(A,"option")){return(A.attributes.value||{}).specified?A.value:A.text}if(AM.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=AM(J).val();if(A){return F}K.push(F)}}return K}if(A4.test(A.type)&&!AM.support.checkOn){return A.getAttribute("value")===null?"on":A.value}return(A.value||"").replace(BE,"")}return AD}var N=AM.isFunction(F);return this.each(function(P){var T=AM(this),R=F;if(this.nodeType===1){if(N){R=F.call(this,P,T.val())}if(typeof R==="number"){R+=""}if(AM.isArray(R)&&A4.test(this.type)){this.checked=AM.inArray(T.val(),R)>=0}else{if(AM.nodeName(this,"select")){var Q=AM.makeArray(R);AM("option",this).each(function(){this.selected=AM.inArray(AM(this).val(),Q)>=0});if(!Q.length){this.selectedIndex=-1}}else{this.value=R}}}})}});AM.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 AD}if(J&&A in AM.attrFn){return AM(F)[A](L)}J=F.nodeType!==1||!AM.isXMLDoc(F);var K=L!==AD;A=J&&AM.props[A]||A;if(F.nodeType===1){var G=As.test(A);if(A in F&&J&&!G){if(K){A==="type"&&A0.test(F.nodeName)&&F.parentNode&&AM.error("type property can't be changed");F[A]=L}if(AM.nodeName(F,"form")&&F.getAttributeNode(A)){return F.getAttributeNode(A).nodeValue}if(A==="tabIndex"){return(A=F.getAttributeNode("tabIndex"))&&A.specified?A.value:Ac.test(F.nodeName)||AF.test(F.nodeName)&&F.href?0:AD}return F[A]}if(!AM.support.style&&J&&A==="style"){if(K){F.style.cssText=""+L}return F.style.cssText}K&&F.setAttribute(A,""+L);F=!AM.support.hrefNormalized&&J&&G?F.getAttribute(A,2):F.getAttribute(A);return F===null?AD:F}return AM.style(F,A,L)}});var Af=/\.(.*)$/,m=function(A){return A.replace(/[^\w\s\.\|`]/g,function(F){return"\\"+F})};AM.event={add:function(T,R,P,N){if(!(T.nodeType===3||T.nodeType===8)){if(T.setInterval&&T!==Au&&!T.frameElement){T=Au}var O,K;if(P.handler){O=P;P=O.handler}if(!P.guid){P.guid=AM.guid++}if(K=AM.data(T)){var L=K.events=K.events||{},F=K.handle;if(!F){K.handle=F=function(){return typeof AM!=="undefined"&&!AM.event.triggered?AM.event.handle.apply(F.elem,arguments):AD}}F.elem=T;R=R.split(" ");for(var J,G=0,A;J=R[G++];){K=O?AM.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=AM.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);AM.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=AM.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){AM.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("(^|\\.)"+AM.map(J.slice(0).sort(),m).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=F[Q]){if(R){K=AM.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){Am(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)){AM.event.remove(W,K,X.handler,G);A.splice(G--,1)}}}}}if(AM.isEmptyObject(F)){if(V=T.handle){V.elem=null}delete T.events;delete T.handle;AM.isEmptyObject(T)&&AM.removeData(W)}}}}},trigger:function(Q,P,O,L){var N=Q.type||Q;if(!L){Q=typeof Q==="object"?Q[An]?Q:AM.extend(AM.Event(N),Q):AM.Event(N);if(N.indexOf("!")>=0){Q.type=N=N.slice(0,-1);Q.exclusive=true}if(!O){Q.stopPropagation();AM.event.global[N]&&AM.each(AM.cache,function(){this.events&&this.events[N]&&AM.event.trigger(Q,P,this.handle.elem)})}if(!O||O.nodeType===3||O.nodeType===8){return AD}Q.result=AD;Q.target=O;P=AM.makeArray(P);P.unshift(Q)}Q.currentTarget=O;(L=AM.data(O,"handle"))&&L.apply(O,P);L=O.parentNode||O.ownerDocument;try{if(!(O&&O.nodeName&&AM.noData[O.nodeName.toLowerCase()])){if(O["on"+N]&&O["on"+N].apply(O,P)===false){Q.result=false}}}catch(J){}if(!Q.isPropagationStopped()&&L){AM.event.trigger(Q,P,L,true)}else{if(!Q.isDefaultPrevented()){L=Q.target;var K,A=AM.nodeName(L,"a")&&N==="click",G=AM.event.special[N]||{};if((!G._default||G._default.call(O,Q)===false)&&!A&&!(L&&L.nodeName&&AM.noData[L.nodeName.toLowerCase()])){try{if(L[N]){if(K=L["on"+N]){L["on"+N]=null}AM.event.triggered=true;L[N]()}}catch(F){}if(K){L["on"+N]=K}AM.event.triggered=false}}}},handle:function(F){var A,N,K,L;F=arguments[0]=AM.event.fix(F||Au.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=AM.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!==AD){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[An]){return F}var A=F;F=AM.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||AE}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=AE.documentElement;J=AE.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!==AD){F.which=F.button&1?1:F.button&2?3:F.button&4?2:0}return F},guid:100000000,proxy:AM.proxy,special:{ready:{setup:AM.bindReady,teardown:AM.noop},live:{add:function(A){AM.event.add(this,A.origType,AM.extend({},A,{handler:AL}))},remove:function(F){var A=true,G=F.origType.replace(Af,"");AM.each(AM.data(this,"events").live||[],function(){if(G===this.origType.replace(Af,"")){return A=false}});A&&AM.event.remove(this,F.origType,AL)}},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 Am=AE.removeEventListener?function(F,A,G){F.removeEventListener(A,G,false)}:function(F,A,G){F.detachEvent("on"+A,G)};AM.Event=function(A){if(!this.preventDefault){return new AM.Event(A)}if(A&&A.type){this.originalEvent=A;this.type=A.type}else{this.type=A}this.timeStamp=Al();this[An]=true};AM.Event.prototype={preventDefault:function(){this.isDefaultPrevented=AR;var A=this.originalEvent;if(A){A.preventDefault&&A.preventDefault();A.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=AR;var A=this.originalEvent;if(A){A.stopPropagation&&A.stopPropagation();A.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=AR;this.stopPropagation()},isDefaultPrevented:AT,isPropagationStopped:AT,isImmediatePropagationStopped:AT};var AJ=function(F){var A=F.relatedTarget;try{for(;A&&A!==this;){A=A.parentNode}if(A!==this){F.type=F.data;AM.event.handle.apply(this,arguments)}}catch(G){}},t=function(A){A.type=A.data;AM.event.handle.apply(this,arguments)};AM.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(F,A){AM.event.special[F]={setup:function(G){AM.event.add(this,A,G&&G.selector?t:AJ,F)},teardown:function(G){AM.event.remove(this,A,G&&G.selector?t:AJ)}}});if(!AM.support.submitBubbles){AM.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!=="form"){AM.event.add(this,"click.specialSubmit",function(F){var A=F.target,G=A.type;if((G==="submit"||G==="image")&&AM(A).closest("form").length){return Aq("submit",this,arguments)}});AM.event.add(this,"keypress.specialSubmit",function(F){var A=F.target,G=A.type;if((G==="text"||G==="password")&&AM(A).closest("form").length&&F.keyCode===13){return Aq("submit",this,arguments)}})}else{return false}},teardown:function(){AM.event.remove(this,".specialSubmit")}}}if(!AM.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?AM.map(F.options,function(J){return J.selected}).join("-"):""}else{if(F.nodeName.toLowerCase()==="select"){G=F.selectedIndex}}}return G},BH=function(F,A){var K=F.target,G,J;if(!(!n.test(K.nodeName)||K.readOnly)){G=AM.data(K,"_change_data");J=U(K);if(F.type!=="focusout"||K.type!=="radio"){AM.data(K,"_change_data",J)}if(!(G===AD||J===G)){if(G!=null||J){F.type="change";return AM.event.trigger(F,A,K)}}}};AM.event.special.change={filters:{focusout:BH,click:function(F){var A=F.target,G=A.type;if(G==="radio"||G==="checkbox"||A.nodeName.toLowerCase()==="select"){return BH.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 BH.call(this,F)}},beforeactivate:function(A){A=A.target;AM.data(A,"_change_data",U(A))}},setup:function(){if(this.type==="file"){return false}for(var A in I){AM.event.add(this,A+".specialChange",I[A])}return n.test(this.nodeName)},teardown:function(){AM.event.remove(this,".specialChange");return n.test(this.nodeName)}};I=AM.event.special.change.filters}AE.addEventListener&&AM.each({focus:"focusin",blur:"focusout"},function(F,A){function G(J){J=AM.event.fix(J);J.type=A;return AM.event.handle.call(this,J)}AM.event.special[A]={setup:function(){this.addEventListener(F,G,true)},teardown:function(){this.removeEventListener(F,G,true)}}});AM.each(["bind","one"],function(F,A){AM.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(AM.isFunction(K)){L=K;K=AD}var J=A==="one"?AM.proxy(L,function(P){AM(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++){AM.event.add(this[G],O,J,K)}}return this}});AM.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++){AM.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(){AM.event.trigger(F,A,this)})},triggerHandler:function(F,A){if(this[0]){F=AM.Event(F);F.preventDefault();F.stopPropagation();AM.event.trigger(F,A,this[0]);return F.result}},toggle:function(F){for(var A=arguments,G=1;G<A.length;){AM.proxy(F,A[G++])}return this.click(AM.proxy(F,function(J){var K=(AM.data(this,"lastToggle"+F.guid)||0)%G;AM.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 BL={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};AM.each(["live","die"],function(F,A){AM.fn[A]=function(R,P,Q,N){var O,J=0,L,K,G=N||this.selector,T=N?this:AM(this.context);if(AM.isFunction(P)){Q=P;P=AD}for(R=(R||"").split(" ");(O=R[J++])!=null;){N=Af.exec(O);L="";if(N){L=N[0];O=O.replace(Af,"")}if(O==="hover"){R.push("mouseenter"+L,"mouseleave"+L)}else{K=O;if(O==="focus"||O==="blur"){R.push(BL[O]+L);O+=L}else{O=(BL[O]||O)+L}A==="live"?T.each(function(){AM.event.add(this,x(O,G),{data:P,selector:G,handler:Q,origType:O,origHandler:Q,preType:K})}):T.unbind(x(O,G),Q)}}return this}});AM.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){AM.fn[A]=function(G){return G?this.bind(A,G):this.trigger(A)};if(AM.attrFn){AM.attrFn[A]=true}});Au.attachEvent&&!Au.addEventListener&&Au.attachEvent("onunload",function(){for(var F in AM.cache){if(AM.cache[F].handle){try{AM.event.remove(AM.cache[F].handle.elem)}catch(A){}}}});(function(){function Z(BQ){for(var BP="",Ab,Aa=0;BQ[Aa];Aa++){Ab=BQ[Aa];if(Ab.nodeType===3||Ab.nodeType===4){BP+=Ab.nodeValue}else{if(Ab.nodeType!==8){BP+=Z(Ab.childNodes)}}}return BP}function Y(BS,BR,BQ,BP,Aa,Ab){Aa=0;for(var BU=BP.length;Aa<BU;Aa++){var BV=BP[Aa];if(BV){BV=BV[BS];for(var BT=false;BV;){if(BV.sizcache===BQ){BT=BP[BV.sizset];break}if(BV.nodeType===1&&!Ab){BV.sizcache=BQ;BV.sizset=Aa}if(BV.nodeName.toLowerCase()===BR){BT=BV;break}BV=BV[BS]}BP[Aa]=BT}}}function X(BS,BR,BQ,BP,Aa,Ab){Aa=0;for(var BU=BP.length;Aa<BU;Aa++){var BV=BP[Aa];if(BV){BV=BV[BS];for(var BT=false;BV;){if(BV.sizcache===BQ){BT=BP[BV.sizset];break}if(BV.nodeType===1){if(!Ab){BV.sizcache=BQ;BV.sizset=Aa}if(typeof BR!=="string"){if(BV===BR){BT=true;break}}else{if(Q.filter(BR,[BV]).length>0){BT=BV;break}}}BV=BV[BS]}BP[Aa]=BT}}}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(BU,BT,BR,BQ){BR=BR||[];var Ab=BT=BT||AE;if(BT.nodeType!==1&&BT.nodeType!==9){return[]}if(!BU||typeof BU!=="string"){return BR}for(var BP=[],BZ,Ba,BW,BS,BY=true,BV=F(BT),BX=BU;(V.exec(""),BZ=V.exec(BX))!==null;){BX=BZ[3];BP.push(BZ[1]);if(BZ[2]){BS=BZ[3];break}}if(BP.length>1&&L.exec(BU)){if(BP.length===2&&P.relative[BP[0]]){Ba=w(BP[0]+BP[1],BT)}else{for(Ba=P.relative[BP[0]]?[BT]:Q(BP.shift(),BT);BP.length;){BU=BP.shift();if(P.relative[BU]){BU+=BP.shift()}Ba=w(BU,Ba)}}}else{if(!BQ&&BP.length>1&&BT.nodeType===9&&!BV&&P.match.ID.test(BP[0])&&!P.match.ID.test(BP[BP.length-1])){BZ=Q.find(BP.shift(),BT,BV);BT=BZ.expr?Q.filter(BZ.expr,BZ.set)[0]:BZ.set[0]}if(BT){BZ=BQ?{expr:BP.pop(),set:A(BQ)}:Q.find(BP.pop(),BP.length===1&&(BP[0]==="~"||BP[0]==="+")&&BT.parentNode?BT.parentNode:BT,BV);Ba=BZ.expr?Q.filter(BZ.expr,BZ.set):BZ.set;if(BP.length>0){BW=A(Ba)}else{BY=false}for(;BP.length;){var Aa=BP.pop();BZ=Aa;if(P.relative[Aa]){BZ=BP.pop()}else{Aa=""}if(BZ==null){BZ=BT}P.relative[Aa](BW,BZ,BV)}}else{BW=[]}}BW||(BW=Ba);BW||Q.error(Aa||BU);if(R.call(BW)==="[object Array]"){if(BY){if(BT&&BT.nodeType===1){for(BU=0;BW[BU]!=null;BU++){if(BW[BU]&&(BW[BU]===true||BW[BU].nodeType===1&&J(BT,BW[BU]))){BR.push(Ba[BU])}}}else{for(BU=0;BW[BU]!=null;BU++){BW[BU]&&BW[BU].nodeType===1&&BR.push(Ba[BU])}}}else{BR.push.apply(BR,BW)}}else{A(BW,BR)}if(BS){Q(BS,Ab,BR,BQ);Q.uniqueSort(BR)}return BR};Q.uniqueSort=function(Ab){if(N){T=O;Ab.sort(N);if(T){for(var Aa=1;Aa<Ab.length;Aa++){Ab[Aa]===Ab[Aa-1]&&Ab.splice(Aa--,1)}}}return Ab};Q.matches=function(Ab,Aa){return Q(Ab,null,null,Aa)};Q.find=function(BS,BR,BQ){var BP,Aa;if(!BS){return[]}for(var Ab=0,BU=P.order.length;Ab<BU;Ab++){var BV=P.order[Ab];if(Aa=P.leftMatch[BV].exec(BS)){var BT=Aa[1];Aa.splice(1,1);if(BT.substr(BT.length-1)!=="\\"){Aa[1]=(Aa[1]||"").replace(/\\/g,"");BP=P.find[BV](Aa,BR,BQ);if(BP!=null){BS=BS.replace(P.match[BV],"");break}}}}BP||(BP=BR.getElementsByTagName("*"));return{set:BP,expr:BS}};Q.filter=function(BV,BU,BS,BQ){for(var Ab=BV,BP=[],Bb=BU,Bc,BY,BT=BU&&BU[0]&&F(BU[0]);BV&&BU.length;){for(var Ba in P.filter){if((Bc=P.leftMatch[Ba].exec(BV))!=null&&Bc[2]){var BW=P.filter[Ba],BZ,Aa;Aa=Bc[1];BY=false;Bc.splice(1,1);if(Aa.substr(Aa.length-1)!=="\\"){if(Bb===BP){BP=[]}if(P.preFilter[Ba]){if(Bc=P.preFilter[Ba](Bc,Bb,BS,BP,BQ,BT)){if(Bc===true){continue}}else{BY=BZ=true}}if(Bc){for(var BR=0;(Aa=Bb[BR])!=null;BR++){if(Aa){BZ=BW(Aa,Bc,BR,Bb);var BX=BQ^!!BZ;if(BS&&BZ!=null){if(BX){BY=true}else{Bb[BR]=false}}else{if(BX){BP.push(Aa);BY=true}}}}}if(BZ!==AD){BS||(Bb=BP);BV=BV.replace(P.match[Ba],"");if(!BY){return[]}break}}}}if(BV===Ab){if(BY==null){Q.error(BV)}else{break}}Ab=BV}return Bb};Q.error=function(Aa){throw"Syntax error, unrecognized expression: "+Aa};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(Aa){return Aa.getAttribute("href")}},relative:{"+":function(BQ,BP){var Ab=typeof BP==="string",Aa=Ab&&!/\W/.test(BP);Ab=Ab&&!Aa;if(Aa){BP=BP.toLowerCase()}Aa=0;for(var BR=BQ.length,BS;Aa<BR;Aa++){if(BS=BQ[Aa]){for(;(BS=BS.previousSibling)&&BS.nodeType!==1;){}BQ[Aa]=Ab||BS&&BS.nodeName.toLowerCase()===BP?BS||false:BS===BP}}Ab&&Q.filter(BP,BQ,true)},">":function(BQ,BP){var Ab=typeof BP==="string";if(Ab&&!/\W/.test(BP)){BP=BP.toLowerCase();for(var Aa=0,BR=BQ.length;Aa<BR;Aa++){var BS=BQ[Aa];if(BS){Ab=BS.parentNode;BQ[Aa]=Ab.nodeName.toLowerCase()===BP?Ab:false}}}else{Aa=0;for(BR=BQ.length;Aa<BR;Aa++){if(BS=BQ[Aa]){BQ[Aa]=Ab?BS.parentNode:BS.parentNode===BP}}Ab&&Q.filter(BP,BQ,true)}},"":function(BQ,BP,Ab){var Aa=W++,BR=X;if(typeof BP==="string"&&!/\W/.test(BP)){var BS=BP=BP.toLowerCase();BR=Y}BR("parentNode",BP,Aa,BQ,BS,Ab)},"~":function(BQ,BP,Ab){var Aa=W++,BR=X;if(typeof BP==="string"&&!/\W/.test(BP)){var BS=BP=BP.toLowerCase();BR=Y}BR("previousSibling",BP,Aa,BQ,BS,Ab)}},find:{ID:function(BP,Ab,Aa){if(typeof Ab.getElementById!=="undefined"&&!Aa){return(BP=Ab.getElementById(BP[1]))?[BP]:[]}},NAME:function(BQ,BP){if(typeof BP.getElementsByName!=="undefined"){var Ab=[];BP=BP.getElementsByName(BQ[1]);for(var Aa=0,BR=BP.length;Aa<BR;Aa++){BP[Aa].getAttribute("name")===BQ[1]&&Ab.push(BP[Aa])}return Ab.length===0?null:Ab}},TAG:function(Ab,Aa){return Aa.getElementsByTagName(Ab[1])}},preFilter:{CLASS:function(BR,BQ,Ab,Aa,BS,BT){BR=" "+BR[1].replace(/\\/g,"")+" ";if(BT){return BR}BT=0;for(var BP;(BP=BQ[BT])!=null;BT++){if(BP){if(BS^(BP.className&&(" "+BP.className+" ").replace(/[\t\n]/g," ").indexOf(BR)>=0)){Ab||Aa.push(BP)}else{if(Ab){BQ[BT]=false}}}}return false},ID:function(Aa){return Aa[1].replace(/\\/g,"")},TAG:function(Aa){return Aa[1].toLowerCase()},CHILD:function(Ab){if(Ab[1]==="nth"){var Aa=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(Ab[2]==="even"&&"2n"||Ab[2]==="odd"&&"2n+1"||!/\D/.test(Ab[2])&&"0n+"+Ab[2]||Ab[2]);Ab[2]=Aa[1]+(Aa[2]||1)-0;Ab[3]=Aa[3]-0}Ab[0]=W++;return Ab},ATTR:function(BQ,BP,Ab,Aa,BR,BS){BP=BQ[1].replace(/\\/g,"");if(!BS&&P.attrMap[BP]){BQ[1]=P.attrMap[BP]}if(BQ[2]==="~="){BQ[4]=" "+BQ[4]+" "}return BQ},PSEUDO:function(BQ,BP,Ab,Aa,BR){if(BQ[1]==="not"){if((V.exec(BQ[3])||"").length>1||/^\w/.test(BQ[3])){BQ[3]=Q(BQ[3],null,null,BP)}else{BQ=Q.filter(BQ[3],BP,Ab,true^BR);Ab||Aa.push.apply(Aa,BQ);return false}}else{if(P.match.POS.test(BQ[0])||P.match.CHILD.test(BQ[0])){return true}}return BQ},POS:function(Aa){Aa.unshift(true);return Aa}},filters:{enabled:function(Aa){return Aa.disabled===false&&Aa.type!=="hidden"},disabled:function(Aa){return Aa.disabled===true},checked:function(Aa){return Aa.checked===true},selected:function(Aa){return Aa.selected===true},parent:function(Aa){return !!Aa.firstChild},empty:function(Aa){return !Aa.firstChild},has:function(BP,Ab,Aa){return !!Q(Aa[3],BP).length},header:function(Aa){return/h\d/i.test(Aa.nodeName)},text:function(Aa){return"text"===Aa.type},radio:function(Aa){return"radio"===Aa.type},checkbox:function(Aa){return"checkbox"===Aa.type},file:function(Aa){return"file"===Aa.type},password:function(Aa){return"password"===Aa.type},submit:function(Aa){return"submit"===Aa.type},image:function(Aa){return"image"===Aa.type},reset:function(Aa){return"reset"===Aa.type},button:function(Aa){return"button"===Aa.type||Aa.nodeName.toLowerCase()==="button"},input:function(Aa){return/input|select|textarea|button/i.test(Aa.nodeName)}},setFilters:{first:function(Ab,Aa){return Aa===0},last:function(BQ,BP,Ab,Aa){return BP===Aa.length-1},even:function(Ab,Aa){return Aa%2===0},odd:function(Ab,Aa){return Aa%2===1},lt:function(BP,Ab,Aa){return Ab<Aa[3]-0},gt:function(BP,Ab,Aa){return Ab>Aa[3]-0},nth:function(BP,Ab,Aa){return Aa[3]-0===Ab},eq:function(BP,Ab,Aa){return Aa[3]-0===Ab}},filter:{PSEUDO:function(BQ,BP,Ab,Aa){var BR=BP[1],BS=P.filters[BR];if(BS){return BS(BQ,Ab,BP,Aa)}else{if(BR==="contains"){return(BQ.textContent||BQ.innerText||Z([BQ])||"").indexOf(BP[3])>=0}else{if(BR==="not"){BP=BP[3];Ab=0;for(Aa=BP.length;Ab<Aa;Ab++){if(BP[Ab]===BQ){return false}}return true}else{Q.error("Syntax error, unrecognized expression: "+BR)}}}},CHILD:function(BR,BQ){var Ab=BQ[1],Aa=BR;switch(Ab){case"only":case"first":for(;Aa=Aa.previousSibling;){if(Aa.nodeType===1){return false}}if(Ab==="first"){return true}Aa=BR;case"last":for(;Aa=Aa.nextSibling;){if(Aa.nodeType===1){return false}}return true;case"nth":Ab=BQ[2];var BS=BQ[3];if(Ab===1&&BS===0){return true}BQ=BQ[0];var BT=BR.parentNode;if(BT&&(BT.sizcache!==BQ||!BR.nodeIndex)){var BP=0;for(Aa=BT.firstChild;Aa;Aa=Aa.nextSibling){if(Aa.nodeType===1){Aa.nodeIndex=++BP}}BT.sizcache=BQ}BR=BR.nodeIndex-BS;return Ab===0?BR===0:BR%Ab===0&&BR/Ab>=0}},ID:function(Ab,Aa){return Ab.nodeType===1&&Ab.getAttribute("id")===Aa},TAG:function(Ab,Aa){return Aa==="*"&&Ab.nodeType===1||Ab.nodeName.toLowerCase()===Aa},CLASS:function(Ab,Aa){return(" "+(Ab.className||Ab.getAttribute("class"))+" ").indexOf(Aa)>-1},ATTR:function(BQ,BP){var Ab=BP[1];BQ=P.attrHandle[Ab]?P.attrHandle[Ab](BQ):BQ[Ab]!=null?BQ[Ab]:BQ.getAttribute(Ab);Ab=BQ+"";var Aa=BP[2];BP=BP[4];return BQ==null?Aa==="!=":Aa==="="?Ab===BP:Aa==="*="?Ab.indexOf(BP)>=0:Aa==="~="?(" "+Ab+" ").indexOf(BP)>=0:!BP?Ab&&BQ!==false:Aa==="!="?Ab!==BP:Aa==="^="?Ab.indexOf(BP)===0:Aa==="$="?Ab.substr(Ab.length-BP.length)===BP:Aa==="|="?Ab===BP||Ab.substr(0,BP.length+1)===BP+"-":false},POS:function(BQ,BP,Ab,Aa){var BR=P.setFilters[BP[2]];if(BR){return BR(BQ,Ab,BP,Aa)}}}},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(Ab,Aa){return"\\"+(Aa-0+1)}))}var A=function(Ab,Aa){Ab=Array.prototype.slice.call(Ab,0);if(Aa){Aa.push.apply(Aa,Ab);return Aa}return Ab};try{Array.prototype.slice.call(AE.documentElement.childNodes,0)}catch(K){A=function(BQ,BP){BP=BP||[];if(R.call(BQ)==="[object Array]"){Array.prototype.push.apply(BP,BQ)}else{if(typeof BQ.length==="number"){for(var Ab=0,Aa=BQ.length;Ab<Aa;Ab++){BP.push(BQ[Ab])}}else{for(Ab=0;BQ[Ab];Ab++){BP.push(BQ[Ab])}}}return BP}}var N;if(AE.documentElement.compareDocumentPosition){N=function(Ab,Aa){if(!Ab.compareDocumentPosition||!Aa.compareDocumentPosition){if(Ab==Aa){T=true}return Ab.compareDocumentPosition?-1:1}Ab=Ab.compareDocumentPosition(Aa)&4?-1:Ab===Aa?0:1;if(Ab===0){T=true}return Ab}}else{if("sourceIndex" in AE.documentElement){N=function(Ab,Aa){if(!Ab.sourceIndex||!Aa.sourceIndex){if(Ab==Aa){T=true}return Ab.sourceIndex?-1:1}Ab=Ab.sourceIndex-Aa.sourceIndex;if(Ab===0){T=true}return Ab}}else{if(AE.createRange){N=function(BQ,BP){if(!BQ.ownerDocument||!BP.ownerDocument){if(BQ==BP){T=true}return BQ.ownerDocument?-1:1}var Ab=BQ.ownerDocument.createRange(),Aa=BP.ownerDocument.createRange();Ab.setStart(BQ,0);Ab.setEnd(BQ,0);Aa.setStart(BP,0);Aa.setEnd(BP,0);BQ=Ab.compareBoundaryPoints(Range.START_TO_END,Aa);if(BQ===0){T=true}return BQ}}}}(function(){var BP=AE.createElement("div"),Ab="script"+(new Date).getTime();BP.innerHTML="<a name='"+Ab+"'/>";var Aa=AE.documentElement;Aa.insertBefore(BP,Aa.firstChild);if(AE.getElementById(Ab)){P.find.ID=function(BQ,BR,BS){if(typeof BR.getElementById!=="undefined"&&!BS){return(BR=BR.getElementById(BQ[1]))?BR.id===BQ[1]||typeof BR.getAttributeNode!=="undefined"&&BR.getAttributeNode("id").nodeValue===BQ[1]?[BR]:AD:[]}};P.filter.ID=function(BQ,BR){var BS=typeof BQ.getAttributeNode!=="undefined"&&BQ.getAttributeNode("id");return BQ.nodeType===1&&BS&&BS.nodeValue===BR}}Aa.removeChild(BP);Aa=BP=null})();(function(){var Aa=AE.createElement("div");Aa.appendChild(AE.createComment(""));if(Aa.getElementsByTagName("*").length>0){P.find.TAG=function(BQ,BP){BP=BP.getElementsByTagName(BQ[1]);if(BQ[1]==="*"){BQ=[];for(var Ab=0;BP[Ab];Ab++){BP[Ab].nodeType===1&&BQ.push(BP[Ab])}BP=BQ}return BP}}Aa.innerHTML="<a href='#'></a>";if(Aa.firstChild&&typeof Aa.firstChild.getAttribute!=="undefined"&&Aa.firstChild.getAttribute("href")!=="#"){P.attrHandle.href=function(Ab){return Ab.getAttribute("href",2)}}Aa=null})();AE.querySelectorAll&&function(){var BP=Q,Ab=AE.createElement("div");Ab.innerHTML="<p class='TEST'></p>";if(!(Ab.querySelectorAll&&Ab.querySelectorAll(".TEST").length===0)){Q=function(BQ,BT,BU,BR){BT=BT||AE;if(!BR&&BT.nodeType===9&&!F(BT)){try{return A(BT.querySelectorAll(BQ),BU)}catch(BS){}}return BP(BQ,BT,BU,BR)};for(var Aa in BP){Q[Aa]=BP[Aa]}Ab=null}}();(function(){var Aa=AE.createElement("div");Aa.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!Aa.getElementsByClassName||Aa.getElementsByClassName("e").length===0)){Aa.lastChild.className="e";if(Aa.getElementsByClassName("e").length!==1){P.order.splice(1,0,"CLASS");P.find.CLASS=function(BQ,BP,Ab){if(typeof BP.getElementsByClassName!=="undefined"&&!Ab){return BP.getElementsByClassName(BQ[1])}};Aa=null}}})();var J=AE.compareDocumentPosition?function(Ab,Aa){return !!(Ab.compareDocumentPosition(Aa)&16)}:function(Ab,Aa){return Ab!==Aa&&(Ab.contains?Ab.contains(Aa):true)},F=function(Aa){return(Aa=(Aa?Aa.ownerDocument||Aa:0).documentElement)?Aa.nodeName!=="HTML":false},w=function(BQ,BP){var Ab=[],Aa="",BR;for(BP=BP.nodeType?[BP]:BP;BR=P.match.PSEUDO.exec(BQ);){Aa+=BR[0];BQ=BQ.replace(P.match.PSEUDO,"")}BQ=P.relative[BQ]?BQ+"*":BQ;BR=0;for(var BS=BP.length;BR<BS;BR++){Q(BQ,BP[BR],Ab)}return Q.filter(Aa,Ab)};AM.find=Q;AM.expr=Q.selectors;AM.expr[":"]=AM.expr.filters;AM.unique=Q.uniqueSort;AM.text=Z;AM.isXMLDoc=F;AM.contains=J})();var H=/Until$/,BF=/^(?:parents|prevUntil|prevAll)/,A2=/,/;AY=Array.prototype.slice;var Ar=function(F,A,J){if(AM.isFunction(A)){return AM.grep(F,function(L,K){return !!A.call(L,K,L)===J})}else{if(A.nodeType){return AM.grep(F,function(K){return K===A===J})}else{if(typeof A==="string"){var G=AM.grep(F,function(K){return K.nodeType===1});if(Az.test(A)){return AM.filter(A,G,!J)}else{A=AM.filter(A,G)}}}}return AM.grep(F,function(K){return AM.inArray(K,A)>=0===J})};AM.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;AM.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=AM(F);return this.filter(function(){for(var J=0,G=A.length;J<G;J++){if(AM.contains(this,A[J])){return true}}})},not:function(A){return this.pushStack(Ar(this,A,false),"not",A)},filter:function(A){return this.pushStack(Ar(this,A,true),"filter",A)},is:function(A){return !!A&&AM.filter(A,this).length>0},closest:function(P,O){if(AM.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]=AM.expr.match.POS.test(J)?AM(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:AM(K).is(L)){N.push({selector:J,elem:K});delete G[J]}}K=K.parentNode}}return N}var F=AM.expr.match.POS.test(P)?AM(P,O||this.context):null;return this.map(function(R,Q){for(;Q&&Q.ownerDocument&&Q!==O;){if(F?F.index(Q)>-1:AM(Q).is(P)){return Q}Q=Q.parentNode}return null})},index:function(A){if(!A||typeof A==="string"){return AM.inArray(this[0],A?AM(A):this.parent().children())}return AM.inArray(A.jquery?A[0]:A,this)},add:function(F,A){F=typeof F==="string"?AM(F,A||this.context):AM.makeArray(F);A=AM.merge(this.get(),F);return this.pushStack(e(F[0])||e(A[0])?A:AM.unique(A))},andSelf:function(){return this.add(this.prevObject)}});AM.each({parent:function(A){return(A=A.parentNode)&&A.nodeType!==11?A:null},parents:function(A){return AM.dir(A,"parentNode")},parentsUntil:function(F,A,G){return AM.dir(F,"parentNode",G)},next:function(A){return AM.nth(A,2,"nextSibling")},prev:function(A){return AM.nth(A,2,"previousSibling")},nextAll:function(A){return AM.dir(A,"nextSibling")},prevAll:function(A){return AM.dir(A,"previousSibling")},nextUntil:function(F,A,G){return AM.dir(F,"nextSibling",G)},prevUntil:function(F,A,G){return AM.dir(F,"previousSibling",G)},siblings:function(A){return AM.sibling(A.parentNode.firstChild,A)},children:function(A){return AM.sibling(A.firstChild)},contents:function(A){return AM.nodeName(A,"iframe")?A.contentDocument||A.contentWindow.document:AM.makeArray(A.childNodes)}},function(F,A){AM.fn[F]=function(K,G){var J=AM.map(this,A,K);H.test(F)||(G=K);if(G&&typeof G==="string"){J=AM.filter(G,J)}J=this.length>1?AM.unique(J):J;if((this.length>1||A2.test(G))&&BF.test(F)){J=J.reverse()}return this.pushStack(J,F,AY.call(arguments).join(","))}});AM.extend({filter:function(F,A,G){if(G){F=":not("+F+")"}return AM.find.matches(F,A)},dir:function(F,A,J){var G=[];for(F=F[A];F&&F.nodeType!==9&&(J===AD||F.nodeType!==1||!AM(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 AN=/ jQuery\d+="(?:\d+|null)"/g,AW=/^\s+/,y=/(<([\w:]+)[^>]*?)\/>/g,Aj=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,f=/<([\w:]+)/,AH=/<tbody/i,o=/<|&#?\w+;/,Av=/<script|<object|<embed|<option|<style/i,AP=/checked\s*(?:[^=]|=\s*.checked.)/i,BO=function(F,A,G){return Aj.test(G)?F:A+"></"+G+">"},Ap={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,"",""]};Ap.optgroup=Ap.option;Ap.tbody=Ap.tfoot=Ap.colgroup=Ap.caption=Ap.thead;Ap.th=Ap.td;if(!AM.support.htmlSerialize){Ap._default=[1,"div<div>","</div>"]}AM.fn.extend({text:function(A){if(AM.isFunction(A)){return this.each(function(F){var G=AM(this);G.text(A.call(this,F,G.text()))})}if(typeof A!=="object"&&A!==AD){return this.empty().append((this[0]&&this[0].ownerDocument||AE).createTextNode(A))}return AM.text(this)},wrapAll:function(F){if(AM.isFunction(F)){return this.each(function(G){AM(this).wrapAll(F.call(this,G))})}if(this[0]){var A=AM(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(AM.isFunction(A)){return this.each(function(F){AM(this).wrapInner(A.call(this,F))})}return this.each(function(){var F=AM(this),G=F.contents();G.length?G.wrapAll(A):F.append(A)})},wrap:function(A){return this.each(function(){AM(this).wrapAll(A)})},unwrap:function(){return this.parent().each(function(){AM.nodeName(this,"body")||AM(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=AM(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,AM(arguments[0]).toArray());return A}}},remove:function(F,A){for(var J=0,G;(G=this[J])!=null;J++){if(!F||AM.filter(F,[G]).length){if(!A&&G.nodeType===1){AM.cleanData(G.getElementsByTagName("*"));AM.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&&AM.cleanData(A.getElementsByTagName("*"));A.firstChild;){A.removeChild(A.firstChild)}}return this},clone:function(F){var A=this.map(function(){if(!AM.support.noCloneEvent&&!AM.isXMLDoc(this)){var J=this.outerHTML,G=this.ownerDocument;if(!J){J=G.createElement("div");J.appendChild(this.cloneNode(true));J=J.innerHTML}return AM.clean([J.replace(AN,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(AW,"")],G)[0]}else{return this.cloneNode(true)}});if(F===true){BN(this,A);BN(this.find("*"),A.find("*"))}return A},html:function(F){if(F===AD){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(AN,""):null}else{if(typeof F==="string"&&!Av.test(F)&&(AM.support.leadingWhitespace||!AW.test(F))&&!Ap[(f.exec(F)||["",""])[1].toLowerCase()]){F=F.replace(y,BO);try{for(var A=0,J=this.length;A<J;A++){if(this[A].nodeType===1){AM.cleanData(this[A].getElementsByTagName("*"));this[A].innerHTML=F}}}catch(G){this.empty().append(F)}}else{AM.isFunction(F)?this.each(function(N){var K=AM(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(AM.isFunction(A)){return this.each(function(F){var J=AM(this),G=J.html();J.replaceWith(A.call(this,F,G))})}if(typeof A!=="string"){A=AM(A).detach()}return this.each(function(){var F=this.nextSibling,G=this.parentNode;AM(this).remove();F?AM(F).before(A):AM(G).append(A)})}else{return this.pushStack(AM(AM.isFunction(A)?A():A),"replaceWith",A)}},detach:function(A){return this.remove(A,true)},domManip:function(R,Q,P){function N(T){return AM.nodeName(T,"table")?T.getElementsByTagName("tbody")[0]||T.appendChild(T.ownerDocument.createElement("tbody")):T}var O,K,L=R[0],F=[],J;if(!AM.support.checkClone&&arguments.length===3&&typeof L==="string"&&AP.test(L)){return this.each(function(){AM(this).domManip(R,Q,P,true)})}if(AM.isFunction(L)){return this.each(function(T){var V=AM(this);R[0]=L.call(this,T,Q?V.html():AD);V.domManip(R,Q,P)})}if(this[0]){O=L&&L.parentNode;O=AM.support.parentNode&&O&&O.nodeType===11&&O.childNodes.length===this.length?{fragment:O}:A9(R,this,F);J=O.fragment;if(K=J.childNodes.length===1?(J=J.firstChild):J.firstChild){Q=Q&&AM.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&&AM.each(F,AB)}return this}});AM.fragments={};AM.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(F,A){AM.fn[F]=function(N){var K=[];N=AM(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();AM.fn[A].apply(AM(N[L]),J);K=K.concat(J)}return this.pushStack(K,F,N.selector)}}});AM.extend({clean:function(R,Q,P,N){Q=Q||AE;if(typeof Q.createElement==="undefined"){Q=Q.ownerDocument||Q[0]&&Q[0].ownerDocument||AE}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(y,BO);var F=(f.exec(L)||["",""])[1].toLowerCase(),J=Ap[F]||Ap._default,G=J[0],A=Q.createElement("div");for(A.innerHTML=J[1]+L+J[2];G--;){A=A.lastChild}if(!AM.support.tbody){G=AH.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){AM.nodeName(F[J],"tbody")&&!F[J].childNodes.length&&F[J].parentNode.removeChild(F[J])}}!AM.support.leadingWhitespace&&AW.test(L)&&A.insertBefore(Q.createTextNode(AW.exec(L)[0]),A.firstChild);L=A.childNodes}}if(L.nodeType){O.push(L)}else{O=AM.merge(O,L)}}}if(P){for(K=0;O[K];K++){if(N&&AM.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(AM.makeArray(O[K].getElementsByTagName("script"))));P.appendChild(O[K])}}}return O},cleanData:function(P){for(var O,N,K=AM.cache,L=AM.event.special,G=AM.support.deleteExpando,J=0,A;(A=P[J])!=null;J++){if(N=A[AM.expando]){O=K[N];if(O.events){for(var F in O.events){L[F]?AM.event.remove(A,F):Am(A,F,O.handle)}}if(G){delete A[AM.expando]}else{A.removeAttribute&&A.removeAttribute(AM.expando)}delete K[N]}}}});var M=/z-?index|font-?weight|opacity|zoom|line-?height/i,BA=/alpha\([^)]*\)/,Aw=/opacity=([^)]*)/,Ak=/float/i,AI=/-([a-z])/ig,BJ=/([A-Z])/g,A5=/^-?\d+(?:px)?$/i,Ao=/^-?\d/,AK={position:"absolute",visibility:"hidden",display:"block"},u=["Left","Right"],b=["Top","Bottom"],BM=AE.defaultView&&AE.defaultView.getComputedStyle,AQ=AM.support.cssFloat?"cssFloat":"styleFloat",p=function(F,A){return A.toUpperCase()};AM.fn.css=function(F,A){return AU(this,F,A,true,function(K,G,J){if(J===AD){return AM.curCSS(K,G)}if(typeof J==="number"&&!M.test(G)){J+="px"}AM.style(K,G,J)})};AM.extend({style:function(F,A,K){if(!F||F.nodeType===3||F.nodeType===8){return AD}if((A==="width"||A==="height")&&parseFloat(K)<0){K=AD}var G=F.style||F,J=K!==AD;if(!AM.support.opacity&&A==="opacity"){if(J){G.zoom=1;A=parseInt(K,10)+""==="NaN"?"":"alpha(opacity="+K*100+")";F=G.filter||AM.curCSS(F,"filter")||"";G.filter=BA.test(F)?F.replace(BA,A):A}return G.filter&&G.filter.indexOf("opacity=")>=0?parseFloat(Aw.exec(G.filter)[1])/100+"":""}if(Ak.test(A)){A=AQ}A=A.replace(AI,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"?u:b;function J(){L=A==="width"?F.offsetWidth:F.offsetHeight;K!=="border"&&AM.each(G,function(){K||(L-=parseFloat(AM.curCSS(F,"padding"+this,true))||0);if(K==="margin"){L+=parseFloat(AM.curCSS(F,"margin"+this,true))||0}else{L-=parseFloat(AM.curCSS(F,"border"+this+"Width",true))||0}})}F.offsetWidth!==0?J():AM.swap(F,AK,J);return Math.max(0,Math.round(L))}return AM.curCSS(F,A,N)},curCSS:function(F,A,L){var J,K=F.style;if(!AM.support.opacity&&A==="opacity"&&F.currentStyle){J=Aw.test(F.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return J===""?"1":J}if(Ak.test(A)){A=AQ}if(!L&&K&&K[A]){J=K[A]}else{if(BM){if(Ak.test(A)){A="float"}A=A.replace(BJ,"-$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(AI,p);J=F.currentStyle[A]||F.currentStyle[L];if(!A5.test(J)&&Ao.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(AM.expr&&AM.expr.filters){AM.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:AM.curCSS(F,"display")==="none"};AM.expr.filters.visible=function(A){return !AM.expr.filters.hidden(A)}}var A8=Al(),At=/<script(.|\s)*?\/script>/gi,AO=/select|textarea/i,z=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,Ag=/=\?(&|$)/,S=/\?/,g=/(\?|&)_=.*?(&|$)/,B=/^(\w+:)?\/\/([^\/?#]+)/,BB=/%20/g,Ax=AM.fn.load;AM.fn.extend({load:function(F,A,L){if(typeof F!=="string"){return Ax.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(AM.isFunction(A)){L=A;A=null}else{if(typeof A==="object"){A=AM.param(A,AM.ajaxSettings.traditional);J="POST"}}}var G=this;AM.ajax({url:F,type:J,dataType:"html",data:A,complete:function(N,O){if(O==="success"||O==="notmodified"){G.html(K?AM("<div />").append(N.responseText.replace(At,"")).find(K):N.responseText)}L&&G.each(L,[N.responseText,O,N])}});return this},serialize:function(){return AM.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?AM.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||AO.test(this.nodeName)||z.test(this.type))}).map(function(F,A){F=AM(this).val();return F==null?null:AM.isArray(F)?AM.map(F,function(G){return{name:A.name,value:G}}):{name:A.name,value:F}}).get()}});AM.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(F,A){AM.fn[A]=function(G){return this.bind(A,G)}});AM.extend({get:function(F,A,J,G){if(AM.isFunction(A)){G=G||J;J=A;A=null}return AM.ajax({type:"GET",url:F,data:A,success:J,dataType:G})},getScript:function(F,A){return AM.get(F,null,A,"script")},getJSON:function(F,A,G){return AM.get(F,A,G,"json")},post:function(F,A,J,G){if(AM.isFunction(A)){G=G||J;J=A;A={}}return AM.ajax({type:"POST",url:F,data:A,success:J,dataType:G})},ajaxSetup:function(A){AM.extend(AM.ajaxSettings,A)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:Au.XMLHttpRequest&&(Au.location.protocol!=="file:"||!Au.ActiveXObject)?function(){return new Au.XMLHttpRequest}:function(){try{return new Au.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(BP){function Ab(){w.success&&w.success.call(T,O,W,F);w.global&&Z("ajaxSuccess",[F,w])}function Aa(){w.complete&&w.complete.call(T,F,W);w.global&&Z("ajaxComplete",[F,w]);w.global&&!--AM.active&&AM.event.trigger("ajaxStop")}function Z(BR,BS){(w.context?AM(w.context):AM.event).trigger(BR,BS)}var w=AM.extend(true,{},AM.ajaxSettings,BP),V,W,O,T=BP&&BP.context||w,P=w.type.toUpperCase();if(w.data&&w.processData&&typeof w.data!=="string"){w.data=AM.param(w.data,w.traditional)}if(w.dataType==="jsonp"){if(P==="GET"){Ag.test(w.url)||(w.url+=(S.test(w.url)?"&":"?")+(w.jsonp||"callback")+"=?")}else{if(!w.data||!Ag.test(w.data)){w.data=(w.data?w.data+"&":"")+(w.jsonp||"callback")+"=?"}}w.dataType="json"}if(w.dataType==="json"&&(w.data&&Ag.test(w.data)||Ag.test(w.url))){V=w.jsonpCallback||"jsonp"+A8++;if(w.data){w.data=(w.data+"").replace(Ag,"="+V+"$1")}w.url=w.url.replace(Ag,"="+V+"$1");w.dataType="script";Au[V]=Au[V]||function(BR){O=BR;Ab();Aa();Au[V]=AD;try{delete Au[V]}catch(BS){}A&&A.removeChild(K)}}if(w.dataType==="script"&&w.cache===null){w.cache=false}if(w.cache===false&&P==="GET"){var L=Al(),G=w.url.replace(g,"$1_="+L+"$2");w.url=G+(G===w.url?(S.test(w.url)?"&":"?")+"_="+L:"")}if(w.data&&P==="GET"){w.url+=(S.test(w.url)?"&":"?")+w.data}w.global&&!AM.active++&&AM.event.trigger("ajaxStart");L=(L=B.exec(w.url))&&(L[1]&&L[1]!==location.protocol||L[2]!==location.host);if(w.dataType==="script"&&P==="GET"&&L){var A=AE.getElementsByTagName("head")[0]||AE.documentElement,K=AE.createElement("script");K.src=w.url;if(w.scriptCharset){K.charset=w.scriptCharset}if(!V){var N=false;K.onload=K.onreadystatechange=function(){if(!N&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){N=true;Ab();Aa();K.onload=K.onreadystatechange=null;A&&K.parentNode&&A.removeChild(K)}}}A.insertBefore(K,A.firstChild);return AD}var J=false,F=w.xhr();if(F){w.username?F.open(P,w.url,w.async,w.username,w.password):F.open(P,w.url,w.async);try{if(w.data||BP&&BP.contentType){F.setRequestHeader("Content-Type",w.contentType)}if(w.ifModified){AM.lastModified[w.url]&&F.setRequestHeader("If-Modified-Since",AM.lastModified[w.url]);AM.etag[w.url]&&F.setRequestHeader("If-None-Match",AM.etag[w.url])}L||F.setRequestHeader("X-Requested-With","XMLHttpRequest");F.setRequestHeader("Accept",w.dataType&&w.accepts[w.dataType]?w.accepts[w.dataType]+", */*":w.accepts._default)}catch(BQ){}if(w.beforeSend&&w.beforeSend.call(T,F,w)===false){w.global&&!--AM.active&&AM.event.trigger("ajaxStop");F.abort();return false}w.global&&Z("ajaxSend",[F,w]);var Y=F.onreadystatechange=function(BS){if(!F||F.readyState===0||BS==="abort"){J||Aa();J=true;if(F){F.onreadystatechange=AM.noop}}else{if(!J&&F&&(F.readyState===4||BS==="timeout")){J=true;F.onreadystatechange=AM.noop;W=BS==="timeout"?"timeout":!AM.httpSuccess(F)?"error":w.ifModified&&AM.httpNotModified(F,w.url)?"notmodified":"success";var BT;if(W==="success"){try{O=AM.httpData(F,w.dataType,w)}catch(BR){W="parsererror";BT=BR}}if(W==="success"||W==="notmodified"){V||Ab()}else{AM.handleError(w,F,W,BT)}Aa();BS==="timeout"&&F.abort();if(w.async){F=null}}}};try{var X=F.abort;F.abort=function(){F&&X.call(F);Y("abort")}}catch(R){}w.async&&w.timeout>0&&setTimeout(function(){F&&!J&&Y("timeout")},w.timeout);try{F.send(P==="POST"||P==="PUT"||P==="DELETE"?w.data:null)}catch(Q){AM.handleError(w,F,null,Q);Aa()}w.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?AM(F.context):AM.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){AM.lastModified[A]=J}if(G){AM.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"&&AM.error("parsererror");if(K&&K.dataFilter){F=K.dataFilter(F,A)}if(typeof F==="string"){if(A==="json"||!A&&G.indexOf("json")>=0){F=AM.parseJSON(F)}else{if(A==="script"||!A&&G.indexOf("javascript")>=0){AM.globalEval(F)}}}return F},param:function(F,A){function L(N,O){if(AM.isArray(O)){AM.each(O,function(P,Q){A||/\[\]$/.test(N)?J(N,Q):L(N+"["+(typeof Q==="object"||AM.isArray(Q)?P:"")+"]",Q)})}else{!A&&O!=null&&typeof O==="object"?AM.each(O,function(P,Q){L(N+"["+P+"]",Q)}):J(N,O)}}function J(N,O){O=AM.isFunction(O)?O():O;K[K.length]=encodeURIComponent(N)+"="+encodeURIComponent(O)}var K=[];if(A===AD){A=AM.ajaxSettings.traditional}if(AM.isArray(F)||F.jquery){AM.each(F,function(){J(this.name,this.value)})}else{for(var G in F){L(G,F[G])}}return K.join("&").replace(BB,"+")}});var BK={},BG=/toggle|show|hide/,A3=/^([+-]=)?([\d+-.]+)(.*)$/,AV,AA=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];AM.fn.extend({show:function(F,A){if(F||F===0){return this.animate(Ai("show",3),F,A)}else{F=0;for(A=this.length;F<A;F++){var K=AM.data(this[F],"olddisplay");this[F].style.display=K||"";if(AM.css(this[F],"display")==="none"){K=this[F].nodeName;var G;if(BK[K]){G=BK[K]}else{var J=AM("<"+K+" />").appendTo("body");G=J.css("display");if(G==="none"){G="block"}J.remove();BK[K]=G}AM.data(this[F],"olddisplay",G)}}F=0;for(A=this.length;F<A;F++){this[F].style.display=AM.data(this[F],"olddisplay")||""}return this}},hide:function(F,A){if(F||F===0){return this.animate(Ai("hide",3),F,A)}else{F=0;for(A=this.length;F<A;F++){var G=AM.data(this[F],"olddisplay");!G&&G!=="none"&&AM.data(this[F],"olddisplay",AM.css(this[F],"display"))}F=0;for(A=this.length;F<A;F++){this[F].style.display="none"}return this}},_toggle:AM.fn.toggle,toggle:function(F,A){var G=typeof F==="boolean";if(AM.isFunction(F)&&AM.isFunction(A)){this._toggle.apply(this,arguments)}else{F==null||G?this.each(function(){var J=G?F:AM(this).is(":hidden");AM(this)[J?"show":"hide"]()}):this.animate(Ai("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=AM.speed(A,K,G);if(AM.isEmptyObject(F)){return this.each(J.complete)}return this[J.queue===false?"each":"queue"](function(){var N=AM.extend({},J),O,P=this.nodeType===1&&AM(this).is(":hidden"),L=this;for(O in F){var Q=O.replace(AI,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=AM.css(this,"display");N.overflow=this.style.overflow}if(AM.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=AM.extend({},F);AM.each(F,function(T,R){var X=new AM.fx(L,N,T);if(BG.test(R)){X[R==="toggle"?P?"show":"hide":R](F)}else{var W=A3.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=AM.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}});AM.each({slideDown:Ai("show",1),slideUp:Ai("hide",1),slideToggle:Ai("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(F,A){AM.fn[F]=function(J,G){return this.animate(A,J,G)}});AM.extend({speed:function(F,A,J){var G=F&&typeof F==="object"?F:{complete:J||!J&&A||AM.isFunction(F)&&F,duration:F,easing:J&&A||A&&!AM.isFunction(A)&&A};G.duration=AM.fx.off?0:typeof G.duration==="number"?G.duration:AM.fx.speeds[G.duration]||AM.fx.speeds._default;G.old=G.complete;G.complete=function(){G.queue!==false&&AM(this).dequeue();AM.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={}}}});AM.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(AM.fx.step[this.prop]||AM.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(AM.css(this.elem,this.prop,A)))&&A>-10000?A:parseFloat(AM.curCSS(this.elem,this.prop))||0},custom:function(F,A,K){function G(L){return J.step(L)}this.startTime=Al();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()&&AM.timers.push(G)&&!AV){AV=setInterval(AM.fx.tick,13)}},show:function(){this.options.orig[this.prop]=AM.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());AM(this.elem).show()},hide:function(){this.options.orig[this.prop]=AM.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(F){var A=Al(),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=AM.data(this.elem,"olddisplay");this.elem.style.display=F?F:this.options.display;if(AM.css(this.elem,"display")==="none"){this.elem.style.display="block"}}this.options.hide&&AM(this.elem).hide();if(this.options.hide||this.options.show){for(var J in this.options.curAnim){AM.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||(AM.easing.swing?"swing":"linear");this.pos=AM.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}};AM.extend(AM.fx,{tick:function(){for(var F=AM.timers,A=0;A<F.length;A++){F[A]()||F.splice(A--,1)}F.length||AM.fx.stop()},stop:function(){clearInterval(AV);AV=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(A){AM.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(AM.expr&&AM.expr.filters){AM.expr.filters.animated=function(A){return AM.grep(AM.timers,function(F){return A===F.elem}).length}}AM.fn.offset="getBoundingClientRect" in AE.documentElement?function(F){var A=this[0];if(F){return this.each(function(K){AM.offset.setOffset(this,F,K)})}if(!A||!A.ownerDocument){return null}if(A===A.ownerDocument.body){return AM.offset.bodyOffset(A)}var J=A.getBoundingClientRect(),G=A.ownerDocument;A=G.body;G=G.documentElement;return{top:J.top+(self.pageYOffset||AM.support.boxModel&&G.scrollTop||A.scrollTop)-(G.clientTop||A.clientTop||0),left:J.left+(self.pageXOffset||AM.support.boxModel&&G.scrollLeft||A.scrollLeft)-(G.clientLeft||A.clientLeft||0)}}:function(Q){var P=this[0];if(Q){return this.each(function(R){AM.offset.setOffset(this,Q,R)})}if(!P||!P.ownerDocument){return null}if(P===P.ownerDocument.body){return AM.offset.bodyOffset(P)}AM.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(AM.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(AM.offset.doesNotAddBorder&&!(AM.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(AM.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(AM.offset.supportsFixedPosition&&L.position==="fixed"){G+=Math.max(K.scrollTop,A.scrollTop);F+=Math.max(K.scrollLeft,A.scrollLeft)}return{top:G,left:F}};AM.offset={initialize:function(){var F=AE.body,A=AE.createElement("div"),L,J,K,G=parseFloat(AM.curCSS(F,"marginTop",true))||0;AM.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);AM.offset.initialize=AM.noop},bodyOffset:function(F){var A=F.offsetTop,G=F.offsetLeft;AM.offset.initialize();if(AM.offset.doesNotIncludeMarginInBodyOffset){A+=parseFloat(AM.curCSS(F,"marginTop",true))||0;G+=parseFloat(AM.curCSS(F,"marginLeft",true))||0}return{top:A,left:G}},setOffset:function(F,A,N){if(/static/.test(AM.curCSS(F,"position"))){F.style.position="relative"}var K=AM(F),L=K.offset(),G=parseInt(AM.curCSS(F,"top",true),10)||0,J=parseInt(AM.curCSS(F,"left",true),10)||0;if(AM.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)}};AM.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(AM.curCSS(F,"marginTop",true))||0;J.left-=parseFloat(AM.curCSS(F,"marginLeft",true))||0;G.top+=parseFloat(AM.curCSS(A[0],"borderTopWidth",true))||0;G.left+=parseFloat(AM.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||AE.body;A&&!/^body|html$/i.test(A.nodeName)&&AM.css(A,"position")==="static";){A=A.offsetParent}return A})}});AM.each(["Left","Top"],function(F,A){var G="scroll"+A;AM.fn[G]=function(K){var L=this[0],J;if(!L){return null}if(K!==AD){return this.each(function(){if(J=h(this)){J.scrollTo(!F?K:AM(J).scrollLeft(),F?K:AM(J).scrollTop())}else{this[G]=K}})}else{return(J=h(L))?"pageXOffset" in J?J[F?"pageYOffset":"pageXOffset"]:AM.support.boxModel&&J.document.documentElement[G]||J.document.body[G]:L[G]}}});AM.each(["Height","Width"],function(F,A){var G=A.toLowerCase();AM.fn["inner"+A]=function(){return this[0]?AM.css(this[0],G,false,"padding"):null};AM.fn["outer"+A]=function(J){return this[0]?AM.css(this[0],G,false,J?"margin":"border"):null};AM.fn[G]=function(J){var K=this[0];if(!K){return J==null?null:this}if(AM.isFunction(J)){return this.each(function(L){var N=AM(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===AD?AM.css(K,G):this.css(G,typeof J==="string"?J:J+"px")}});Au.jQuery=Au.$=AM})(window);(function(){if(!Date.now){Date.now=function(){return +new Date}}try{document.createElement("div").style.setProperty("opacity",0,"")}catch(DF){var Bv=CSSStyleDeclaration.prototype,D4=Bv.setProperty;Bv.setProperty=function(e,Ew,Ev){D4.call(this,e,Ew+"",Ev)}}d3={version:"2.8.1"};function Ep(Ex,Ew){try{for(var Ev in Ew){Object.defineProperty(Ex.prototype,Ev,{value:Ew[Ev],enumerable:false})}}catch(Ey){Ex.prototype=Ew}}var B2=At;function En(Ev){var e=-1,Ex=Ev.length,Ew=[];while(++e<Ex){Ew.push(Ev[e])}return Ew}function At(e){return Array.prototype.slice.call(e)}try{B2(document.documentElement.childNodes)[0].nodeType}catch(EM){B2=En}var Ci=[].__proto__?function(Ev,e){Ev.__proto__=e}:function(Ew,e){for(var Ev in e){Ew[Ev]=e[Ev]}};d3.map=function(e){var Ew=new AK;for(var Ev in e){Ew.set(Ev,e[Ev])}return Ew};function AK(){}Ep(AK,{has:function(e){return Er+e in this},get:function(e){return this[Er+e]},set:function(e,Ev){return this[Er+e]=Ev},remove:function(e){e=Er+e;return e in this&&delete this[e]},keys:function(){var e=[];this.forEach(function(Ev){e.push(Ev)});return e},values:function(){var e=[];this.forEach(function(Ev,Ew){e.push(Ew)});return e},entries:function(){var e=[];this.forEach(function(Ev,Ew){e.push({key:Ev,value:Ew})});return e},forEach:function(Ev){for(var e in this){if(e.charCodeAt(0)===Bx){Ev.call(this,e.substring(1),this[e])}}}});var Er="\0",Bx=Er.charCodeAt(0);function t(){return this}d3.functor=function(e){return typeof e==="function"?e:function(){return e}};d3.rebind=function(Ew,Ev){var e=1,Ey=arguments.length,Ex;while(++e<Ey){Ew[Ex=arguments[e]]=CT(Ew,Ev,Ev[Ex])}return Ew};function CT(Ev,e,Ew){return function(){var Ex=Ew.apply(e,arguments);return arguments.length?Ev:Ex}}d3.ascending=function(Ev,e){return Ev<e?-1:Ev>e?1:Ev>=e?0:NaN};d3.descending=function(Ev,e){return e<Ev?-1:e>Ev?1:e>=Ev?0:NaN};d3.mean=function(E0,Ey){var Ez=E0.length,Ev,e=0,Ex=-1,Ew=0;if(arguments.length===1){while(++Ex<Ez){if(ET(Ev=E0[Ex])){e+=(Ev-e)/++Ew}}}else{while(++Ex<Ez){if(ET(Ev=Ey.call(E0,E0[Ex],Ex))){e+=(Ev-e)/++Ew}}}return Ew?e:undefined};d3.median=function(Ev,e){if(arguments.length>1){Ev=Ev.map(e)}Ev=Ev.filter(ET);return Ev.length?d3.quantile(Ev.sort(d3.ascending),0.5):undefined};d3.min=function(Ez,Ex){var Ew=-1,Ey=Ez.length,Ev,e;if(arguments.length===1){while(++Ew<Ey&&((Ev=Ez[Ew])==null||Ev!=Ev)){Ev=undefined}while(++Ew<Ey){if((e=Ez[Ew])!=null&&Ev>e){Ev=e}}}else{while(++Ew<Ey&&((Ev=Ex.call(Ez,Ez[Ew],Ew))==null||Ev!=Ev)){Ev=undefined}while(++Ew<Ey){if((e=Ex.call(Ez,Ez[Ew],Ew))!=null&&Ev>e){Ev=e}}}return Ev};d3.max=function(Ez,Ex){var Ew=-1,Ey=Ez.length,Ev,e;if(arguments.length===1){while(++Ew<Ey&&((Ev=Ez[Ew])==null||Ev!=Ev)){Ev=undefined}while(++Ew<Ey){if((e=Ez[Ew])!=null&&e>Ev){Ev=e}}}else{while(++Ew<Ey&&((Ev=Ex.call(Ez,Ez[Ew],Ew))==null||Ev!=Ev)){Ev=undefined}while(++Ew<Ey){if((e=Ex.call(Ez,Ez[Ew],Ew))!=null&&e>Ev){Ev=e}}}return Ev};d3.extent=function(E0,Ex){var Ew=-1,Ez=E0.length,Ev,e,Ey;if(arguments.length===1){while(++Ew<Ez&&((Ev=Ey=E0[Ew])==null||Ev!=Ev)){Ev=Ey=undefined}while(++Ew<Ez){if((e=E0[Ew])!=null){if(Ev>e){Ev=e}if(Ey<e){Ey=e}}}}else{while(++Ew<Ez&&((Ev=Ey=Ex.call(E0,E0[Ew],Ew))==null||Ev!=Ev)){Ev=undefined}while(++Ew<Ez){if((e=Ex.call(E0,E0[Ew],Ew))!=null){if(Ev>e){Ev=e}if(Ey<e){Ey=e}}}}return[Ev,Ey]};d3.random={normal:function(e,Ev){if(arguments.length<2){Ev=1}if(arguments.length<1){e=0}return function(){var Ew,Ey,Ex;do{Ew=Math.random()*2-1;Ey=Math.random()*2-1;Ex=Ew*Ew+Ey*Ey}while(!Ex||Ex>1);return e+Ev*Ew*Math.sqrt(-2*Math.log(Ex)/Ex)}}};function ET(e){return e!=null&&!isNaN(e)}d3.sum=function(Ez,Ex){var Ew=0,Ey=Ez.length,e,Ev=-1;if(arguments.length===1){while(++Ev<Ey){if(!isNaN(e=+Ez[Ev])){Ew+=e}}}else{while(++Ev<Ey){if(!isNaN(e=+Ex.call(Ez,Ez[Ev],Ev))){Ew+=e}}}return Ew};d3.quantile=function(Ew,E0){var Ex=(Ew.length-1)*E0+1,Ey=Math.floor(Ex),Ev=Ew[Ey-1],Ez=Ex-Ey;return Ez?Ev+Ez*(Ew[Ey]-Ev):Ev};d3.transpose=function(e){return d3.zip.apply(d3,e)};d3.zip=function(){if(!(Ez=arguments.length)){return[]}for(var Ex=-1,e=d3.min(arguments,Cz),Ew=new Array(e);++Ex<e;){for(var Ev=-1,Ez,Ey=Ew[Ex]=new Array(Ez);++Ev<Ez;){Ey[Ev]=arguments[Ev][Ex]}}return Ew};function Cz(e){return e.length}d3.bisector=function(e){return{left:function(Ew,Ev,Ez,Ey){if(arguments.length<3){Ez=0}if(arguments.length<4){Ey=Ew.length}while(Ez<Ey){var Ex=Ez+Ey>>1;if(e.call(Ew,Ew[Ex],Ex)<Ev){Ez=Ex+1}else{Ey=Ex}}return Ez},right:function(Ew,Ev,Ez,Ey){if(arguments.length<3){Ez=0}if(arguments.length<4){Ey=Ew.length}while(Ez<Ey){var Ex=Ez+Ey>>1;if(Ev<e.call(Ew,Ew[Ex],Ex)){Ey=Ex}else{Ez=Ex+1}}return Ez}}};var Do=d3.bisector(function(e){return e});d3.bisectLeft=Do.left;d3.bisect=d3.bisectRight=Do.right;d3.first=function(Ez,Ex){var Ew=0,Ey=Ez.length,Ev=Ez[0],e;if(arguments.length===1){Ex=d3.ascending}while(++Ew<Ey){if(Ex.call(Ez,Ev,e=Ez[Ew])>0){Ev=e}}return Ev};d3.last=function(Ez,Ex){var Ew=0,Ey=Ez.length,Ev=Ez[0],e;if(arguments.length===1){Ex=d3.ascending}while(++Ew<Ey){if(Ex.call(Ez,Ev,e=Ez[Ew])<=0){Ev=e}}return Ev};d3.nest=function(){var Ex={},Ew=[],E0=[],Ev,Ey;function Ez(E8,E6){if(E6>=Ew.length){return Ey?Ey.call(Ex,E8):(Ev?E8.sort(Ev):E8)}var E7=-1,E2=E8.length,FA=Ew[E6++],E5,E4,E3=new AK,E9,E1={};while(++E7<E2){if(E9=E3.get(E5=FA(E4=E8[E7]))){E9.push(E4)}else{E3.set(E5,[E4])}}E3.forEach(function(FB){E1[FB]=Ez(E3.get(FB),E6)});return E1}function e(E4,E5){if(E5>=Ew.length){return E4}var E1=[],E2=E0[E5++],E3;for(E3 in E4){E1.push({key:E3,values:e(E4[E3],E5)})}if(E2){E1.sort(function(E7,E6){return E2(E7.key,E6.key)})}return E1}Ex.map=function(E1){return Ez(E1,0)};Ex.entries=function(E1){return e(Ez(E1,0),0)};Ex.key=function(E1){Ew.push(E1);return Ex};Ex.sortKeys=function(E1){E0[Ew.length-1]=E1;return Ex};Ex.sortValues=function(E1){Ev=E1;return Ex};Ex.rollup=function(E1){Ey=E1;return Ex};return Ex};d3.keys=function(Ew){var Ev=[];for(var e in Ew){Ev.push(e)}return Ev};d3.values=function(Ew){var e=[];for(var Ev in Ew){e.push(Ew[Ev])}return e};d3.entries=function(Ew){var e=[];for(var Ev in Ew){e.push({key:Ev,value:Ew[Ev]})}return e};d3.permute=function(Ey,Ev){var e=[],Ew=-1,Ex=Ev.length;while(++Ew<Ex){e[Ew]=Ey[Ev[Ew]]}return e};d3.merge=function(e){return Array.prototype.concat.apply([],e)};d3.split=function(E0,Ey){var Ex=[],e=[],Ew,Ev=-1,Ez=E0.length;if(arguments.length<2){Ey=Cg}while(++Ev<Ez){if(Ey.call(e,Ew=E0[Ev],Ev)){e=[]}else{if(!e.length){Ex.push(e)}e.push(Ew)}}return Ex};function Cg(e){return e==null}function BR(e){return e.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}d3.range=function(E0,Ey,Ez){if(arguments.length<3){Ez=1;if(arguments.length<2){Ey=E0;E0=0}}if((Ey-E0)/Ez===Infinity){throw new Error("infinite range")}var Ev=[],e=Dl(Math.abs(Ez)),Ex=-1,Ew;E0*=e,Ey*=e,Ez*=e;if(Ez<0){while((Ew=E0+Ez*++Ex)>Ey){Ev.push(Ew/e)}}else{while((Ew=E0+Ez*++Ex)<Ey){Ev.push(Ew/e)}}return Ev};function Dl(e){var Ev=1;while(e*Ev%1){Ev*=10}return Ev}d3.requote=function(e){return e.replace(Bg,"\\$&")};var Bg=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(e,Ev){return Ev?Math.round(e*(Ev=Math.pow(10,Ev)))/Ev:Math.round(e)};d3.xhr=function(e,Ew,Ex){var Ev=new XMLHttpRequest;if(arguments.length<3){Ex=Ew,Ew=null}else{if(Ew&&Ev.overrideMimeType){Ev.overrideMimeType(Ew)}}Ev.open("GET",e,true);if(Ew){Ev.setRequestHeader("Accept",Ew)}Ev.onreadystatechange=function(){if(Ev.readyState===4){Ex(Ev.status<300?Ev:null)}};Ev.send(null)};d3.text=function(e,Ew,Ex){function Ev(Ey){Ex(Ey&&Ey.responseText)}if(arguments.length<3){Ex=Ew;Ew=null}d3.xhr(e,Ew,Ev)};d3.json=function(e,Ev){d3.text(e,"application/json",function(Ew){Ev(Ew?JSON.parse(Ew):null)})};d3.html=function(e,Ev){d3.text(e,"text/html",function(Ex){if(Ex!=null){var Ew=document.createRange();Ew.selectNode(document.body);Ex=Ew.createContextualFragment(Ex)}Ev(Ex)})};d3.xml=function(e,Ew,Ex){function Ev(Ey){Ex(Ey&&Ey.responseXML)}if(arguments.length<3){Ex=Ew;Ew=null}d3.xhr(e,Ew,Ev)};var CJ={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:CJ,qualify:function(e){var Ev=e.indexOf(":"),Ew=e;if(Ev>=0){Ew=e.substring(0,Ev);e=e.substring(Ev+1)}return CJ.hasOwnProperty(Ew)?{space:CJ[Ew],local:e}:e}};d3.dispatch=function(){var e=new Ce,Ev=-1,Ew=arguments.length;while(++Ev<Ew){e[arguments[Ev]]=C2(e)}return e};function Ce(){}Ce.prototype.on=function(Ew,Ex){var Ev=Ew.indexOf("."),e="";if(Ev>0){e=Ew.substring(Ev+1);Ew=Ew.substring(0,Ev)}return arguments.length<2?this[Ew].on(e):this[Ew].on(e,Ex)};function C2(e){var Ew=[],Ev=new AK;function Ex(){var E0=Ew,Ez=-1,E1=E0.length,Ey;while(++Ez<E1){if(Ey=E0[Ez].on){Ey.apply(this,arguments)}}return e}Ex.on=function(Ez,E1){var Ey=Ev.get(Ez),E0;if(arguments.length<2){return Ey&&Ey.on}if(Ey){Ey.on=null;Ew=Ew.slice(0,E0=Ew.indexOf(Ey)).concat(Ew.slice(E0+1));Ev.remove(Ez)}if(E1){Ew.push(Ev.set(Ez,{on:E1}))}return e};return Ex}d3.format=function(E2){var Ez=BK.exec(E2),E4=Ez[1]||" ",Ev=Ez[3]||"",Ex=Ez[5],e=+Ez[6],E5=Ez[7],E0=Ez[8],E1=Ez[9],Ew=1,E3="",Ey=false;if(E0){E0=+E0.substring(1)}if(Ex){E4="0";if(E5){e-=Math.floor((e-1)/4)}}switch(E1){case"n":E5=true;E1="g";break;case"%":Ew=100;E3="%";E1="f";break;case"p":Ew=100;E3="%";E1="r";break;case"d":Ey=true;E0=0;break;case"s":Ew=-1;E1="r";break}if(E1=="r"&&!E0){E1="g"}E1=R.get(E1)||Ag;return function(E9){if(Ey&&(E9%1)){return""}var E6=(E9<0)&&(E9=-E9)?"\u2212":Ev;if(Ew<0){var E8=d3.formatPrefix(E9,E0);E9*=E8.scale;E3=E8.symbol}else{E9*=Ew}E9=E1(E9,E0);if(Ex){var E7=E9.length+E6.length;if(E7<e){E9=new Array(e-E7+1).join(E4)+E9}if(E5){E9=Bj(E9)}E9=E6+E9}else{if(E5){E9=Bj(E9)}E9=E6+E9;var E7=E9.length;if(E7<e){E9=new Array(e-E7+1).join(E4)+E9}}return E9+E3}};var BK=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;var R=d3.map({g:function(e,Ev){return e.toPrecision(Ev)},e:function(e,Ev){return e.toExponential(Ev)},f:function(e,Ev){return e.toFixed(Ev)},r:function(e,Ev){return d3.round(e,Ev=CL(e,Ev)).toFixed(Math.max(0,Math.min(20,Ev)))}});function CL(e,Ev){return Ev-(e?1+Math.floor(Math.log(e+Math.pow(10,1+Math.floor(Math.log(e)/Math.LN10)-Ev))/Math.LN10):1)}function Ag(e){return e+""}function Bj(Ex){var Ev=Ex.lastIndexOf("."),Ew=Ev>=0?Ex.substring(Ev):(Ev=Ex.length,""),e=[];while(Ev>0){e.push(Ex.substring(Ev-=3,Ev+3))}return e.reverse().join(",")+Ew}var BH=["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(B1);d3.formatPrefix=function(Ew,e){var Ev=0;if(Ew){if(Ew<0){Ew*=-1}if(e){Ew=d3.round(Ew,CL(Ew,e))}Ev=1+Math.floor(1e-12+Math.log(Ew)/Math.LN10);Ev=Math.max(-24,Math.min(24,Math.floor((Ev<=0?Ev+1:Ev-1)/3)*3))}return BH[8+Ev/3]};function B1(Ev,e){return{scale:Math.pow(10,(8-e)*3),symbol:Ev}}var A2=AP(2),Y=AP(3),EO=function(){return Bi};var p=d3.map({linear:EO,poly:AP,quad:function(){return A2},cubic:function(){return Y},sin:function(){return Df},exp:function(){return DC},circle:function(){return CH},elastic:o,back:ED,bounce:function(){return BB}});var I=d3.map({"in":Bi,out:U,"in-out":AW,"out-in":function(e){return AW(U(e))}});d3.ease=function(Ev){var Ex=Ev.indexOf("-"),Ew=Ex>=0?Ev.substring(0,Ex):Ev,e=Ex>=0?Ev.substring(Ex+1):"in";Ew=p.get(Ew)||EO;e=I.get(e)||Bi;return DJ(e(Ew.apply(null,Array.prototype.slice.call(arguments,1))))};function DJ(e){return function(Ev){return Ev<=0?0:Ev>=1?1:e(Ev)}}function U(e){return function(Ev){return 1-e(1-Ev)}}function AW(e){return function(Ev){return 0.5*(Ev<0.5?e(2*Ev):(2-e(2-2*Ev)))}}function Bi(e){return e}function AP(Ev){return function(e){return Math.pow(e,Ev)}}function Df(e){return 1-Math.cos(e*Math.PI/2)}function DC(e){return Math.pow(2,10*(e-1))}function CH(e){return 1-Math.sqrt(1-e*e)}function o(e,Ew){var Ev;if(arguments.length<2){Ew=0.45}if(arguments.length<1){e=1;Ev=Ew/4}else{Ev=Ew/(2*Math.PI)*Math.asin(1/e)}return function(Ex){return 1+e*Math.pow(2,10*-Ex)*Math.sin((Ex-Ev)*2*Math.PI/Ew)}}function ED(e){if(!e){e=1.70158}return function(Ev){return Ev*Ev*((e+1)*Ev-e)}}function BB(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 Ee(){d3.event.stopPropagation();d3.event.preventDefault()}function u(){var Ew=d3.event,Ev;while(Ev=Ew.sourceEvent){Ew=Ev}return Ew}function EN(Ew){var e=new Ce,Ev=0,Ex=arguments.length;while(++Ev<Ex){e[arguments[Ev]]=C2(e)}e.of=function(Ez,Ey){return function(E0){try{var E1=E0.sourceEvent=d3.event;E0.target=Ew;d3.event=E0;e[E0.type].apply(Ez,Ey)}finally{d3.event=E1}}};return e}d3.interpolate=function(Ev,e){var Ew=d3.interpolators.length,Ex;while(--Ew>=0&&!(Ex=d3.interpolators[Ew](Ev,e))){}return Ex};d3.interpolateNumber=function(Ev,e){e-=Ev;return function(Ew){return Ev+e*Ew}};d3.interpolateRound=function(Ev,e){e-=Ev;return function(Ew){return Math.round(Ev+e*Ew)}};d3.interpolateString=function(E1,E0){var Ex,Ez,Ey,E3=0,E2=0,E4=[],e=[],Ew,Ev;DS.lastIndex=0;for(Ez=0;Ex=DS.exec(E0);++Ez){if(Ex.index){E4.push(E0.substring(E3,E2=Ex.index))}e.push({i:E4.length,x:Ex[0]});E4.push(null);E3=DS.lastIndex}if(E3<E0.length){E4.push(E0.substring(E3))}for(Ez=0,Ew=e.length;(Ex=DS.exec(E1))&&Ez<Ew;++Ez){Ev=e[Ez];if(Ev.x==Ex[0]){if(Ev.i){if(E4[Ev.i+1]==null){E4[Ev.i-1]+=Ev.x;E4.splice(Ev.i,1);for(Ey=Ez+1;Ey<Ew;++Ey){e[Ey].i--}}else{E4[Ev.i-1]+=Ev.x+E4[Ev.i+1];E4.splice(Ev.i,2);for(Ey=Ez+1;Ey<Ew;++Ey){e[Ey].i-=2}}}else{if(E4[Ev.i+1]==null){E4[Ev.i]=Ev.x}else{E4[Ev.i]=Ev.x+E4[Ev.i+1];E4.splice(Ev.i+1,1);for(Ey=Ez+1;Ey<Ew;++Ey){e[Ey].i--}}}e.splice(Ez,1);Ew--;Ez--}else{Ev.x=d3.interpolateNumber(parseFloat(Ex[0]),parseFloat(Ev.x))}}while(Ez<Ew){Ev=e.pop();if(E4[Ev.i+1]==null){E4[Ev.i]=Ev.x}else{E4[Ev.i]=Ev.x+E4[Ev.i+1];E4.splice(Ev.i+1,1)}Ew--}if(E4.length===1){return E4[0]==null?e[0].x:function(){return E0}}return function(E5){for(Ez=0;Ez<Ew;++Ez){E4[(Ev=e[Ez]).i]=Ev.x(E5)}return E4.join("")}};d3.interpolateTransform=function(E7,E6){var E8=[],Ev=[],Ez,Ey=d3.transform(E7),Ex=d3.transform(E6),E3=Ey.translate,E2=Ex.translate,Ew=Ey.rotate,e=Ex.rotate,E1=Ey.skew,E0=Ex.skew,E5=Ey.scale,E4=Ex.scale;if(E3[0]!=E2[0]||E3[1]!=E2[1]){E8.push("translate(",null,",",null,")");Ev.push({i:1,x:d3.interpolateNumber(E3[0],E2[0])},{i:3,x:d3.interpolateNumber(E3[1],E2[1])})}else{if(E2[0]||E2[1]){E8.push("translate("+E2+")")}else{E8.push("")}}if(Ew!=e){Ev.push({i:E8.push(E8.pop()+"rotate(",null,")")-2,x:d3.interpolateNumber(Ew,e)})}else{if(e){E8.push(E8.pop()+"rotate("+e+")")}}if(E1!=E0){Ev.push({i:E8.push(E8.pop()+"skewX(",null,")")-2,x:d3.interpolateNumber(E1,E0)})}else{if(E0){E8.push(E8.pop()+"skewX("+E0+")")}}if(E5[0]!=E4[0]||E5[1]!=E4[1]){Ez=E8.push(E8.pop()+"scale(",null,",",null,")");Ev.push({i:Ez-4,x:d3.interpolateNumber(E5[0],E4[0])},{i:Ez-2,x:d3.interpolateNumber(E5[1],E4[1])})}else{if(E4[0]!=1||E4[1]!=1){E8.push(E8.pop()+"scale("+E4+")")}}Ez=Ev.length;return function(FA){var E9=-1,FB;while(++E9<Ez){E8[(FB=Ev[E9]).i]=FB.x(FA)}return E8.join("")}};d3.interpolateRgb=function(Ev,e){Ev=d3.rgb(Ev);e=d3.rgb(e);var Ex=Ev.r,Ew=Ev.g,E0=Ev.b,Ez=e.r-Ex,Ey=e.g-Ew,E1=e.b-E0;return function(E2){return"#"+BI(Math.round(Ex+Ez*E2))+BI(Math.round(Ew+Ey*E2))+BI(Math.round(E0+E1*E2))}};d3.interpolateHsl=function(Ew,e){Ew=d3.hsl(Ew);e=d3.hsl(e);var E1=Ew.h,E0=Ew.s,Ex=Ew.l,Ez=e.h-E1,Ey=e.s-E0,Ev=e.l-Ex;return function(E2){return Ac(E1+Ez*E2,E0+Ey*E2,Ex+Ev*E2).toString()}};d3.interpolateArray=function(Ey,Ew){var Ev=[],E1=[],Ex=Ey.length,e=Ew.length,E0=Math.min(Ey.length,Ew.length),Ez;for(Ez=0;Ez<E0;++Ez){Ev.push(d3.interpolate(Ey[Ez],Ew[Ez]))}for(;Ez<Ex;++Ez){E1[Ez]=Ey[Ez]}for(;Ez<e;++Ez){E1[Ez]=Ew[Ez]}return function(E2){for(Ez=0;Ez<E0;++Ez){E1[Ez]=Ev[Ez](E2)}return E1}};d3.interpolateObject=function(Ev,e){var Ex={},Ey={},Ew;for(Ew in Ev){if(Ew in e){Ex[Ew]=DD(Ew)(Ev[Ew],e[Ew])}else{Ey[Ew]=Ev[Ew]}}for(Ew in e){if(!(Ew in Ev)){Ey[Ew]=e[Ew]}}return function(Ez){for(Ew in Ex){Ey[Ew]=Ex[Ew](Ez)}return Ey}};var DS=/[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;function DD(e){return e=="transform"?d3.interpolateTransform:d3.interpolate}d3.interpolators=[d3.interpolateObject,function(Ev,e){return(e instanceof Array)&&d3.interpolateArray(Ev,e)},function(Ev,e){return(typeof Ev==="string"||typeof e==="string")&&d3.interpolateString(Ev+"",e+"")},function(Ev,e){return(typeof e==="string"?x.has(e)||/^(#|rgb\(|hsl\()/.test(e):e instanceof Ct||e instanceof DB)&&d3.interpolateRgb(Ev,e)},function(Ev,e){return !isNaN(Ev=+Ev)&&!isNaN(e=+e)&&d3.interpolateNumber(Ev,e)}];function EW(Ev,e){e=e-(Ev=+Ev)?1/(e-Ev):0;return function(Ew){return(Ew-Ev)*e}}function AF(Ev,e){e=e-(Ev=+Ev)?1/(e-Ev):0;return function(Ew){return Math.max(0,Math.min(1,(Ew-Ev)*e))}}d3.rgb=function(Ew,Ev,e){return arguments.length===1?(Ew instanceof Ct?CO(Ew.r,Ew.g,Ew.b):AR(""+Ew,CO,Ac)):CO(~~Ew,~~Ev,~~e)};function CO(Ew,Ev,e){return new Ct(Ew,Ev,e)}function Ct(Ew,Ev,e){this.r=Ew;this.g=Ev;this.b=e}Ct.prototype.brighter=function(Ev){Ev=Math.pow(0.7,arguments.length?Ev:1);var Ey=this.r,Ex=this.g,e=this.b,Ew=30;if(!Ey&&!Ex&&!e){return CO(Ew,Ew,Ew)}if(Ey&&Ey<Ew){Ey=Ew}if(Ex&&Ex<Ew){Ex=Ew}if(e&&e<Ew){e=Ew}return CO(Math.min(255,Math.floor(Ey/Ev)),Math.min(255,Math.floor(Ex/Ev)),Math.min(255,Math.floor(e/Ev)))};Ct.prototype.darker=function(e){e=Math.pow(0.7,arguments.length?e:1);return CO(Math.floor(e*this.r),Math.floor(e*this.g),Math.floor(e*this.b))};Ct.prototype.hsl=function(){return Ds(this.r,this.g,this.b)};Ct.prototype.toString=function(){return"#"+BI(this.r)+BI(this.g)+BI(this.b)};function BI(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function AR(Ez,Ex,E0){var e=0,Ew=0,Ey=0,E2,E1,Ev;E2=/([a-z]+)\((.*)\)/i.exec(Ez);if(E2){E1=E2[2].split(",");switch(E2[1]){case"hsl":return E0(parseFloat(E1[0]),parseFloat(E1[1])/100,parseFloat(E1[2])/100);case"rgb":return Ex(Ch(E1[0]),Ch(E1[1]),Ch(E1[2]))}}if(Ev=x.get(Ez)){return Ex(Ev.r,Ev.g,Ev.b)}if(Ez!=null&&Ez.charAt(0)==="#"){if(Ez.length===4){e=Ez.charAt(1);e+=e;Ew=Ez.charAt(2);Ew+=Ew;Ey=Ez.charAt(3);Ey+=Ey}else{if(Ez.length===7){e=Ez.substring(1,3);Ew=Ez.substring(3,5);Ey=Ez.substring(5,7)}}e=parseInt(e,16);Ew=parseInt(Ew,16);Ey=parseInt(Ey,16)}return Ex(e,Ew,Ey)}function Ds(e,Ey,E0){var Ew=Math.min(e/=255,Ey/=255,E0/=255),E1=Math.max(e,Ey,E0),Ez=E1-Ew,Ex,E2,Ev=(E1+Ew)/2;if(Ez){E2=Ev<0.5?Ez/(E1+Ew):Ez/(2-E1-Ew);if(e==E1){Ex=(Ey-E0)/Ez+(Ey<E0?6:0)}else{if(Ey==E1){Ex=(E0-e)/Ez+2}else{Ex=(e-Ey)/Ez+4}}Ex*=60}else{E2=Ex=0}return CX(Ex,E2,Ev)}function Ch(Ev){var e=parseFloat(Ev);return Ev.charAt(Ev.length-1)==="%"?Math.round(e*2.55):e}var x=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"});x.forEach(function(e,Ev){x.set(e,AR(Ev,CO,Ac))});d3.hsl=function(Ew,Ev,e){return arguments.length===1?(Ew instanceof DB?CX(Ew.h,Ew.s,Ew.l):AR(""+Ew,Ds,CX)):CX(+Ew,+Ev,+e)};function CX(Ew,Ev,e){return new DB(Ew,Ev,e)}function DB(Ew,Ev,e){this.h=Ew;this.s=Ev;this.l=e}DB.prototype.brighter=function(e){e=Math.pow(0.7,arguments.length?e:1);return CX(this.h,this.s,this.l/e)};DB.prototype.darker=function(e){e=Math.pow(0.7,arguments.length?e:1);return CX(this.h,this.s,e*this.l)};DB.prototype.rgb=function(){return Ac(this.h,this.s,this.l)};DB.prototype.toString=function(){return this.rgb().toString()};function Ac(Ez,Ey,e){var Ex,Ew;Ez=Ez%360;if(Ez<0){Ez+=360}Ey=Ey<0?0:Ey>1?1:Ey;e=e<0?0:e>1?1:e;Ew=e<=0.5?e*(1+Ey):e+Ey-e*Ey;Ex=2*e-Ew;function Ev(E1){if(E1>360){E1-=360}else{if(E1<0){E1+=360}}if(E1<60){return Ex+(Ew-Ex)*E1/60}if(E1<180){return Ew}if(E1<240){return Ex+(Ew-Ex)*(240-E1)/60}return Ex}function E0(E1){return Math.round(Ev(E1)*255)}return CO(E0(Ez+120),E0(Ez),E0(Ez-120))}function CA(e){Ci(e,B9);return e}var Bn=function(e,Ev){return Ev.querySelector(e)},Db=function(e,Ev){return Ev.querySelectorAll(e)},CW=document.documentElement,B=CW.matchesSelector||CW.webkitMatchesSelector||CW.mozMatchesSelector||CW.msMatchesSelector||CW.oMatchesSelector,A=function(Ev,e){return B.call(Ev,e)};if(typeof Sizzle==="function"){Bn=function(e,Ev){return Sizzle(e,Ev)[0]};Db=function(e,Ev){return Sizzle.uniqueSort(Sizzle(e,Ev))};A=Sizzle.matchesSelector}var B9=[];d3.selection=function(){return D7};d3.selection.prototype=B9;B9.select=function(Ez){var Ew=[],E3,e,E2,Ex;if(typeof Ez!=="function"){Ez=S(Ez)}for(var E0=-1,Ey=this.length;++E0<Ey;){Ew.push(E3=[]);E3.parentNode=(E2=this[E0]).parentNode;for(var E1=-1,Ev=E2.length;++E1<Ev;){if(Ex=E2[E1]){E3.push(e=Ez.call(Ex,Ex.__data__,E1));if(e&&"__data__" in Ex){e.__data__=Ex.__data__}}else{E3.push(null)}}}return CA(Ew)};function S(e){return function(){return Bn(e,this)}}B9.selectAll=function(Ey){var Ev=[],E2,Ew;if(typeof Ey!=="function"){Ey=Bc(Ey)}for(var Ez=-1,Ex=this.length;++Ez<Ex;){for(var E1=this[Ez],E0=-1,e=E1.length;++E0<e;){if(Ew=E1[E0]){Ev.push(E2=B2(Ey.call(Ew,Ew.__data__,E0)));E2.parentNode=Ew}}}return CA(Ev)};function Bc(e){return function(){return Db(e,this)}}B9.attr=function(Ev,E1){Ev=d3.ns.qualify(Ev);if(arguments.length<2){var Ez=this.node();return Ev.local?Ez.getAttributeNS(Ev.space,Ev.local):Ez.getAttribute(Ev)}function Ew(){this.removeAttribute(Ev)}function Ey(){this.removeAttributeNS(Ev.space,Ev.local)}function E2(){this.setAttribute(Ev,E1)}function Ex(){this.setAttributeNS(Ev.space,Ev.local,E1)}function E0(){var E3=E1.apply(this,arguments);if(E3==null){this.removeAttribute(Ev)}else{this.setAttribute(Ev,E3)}}function e(){var E3=E1.apply(this,arguments);if(E3==null){this.removeAttributeNS(Ev.space,Ev.local)}else{this.setAttributeNS(Ev.space,Ev.local,E3)}}return this.each(E1==null?(Ev.local?Ey:Ew):(typeof E1==="function"?(Ev.local?e:E0):(Ev.local?Ex:E2)))};B9.classed=function(e,Ew){var Ex=e.split(G),Ey=Ex.length,Ev=-1;if(arguments.length>1){while(++Ev<Ey){Dy.call(this,Ex[Ev],Ew)}return this}else{while(++Ev<Ey){if(!Dy.call(this,Ex[Ev])){return false}}return true}};var G=/\s+/g;function Dy(e,Ey){var Ev=new RegExp("(^|\\s+)"+d3.requote(e)+"(\\s+|$)","g");if(arguments.length<2){var Ex=this.node();if(E1=Ex.classList){return E1.contains(e)}var E1=Ex.className;Ev.lastIndex=0;return Ev.test(E1.baseVal!=null?E1.baseVal:E1)}function E0(){if(E4=this.classList){return E4.add(e)}var E4=this.className,E2=E4.baseVal!=null,E3=E2?E4.baseVal:E4;Ev.lastIndex=0;if(!Ev.test(E3)){E3=BR(E3+" "+e);if(E2){E4.baseVal=E3}else{this.className=E3}}}function Ez(){if(E4=this.classList){return E4.remove(e)}var E4=this.className,E2=E4.baseVal!=null,E3=E2?E4.baseVal:E4;E3=BR(E3.replace(Ev," "));if(E2){E4.baseVal=E3}else{this.className=E3}}function Ew(){(Ey.apply(this,arguments)?E0:Ez).call(this)}return this.each(typeof Ey==="function"?Ew:Ey?E0:Ez)}B9.style=function(Ew,Ez,Ex){if(arguments.length<3){Ex=""}if(arguments.length<2){return window.getComputedStyle(this.node(),null).getPropertyValue(Ew)}function Ev(){this.style.removeProperty(Ew)}function Ey(){this.style.setProperty(Ew,Ez,Ex)}function e(){var E0=Ez.apply(this,arguments);if(E0==null){this.style.removeProperty(Ew)}else{this.style.setProperty(Ew,E0,Ex)}}return this.each(Ez==null?Ev:(typeof Ez==="function"?e:Ey))};B9.property=function(Ev,Ex){if(arguments.length<2){return this.node()[Ev]}function e(){delete this[Ev]}function Ew(){this[Ev]=Ex}function Ey(){var Ez=Ex.apply(this,arguments);if(Ez==null){delete this[Ev]}else{this[Ev]=Ez}}return this.each(Ex==null?e:(typeof Ex==="function"?Ey:Ew))};B9.text=function(e){return arguments.length<1?this.node().textContent:this.each(typeof e==="function"?function(){var Ev=e.apply(this,arguments);this.textContent=Ev==null?"":Ev}:e==null?function(){this.textContent=""}:function(){this.textContent=e})};B9.html=function(e){return arguments.length<1?this.node().innerHTML:this.each(typeof e==="function"?function(){var Ev=e.apply(this,arguments);this.innerHTML=Ev==null?"":Ev}:e==null?function(){this.innerHTML=""}:function(){this.innerHTML=e})};B9.append=function(Ev){Ev=d3.ns.qualify(Ev);function e(){return this.appendChild(document.createElementNS(this.namespaceURI,Ev))}function Ew(){return this.appendChild(document.createElementNS(Ev.space,Ev.local))}return this.select(Ev.local?Ew:e)};B9.insert=function(e,Ew){e=d3.ns.qualify(e);function Ev(){return this.insertBefore(document.createElementNS(this.namespaceURI,e),Bn(Ew,this))}function Ex(){return this.insertBefore(document.createElementNS(e.space,e.local),Bn(Ew,this))}return this.select(e.local?Ex:Ev)};B9.remove=function(){return this.each(function(){var e=this.parentNode;if(e){e.removeChild(this)}})};B9.data=function(E1,E3){var Ey=-1,Ev=this.length,E2,Ew;if(!arguments.length){E1=new Array(Ev=(E2=this[0]).length);while(++Ey<Ev){if(Ew=E2[Ey]){E1[Ey]=Ew.__data__}}return E1}function Ez(FG,E8){var FB,E5=FG.length,E7=E8.length,FE=Math.min(E5,E7),FD=Math.max(E5,E7),FI=[],FF=[],FC=[],E6,E4;if(E3){var FJ=new AK,FH=[],FA,E9=E8.length;for(FB=-1;++FB<E5;){FA=E3.call(E6=FG[FB],E6.__data__,FB);if(FJ.has(FA)){FC[E9++]=E6}else{FJ.set(FA,E6)}FH.push(FA)}for(FB=-1;++FB<E7;){FA=E3.call(E8,E4=E8[FB],FB);if(FJ.has(FA)){FI[FB]=E6=FJ.get(FA);E6.__data__=E4;FF[FB]=FC[FB]=null}else{FF[FB]=b(E4);FI[FB]=FC[FB]=null}FJ.remove(FA)}for(FB=-1;++FB<E5;){if(FJ.has(FH[FB])){FC[FB]=FG[FB]}}}else{for(FB=-1;++FB<FE;){E6=FG[FB];E4=E8[FB];if(E6){E6.__data__=E4;FI[FB]=E6;FF[FB]=FC[FB]=null}else{FF[FB]=b(E4);FI[FB]=FC[FB]=null}}for(;FB<E7;++FB){FF[FB]=b(E8[FB]);FI[FB]=FC[FB]=null}for(;FB<FD;++FB){FC[FB]=FG[FB];FF[FB]=FI[FB]=null}}FF.update=FI;FF.parentNode=FI.parentNode=FC.parentNode=FG.parentNode;E0.push(FF);Ex.push(FI);e.push(FC)}var E0=Az([]),Ex=CA([]),e=CA([]);if(typeof E1==="function"){while(++Ey<Ev){Ez(E2=this[Ey],E1.call(E2,E2.parentNode.__data__,Ey))}}else{while(++Ey<Ev){Ez(E2=this[Ey],E1)}}Ex.enter=function(){return E0};Ex.exit=function(){return e};return Ex};function b(e){return{__data__:e}}B9.datum=B9.map=function(e){return arguments.length<1?this.property("__data__"):this.property("__data__",e)};B9.filter=function(e){var Ew=[],E2,E1,Ex;if(typeof e!=="function"){e=AY(e)}for(var Ez=0,Ey=this.length;Ez<Ey;Ez++){Ew.push(E2=[]);E2.parentNode=(E1=this[Ez]).parentNode;for(var E0=0,Ev=E1.length;E0<Ev;E0++){if((Ex=E1[E0])&&e.call(Ex,Ex.__data__,E0)){E2.push(Ex)}}}return CA(Ew)};function AY(e){return function(){return A(this,e)}}B9.order=function(){for(var Ev=-1,e=this.length;++Ev<e;){for(var Ez=this[Ev],Ew=Ez.length-1,Ex=Ez[Ew],Ey;--Ew>=0;){if(Ey=Ez[Ew]){if(Ex&&Ex!==Ey.nextSibling){Ex.parentNode.insertBefore(Ey,Ex)}Ex=Ey}}}return this};B9.sort=function(Ev){Ev=D3.apply(this,arguments);for(var Ew=-1,e=this.length;++Ew<e;){this[Ew].sort(Ev)}return this.order()};function D3(e){if(!arguments.length){e=d3.ascending}return function(Ew,Ev){return e(Ew&&Ew.__data__,Ev&&Ev.__data__)}}B9.on=function(Ex,Ey,e){if(arguments.length<3){e=false}var Ev="__on"+Ex,Ew=Ex.indexOf(".");if(Ew>0){Ex=Ex.substring(0,Ew)}if(arguments.length<2){return(Ew=this.node()[Ev])&&Ew._}return this.each(function(E3,E0){var E1=this,E2=E1[Ev];if(E2){E1.removeEventListener(Ex,E2,E2.$);delete E1[Ev]}if(Ey){E1.addEventListener(Ex,E1[Ev]=Ez,Ez.$=e);Ez._=Ey}function Ez(E4){var E5=d3.event;d3.event=E4;try{Ey.call(E1,E1.__data__,E0)}finally{d3.event=E5}}})};B9.each=function(E0){for(var Ev=-1,e=this.length;++Ev<e;){for(var Ey=this[Ev],Ew=-1,Ez=Ey.length;++Ew<Ez;){var Ex=Ey[Ew];if(Ex){E0.call(Ex,Ex.__data__,Ew,Ev)}}}return this};B9.call=function(e){e.apply(this,(arguments[0]=this,arguments));return this};B9.empty=function(){return !this.node()};B9.node=function(E0){for(var Ev=0,e=this.length;Ev<e;Ev++){for(var Ey=this[Ev],Ew=0,Ez=Ey.length;Ew<Ez;Ew++){var Ex=Ey[Ew];if(Ex){return Ex}}}return null};B9.transition=function(){var Ev=[],Ew,Ez;for(var Ex=-1,e=this.length;++Ex<e;){Ev.push(Ew=[]);for(var E0=this[Ex],Ey=-1,E1=E0.length;++Ey<E1;){Ew.push((Ez=E0[Ey])?{node:Ez,delay:Cn,duration:EE}:null)}}return D5(Ev,EL||++EZ,Date.now())};var D7=CA([[document]]);D7[0].parentNode=CW;d3.select=function(e){return typeof e==="string"?D7.select(e):CA([[e]])};d3.selectAll=function(e){return typeof e==="string"?D7.selectAll(e):CA([B2(e)])};function Az(e){Ci(e,Cq);return e}var Cq=[];d3.selection.enter=Az;d3.selection.enter.prototype=Cq;Cq.append=B9.append;Cq.insert=B9.insert;Cq.empty=B9.empty;Cq.node=B9.node;Cq.select=function(Ez){var Ew=[],E4,e,E2,E3,Ey;for(var E0=-1,Ex=this.length;++E0<Ex;){E2=(E3=this[E0]).update;Ew.push(E4=[]);E4.parentNode=E3.parentNode;for(var E1=-1,Ev=E3.length;++E1<Ev;){if(Ey=E3[E1]){E4.push(E2[E1]=e=Ez.call(E3.parentNode,Ey.__data__,E1));e.__data__=Ey.__data__}else{E4.push(null)}}}return CA(Ew)};function D5(e,Ez,Ex){Ci(e,CR);var Ew=new AK,Ev=d3.dispatch("start","end"),Ey=Ad;e.id=Ez;e.time=Ex;e.tween=function(E0,E1){if(arguments.length<2){return Ew.get(E0)}if(E1==null){Ew.remove(E0)}else{Ew.set(E0,E1)}return e};e.ease=function(E0){if(!arguments.length){return Ey}Ey=typeof E0==="function"?E0:d3.ease.apply(d3,arguments);return e};e.each=function(E0,E1){if(arguments.length<2){return B3.call(e,E0)}Ev.on(E0,E1);return e};d3.timer(function(E0){e.each(function(E8,E5,E4){var FA=[],E2=this,E6=e[E4][E5].delay,E3=e[E4][E5].duration,FB=E2.__transition__||(E2.__transition__={active:0,count:0});++FB.count;E6<=E0?E1(E0):d3.timer(E1,E6,Ex);function E1(FC){if(FB.active>Ez){return E9()}FB.active=Ez;Ew.forEach(function(FD,FE){if(tween=FE.call(E2,E8,E5)){FA.push(tween)}});Ev.start.call(E2,E8,E5);if(!E7(FC)){d3.timer(E7,0,Ex)}return 1}function E7(FC){if(FB.active!==Ez){return E9()}var FD=(FC-E6)/E3,FE=Ey(FD),FF=FA.length;while(FF>0){FA[--FF].call(E2,FE)}if(FD>=1){E9();EL=Ez;Ev.end.call(E2,E8,E5);EL=0;return 1}}function E9(){if(!--FB.count){delete E2.__transition__}return 1}});return 1},0,Ex);return e}var Q={};function EC(Ew,Ev,e){return e!=""&&Q}function E(Ex,e){var Ew=DD(Ex);function Ev(E2,E1,Ez){var E0=e.call(this,E2,E1);return E0==null?Ez!=""&&Q:Ez!=E0&&Ew(Ez,E0)}function Ey(E1,E0,Ez){return Ez!=e&&Ew(Ez,e)}return typeof e==="function"?Ev:e==null?EC:(e+="",Ey)}var CR=[],EZ=0,EL=0,D=0,EA=250,C3=d3.ease("cubic-in-out"),Cn=D,EE=EA,Ad=C3;CR.call=B9.call;d3.transition=function(e){return arguments.length?(EL?e.transition():e):D7.transition()};d3.transition.prototype=CR;CR.select=function(Ez){var Ew=[],E3,e,Ex;if(typeof Ez!=="function"){Ez=S(Ez)}for(var E0=-1,Ey=this.length;++E0<Ey;){Ew.push(E3=[]);for(var E2=this[E0],E1=-1,Ev=E2.length;++E1<Ev;){if((Ex=E2[E1])&&(e=Ez.call(Ex.node,Ex.node.__data__,E1))){if("__data__" in Ex.node){e.__data__=Ex.node.__data__}E3.push({node:e,delay:Ex.delay,duration:Ex.duration})}else{E3.push(null)}}}return D5(Ew,this.id,this.time).ease(this.ease())};CR.selectAll=function(E0){var Ex=[],E5,e,Ey;if(typeof E0!=="function"){E0=Bc(E0)}for(var E2=-1,Ez=this.length;++E2<Ez;){for(var E4=this[E2],E3=-1,Ew=E4.length;++E3<Ew;){if(Ey=E4[E3]){e=E0.call(Ey.node,Ey.node.__data__,E3);Ex.push(E5=[]);for(var E1=-1,Ev=e.length;++E1<Ev;){E5.push({node:e[E1],delay:Ey.delay,duration:Ey.duration})}}}}return D5(Ex,this.id,this.time).ease(this.ease())};CR.attr=function(e,Ev){return this.attrTween(e,E(e,Ev))};CR.attrTween=function(e,Ew){var Ev=d3.ns.qualify(e);function Ex(E1,Ez){var E0=Ew.call(this,E1,Ez,this.getAttribute(Ev));return E0===Q?(this.removeAttribute(Ev),null):E0&&function(E2){this.setAttribute(Ev,E0(E2))}}function Ey(E1,Ez){var E0=Ew.call(this,E1,Ez,this.getAttributeNS(Ev.space,Ev.local));return E0===Q?(this.removeAttributeNS(Ev.space,Ev.local),null):E0&&function(E2){this.setAttributeNS(Ev.space,Ev.local,E0(E2))}}return this.tween("attr."+e,Ev.local?Ey:Ex)};CR.style=function(e,Ew,Ev){if(arguments.length<3){Ev=""}return this.styleTween(e,E(e,Ew),Ev)};CR.styleTween=function(e,Ew,Ev){if(arguments.length<3){Ev=""}return this.tween("style."+e,function(Ez,Ex){var Ey=Ew.call(this,Ez,Ex,window.getComputedStyle(this,null).getPropertyValue(e));return Ey===Q?(this.style.removeProperty(e),null):Ey&&function(E0){this.style.setProperty(e,Ey(E0),Ev)}})};CR.text=function(e){return this.tween("text",function(Ew,Ev){this.textContent=typeof e==="function"?e.call(this,Ew,Ev):e})};CR.remove=function(){return this.each("end.transition",function(){var e;if(!this.__transition__&&(e=this.parentNode)){e.removeChild(this)}})};CR.delay=function(Ev){var e=this;return e.each(typeof Ev==="function"?function(Ey,Ex,Ew){e[Ew][Ex].delay=Ev.apply(this,arguments)|0}:(Ev=Ev|0,function(Ey,Ex,Ew){e[Ew][Ex].delay=Ev}))};CR.duration=function(Ev){var e=this;return e.each(typeof Ev==="function"?function(Ey,Ex,Ew){e[Ew][Ex].duration=Math.max(1,Ev.apply(this,arguments)|0)}:(Ev=Math.max(1,Ev|0),function(Ey,Ex,Ew){e[Ew][Ex].duration=Ev}))};function B3(E4){var e=EL,Ey=Ad,E2=Cn,Ez=EE;EL=this.id;Ad=this.ease();for(var E0=0,Ex=this.length;E0<Ex;E0++){for(var E3=this[E0],E1=0,Ev=E3.length;E1<Ev;E1++){var Ew=E3[E1];if(Ew){Cn=this[E0][E1].delay;EE=this[E0][E1].duration;E4.call(Ew=Ew.node,Ew.__data__,E1,E0)}}}EL=e;Ad=Ey;Cn=E2;EE=Ez;return this}CR.transition=function(){return this.select(t)};var A6=null,BE,C1;d3.timer=function(Ez,e,Ey){var Ex=false,Ew,Ev=A6;if(arguments.length<3){if(arguments.length<2){e=0}else{if(!isFinite(e)){return}}Ey=Date.now()}while(Ev){if(Ev.callback===Ez){Ev.then=Ey;Ev.delay=e;Ex=true;break}Ew=Ev;Ev=Ev.next}if(!Ex){A6={callback:Ez,then:Ey,delay:e,next:A6}}if(!BE){C1=clearTimeout(C1);BE=1;EU(EV)}};function EV(){var e,Ew=Date.now(),Ex=A6;while(Ex){e=Ew-Ex.then;if(e>=Ex.delay){Ex.flush=Ex.callback(e)}Ex=Ex.next}var Ev=Cs()-Ew;if(Ev>24){if(isFinite(Ev)){clearTimeout(C1);C1=setTimeout(EV,Ev)}BE=0}else{BE=1;EU(EV)}}d3.timer.flush=function(){var e,Ev=Date.now(),Ew=A6;while(Ew){e=Ev-Ew.then;if(!Ew.delay){Ew.flush=Ew.callback(e)}Ew=Ew.next}Cs()};function Cs(){var Ev=null,e=A6,Ew=Infinity;while(e){if(e.flush){e=Ev?Ev.next=e.next:A6=e.next}else{Ew=Math.min(Ew,e.then+e.delay);e=(Ev=e).next}}return Ew}var EU=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,17)};d3.transform=function(Ev){var Ew=document.createElementNS(d3.ns.prefix.svg,"g"),e={a:1,b:0,c:0,d:1,e:0,f:0};return(d3.transform=function(Ex){Ew.setAttribute("transform",Ex);var Ey=Ew.transform.baseVal.consolidate();return new N(Ey?Ey.matrix:e)})(Ev)};function N(e){var Ex=[e.a,e.b],Ev=[e.c,e.d],Ez=DA(Ex),Ew=Cj(Ex,Ev),Ey=DA(Ax(Ev,Ex,-Ew))||0;if(Ex[0]*Ev[1]<Ev[0]*Ex[1]){Ex[0]*=-1;Ex[1]*=-1;Ez*=-1;Ew*=-1}this.rotate=(Ez?Math.atan2(Ex[1],Ex[0]):Math.atan2(-Ev[0],Ev[1]))*CY;this.translate=[e.e,e.f];this.scale=[Ez,Ey];this.skew=Ey?Math.atan2(Ew,Ey)*CY:0}N.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};function Cj(Ev,e){return Ev[0]*e[0]+Ev[1]*e[1]}function DA(e){var Ev=Math.sqrt(Cj(e,e));if(Ev){e[0]/=Ev;e[1]/=Ev}return Ev}function Ax(Ev,e,Ew){Ev[0]+=Ew*e[0];Ev[1]+=Ew*e[1];return Ev}var CY=180/Math.PI;d3.mouse=function(e){return AS(e,u())};var BP=/WebKit/.test(navigator.userAgent)?-1:0;function AS(Ex,E0){var Ey=Ex.ownerSVGElement||Ex;if(Ey.createSVGPoint){var Ev=Ey.createSVGPoint();if((BP<0)&&(window.scrollX||window.scrollY)){Ey=d3.select(document.body).append("svg").style("position","absolute").style("top",0).style("left",0);var Ew=Ey[0][0].getScreenCTM();BP=!(Ew.f||Ew.e);Ey.remove()}if(BP){Ev.x=E0.pageX;Ev.y=E0.pageY}else{Ev.x=E0.clientX;Ev.y=E0.clientY}Ev=Ev.matrixTransform(Ex.getScreenCTM().inverse());return[Ev.x,Ev.y]}var Ez=Ex.getBoundingClientRect();return[E0.clientX-Ez.left-Ex.clientLeft,E0.clientY-Ez.top-Ex.clientTop]}d3.touches=function(e,Ev){if(arguments.length<2){Ev=u().touches}return Ev?B2(Ev).map(function(Ex){var Ew=AS(e,Ex);Ew.identifier=Ex.identifier;return Ew}):[]};function AJ(){}d3.scale={};function CP(Ev){var Ew=Ev[0],e=Ev[Ev.length-1];return Ew<e?[Ew,e]:[e,Ew]}function AT(e){return e.rangeExtent?e.rangeExtent():CP(e.range())}function Dk(E0,Ey){var Ez=0,Ex=E0.length-1,Ew=E0[Ez],Ev=E0[Ex],e;if(Ev<Ew){e=Ez;Ez=Ex;Ex=e;e=Ew;Ew=Ev;Ev=e}if(e=Ev-Ew){Ey=Ey(e);E0[Ez]=Ey.floor(Ew);E0[Ex]=Ey.ceil(Ev)}return E0}function Cc(){return Math}d3.scale.linear=function(){return CM([0,1],[0,1],d3.interpolate,false)};function CM(Ez,Ex,Ey,E1){var Ew,Ev;function e(){var E2=Math.min(Ez.length,Ex.length)>2?f:AI,E3=E1?AF:EW;Ew=E2(Ez,Ex,E3,Ey);Ev=E2(Ex,Ez,E3,d3.interpolate);return E0}function E0(E2){return Ew(E2)}E0.invert=function(E2){return Ev(E2)};E0.domain=function(E2){if(!arguments.length){return Ez}Ez=E2.map(Number);return e()};E0.range=function(E2){if(!arguments.length){return Ex}Ex=E2;return e()};E0.rangeRound=function(E2){return E0.range(E2).interpolate(d3.interpolateRound)};E0.clamp=function(E2){if(!arguments.length){return E1}E1=E2;return e()};E0.interpolate=function(E2){if(!arguments.length){return Ey}Ey=E2;return e()};E0.ticks=function(E2){return Cm(Ez,E2)};E0.tickFormat=function(E2){return Cw(Ez,E2)};E0.nice=function(){Dk(Ez,AM);return e()};E0.copy=function(){return CM(Ez,Ex,Ey,E1)};return e()}function Dc(Ev,e){return d3.rebind(Ev,e,"range","rangeRound","interpolate","clamp")}function AM(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return{floor:function(Ev){return Math.floor(Ev/e)*e},ceil:function(Ev){return Math.ceil(Ev/e)*e}}}function O(Ez,e){var Ew=CP(Ez),Ev=Ew[1]-Ew[0],Ey=Math.pow(10,Math.floor(Math.log(Ev/e)/Math.LN10)),Ex=e/Ev*Ey;if(Ex<=0.15){Ey*=10}else{if(Ex<=0.35){Ey*=5}else{if(Ex<=0.75){Ey*=2}}}Ew[0]=Math.ceil(Ew[0]/Ey)*Ey;Ew[1]=Math.floor(Ew[1]/Ey)*Ey+Ey*0.5;Ew[2]=Ey;return Ew}function Cm(Ev,e){return d3.range.apply(d3,O(Ev,e))}function Cw(Ev,e){return d3.format(",."+Math.max(0,-Math.floor(Math.log(O(Ev,e)[2])/Math.LN10+0.01))+"f")}function AI(Ey,e,Ez,Ew){var Ev=Ez(Ey[0],Ey[1]),Ex=Ew(e[0],e[1]);return function(E0){return Ex(Ev(E0))}}function f(E0,Ev,E1,Ey){var Ex=[],Ez=[],Ew=0,e=Math.min(E0.length,Ev.length)-1;if(E0[e]<E0[0]){E0=E0.slice().reverse();Ev=Ev.slice().reverse()}while(++Ew<=e){Ex.push(E1(E0[Ew-1],E0[Ew]));Ez.push(Ey(Ev[Ew-1],Ev[Ew]))}return function(E2){var E3=d3.bisect(E0,E2,1,e)-1;return Ez[E3](Ex[E3](E2))}}d3.scale.log=function(){return D1(d3.scale.linear(),Dd)};function D1(e,Ev){var Ew=Ev.pow;function Ex(Ey){return e(Ev(Ey))}Ex.invert=function(Ey){return Ew(e.invert(Ey))};Ex.domain=function(Ey){if(!arguments.length){return e.domain().map(Ew)}Ev=Ey[0]<0?Dg:Dd;Ew=Ev.pow;e.domain(Ey.map(Ev));return Ex};Ex.nice=function(){e.domain(Dk(e.domain(),Cc));return Ex};Ex.ticks=function(){var E3=CP(e.domain()),E4=[];if(E3.every(isFinite)){var E2=Math.floor(E3[0]),E1=Math.ceil(E3[1]),E0=Ew(E3[0]),Ez=Ew(E3[1]);if(Ev===Dg){E4.push(Ew(E2));for(;E2++<E1;){for(var Ey=9;Ey>0;Ey--){E4.push(Ew(E2)*Ey)}}}else{for(;E2<E1;E2++){for(var Ey=1;Ey<10;Ey++){E4.push(Ew(E2)*Ey)}}E4.push(Ew(E2))}for(E2=0;E4[E2]<E0;E2++){}for(E1=E4.length;E4[E1-1]>Ez;E1--){}E4=E4.slice(E2,E1)}return E4};Ex.tickFormat=function(E2,E1){if(arguments.length<2){E1=Bo}if(arguments.length<1){return E1}var Ey=E2/Ex.ticks().length,Ez=Ev===Dg?(E0=-1e-12,Math.floor):(E0=1e-12,Math.ceil),E0;return function(E3){return E3/Ew(Ez(Ev(E3)+E0))<Ey?E1(E3):""}};Ex.copy=function(){return D1(e.copy(),Ev)};return Dc(Ex,e)}var Bo=d3.format(".0e");function Dd(e){return Math.log(e<0?0:e)/Math.LN10}function Dg(e){return -Math.log(e>0?0:-e)/Math.LN10}Dd.pow=function(e){return Math.pow(10,e)};Dg.pow=function(e){return -Math.pow(10,-e)};d3.scale.pow=function(){return Dp(d3.scale.linear(),1)};function Dp(e,Ew){var Ev=DU(Ew),Ex=DU(1/Ew);function Ey(Ez){return e(Ev(Ez))}Ey.invert=function(Ez){return Ex(e.invert(Ez))};Ey.domain=function(Ez){if(!arguments.length){return e.domain().map(Ex)}e.domain(Ez.map(Ev));return Ey};Ey.ticks=function(Ez){return Cm(Ey.domain(),Ez)};Ey.tickFormat=function(Ez){return Cw(Ey.domain(),Ez)};Ey.nice=function(){return Ey.domain(Dk(Ey.domain(),AM))};Ey.exponent=function(Ez){if(!arguments.length){return Ew}var E0=Ey.domain();Ev=DU(Ew=Ez);Ex=DU(1/Ew);return Ey.domain(E0)};Ey.copy=function(){return Dp(e.copy(),Ew)};return Dc(Ey,e)}function DU(Ev){return function(e){return e<0?-Math.pow(-e,Ev):Math.pow(e,Ev)}}d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){return BF([],{t:"range",x:[]})};function BF(Ez,Ew){var Ey,Ev,Ex;function E0(E1){return Ev[((Ey.get(E1)||Ey.set(E1,Ez.push(E1)))-1)%Ev.length]}function e(E2,E1){return d3.range(Ez.length).map(function(E3){return E2+E1*E3})}E0.domain=function(E1){if(!arguments.length){return Ez}Ez=[];Ey=new AK;var E3=-1,E4=E1.length,E2;while(++E3<E4){if(!Ey.has(E2=E1[E3])){Ey.set(E2,Ez.push(E2))}}return E0[Ew.t](Ew.x,Ew.p)};E0.range=function(E1){if(!arguments.length){return Ev}Ev=E1;Ex=0;Ew={t:"range",x:E1};return E0};E0.rangePoints=function(E1,E4){if(arguments.length<2){E4=0}var E5=E1[0],E2=E1[1],E3=(E2-E5)/(Ez.length-1+E4);Ev=e(Ez.length<2?(E5+E2)/2:E5+E3*E4/2,E3);Ex=0;Ew={t:"rangePoints",x:E1,p:E4};return E0};E0.rangeBands=function(E1,E5){if(arguments.length<2){E5=0}var E2=E1[1]<E1[0],E6=E1[E2-0],E3=E1[1-E2],E4=(E3-E6)/(Ez.length+E5);Ev=e(E6+E4*E5,E4);if(E2){Ev.reverse()}Ex=E4*(1-E5);Ew={t:"rangeBands",x:E1,p:E5};return E0};E0.rangeRoundBands=function(E1,E6){if(arguments.length<2){E6=0}var E3=E1[1]<E1[0],E7=E1[E3-0],E4=E1[1-E3],E5=Math.floor((E4-E7)/(Ez.length+E6)),E2=E4-E7-(Ez.length-E6)*E5;Ev=e(E7+Math.round(E2/2),E5);if(E3){Ev.reverse()}Ex=Math.round(E5*(1-E6));Ew={t:"rangeRoundBands",x:E1,p:E6};return E0};E0.rangeBand=function(){return Ex};E0.rangeExtent=function(){return CP(Ew.x)};E0.copy=function(){return BF(Ez,Ew)};return E0.domain(Ez)}d3.scale.category10=function(){return d3.scale.ordinal().range(BM)};d3.scale.category20=function(){return d3.scale.ordinal().range(BA)};d3.scale.category20b=function(){return d3.scale.ordinal().range(EK)};d3.scale.category20c=function(){return d3.scale.ordinal().range(EJ)};var BM=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var BA=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];var EK=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"];var EJ=["#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(Ew,Ev){var Ex;function e(){var Ez=0,E1=Ew.length,E0=Ev.length;Ex=[];while(++Ez<E0){Ex[Ez-1]=d3.quantile(Ew,Ez/E0)}return Ey}function Ey(Ez){if(isNaN(Ez=+Ez)){return NaN}return Ev[d3.bisect(Ex,Ez)]}Ey.domain=function(Ez){if(!arguments.length){return Ew}Ew=Ez.filter(function(E0){return !isNaN(E0)}).sort(d3.ascending);return e()};Ey.range=function(Ez){if(!arguments.length){return Ev}Ev=Ez;return e()};Ey.quantiles=function(){return Ex};Ey.copy=function(){return V(Ew,Ev)};return e()}d3.scale.quantize=function(){return By(0,1,[0,1])};function By(Ey,Ew,Ev){var Ez,Ex;function E0(E1){return Ev[Math.max(0,Math.min(Ex,Math.floor(Ez*(E1-Ey))))]}function e(){Ez=Ev.length/(Ew-Ey);Ex=Ev.length-1;return E0}E0.domain=function(E1){if(!arguments.length){return[Ey,Ew]}Ey=+E1[0];Ew=+E1[E1.length-1];return e()};E0.range=function(E1){if(!arguments.length){return Ev}Ev=E1;return e()};E0.copy=function(){return By(Ey,Ew,Ev)};return e()}d3.scale.identity=function(){return Cd([0,1])};function Cd(Ev){function e(Ew){return +Ew}e.invert=e;e.domain=e.range=function(Ew){if(!arguments.length){return Ev}Ev=Ew.map(e);return e};e.ticks=function(Ew){return Cm(Ev,Ew)};e.tickFormat=function(Ew){return Cw(Ev,Ew)};e.copy=function(){return Cd(Ev)};return e}d3.svg={};d3.svg.arc=function(){var Ey=An,Ex=BV,Ew=Dh,e=AA;function Ev(){var E2=Ey.apply(this,arguments),E1=Ex.apply(this,arguments),E0=Ew.apply(this,arguments)+Ec,Ez=e.apply(this,arguments)+Ec,E8=(Ez<E0&&(E8=E0,E0=Ez,Ez=E8),Ez-E0),E5=E8<Math.PI?"0":"1",E4=Math.cos(E0),E7=Math.sin(E0),E3=Math.cos(Ez),E6=Math.sin(Ez);return E8>=Eh?(E2?"M0,"+E1+"A"+E1+","+E1+" 0 1,1 0,"+(-E1)+"A"+E1+","+E1+" 0 1,1 0,"+E1+"M0,"+E2+"A"+E2+","+E2+" 0 1,0 0,"+(-E2)+"A"+E2+","+E2+" 0 1,0 0,"+E2+"Z":"M0,"+E1+"A"+E1+","+E1+" 0 1,1 0,"+(-E1)+"A"+E1+","+E1+" 0 1,1 0,"+E1+"Z"):(E2?"M"+E1*E4+","+E1*E7+"A"+E1+","+E1+" 0 "+E5+",1 "+E1*E3+","+E1*E6+"L"+E2*E3+","+E2*E6+"A"+E2+","+E2+" 0 "+E5+",0 "+E2*E4+","+E2*E7+"Z":"M"+E1*E4+","+E1*E7+"A"+E1+","+E1+" 0 "+E5+",1 "+E1*E3+","+E1*E6+"L0,0Z")}Ev.innerRadius=function(Ez){if(!arguments.length){return Ey}Ey=d3.functor(Ez);return Ev};Ev.outerRadius=function(Ez){if(!arguments.length){return Ex}Ex=d3.functor(Ez);return Ev};Ev.startAngle=function(Ez){if(!arguments.length){return Ew}Ew=d3.functor(Ez);return Ev};Ev.endAngle=function(Ez){if(!arguments.length){return e}e=d3.functor(Ez);return Ev};Ev.centroid=function(){var E0=(Ey.apply(this,arguments)+Ex.apply(this,arguments))/2,Ez=(Ew.apply(this,arguments)+e.apply(this,arguments))/2+Ec;return[Math.cos(Ez)*E0,Math.sin(Ez)*E0]};return Ev};var Ec=-Math.PI/2,Eh=2*Math.PI-0.000001;function An(e){return e.innerRadius}function BV(e){return e.outerRadius}function Dh(e){return e.startAngle}function AA(e){return e.endAngle}function Cv(Ev){var e=D9,E0=D8,Ex=CE,Ez=A7.get(Ex),Ey=0.7;function Ew(E1){return E1.length<1?null:"M"+Ez(Ev(AH(this,E1,e,E0)),Ey)}Ew.x=function(E1){if(!arguments.length){return e}e=E1;return Ew};Ew.y=function(E1){if(!arguments.length){return E0}E0=E1;return Ew};Ew.interpolate=function(E1){if(!arguments.length){return Ex}if(!A7.has(E1+="")){E1=CE}Ez=A7.get(Ex=E1);return Ew};Ew.tension=function(E1){if(!arguments.length){return Ey}Ey=E1;return Ew};return Ew}d3.svg.line=function(){return Cv(Object)};function AH(E3,Ey,E0,Ez){var E2=[],Ex=-1,e=Ey.length,Ew=typeof E0==="function",Ev=typeof Ez==="function",E1;if(Ew&&Ev){while(++Ex<e){E2.push([E0.call(E3,E1=Ey[Ex],Ex),Ez.call(E3,E1,Ex)])}}else{if(Ew){while(++Ex<e){E2.push([E0.call(E3,Ey[Ex],Ex),Ez])}}else{if(Ev){while(++Ex<e){E2.push([E0,Ez.call(E3,Ey[Ex],Ex)])}}else{while(++Ex<e){E2.push([E0,Ez])}}}}return E2}function D9(e){return e[0]}function D8(e){return e[1]}var CE="linear";var A7=d3.map({linear:Ek,"step-before":Ah,"step-after":EY,basis:C0,"basis-open":Ae,"basis-closed":BT,bundle:BU,cardinal:B7,"cardinal-open":A4,"cardinal-closed":P,monotone:Bl});function Ek(Ev){var e=0,Ey=Ev.length,Ex=Ev[0],Ew=[Ex[0],",",Ex[1]];while(++e<Ey){Ew.push("L",(Ex=Ev[e])[0],",",Ex[1])}return Ew.join("")}function Ah(Ev){var e=0,Ey=Ev.length,Ex=Ev[0],Ew=[Ex[0],",",Ex[1]];while(++e<Ey){Ew.push("V",(Ex=Ev[e])[1],"H",Ex[0])}return Ew.join("")}function EY(Ev){var e=0,Ey=Ev.length,Ex=Ev[0],Ew=[Ex[0],",",Ex[1]];while(++e<Ey){Ew.push("H",(Ex=Ev[e])[0],"V",Ex[1])}return Ew.join("")}function A4(Ev,e){return Ev.length<4?Ek(Ev):Ev[1]+BZ(Ev.slice(1,Ev.length-1),A0(Ev,e))}function P(Ev,e){return Ev.length<3?Ek(Ev):Ev[0]+BZ((Ev.push(Ev[0]),Ev),A0([Ev[Ev.length-2]].concat(Ev,[Ev[1]]),e))}function B7(Ew,Ev,e){return Ew.length<3?Ek(Ew):Ew[0]+BZ(Ew,A0(Ew,Ev))}function BZ(E0,Ez){if(Ez.length<1||(E0.length!=Ez.length&&E0.length!=Ez.length+2)){return Ek(E0)}var E1=E0.length!=Ez.length,E4="",E2=E0[0],e=E0[1],Ey=Ez[0],E3=Ey,Ew=1;if(E1){E4+="Q"+(e[0]-Ey[0]*2/3)+","+(e[1]-Ey[1]*2/3)+","+e[0]+","+e[1];E2=E0[1];Ew=2}if(Ez.length>1){E3=Ez[1];e=E0[Ew];Ew++;E4+="C"+(E2[0]+Ey[0])+","+(E2[1]+Ey[1])+","+(e[0]-E3[0])+","+(e[1]-E3[1])+","+e[0]+","+e[1];for(var Ev=2;Ev<Ez.length;Ev++,Ew++){e=E0[Ew];E3=Ez[Ev];E4+="S"+(e[0]-E3[0])+","+(e[1]-E3[1])+","+e[0]+","+e[1]}}if(E1){var Ex=E0[Ew];E4+="Q"+(e[0]+E3[0]*2/3)+","+(e[1]+E3[1]*2/3)+","+Ex[0]+","+Ex[1]}return E4}function A0(E0,Ey){var Ew=[],Ex=(1-Ey)/2,E2,E1=E0[0],Ez=E0[1],Ev=1,e=E0.length;while(++Ev<e){E2=E1;E1=Ez;Ez=E0[Ev];Ew.push([Ex*(Ez[0]-E2[0]),Ex*(Ez[1]-E2[1])])}return Ew}function C0(E1){if(E1.length<3){return Ek(E1)}var Ew=1,Ev=E1.length,Ex=E1[0],e=Ex[0],Ez=Ex[1],E0=[e,e,e,(Ex=E1[1])[0]],Ey=[Ez,Ez,Ez,Ex[1]],E2=[e,",",Ez];Au(E2,E0,Ey);while(++Ew<Ev){Ex=E1[Ew];E0.shift();E0.push(Ex[0]);Ey.shift();Ey.push(Ex[1]);Au(E2,E0,Ey)}Ew=-1;while(++Ew<2){E0.shift();E0.push(Ex[0]);Ey.shift();Ey.push(Ex[1]);Au(E2,E0,Ey)}return E2.join("")}function Ae(Ex){if(Ex.length<4){return Ek(Ex)}var Ez=[],Ew=-1,E0=Ex.length,Ey,Ev=[0],e=[0];while(++Ew<3){Ey=Ex[Ew];Ev.push(Ey[0]);e.push(Ey[1])}Ez.push(Dn(EP,Ev)+","+Dn(EP,e));--Ew;while(++Ew<E0){Ey=Ex[Ew];Ev.shift();Ev.push(Ey[0]);e.shift();e.push(Ey[1]);Au(Ez,Ev,e)}return Ez.join("")}function BT(Ey){var E0,Ex=-1,E1=Ey.length,e=E1+4,Ez,Ew=[],Ev=[];while(++Ex<4){Ez=Ey[Ex%E1];Ew.push(Ez[0]);Ev.push(Ez[1])}E0=[Dn(EP,Ew),",",Dn(EP,Ev)];--Ex;while(++Ex<e){Ez=Ey[Ex%E1];Ew.shift();Ew.push(Ez[0]);Ev.shift();Ev.push(Ez[1]);Au(E0,Ew,Ev)}return E0.join("")}function BU(E0,Ez){var Ew=E0.length-1,Ev=E0[0][0],Ey=E0[0][1],E3=E0[Ew][0]-Ev,E2=E0[Ew][1]-Ey,Ex=-1,e,E1;while(++Ex<=Ew){e=E0[Ex];E1=Ex/Ew;e[0]=Ez*e[0]+(1-Ez)*(Ev+E1*E3);e[1]=Ez*e[1]+(1-Ez)*(Ey+E1*E2)}return C0(E0)}function Dn(Ev,e){return Ev[0]*e[0]+Ev[1]*e[1]+Ev[2]*e[2]+Ev[3]*e[3]}var ES=[0,2/3,1/3,0],EQ=[0,1/3,2/3,0],EP=[0,1/6,2/3,1/6];function Au(Ev,e,Ew){Ev.push("C",Dn(ES,e),",",Dn(ES,Ew),",",Dn(EQ,e),",",Dn(EQ,Ew),",",Dn(EP,e),",",Dn(EP,Ew))}function Eq(Ev,e){return(e[1]-Ev[1])/(e[0]-Ev[0])}function CI(Ex){var Ew=0,Ev=Ex.length-1,e=[],E0=Ex[0],Ez=Ex[1],Ey=e[0]=Eq(E0,Ez);while(++Ew<Ev){e[Ew]=Ey+(Ey=Eq(E0=Ez,Ez=Ex[Ew+1]))}e[Ew]=Ey;return e}function AC(E1){var Ey=[],Ex,E0,Ez,E2,e=CI(E1),Ew=-1,Ev=E1.length-1;while(++Ew<Ev){Ex=Eq(E1[Ew],E1[Ew+1]);if(Math.abs(Ex)<0.000001){e[Ew]=e[Ew+1]=0}else{E0=e[Ew]/Ex;Ez=e[Ew+1]/Ex;E2=E0*E0+Ez*Ez;if(E2>9){E2=Ex*3/Math.sqrt(E2);e[Ew]=E2*E0;e[Ew+1]=E2*Ez}}}Ew=-1;while(++Ew<=Ev){E2=(E1[Math.min(Ev,Ew+1)][0]-E1[Math.max(0,Ew-1)][0])/(6*(1+e[Ew]*e[Ew]));Ey.push([E2||0,e[Ew]*E2||0])}return Ey}function Bl(e){return e.length<3?Ek(e):e[0]+BZ(e,AC(e))}d3.svg.line.radial=function(){var e=Cv(h);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};function h(Ex){var e,Ew=-1,Ez=Ex.length,Ey,Ev;while(++Ew<Ez){e=Ex[Ew];Ey=e[0];Ev=e[1]+Ec;e[0]=Ey*Math.cos(Ev);e[1]=Ey*Math.sin(Ev)}return Ex}function Es(Ez){var Ew=D9,Ev=D9,E3=0,E1=D8,E0,Ey,Ex,E2=0.7;function e(E6){if(E6.length<1){return null}var E5=AH(this,E6,Ew,E3),E4=AH(this,E6,Ew===Ev?Bq(E5):Ev,E3===E1?Bp(E5):E1);return"M"+Ey(Ez(E4),E2)+"L"+Ex(Ez(E5.reverse()),E2)+"Z"}e.x=function(E4){if(!arguments.length){return Ev}Ew=Ev=E4;return e};e.x0=function(E4){if(!arguments.length){return Ew}Ew=E4;return e};e.x1=function(E4){if(!arguments.length){return Ev}Ev=E4;return e};e.y=function(E4){if(!arguments.length){return E1}E3=E1=E4;return e};e.y0=function(E4){if(!arguments.length){return E3}E3=E4;return e};e.y1=function(E4){if(!arguments.length){return E1}E1=E4;return e};e.interpolate=function(E4){if(!arguments.length){return E0}if(!A7.has(E4+="")){E4=CE}Ey=A7.get(E0=E4);Ex=Ey.reverse||Ey;return e};e.tension=function(E4){if(!arguments.length){return E2}E2=E4;return e};return e.interpolate("linear")}Ah.reverse=EY;EY.reverse=Ah;d3.svg.area=function(){return Es(Object)};function Bq(e){return function(Ew,Ev){return e[Ev][0]}}function Bp(e){return function(Ew,Ev){return e[Ev][1]}}d3.svg.area.radial=function(){var e=Es(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=AB,E1=AL,E0=X,E2=Dh,Ey=AA;function Ez(E7,E5){var E6=E3(this,e,E7,E5),E4=E3(this,E1,E7,E5);return"M"+E6.p0+Ev(E6.r,E6.p1,E6.a1-E6.a0)+(Ew(E6,E4)?Ex(E6.r,E6.p1,E6.r,E6.p0):Ex(E6.r,E6.p1,E4.r,E4.p0)+Ev(E4.r,E4.p1,E4.a1-E4.a0)+Ex(E4.r,E4.p1,E6.r,E6.p0))+"Z"}function E3(E7,FA,FB,E8){var E6=FA.call(E7,FB,E8),E9=E0.call(E7,E6,E8),E5=E2.call(E7,E6,E8)+Ec,E4=Ey.call(E7,E6,E8)+Ec;return{r:E9,a0:E5,a1:E4,p0:[E9*Math.cos(E5),E9*Math.sin(E5)],p1:[E9*Math.cos(E4),E9*Math.sin(E4)]}}function Ew(E5,E4){return E5.a0==E4.a0&&E5.a1==E4.a1}function Ev(E5,E6,E4){return"A"+E5+","+E5+" 0 "+ +(E4>Math.PI)+",1 "+E6}function Ex(E5,E7,E4,E6){return"Q 0,0 "+E6}Ez.radius=function(E4){if(!arguments.length){return E0}E0=d3.functor(E4);return Ez};Ez.source=function(E4){if(!arguments.length){return e}e=d3.functor(E4);return Ez};Ez.target=function(E4){if(!arguments.length){return E1}E1=d3.functor(E4);return Ez};Ez.startAngle=function(E4){if(!arguments.length){return E2}E2=d3.functor(E4);return Ez};Ez.endAngle=function(E4){if(!arguments.length){return Ey}Ey=d3.functor(E4);return Ez};return Ez};function AB(e){return e.source}function AL(e){return e.target}function X(e){return e.radius}function Dx(e){return e.startAngle}function CQ(e){return e.endAngle}d3.svg.diagonal=function(){var Ew=AB,Ex=AL,e=L;function Ev(E2,Ez){var E3=Ew.call(this,E2,Ez),E0=Ex.call(this,E2,Ez),Ey=(E3.y+E0.y)/2,E1=[E3,{x:E3.x,y:Ey},{x:E0.x,y:Ey},E0];E1=E1.map(e);return"M"+E1[0]+"C"+E1[1]+" "+E1[2]+" "+E1[3]}Ev.source=function(Ey){if(!arguments.length){return Ew}Ew=d3.functor(Ey);return Ev};Ev.target=function(Ey){if(!arguments.length){return Ex}Ex=d3.functor(Ey);return Ev};Ev.projection=function(Ey){if(!arguments.length){return e}e=Ey;return Ev};return Ev};function L(e){return[e.x,e.y]}d3.svg.diagonal.radial=function(){var Ew=d3.svg.diagonal(),e=L,Ev=Ew.projection;Ew.projection=function(Ex){return arguments.length?Ev(M(e=Ex)):e};return Ew};function M(e){return function(){var Ex=e.apply(this,arguments),Ew=Ex[0],Ev=Ex[1]+Ec;return[Ew*Math.cos(Ev),Ew*Math.sin(Ev)]}}d3.svg.mouse=d3.mouse;d3.svg.touches=d3.touches;d3.svg.symbol=function(){var Ev=AQ,e=Cr;function Ew(Ey,Ex){return(Ei.get(Ev.call(this,Ey,Ex))||A8)(e.call(this,Ey,Ex))}Ew.type=function(Ex){if(!arguments.length){return Ev}Ev=d3.functor(Ex);return Ew};Ew.size=function(Ex){if(!arguments.length){return e}e=d3.functor(Ex);return Ew};return Ew};function Cr(){return 64}function AQ(){return"circle"}function A8(e){var Ev=Math.sqrt(e/Math.PI);return"M0,"+Ev+"A"+Ev+","+Ev+" 0 1,1 0,"+(-Ev)+"A"+Ev+","+Ev+" 0 1,1 0,"+Ev+"Z"}var Ei=d3.map({circle:A8,cross:function(e){var Ev=Math.sqrt(e/5)/2;return"M"+-3*Ev+","+-Ev+"H"+-Ev+"V"+-3*Ev+"H"+Ev+"V"+-Ev+"H"+3*Ev+"V"+Ev+"H"+Ev+"V"+3*Ev+"H"+-Ev+"V"+Ev+"H"+-3*Ev+"Z"},diamond:function(e){var Ev=Math.sqrt(e/(2*BC)),Ew=Ev*BC;return"M0,"+-Ev+"L"+Ew+",0 0,"+Ev+" "+-Ew+",0Z"},square:function(e){var Ev=Math.sqrt(e)/2;return"M"+-Ev+","+-Ev+"L"+Ev+","+-Ev+" "+Ev+","+Ev+" "+-Ev+","+Ev+"Z"},"triangle-down":function(e){var Ew=Math.sqrt(e/A5),Ev=Ew*A5/2;return"M0,"+Ev+"L"+Ew+","+-Ev+" "+-Ew+","+-Ev+"Z"},"triangle-up":function(e){var Ew=Math.sqrt(e/A5),Ev=Ew*A5/2;return"M0,"+-Ev+"L"+Ew+","+Ev+" "+-Ew+","+Ev+"Z"}});d3.svg.symbolTypes=Ei.keys();var A5=Math.sqrt(3),BC=Math.tan(30*Math.PI/180);d3.svg.axis=function(){var Ex=d3.scale.linear(),E0="bottom",Ey=6,e=6,Ev=6,E4=3,E3=[10],Ez=null,E2,E1=0;function Ew(E5){E5.each(function(){var FO=d3.select(this);var FP=Ez==null?(Ex.ticks?Ex.ticks.apply(Ex,E3):Ex.domain()):Ez,FI=E2==null?(Ex.tickFormat?Ex.tickFormat.apply(Ex,E3):String):E2;var FA=BW(Ex,FP,E1),E9=FO.selectAll(".minor").data(FA,String),FL=E9.enter().insert("line","g").attr("class","tick minor").style("opacity",0.000001),FJ=d3.transition(E9.exit()).style("opacity",0.000001).remove(),E7=d3.transition(E9).style("opacity",1);var FN=FO.selectAll("g").data(FP,String),FF=FN.enter().insert("g","path").style("opacity",0.000001),FH=d3.transition(FN.exit()).style("opacity",0.000001).remove(),FB=d3.transition(FN).style("opacity",1),E6;var FE=AT(Ex),FG=FO.selectAll(".domain").data([0]),E8=FG.enter().append("path").attr("class","domain"),FQ=d3.transition(FG);var FK=Ex.copy(),FM=this.__chart__||FK;this.__chart__=FK;FF.append("line").attr("class","tick");FF.append("text");FB.select("text").text(FI);switch(E0){case"bottom":E6=C7;FL.attr("y2",e);E7.attr("x2",0).attr("y2",e);FF.select("line").attr("y2",Ey);FF.select("text").attr("y",Math.max(Ey,0)+E4);FB.select("line").attr("x2",0).attr("y2",Ey);FB.select("text").attr("x",0).attr("y",Math.max(Ey,0)+E4).attr("dy",".71em").attr("text-anchor","middle");FQ.attr("d","M"+FE[0]+","+Ev+"V0H"+FE[1]+"V"+Ev);break;case"top":E6=C7;FL.attr("y2",-e);E7.attr("x2",0).attr("y2",-e);FF.select("line").attr("y2",-Ey);FF.select("text").attr("y",-(Math.max(Ey,0)+E4));FB.select("line").attr("x2",0).attr("y2",-Ey);FB.select("text").attr("x",0).attr("y",-(Math.max(Ey,0)+E4)).attr("dy","0em").attr("text-anchor","middle");FQ.attr("d","M"+FE[0]+","+-Ev+"V0H"+FE[1]+"V"+-Ev);break;case"left":E6=C5;FL.attr("x2",-e);E7.attr("x2",-e).attr("y2",0);FF.select("line").attr("x2",-Ey);FF.select("text").attr("x",-(Math.max(Ey,0)+E4));FB.select("line").attr("x2",-Ey).attr("y2",0);FB.select("text").attr("x",-(Math.max(Ey,0)+E4)).attr("y",0).attr("dy",".32em").attr("text-anchor","end");FQ.attr("d","M"+-Ev+","+FE[0]+"H0V"+FE[1]+"H"+-Ev);break;case"right":E6=C5;FL.attr("x2",e);E7.attr("x2",e).attr("y2",0);FF.select("line").attr("x2",Ey);FF.select("text").attr("x",Math.max(Ey,0)+E4);FB.select("line").attr("x2",Ey).attr("y2",0);FB.select("text").attr("x",Math.max(Ey,0)+E4).attr("y",0).attr("dy",".32em").attr("text-anchor","start");FQ.attr("d","M"+Ev+","+FE[0]+"H0V"+FE[1]+"H"+Ev);break}if(Ex.ticks){FF.call(E6,FM);FB.call(E6,FK);FH.call(E6,FK);FL.call(E6,FM);E7.call(E6,FK);FJ.call(E6,FK)}else{var FD=FK.rangeBand()/2,FC=function(FR){return FK(FR)+FD};FF.call(E6,FC);FB.call(E6,FC)}})}Ew.scale=function(E5){if(!arguments.length){return Ex}Ex=E5;return Ew};Ew.orient=function(E5){if(!arguments.length){return E0}E0=E5;return Ew};Ew.ticks=function(){if(!arguments.length){return E3}E3=arguments;return Ew};Ew.tickValues=function(E5){if(!arguments.length){return Ez}Ez=E5;return Ew};Ew.tickFormat=function(E5){if(!arguments.length){return E2}E2=E5;return Ew};Ew.tickSize=function(E5,E8,E6){if(!arguments.length){return Ey}var E7=arguments.length-1;Ey=+E5;e=E7>1?+E8:Ey;Ev=E7>0?+arguments[E7]:Ey;return Ew};Ew.tickPadding=function(E5){if(!arguments.length){return E4}E4=+E5;return Ew};Ew.tickSubdivide=function(E5){if(!arguments.length){return E1}E1=+E5;return Ew};return Ew};function C7(Ev,e){Ev.attr("transform",function(Ew){return"translate("+e(Ew)+",0)"})}function C5(e,Ev){e.attr("transform",function(Ew){return"translate(0,"+Ev(Ew)+")"})}function BW(Ew,E0,Ev){E1=[];if(Ev&&E0.length>1){var E3=CP(Ew.domain()),E1,Ey=-1,e=E0.length,Ez=(E0[1]-E0[0])/++Ev,Ex,E2;while(++Ey<e){for(Ex=Ev;--Ex>0;){if((E2=+E0[Ey]-Ex*Ez)>=E3[0]){E1.push(E2)}}}for(--Ey,Ex=0;++Ex<Ev&&(E2=+E0[Ey]+Ex*Ez)<E3[1];){E1.push(E2)}}return E1}d3.svg.brush=function(){var e=EN(Ey,"brushstart","brush","brushend"),E0=null,Ez=null,E1=AD[0],E4=[[0,0],[0,0]],Ev;function Ey(E5){E5.each(function(){var E8=d3.select(this),E7=E8.selectAll(".background").data([0]),E6=E8.selectAll(".extent").data([0]),FA=E8.selectAll(".resize").data(E1,String),E9;E8.style("pointer-events","all").on("mousedown.brush",E2).on("touchstart.brush",E2);E7.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");E6.enter().append("rect").attr("class","extent").style("cursor","move");FA.enter().append("g").attr("class",function(FB){return"resize "+FB}).style("cursor",function(FB){return Cf[FB]}).append("rect").attr("x",function(FB){return/[ew]$/.test(FB)?-3:null}).attr("y",function(FB){return/^[ns]/.test(FB)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");FA.style("display",Ey.empty()?"none":null);FA.exit().remove();if(E0){E9=AT(E0);E7.attr("x",E9[0]).attr("width",E9[1]-E9[0]);Ex(E8)}if(Ez){E9=AT(Ez);E7.attr("y",E9[0]).attr("height",E9[1]-E9[0]);Ew(E8)}E3(E8)})}function E3(E5){E5.selectAll(".resize").attr("transform",function(E6){return"translate("+E4[+/e$/.test(E6)][0]+","+E4[+/^s/.test(E6)][1]+")"})}function Ex(E5){E5.select(".extent").attr("x",E4[0][0]);E5.selectAll(".extent,.n>rect,.s>rect").attr("width",E4[1][0]-E4[0][0])}function Ew(E5){E5.select(".extent").attr("y",E4[0][1]);E5.selectAll(".extent,.e>rect,.w>rect").attr("height",E4[1][1]-E4[0][1])}function E2(){var FO=this,E6=d3.select(d3.event.target),FC=e.of(FO,arguments),FJ=d3.select(FO),FL=E6.datum(),FH=!/^(n|s)$/.test(FL)&&E0,FF=!/^(e|w)$/.test(FL)&&Ez,FG=E6.classed("extent"),FM,FN=FD(),E7;var FA=d3.select(window).on("mousemove.brush",FB).on("mouseup.brush",E5).on("touchmove.brush",FB).on("touchend.brush",E5).on("keydown.brush",FE).on("keyup.brush",E9);if(FG){FN[0]=E4[0][0]-FN[0];FN[1]=E4[0][1]-FN[1]}else{if(FL){var FK=+/w$/.test(FL),FI=+/^n/.test(FL);E7=[E4[1-FK][0]-FN[0],E4[1-FI][1]-FN[1]];FN[0]=E4[FK][0];FN[1]=E4[FI][1]}else{if(d3.event.altKey){FM=FN.slice()}}}FJ.style("pointer-events","none").selectAll(".resize").style("display",null);d3.select("body").style("cursor",E6.style("cursor"));FC({type:"brushstart"});FB();Ee();function FD(){var FP=d3.event.changedTouches;return FP?d3.touches(FO,FP)[0]:d3.mouse(FO)}function FE(){if(d3.event.keyCode==32){if(!FG){FM=null;FN[0]-=E4[1][0];FN[1]-=E4[1][1];FG=2}Ee()}}function E9(){if(d3.event.keyCode==32&&FG==2){FN[0]+=E4[1][0];FN[1]+=E4[1][1];FG=0;Ee()}}function FB(){var FP=FD(),FQ=false;if(E7){FP[0]+=E7[0];FP[1]+=E7[1]}if(!FG){if(d3.event.altKey){if(!FM){FM=[(E4[0][0]+E4[1][0])/2,(E4[0][1]+E4[1][1])/2]}FN[0]=E4[+(FP[0]<FM[0])][0];FN[1]=E4[+(FP[1]<FM[1])][1]}else{FM=null}}if(FH&&E8(FP,E0,0)){Ex(FJ);FQ=true}if(FF&&E8(FP,Ez,1)){Ew(FJ);FQ=true}if(FQ){E3(FJ);FC({type:"brush",mode:FG?"move":"resize"})}}function E8(FX,FR,FT){var FU=AT(FR),FQ=FU[0],FP=FU[1],FV=FN[FT],FY=E4[1][FT]-E4[0][FT],FS,FW;if(FG){FQ-=FV;FP-=FY+FV}FS=Math.max(FQ,Math.min(FP,FX[FT]));if(FG){FW=(FS+=FV)+FY}else{if(FM){FV=Math.max(FQ,Math.min(FP,2*FM[FT]-FS))}if(FV<FS){FW=FS;FS=FV}else{FW=FV}}if(E4[0][FT]!==FS||E4[1][FT]!==FW){Ev=null;E4[0][FT]=FS;E4[1][FT]=FW;return true}}function E5(){FB();FJ.style("pointer-events","all").selectAll(".resize").style("display",Ey.empty()?"none":null);d3.select("body").style("cursor",null);FA.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);FC({type:"brushend"});Ee()}}Ey.x=function(E5){if(!arguments.length){return E0}E0=E5;E1=AD[!E0<<1|!Ez];return Ey};Ey.y=function(E5){if(!arguments.length){return Ez}Ez=E5;E1=AD[!E0<<1|!Ez];return Ey};Ey.extent=function(FA){var E7,E5,E9,E8,E6;if(!arguments.length){FA=Ev||E4;if(E0){E7=FA[0][0],E5=FA[1][0];if(!Ev){E7=E4[0][0],E5=E4[1][0];if(E0.invert){E7=E0.invert(E7),E5=E0.invert(E5)}if(E5<E7){E6=E7,E7=E5,E5=E6}}}if(Ez){E9=FA[0][1],E8=FA[1][1];if(!Ev){E9=E4[0][1],E8=E4[1][1];if(Ez.invert){E9=Ez.invert(E9),E8=Ez.invert(E8)}if(E8<E9){E6=E9,E9=E8,E8=E6}}}return E0&&Ez?[[E7,E9],[E5,E8]]:E0?[E7,E5]:Ez&&[E9,E8]}Ev=[[0,0],[0,0]];if(E0){E7=FA[0],E5=FA[1];if(Ez){E7=E7[0],E5=E5[0]}Ev[0][0]=E7,Ev[1][0]=E5;if(E0.invert){E7=E0(E7),E5=E0(E5)}if(E5<E7){E6=E7,E7=E5,E5=E6}E4[0][0]=E7|0,E4[1][0]=E5|0}if(Ez){E9=FA[0],E8=FA[1];if(E0){E9=E9[1],E8=E8[1]}Ev[0][1]=E9,Ev[1][1]=E8;if(Ez.invert){E9=Ez(E9),E8=Ez(E8)}if(E8<E9){E6=E9,E9=E8,E8=E6}E4[0][1]=E9|0,E4[1][1]=E8|0}return Ey};Ey.clear=function(){Ev=null;E4[0][0]=E4[0][1]=E4[1][0]=E4[1][1]=0;return Ey};Ey.empty=function(){return(E0&&E4[0][0]===E4[1][0])||(Ez&&E4[0][1]===E4[1][1])};return d3.rebind(Ey,e,"on")};var Cf={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 AD=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];d3.behavior={};d3.behavior.drag=function(){var Ex=EN(Ew,"drag","dragstart","dragend"),e=null;function Ew(){this.on("mousedown.drag",Ev).on("touchstart.drag",Ev)}function Ev(){var E0=this,E4=Ex.of(E0,arguments),E3=d3.event.target,Ez,E1=E6(),E2=0;var E5=d3.select(window).on("mousemove.drag",E7).on("touchmove.drag",E7).on("mouseup.drag",Ey,true).on("touchend.drag",Ey,true);if(e){Ez=e.apply(E0,arguments);Ez=[Ez.x-E1[0],Ez.y-E1[1]]}else{Ez=[0,0]}E4({type:"dragstart"});function E6(){var FA=E0.parentNode,E9=d3.event.changedTouches;return E9?d3.touches(FA,E9)[0]:d3.mouse(FA)}function E7(){if(!E0.parentNode){return Ey()}var FB=E6(),FA=FB[0]-E1[0],E9=FB[1]-E1[1];E2|=FA|E9;E1=FB;Ee();E4({type:"drag",x:FB[0]+Ez[0],y:FB[1]+Ez[1],dx:FA,dy:E9})}function Ey(){E4({type:"dragend"});if(E2){Ee();if(d3.event.target===E3){E5.on("click.drag",E8,true)}}E5.on("mousemove.drag",null).on("touchmove.drag",null).on("mouseup.drag",null).on("touchend.drag",null)}function E8(){Ee();E5.on("click.drag",null)}}Ew.origin=function(Ey){if(!arguments.length){return e}e=Ey;return Ew};return d3.rebind(Ew,Ex,"on")};d3.behavior.zoom=function(){var E1=[0,0],FC,FG=1,E8,Ew=DV,E7=EN(e,"zoom"),FB,E9,Ey,Ex,E0;function e(){this.on("mousedown.zoom",E5).on("mousewheel.zoom",E4).on("mousemove.zoom",FD).on("DOMMouseScroll.zoom",E4).on("dblclick.zoom",E2).on("touchstart.zoom",FA).on("touchmove.zoom",E3).on("touchend.zoom",FA)}e.translate=function(FH){if(!arguments.length){return E1}E1=FH.map(Number);return e};e.scale=function(FH){if(!arguments.length){return FG}FG=+FH;return e};e.scaleExtent=function(FH){if(!arguments.length){return Ew}Ew=FH==null?DV:FH.map(Number);return e};e.x=function(FH){if(!arguments.length){return E9}E9=FH;FB=FH.copy();return e};e.y=function(FH){if(!arguments.length){return Ex}Ex=FH;Ey=FH.copy();return e};function Ev(FH){return[(FH[0]-E1[0])/FG,(FH[1]-E1[1])/FG]}function E6(FH){return[FH[0]*FG+E1[0],FH[1]*FG+E1[1]]}function Ez(FH){FG=Math.max(Ew[0],Math.min(Ew[1],FH))}function FE(FI,FH){FH=E6(FH);E1[0]+=FI[0]-FH[0];E1[1]+=FI[1]-FH[1]}function FF(FH){if(E9){E9.domain(FB.range().map(function(FI){return(FI-E1[0])/FG}).map(FB.invert))}if(Ex){Ex.domain(Ey.range().map(function(FI){return(FI-E1[1])/FG}).map(Ey.invert))}d3.event.preventDefault();FH({type:"zoom",scale:FG,translate:E1})}function E5(){var FK=this,FN=E7.of(FK,arguments),FM=d3.event.target,FL=0,FO=d3.select(window).on("mousemove.zoom",FJ).on("mouseup.zoom",FI),FH=Ev(d3.mouse(FK));window.focus();Ee();function FJ(){FL=1;FE(d3.mouse(FK),FH);FF(FN)}function FI(){if(FL){Ee()}FO.on("mousemove.zoom",null).on("mouseup.zoom",null);if(FL&&d3.event.target===FM){FO.on("click.zoom",FP)}}function FP(){Ee();FO.on("click.zoom",null)}}function E4(){if(!FC){FC=Ev(d3.mouse(this))}Ez(Math.pow(2,BJ()*0.002)*FG);FE(d3.mouse(this),FC);FF(E7.of(this,arguments))}function FD(){FC=null}function E2(){var FI=d3.mouse(this),FH=Ev(FI);Ez(d3.event.shiftKey?FG/2:FG*2);FE(FI,FH);FF(E7.of(this,arguments))}function FA(){var FK=d3.touches(this),FI=Date.now();E8=FG;FC={};FK.forEach(function(FL){FC[FL.identifier]=Ev(FL)});Ee();if((FK.length===1)&&(FI-E0<500)){var FJ=FK[0],FH=Ev(FK[0]);Ez(FG*2);FE(FJ,FH);FF(E7.of(this,arguments))}E0=FI}function E3(){var FJ=d3.touches(this),FL=FJ[0],FI=FC[FL.identifier];if(FK=FJ[1]){var FK,FH=FC[FK.identifier];FL=[(FL[0]+FK[0])/2,(FL[1]+FK[1])/2];FI=[(FI[0]+FH[0])/2,(FI[1]+FH[1])/2];Ez(d3.event.scale*E8)}FE(FL,FI);FF(E7.of(this,arguments))}return d3.rebind(e,E7,"on")};var CD,DV=[0,Infinity];function BJ(){if(!CD){CD=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 Ew=d3.event,Ex;try{CD.scrollTop=1000;CD.dispatchEvent(Ew);Ex=1000-CD.scrollTop}catch(Ev){Ex=Ew.wheelDelta||(-Ew.detail*5)}return Ex}d3.layout={};d3.layout.bundle=function(){return function(e){var Ew=[],Ev=-1,Ex=e.length;while(++Ev<Ex){Ew.push(CZ(e[Ev]))}return Ew}};function CZ(Ex){var Ez=Ex.source,e=Ex.target,Ey=DQ(Ez,e),Ew=[Ez];while(Ez!==Ey){Ez=Ez.parent;Ew.push(Ez)}var Ev=Ew.length;while(e!==Ey){Ew.splice(Ev,0,e);e=e.parent}return Ew}function C9(Ew){var Ev=[],e=Ew.parent;while(e!=null){Ev.push(Ew);Ew=e;e=e.parent}Ev.push(Ew);return Ev}function DQ(Ex,Ev){if(Ex===Ev){return Ex}var Ew=C9(Ex),e=C9(Ev),Ey=Ew.pop(),Ez=e.pop(),E0=null;while(Ey===Ez){E0=Ey;Ey=Ew.pop();Ez=e.pop()}return E0}d3.layout.chord=function(){var Ez={},E0,Ex,E4,Ew,E3=0,e,Ev,Ey;function E2(){var E9={},FC=[],FK=d3.range(Ew),FG=[],FA,FI,E8,FD,FB;E0=[];Ex=[];FA=0,FD=-1;while(++FD<Ew){FI=0,FB=-1;while(++FB<Ew){FI+=E4[FD][FB]}FC.push(FI);FG.push(d3.range(Ew));FA+=FI}if(e){FK.sort(function(FM,FL){return e(FC[FM],FC[FL])})}if(Ev){FG.forEach(function(FM,FL){FM.sort(function(FO,FN){return Ev(E4[FL][FO],E4[FL][FN])})})}FA=(2*Math.PI-E3*Ew)/FA;FI=0,FD=-1;while(++FD<Ew){E8=FI,FB=-1;while(++FB<Ew){var FH=FK[FD],FF=FG[FH][FB],FJ=E4[FH][FF],E7=FI,E6=FI+=FJ*FA;E9[FH+"-"+FF]={index:FH,subindex:FF,startAngle:E7,endAngle:E6,value:FJ}}Ex.push({index:FH,startAngle:E8,endAngle:FI,value:(FI-E8)/FA});FI+=E3}FD=-1;while(++FD<Ew){FB=FD-1;while(++FB<Ew){var E5=E9[FD+"-"+FB],FE=E9[FB+"-"+FD];if(E5.value||FE.value){E0.push(E5.value<FE.value?{source:FE,target:E5}:{source:E5,target:FE})}}}if(Ey){E1()}}function E1(){E0.sort(function(E6,E5){return Ey((E6.source.value+E6.target.value)/2,(E5.source.value+E5.target.value)/2)})}Ez.matrix=function(E5){if(!arguments.length){return E4}Ew=(E4=E5)&&E4.length;E0=Ex=null;return Ez};Ez.padding=function(E5){if(!arguments.length){return E3}E3=E5;E0=Ex=null;return Ez};Ez.sortGroups=function(E5){if(!arguments.length){return e}e=E5;E0=Ex=null;return Ez};Ez.sortSubgroups=function(E5){if(!arguments.length){return Ev}Ev=E5;E0=null;return Ez};Ez.sortChords=function(E5){if(!arguments.length){return Ey}Ey=E5;if(E0){E1()}return Ez};Ez.chords=function(){if(!E0){E2()}return E0};Ez.groups=function(){if(!Ex){E2()}return Ex};return Ez};d3.layout.force=function(){var Ev={},E8=d3.dispatch("start","tick","end"),E4=[1,1],FA,Ey,E1=0.9,FC=DR,Ex=BG,E7=-30,Ez=0.1,E2=0.8,FB,E6=[],Ew=[],E0,e,E3;function E9(FD){return function(FK,FF,FJ,FE,FI){if(FK.point!==FD){var FM=FK.cx-FD.x,FL=FK.cy-FD.y,FH=1/Math.sqrt(FM*FM+FL*FL);if((FE-FF)*FH<E2){var FG=FK.charge*FH*FH;FD.px-=FM*FG;FD.py-=FL*FG;return true}if(FK.point&&isFinite(FH)){var FG=FK.pointCharge*FH*FH;FD.px-=FM*FG;FD.py-=FL*FG}}return !FK.charge}}Ev.tick=function(){if((Ey*=0.99)<0.005){E8.end({type:"end",alpha:Ey=0});return true}var FF=E6.length,FG=Ew.length,FD,FJ,FE,FN,FM,FH,FI,FL,FK;for(FJ=0;FJ<FG;++FJ){FE=Ew[FJ];FN=FE.source;FM=FE.target;FL=FM.x-FN.x;FK=FM.y-FN.y;if(FH=(FL*FL+FK*FK)){FH=Ey*e[FJ]*((FH=Math.sqrt(FH))-E0[FJ])/FH;FL*=FH;FK*=FH;FM.x-=FL*(FI=FN.weight/(FM.weight+FN.weight));FM.y-=FK*FI;FN.x+=FL*(FI=1-FI);FN.y+=FK*FI}}if(FI=Ey*Ez){FL=E4[0]/2;FK=E4[1]/2;FJ=-1;if(FI){while(++FJ<FF){FE=E6[FJ];FE.x+=(FL-FE.x)*FI;FE.y+=(FK-FE.y)*FI}}}if(E7){Dv(FD=d3.geom.quadtree(E6),Ey,E3);FJ=-1;while(++FJ<FF){if(!(FE=E6[FJ]).fixed){FD.visit(E9(FE))}}}FJ=-1;while(++FJ<FF){FE=E6[FJ];if(FE.fixed){FE.x=FE.px;FE.y=FE.py}else{FE.x-=(FE.px-(FE.px=FE.x))*E1;FE.y-=(FE.py-(FE.py=FE.y))*E1}}E8.tick({type:"tick",alpha:Ey})};Ev.nodes=function(FD){if(!arguments.length){return E6}E6=FD;return Ev};Ev.links=function(FD){if(!arguments.length){return Ew}Ew=FD;return Ev};Ev.size=function(FD){if(!arguments.length){return E4}E4=FD;return Ev};Ev.linkDistance=function(FD){if(!arguments.length){return FC}FC=d3.functor(FD);return Ev};Ev.distance=Ev.linkDistance;Ev.linkStrength=function(FD){if(!arguments.length){return Ex}Ex=d3.functor(FD);return Ev};Ev.friction=function(FD){if(!arguments.length){return E1}E1=FD;return Ev};Ev.charge=function(FD){if(!arguments.length){return E7}E7=typeof FD==="function"?FD:+FD;return Ev};Ev.gravity=function(FD){if(!arguments.length){return Ez}Ez=FD;return Ev};Ev.theta=function(FD){if(!arguments.length){return E2}E2=FD;return Ev};Ev.alpha=function(FD){if(!arguments.length){return Ey}if(Ey){if(FD>0){Ey=FD}else{Ey=0}}else{if(FD>0){E8.start({type:"start",alpha:Ey=FD});d3.timer(Ev.tick)}}return Ev};Ev.start=function(){var FH,FG,FE=E6.length,FF=Ew.length,FK=E4[0],FJ=E4[1],FM,FD;for(FH=0;FH<FE;++FH){(FD=E6[FH]).index=FH;FD.weight=0}E0=[];e=[];for(FH=0;FH<FF;++FH){FD=Ew[FH];if(typeof FD.source=="number"){FD.source=E6[FD.source]}if(typeof FD.target=="number"){FD.target=E6[FD.target]}E0[FH]=FC.call(this,FD,FH);e[FH]=Ex.call(this,FD,FH);++FD.source.weight;++FD.target.weight}for(FH=0;FH<FE;++FH){FD=E6[FH];if(isNaN(FD.x)){FD.x=FI("x",FK)}if(isNaN(FD.y)){FD.y=FI("y",FJ)}if(isNaN(FD.px)){FD.px=FD.x}if(isNaN(FD.py)){FD.py=FD.y}}E3=[];if(typeof E7==="function"){for(FH=0;FH<FE;++FH){E3[FH]=+E7.call(this,E6[FH],FH)}}else{for(FH=0;FH<FE;++FH){E3[FH]=E7}}function FI(FS,FR){var FQ=FL(FH),FP=-1,FO=FQ.length,FN;while(++FP<FO){if(!isNaN(FN=FQ[FP][FS])){return FN}}return Math.random()*FR}function FL(){if(!FM){FM=[];for(FG=0;FG<FE;++FG){FM[FG]=[]}for(FG=0;FG<FF;++FG){var FN=Ew[FG];FM[FN.source.index].push(FN.target);FM[FN.target.index].push(FN.source)}}return FM[FH]}return Ev.resume()};Ev.resume=function(){return Ev.alpha(0.1)};Ev.stop=function(){return Ev.alpha(0)};Ev.drag=function(){if(!FA){FA=d3.behavior.drag().origin(Object).on("dragstart",E5).on("drag",DE).on("dragend",Ck)}this.on("mouseover.force",J).on("mouseout.force",Du).call(FA)};function E5(FD){J(DK=FD);C6=Ev}return d3.rebind(Ev,E8,"on")};var C6,DK;function J(e){e.fixed|=2}function Du(e){if(e!==DK){e.fixed&=1}}function Ck(){DK.fixed&=1;C6=DK=null}function DE(){DK.px=d3.event.x;DK.py=d3.event.y;C6.resume()}function Dv(E3,Ey,E2){var Ez=0,Ew=0;E3.charge=0;if(!E3.leaf){var e=E3.nodes,Ev=e.length,E0=-1,E1;while(++E0<Ev){E1=e[E0];if(E1==null){continue}Dv(E1,Ey,E2);E3.charge+=E1.charge;Ez+=E1.charge*E1.cx;Ew+=E1.charge*E1.cy}}if(E3.point){if(!E3.leaf){E3.point.x+=Math.random()-0.5;E3.point.y+=Math.random()-0.5}var Ex=Ey*E2[E3.point.index];E3.charge+=E3.pointCharge=Ex;Ez+=Ex*E3.point.x;Ew+=Ex*E3.point.y}E3.cx=Ez/E3.charge;E3.cy=Ew/E3.charge}function DR(e){return 20}function BG(e){return 1}d3.layout.partition=function(){var Ew=d3.layout.hierarchy(),Ex=[1,1];function e(E1,E5,E7,E6){var Ez=E1.children;E1.x=E5;E1.y=E1.depth*E6;E1.dx=E7;E1.dy=E6;if(Ez&&(E0=Ez.length)){var E2=-1,E0,E4,E3;E7=E1.value?E7/E1.value:0;while(++E2<E0){e(E4=Ez[E2],E5,E3=E4.value*E7,E6);E5+=E3}}}function Ey(E1){var E0=E1.children,E2=0;if(E0&&(E3=E0.length)){var Ez=-1,E3;while(++Ez<E3){E2=Math.max(E2,Ey(E0[Ez]))}}return 1+E2}function Ev(E1,E0){var Ez=Ew.call(this,E1,E0);e(Ez[0],0,Ex[0],Ex[1]/Ey(Ez[0]));return Ez}Ev.size=function(Ez){if(!arguments.length){return Ex}Ex=Ez;return Ev};return Dq(Ev,Ew)};d3.layout.pie=function(){var Ey=Number,Ex=n,Ew=0,Ev=2*Math.PI;function e(E5,E3){var E1=E5.map(function(E7,E6){return +Ey.call(e,E7,E6)});var Ez=+(typeof Ew==="function"?Ew.apply(this,arguments):Ew);var E0=((typeof Ev==="function"?Ev.apply(this,arguments):Ev)-Ew)/d3.sum(E1);var E2=d3.range(E5.length);if(Ex!=null){E2.sort(Ex===n?function(E7,E6){return E1[E6]-E1[E7]}:function(E7,E6){return Ex(E5[E7],E5[E6])})}var E4=[];E2.forEach(function(E6){E4[E6]={data:E5[E6],value:d=E1[E6],startAngle:Ez,endAngle:Ez+=d*E0}});return E4}e.value=function(Ez){if(!arguments.length){return Ey}Ey=Ez;return e};e.sort=function(Ez){if(!arguments.length){return Ex}Ex=Ez;return e};e.startAngle=function(Ez){if(!arguments.length){return Ew}Ew=Ez;return e};e.endAngle=function(Ez){if(!arguments.length){return Ev}Ev=Ez;return e};return e};var n={};d3.layout.stack=function(){var Ex=Object,Ew=Av,Ez=DM,Ey=DN,Ev=z,E0=y;function e(E8,FA){var E9=E8.map(function(FD,FC){return Ex.call(e,FD,FC)});var FB=E9.map(function(FD,FC){return FD.map(function(FE,FF){return[Ev.call(e,FE,FF),E0.call(e,FE,FF)]})});var E5=Ew.call(e,FB,FA);E9=d3.permute(E9,E5);FB=d3.permute(FB,E5);var E4=Ez.call(e,FB,FA);var E2=E9.length,E3=E9[0].length,E7,E6,E1;for(E6=0;E6<E3;++E6){Ey.call(e,E9[0][E6],E1=E4[E6],FB[0][E6][1]);for(E7=1;E7<E2;++E7){Ey.call(e,E9[E7][E6],E1+=FB[E7-1][E6][1],FB[E7][E6][1])}}return E8}e.values=function(E1){if(!arguments.length){return Ex}Ex=E1;return e};e.order=function(E1){if(!arguments.length){return Ew}Ew=typeof E1==="function"?E1:AX.get(E1)||Av;return e};e.offset=function(E1){if(!arguments.length){return Ez}Ez=typeof E1==="function"?E1:w.get(E1)||DM;return e};e.x=function(E1){if(!arguments.length){return Ev}Ev=E1;return e};e.y=function(E1){if(!arguments.length){return E0}E0=E1;return e};e.out=function(E1){if(!arguments.length){return Ey}Ey=E1;return e};return e};function z(e){return e.x}function y(e){return e.y}function DN(Ev,e,Ew){Ev.y0=e;Ev.y=Ew}var AX=d3.map({"inside-out":function(Ey){var Ew=Ey.length,Ez,Ex,E3=Ey.map(A1),E0=Ey.map(Br),E1=d3.range(Ew).sort(function(E6,E5){return E3[E6]-E3[E5]}),E2=0,e=0,E4=[],Ev=[];for(Ez=0;Ez<Ew;++Ez){Ex=E1[Ez];if(E2<e){E2+=E0[Ex];E4.push(Ex)}else{e+=E0[Ex];Ev.push(Ex)}}return Ev.reverse().concat(E4)},reverse:function(e){return d3.range(e.length).reverse()},"default":Av});var w=d3.map({silhouette:function(Ey){var Ev=Ey.length,Ew=Ey[0].length,E0=[],E1=0,Ez,Ex,e,E2=[];for(Ex=0;Ex<Ew;++Ex){for(Ez=0,e=0;Ez<Ev;Ez++){e+=Ey[Ez][Ex][1]}if(e>E1){E1=e}E0.push(e)}for(Ex=0;Ex<Ew;++Ex){E2[Ex]=(E1-E0[Ex])/2}return E2},wiggle:function(E0){var Ev=E0.length,E4=E0[0],Ew=E4.length,E2=0,E1,Ez,Ey,E7,E6,E3,E8,e,Ex,E5=[];E5[0]=e=Ex=0;for(Ez=1;Ez<Ew;++Ez){for(E1=0,E7=0;E1<Ev;++E1){E7+=E0[E1][Ez][1]}for(E1=0,E6=0,E8=E4[Ez][0]-E4[Ez-1][0];E1<Ev;++E1){for(Ey=0,E3=(E0[E1][Ez][1]-E0[E1][Ez-1][1])/(2*E8);Ey<E1;++Ey){E3+=(E0[Ey][Ez][1]-E0[Ey][Ez-1][1])/E8}E6+=E3*E0[E1][Ez][1]}E5[Ez]=e-=E7?E6/E7*E8:0;if(e<Ex){Ex=e}}for(Ez=0;Ez<Ew;++Ez){E5[Ez]-=Ex}return E5},expand:function(Ez){var E1=Ez.length,e=Ez[0].length,Ev=1/E1,Ex,Ew,E0,Ey=[];for(Ew=0;Ew<e;++Ew){for(Ex=0,E0=0;Ex<E1;Ex++){E0+=Ez[Ex][Ew][1]}if(E0){for(Ex=0;Ex<E1;Ex++){Ez[Ex][Ew][1]/=E0}}else{for(Ex=0;Ex<E1;Ex++){Ez[Ex][Ew][1]=Ev}}}for(Ew=0;Ew<e;++Ew){Ey[Ew]=0}return Ey},zero:DM});function Av(e){return d3.range(e.length)}function DM(Ex){var Ev=-1,e=Ex[0].length,Ew=[];while(++Ev<e){Ew[Ev]=0}return Ew}function A1(Ez){var Ex=1,Ew=0,Ev=Ez[0][1],e,Ey=Ez.length;for(;Ex<Ey;++Ex){if((e=Ez[Ex][1])>Ev){Ew=Ex;Ev=e}}return Ew}function Br(e){return e.reduce(DL,0)}function DL(e,Ev){return e+Ev[1]}d3.layout.histogram=function(){var Ey=true,Ev=Number,e=Af,Ew=EX;function Ex(E2,E3){var E8=[],E6=E2.map(Ev,this),E4=e.call(this,E6,E3),E7=Ew.call(this,E4,E6,E3),E9,E3=-1,Ez=E6.length,E0=E7.length-1,E1=Ey?1:1/Ez,E5;while(++E3<E0){E9=E8[E3]=[];E9.dx=E7[E3+1]-(E9.x=E7[E3]);E9.y=0}E3=-1;while(++E3<Ez){E5=E6[E3];if((E5>=E4[0])&&(E5<=E4[1])){E9=E8[d3.bisect(E7,E5,1,E0)-1];E9.y+=E1;E9.push(E2[E3])}}return E8}Ex.value=function(Ez){if(!arguments.length){return Ev}Ev=Ez;return Ex};Ex.range=function(Ez){if(!arguments.length){return e}e=d3.functor(Ez);return Ex};Ex.bins=function(Ez){if(!arguments.length){return Ew}Ew=typeof Ez==="number"?function(E0){return F(E0,Ez)}:d3.functor(Ez);return Ex};Ex.frequency=function(Ez){if(!arguments.length){return Ey}Ey=!!Ez;return Ex};return Ex};function EX(Ev,e){return F(Ev,Math.ceil(Math.log(e.length)/Math.LN2+1))}function F(Ex,Ez){var Ew=-1,Ev=+Ex[0],e=(Ex[1]-Ev)/Ez,Ey=[];while(++Ew<=Ez){Ey[Ew]=e*Ew+Ev}return Ey}function Af(e){return[d3.min(e),d3.max(e)]}d3.layout.hierarchy=function(){var Ew=B5,Ev=AZ,Ey=Eg;function Ex(E5,E4,E0){var E7=Ev.call(e,E5,E4),E2=H?E5:{data:E5};E2.depth=E4;E0.push(E2);if(E7&&(E1=E7.length)){var E6=-1,E1,E8=E2.children=[],E9=0,E3=E4+1;while(++E6<E1){d=Ex(E7[E6],E3,E0);d.parent=E2;E8.push(d);E9+=d.value}if(Ew){E8.sort(Ew)}if(Ey){E2.value=E9}}else{if(Ey){E2.value=+Ey.call(e,E5,E4)||0}}return E2}function Ez(E4,E5){var E3=E4.children,E0=0;if(E3&&(E6=E3.length)){var E2=-1,E6,E1=E5+1;while(++E2<E6){E0+=Ez(E3[E2],E1)}}else{if(Ey){E0=+Ey.call(e,H?E4:E4.data,E5)||0}}if(Ey){E4.value=E0}return E0}function e(E1){var E0=[];Ex(E1,0,E0);return E0}e.sort=function(E0){if(!arguments.length){return Ew}Ew=E0;return e};e.children=function(E0){if(!arguments.length){return Ev}Ev=E0;return e};e.value=function(E0){if(!arguments.length){return Ey}Ey=E0;return e};e.revalue=function(E0){Ez(E0,0);return E0};return e};function Dq(Ev,e){d3.rebind(Ev,e,"sort","children","value");Ev.links=Dr;Ev.nodes=function(Ew){H=true;return(Ev.nodes=Ev)(Ew)};return Ev}function AZ(e){return e.children}function Eg(e){return e.value}function B5(Ev,e){return e.value-Ev.value}function Dr(e){return d3.merge(e.map(function(Ev){return(Ev.children||[]).map(function(Ew){return{source:Ev,target:Ew}})}))}var H=false;d3.layout.pack=function(){var e=d3.layout.hierarchy().sort(CU),Ew=[1,1];function Ev(E3,E1){var E0=e.call(this,E3,E1),Ey=E0[0];Ey.x=0;Ey.y=0;CF(Ey);var Ex=Ew[0],E2=Ew[1],Ez=1/Math.max(2*Ey.r/Ex,2*Ey.r/E2);C8(Ey,Ex/2,E2/2,Ez);return E0}Ev.size=function(Ex){if(!arguments.length){return Ew}Ew=Ex;return Ev};return Dq(Ev,e)};function CU(Ev,e){return Ev.value-e.value}function Aw(Ev,e){var Ew=Ev._pack_next;Ev._pack_next=e;e._pack_prev=Ev;e._pack_next=Ew;Ew._pack_prev=e}function Ab(Ev,e){Ev._pack_next=e;e._pack_prev=Ev}function CN(Ew,e){var Ex=e.x-Ew.x,Ev=e.y-Ew.y,Ey=Ew.r+e.r;return Ey*Ey-Ex*Ex-Ev*Ev>0.001}function k(E4){var E9=Infinity,FD=-Infinity,e=Infinity,Ey=-Infinity,E3=E4.length,FC,FB,FA,E7,E6;function Ew(FE){E9=Math.min(FE.x-FE.r,E9);FD=Math.max(FE.x+FE.r,FD);e=Math.min(FE.y-FE.r,e);Ey=Math.max(FE.y+FE.r,Ey)}E4.forEach(AO);FC=E4[0];FC.x=-FC.r;FC.y=0;Ew(FC);if(E3>1){FB=E4[1];FB.x=FB.r;FB.y=0;Ew(FB);if(E3>2){FA=E4[2];Aa(FC,FB,FA);Ew(FA);Aw(FC,FA);FC._pack_prev=FA;Aw(FA,FB);FB=FC._pack_next;for(var E8=3;E8<E3;E8++){Aa(FC,FB,FA=E4[E8]);var Ev=0,Ez=1,Ex=1;for(E7=FB._pack_next;E7!==FB;E7=E7._pack_next,Ez++){if(CN(E7,FA)){Ev=1;break}}if(Ev==1){for(E6=FC._pack_prev;E6!==E7._pack_prev;E6=E6._pack_prev,Ex++){if(CN(E6,FA)){break}}}if(Ev){if(Ez<Ex||(Ez==Ex&&FB.r<FC.r)){Ab(FC,FB=E7)}else{Ab(FC=E6,FB)}E8--}else{Aw(FC,FA);FB=FA;Ew(FA)}}}}var E1=(E9+FD)/2,E0=(e+Ey)/2,E2=0;for(var E8=0;E8<E3;E8++){var E5=E4[E8];E5.x-=E1;E5.y-=E0;E2=Math.max(E2,E5.r+Math.sqrt(E5.x*E5.x+E5.y*E5.y))}E4.forEach(Ca);return E2}function AO(e){e._pack_next=e._pack_prev=e}function Ca(e){delete e._pack_next;delete e._pack_prev}function CF(Ev){var e=Ev.children;if(e&&e.length){e.forEach(CF);Ev.r=k(e)}else{Ev.r=Math.sqrt(Ev.value)}}function C8(Ey,e,E0,Ev){var Ex=Ey.children;Ey.x=(e+=Ev*Ey.x);Ey.y=(E0+=Ev*Ey.y);Ey.r*=Ev;if(Ex){var Ew=-1,Ez=Ex.length;while(++Ew<Ez){C8(Ex[Ew],e,E0,Ev)}}}function Aa(Ez,Ex,Ev){var E2=Ez.r+Ev.r,E5=Ex.x-Ez.x,E3=Ex.y-Ez.y;if(E2&&(E5||E3)){var E4=Ex.r+Ev.r,E1=Math.sqrt(E5*E5+E3*E3),E0=Math.max(-1,Math.min(1,(E2*E2+E1*E1-E4*E4)/(2*E2*E1))),e=Math.acos(E0),Ey=E0*(E2/=E1),Ew=Math.sin(e)*E2;Ev.x=Ez.x+Ey*E5+Ew*E3;Ev.y=Ez.y+Ey*E3-Ew*E5}else{Ev.x=Ez.x+E2;Ev.y=Ez.y}}d3.layout.cluster=function(){var Ev=d3.layout.hierarchy().sort(null).value(null),Ex=Bu,Ew=[1,1];function e(E5,E2){var Ey=Ev.call(this,E5,E2),E6=Ey[0],E7,E8=0,E4,E3;Eb(E6,function(FB){var FA=FB.children;if(FA&&FA.length){FB.x=Al(FA);FB.y=Ak(FA)}else{FB.x=E7?E8+=Ex(FB,E7):0;FB.y=0;E7=FB}});var E1=CV(E6),E9=Bz(E6),E0=E1.x-Ex(E1,E9)/2,Ez=E9.x+Ex(E9,E1)/2;Eb(E6,function(FA){FA.x=(FA.x-E0)/(Ez-E0)*Ew[0];FA.y=(1-(E6.y?FA.y/E6.y:1))*Ew[1]});return Ey}e.separation=function(Ey){if(!arguments.length){return Ex}Ex=Ey;return e};e.size=function(Ey){if(!arguments.length){return Ew}Ew=Ey;return e};return Dq(e,Ev)};function Ak(e){return 1+d3.max(e,function(Ev){return Ev.y})}function Al(e){return e.reduce(function(Ev,Ew){return Ev+Ew.x},0)/e.length}function CV(Ev){var e=Ev.children;return e&&e.length?CV(e[0]):Ev}function Bz(Ev){var e=Ev.children,Ew;return e&&(Ew=e.length)?Bz(e[Ew-1]):Ev}d3.layout.tree=function(){var Ev=d3.layout.hierarchy().sort(null).value(null),Ex=Bu,Ew=[1,1];function e(E5,E3){var Ez=Ev.call(this,E5,E3),E7=Ez[0];function E4(FF,FB){var FD=FF.children,FI=FF._tree;if(FD&&(FE=FD.length)){var FE,FK=FD[0],FJ,FH=FK,FC,FG=-1;while(++FG<FE){FC=FD[FG];E4(FC,FJ);FH=Ey(FC,FJ,FH);FJ=FC}Bw(FF);var FL=0.5*(FK._tree.prelim+FC._tree.prelim);if(FB){FI.prelim=FB._tree.prelim+Ex(FF,FB);FI.mod=FI.prelim-FL}else{FI.prelim=FL}}else{if(FB){FI.prelim=FB._tree.prelim+Ex(FF,FB)}}}function E6(FE,FB){FE.x=FE._tree.prelim+FB;var FD=FE.children;if(FD&&(FF=FD.length)){var FC=-1,FF;FB+=FE._tree.mod;while(++FC<FF){E6(FD[FC],FB)}}}function Ey(FF,FB,FI){if(FB){var FE=FF,FD=FF,FH=FB,FG=FF.parent.children[0],FK=FE._tree.mod,FJ=FD._tree.mod,FM=FH._tree.mod,FL=FG._tree.mod,FC;while(FH=AG(FH),FE=Em(FE),FH&&FE){FG=Em(FG);FD=AG(FD);FD._tree.ancestor=FF;FC=FH._tree.prelim+FM-FE._tree.prelim-FK+Ex(FH,FE);if(FC>0){Eo(DX(FH,FF,FI),FF,FC);FK+=FC;FJ+=FC}FM+=FH._tree.mod;FK+=FE._tree.mod;FL+=FG._tree.mod;FJ+=FD._tree.mod}if(FH&&!AG(FD)){FD._tree.thread=FH;FD._tree.mod+=FM-FJ}if(FE&&!Em(FG)){FG._tree.thread=FE;FG._tree.mod+=FK-FL;FI=FF}}return FI}Eb(E7,function(FC,FB){FC._tree={ancestor:FC,prelim:0,mod:0,change:0,shift:0,number:FB?FB._tree.number+1:0}});E4(E7);E6(E7,-E7._tree.prelim);var E2=CC(E7,Ap),FA=CC(E7,Bb),E9=CC(E7,W),E1=E2.x-Ex(E2,FA)/2,E0=FA.x+Ex(FA,E2)/2,E8=E9.depth||1;Eb(E7,function(FB){FB.x=(FB.x-E1)/(E0-E1)*Ew[0];FB.y=FB.depth/E8*Ew[1];delete FB._tree});return Ez}e.separation=function(Ey){if(!arguments.length){return Ex}Ex=Ey;return e};e.size=function(Ey){if(!arguments.length){return Ew}Ew=Ey;return e};return Dq(e,Ev)};function Bu(Ev,e){return Ev.parent==e.parent?1:2}function Em(Ev){var e=Ev.children;return e&&e.length?e[0]:Ev._tree.thread}function AG(Ev){var e=Ev.children,Ew;return e&&(Ew=e.length)?e[Ew-1]:Ev._tree.thread}function CC(Ew,Ex){var Ev=Ew.children;if(Ev&&(Ey=Ev.length)){var Ez,Ey,e=-1;while(++e<Ey){if(Ex(Ez=CC(Ev[e],Ex),Ew)>0){Ew=Ez}}}return Ew}function Bb(Ev,e){return Ev.x-e.x}function Ap(Ev,e){return e.x-Ev.x}function W(Ev,e){return Ev.depth-e.depth}function Eb(Ev,Ew){function e(E1,E0){var Ez=E1.children;if(Ez&&(E2=Ez.length)){var E3,Ey=null,Ex=-1,E2;while(++Ex<E2){E3=Ez[Ex];e(E3,Ey);Ey=E3}}Ew(E1,E0)}e(Ev,null)}function Bw(Ex){var e=0,Ez=0,Ew=Ex.children,Ev=Ew.length,Ey;while(--Ev>=0){Ey=Ew[Ev]._tree;Ey.prelim+=e;Ey.mod+=e;e+=Ey.shift+(Ez+=Ey.change)}}function Eo(Ev,Ew,e){Ev=Ev._tree;Ew=Ew._tree;var Ex=e/(Ew.number-Ev.number);Ev.change+=Ex;Ew.change-=Ex;Ew.shift+=e;Ew.prelim+=e;Ew.mod+=e}function DX(e,Ew,Ev){return e._tree.ancestor.parent==Ew.parent?e._tree.ancestor:Ev}d3.layout.treemap=function(){var E1=d3.layout.hierarchy(),E5=Math.round,E7=[1,1],E2=null,e=Cu,E3=false,Ez,E0=0.5*(1+Math.sqrt(5));function Ev(FA,E8){var E9=-1,FD=FA.length,FC,FB;while(++E9<FD){FB=(FC=FA[E9]).value*(E8<0?0:E8);FC.area=isNaN(FB)||FB<=0?0:FB}}function Ex(FC){var E9=FC.children;if(E9&&E9.length){var FF=e(FC),FH=[],FE=E9.slice(),E8,FD=Infinity,FB,FG=Math.min(FF.dx,FF.dy),FA;Ev(FE,FF.dx*FF.dy/FC.value);FH.area=0;while((FA=FE.length)>0){FH.push(E8=FE[FA-1]);FH.area+=E8.area;if((FB=Ew(FH,FG))<=FD){FE.pop();FD=FB}else{FH.area-=FH.pop().area;Ey(FH,FG,FF,false);FG=Math.min(FF.dx,FF.dy);FH.length=FH.area=0;FD=Infinity}}if(FH.length){Ey(FH,FG,FF,true);FH.length=FH.area=0}E9.forEach(Ex)}}function E6(FB){var E8=FB.children;if(E8&&E8.length){var FA=e(FB),E9=E8.slice(),FD,FC=[];Ev(E9,FA.dx*FA.dy/FB.value);FC.area=0;while(FD=E9.pop()){FC.push(FD);FC.area+=FD.area;if(FD.z!=null){Ey(FC,FD.z?FA.dx:FA.dy,FA,!E9.length);FC.length=FC.area=0}}E8.forEach(E6)}}function Ew(FD,E9){var FB=FD.area,FC,FF=0,E8=Infinity,FA=-1,FE=FD.length;while(++FA<FE){if(!(FC=FD[FA].area)){continue}if(FC<E8){E8=FC}if(FC>FF){FF=FC}}FB*=FB;E9*=E9;return FB?Math.max((E9*FF*E0)/FB,FB/(E9*E8*E0)):Infinity}function Ey(FH,FG,FC,FF){var FA=-1,E9=FH.length,FD=FC.x,FB=FC.y,FE=FG?E5(FH.area/FG):0,E8;if(FG==FC.dx){if(FF||FE>FC.dy){FE=FC.dy}while(++FA<E9){E8=FH[FA];E8.x=FD;E8.y=FB;E8.dy=FE;FD+=E8.dx=Math.min(FC.x+FC.dx-FD,FE?E5(E8.area/FE):0)}E8.z=true;E8.dx+=FC.x+FC.dx-FD;FC.y+=FE;FC.dy-=FE}else{if(FF||FE>FC.dx){FE=FC.dx}while(++FA<E9){E8=FH[FA];E8.x=FD;E8.y=FB;E8.dx=FE;FB+=E8.dy=Math.min(FC.y+FC.dy-FB,FE?E5(E8.area/FE):0)}E8.z=false;E8.dy+=FC.y+FC.dy-FB;FC.x+=FE;FC.dx-=FE}}function E4(FA){var E9=Ez||E1(FA),E8=E9[0];E8.x=0;E8.y=0;E8.dx=E7[0];E8.dy=E7[1];if(Ez){E1.revalue(E8)}Ev([E8],E8.dx*E8.dy/E8.value);(Ez?E6:Ex)(E8);if(E3){Ez=E9}return E9}E4.size=function(E8){if(!arguments.length){return E7}E7=E8;return E4};E4.padding=function(E8){if(!arguments.length){return E2}function FB(FC){var FD=E8.call(E4,FC,FC.depth);return FD==null?Cu(FC):AU(FC,typeof FD==="number"?[FD,FD,FD,FD]:FD)}function FA(FC){return AU(FC,E8)}var E9;e=(E2=E8)==null?Cu:(E9=typeof E8)==="function"?FB:E9==="number"?(E8=[E8,E8,E8,E8],FA):FA;return E4};E4.round=function(E8){if(!arguments.length){return E5!=Number}E5=E8?Math.round:Number;return E4};E4.sticky=function(E8){if(!arguments.length){return E3}E3=E8;Ez=null;return E4};E4.ratio=function(E8){if(!arguments.length){return E0}E0=E8;return E4};return Dq(E4,E1)};function Cu(e){return{x:e.x,y:e.y,dx:e.dx,dy:e.dy}}function AU(Ex,Ey){var e=Ex.x+Ey[3],Ez=Ex.y+Ey[0],Ew=Ex.dx-Ey[1]-Ey[3],Ev=Ex.dy-Ey[0]-Ey[2];if(Ew<0){e+=Ew/2;Ew=0}if(Ev<0){Ez+=Ev/2;Ev=0}return{x:e,y:Ez,dx:Ew,dy:Ev}}d3.csv=function(e,Ev){d3.text(e,"text/csv",function(Ew){Ev(Ew&&d3.csv.parse(Ew))})};d3.csv.parse=function(e){var Ev;return d3.csv.parseRows(e,function(E0,Ey){if(Ey){var Ez={},Ex=-1,Ew=Ev.length;while(++Ex<Ew){Ez[Ev[Ex]]=E0[Ex]}return Ez}else{Ev=E0;return null}})};d3.csv.parseRows=function(E1,Ey){var Ev={},Ex={},E4=[],E2=/\r\n|[,\r\n]/g,e=0,E3,Ez;E2.lastIndex=0;function Ew(){if(E2.lastIndex>=E1.length){return Ex}if(Ez){Ez=false;return Ev}var E6=E2.lastIndex;if(E1.charCodeAt(E6)===34){var E7=E6;while(E7++<E1.length){if(E1.charCodeAt(E7)===34){if(E1.charCodeAt(E7+1)!==34){break}E7++}}E2.lastIndex=E7+2;var E8=E1.charCodeAt(E7+1);if(E8===13){Ez=true;if(E1.charCodeAt(E7+2)===10){E2.lastIndex++}}else{if(E8===10){Ez=true}}return E1.substring(E6+1,E7).replace(/""/g,'"')}var E5=E2.exec(E1);if(E5){Ez=E5[0].charCodeAt(0)!==44;return E1.substring(E6,E5.index)}E2.lastIndex=E1.length;return E1.substring(E6)}while((E3=Ew())!==Ex){var E0=[];while((E3!==Ev)&&(E3!==Ex)){E0.push(E3);E3=Ew()}if(Ey&&!(E0=Ey(E0,e++))){continue}E4.push(E0)}return E4};d3.csv.format=function(e){return e.map(CK).join("\n")};function CK(e){return e.map(AE).join(",")}function AE(e){return/[",\n]/.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}d3.geo={};var Cb=Math.PI/180;d3.geo.azimuthal=function(){var Ez="orthographic",E2,Ex=200,Ew=[480,250],e,E1,Ey,E0;function Ev(FE){var E4=FE[0]*Cb-e,FD=FE[1]*Cb,E8=Math.cos(E4),E3=Math.sin(E4),E6=Math.cos(FD),FC=Math.sin(FD),E5=Ez!=="orthographic"?E0*FC+Ey*E6*E8:null,E9,E7=Ez==="stereographic"?1/(1+E5):Ez==="gnomonic"?1/E5:Ez==="equidistant"?(E9=Math.acos(E5),E9?E9/Math.sin(E9):0):Ez==="equalarea"?Math.sqrt(2/(1+E5)):1,FB=E7*E6*E3,FA=E7*(E0*E6*E8-Ey*FC);return[Ex*FB+Ew[0],Ex*FA+Ew[1]]}Ev.invert=function(E6){var E3=(E6[0]-Ew[0])/Ex,E9=(E6[1]-Ew[1])/Ex,E4=Math.sqrt(E3*E3+E9*E9),E8=Ez==="stereographic"?2*Math.atan(E4):Ez==="gnomonic"?Math.atan(E4):Ez==="equidistant"?E4:Ez==="equalarea"?2*Math.asin(0.5*E4):Math.asin(E4),E5=Math.sin(E8),E7=Math.cos(E8);return[(e+Math.atan2(E3*E5,E4*Ey*E7+E9*E0*E5))/Cb,Math.asin(E7*E0-(E4?(E9*E5*Ey)/E4:0))/Cb]};Ev.mode=function(E3){if(!arguments.length){return Ez}Ez=E3+"";return Ev};Ev.origin=function(E3){if(!arguments.length){return E2}E2=E3;e=E2[0]*Cb;E1=E2[1]*Cb;Ey=Math.cos(E1);E0=Math.sin(E1);return Ev};Ev.scale=function(E3){if(!arguments.length){return Ex}Ex=+E3;return Ev};Ev.translate=function(E3){if(!arguments.length){return Ew}Ew=[+E3[0],+E3[1]];return Ev};return Ev.origin([0,0])};d3.geo.albers=function(){var E2=[-98,38],E0=[29.5,45.5],Ez=1000,Ey=[480,250],E1,Ex,Ev,E3;function Ew(E6){var E4=Ex*(Cb*E6[0]-E1),E5=Math.sqrt(Ev-2*Ex*Math.sin(Cb*E6[1]))/Ex;return[Ez*E5*Math.sin(E4)+Ey[0],Ez*(E5*Math.cos(E4)-E3)+Ey[1]]}Ew.invert=function(E7){var E4=(E7[0]-Ey[0])/Ez,E9=(E7[1]-Ey[1])/Ez,E8=E3+E9,E5=Math.atan2(E4,E8),E6=Math.sqrt(E4*E4+E8*E8);return[(E1+E5/Ex)/Cb,Math.asin((Ev-E6*E6*Ex*Ex)/(2*Ex))/Cb]};function e(){var E5=Cb*E0[0],E4=Cb*E0[1],E8=Cb*E2[1],E6=Math.sin(E5),E7=Math.cos(E5);E1=Cb*E2[0];Ex=0.5*(E6+Math.sin(E4));Ev=E7*E7+2*Ex*E6;E3=Math.sqrt(Ev-2*Ex*Math.sin(E8))/Ex;return Ew}Ew.origin=function(E4){if(!arguments.length){return E2}E2=[+E4[0],+E4[1]];return e()};Ew.parallels=function(E4){if(!arguments.length){return E0}E0=[+E4[0],+E4[1]];return e()};Ew.scale=function(E4){if(!arguments.length){return Ez}Ez=+E4;return Ew};Ew.translate=function(E4){if(!arguments.length){return Ey}Ey=[+E4[0],+E4[1]];return Ew};return e()};d3.geo.albersUsa=function(){var e=d3.geo.albers();var Ey=d3.geo.albers().origin([-160,60]).parallels([55,65]);var Ex=d3.geo.albers().origin([-160,20]).parallels([8,18]);var Ew=d3.geo.albers().origin([-60,10]).parallels([8,18]);function Ev(E1){var E0=E1[0],Ez=E1[1];return(Ez>50?Ey:E0<-140?Ex:Ez<21?Ew:e)(E1)}Ev.scale=function(Ez){if(!arguments.length){return e.scale()}e.scale(Ez);Ey.scale(Ez*0.6);Ex.scale(Ez);Ew.scale(Ez*1.5);return Ev.translate(e.translate())};Ev.translate=function(E0){if(!arguments.length){return e.translate()}var Ez=e.scale()/1000,E2=E0[0],E1=E0[1];e.translate(E0);Ey.translate([E2-400*Ez,E1+170*Ez]);Ex.translate([E2-190*Ez,E1+200*Ez]);Ew.translate([E2+580*Ez,E1+430*Ez]);return Ev};return Ev.scale(e.scale())};d3.geo.bonne=function(){var Ez=200,Ey=[480,250],e,Ex,Ew,Ev;function E0(E4){var E1=E4[0]*Cb-e,E5=E4[1]*Cb-Ex;if(Ew){var E3=Ev+Ew-E5,E2=E1*Math.cos(E5)/E3;E1=E3*Math.sin(E2);E5=E3*Math.cos(E2)-Ev}else{E1*=Math.cos(E5);E5*=-1}return[Ez*E1+Ey[0],Ez*E5+Ey[1]]}E0.invert=function(E3){var E1=(E3[0]-Ey[0])/Ez,E5=(E3[1]-Ey[1])/Ez;if(Ew){var E4=Ev+E5,E2=Math.sqrt(E1*E1+E4*E4);E5=Ev+Ew-E2;E1=e+E2*Math.atan2(E1,E4)/Math.cos(E5)}else{E5*=-1;E1/=Math.cos(E5)}return[E1/Cb,E5/Cb]};E0.parallel=function(E1){if(!arguments.length){return Ew/Cb}Ev=1/Math.tan(Ew=E1*Cb);return E0};E0.origin=function(E1){if(!arguments.length){return[e/Cb,Ex/Cb]}e=E1[0]*Cb;Ex=E1[1]*Cb;return E0};E0.scale=function(E1){if(!arguments.length){return Ez}Ez=+E1;return E0};E0.translate=function(E1){if(!arguments.length){return Ey}Ey=[+E1[0],+E1[1]];return E0};return E0.origin([0,0]).parallel(45)};d3.geo.equirectangular=function(){var Ew=500,Ev=[480,250];function e(Ey){var Ex=Ey[0]/360,Ez=-Ey[1]/360;return[Ew*Ex+Ev[0],Ew*Ez+Ev[1]]}e.invert=function(Ey){var Ex=(Ey[0]-Ev[0])/Ew,Ez=(Ey[1]-Ev[1])/Ew;return[360*Ex,-360*Ez]};e.scale=function(Ex){if(!arguments.length){return Ew}Ew=+Ex;return e};e.translate=function(Ex){if(!arguments.length){return Ev}Ev=[+Ex[0],+Ex[1]];return e};return e};d3.geo.mercator=function(){var Ew=500,Ev=[480,250];function e(Ey){var Ex=Ey[0]/360,Ez=-(Math.log(Math.tan(Math.PI/4+Ey[1]*Cb/2))/Cb)/360;return[Ew*Ex+Ev[0],Ew*Math.max(-0.5,Math.min(0.5,Ez))+Ev[1]]}e.invert=function(Ey){var Ex=(Ey[0]-Ev[0])/Ew,Ez=(Ey[1]-Ev[1])/Ew;return[360*Ex,2*Math.atan(Math.exp(-360*Ez*Cb))/Cb-90]};e.scale=function(Ex){if(!arguments.length){return Ew}Ew=+Ex;return e};e.translate=function(Ex){if(!arguments.length){return Ev}Ev=[+Ex[0],+Ex[1]];return e};return e};function DI(Ev,e){return function(Ew){return Ew&&Ev.hasOwnProperty(Ew.type)?Ev[Ew.type](Ew):e}}d3.geo.path=function(){var E0=4.5,E4=Z(E0),Ez=d3.geo.albersUsa();function E3(E6,E5){if(typeof E0==="function"){E4=Z(E0.apply(this,arguments))}return Ev(E6)||null}function E1(E5){return Ez(E5).join(",")}var Ev=DI({FeatureCollection:function(E8){var E7=[],E6=E8.features,E5=-1,E9=E6.length;while(++E5<E9){E7.push(Ev(E6[E5].geometry))}return E7.join("")},Feature:function(E5){return Ev(E5.geometry)},Point:function(E5){return"M"+E1(E5.coordinates)+E4},MultiPoint:function(E8){var E6=[],E7=E8.coordinates,E5=-1,E9=E7.length;while(++E5<E9){E6.push("M",E1(E7[E5]),E4)}return E6.join("")},LineString:function(E8){var E6=["M"],E7=E8.coordinates,E5=-1,E9=E7.length;while(++E5<E9){E6.push(E1(E7[E5]),"L")}E6.pop();return E6.join("")},MultiLineString:function(FB){var E9=[],FA=FB.coordinates,E8=-1,FC=FA.length,E6,E7,E5;while(++E8<FC){E6=FA[E8];E7=-1;E5=E6.length;E9.push("M");while(++E7<E5){E9.push(E1(E6[E7]),"L")}E9.pop()}return E9.join("")},Polygon:function(FB){var E9=[],FA=FB.coordinates,E8=-1,FC=FA.length,E6,E7,E5;while(++E8<FC){E6=FA[E8];E7=-1;if((E5=E6.length-1)>0){E9.push("M");while(++E7<E5){E9.push(E1(E6[E7]),"L")}E9[E9.length-1]="Z"}}return E9.join("")},MultiPolygon:function(E6){var FF=[],FE=E6.coordinates,FD=-1,E7=FE.length,FA,FC,E8,FB,E9,E5;while(++FD<E7){FA=FE[FD];FC=-1;E8=FA.length;while(++FC<E8){FB=FA[FC];E9=-1;if((E5=FB.length-1)>0){FF.push("M");while(++E9<E5){FF.push(E1(FB[E9]),"L")}FF[FF.length-1]="Z"}}}return FF.join("")},GeometryCollection:function(E8){var E7=[],E6=E8.geometries,E5=-1,E9=E6.length;while(++E5<E9){E7.push(Ev(E6[E5]))}return E7.join("")}});var Ew=E3.area=DI({FeatureCollection:function(E8){var E7=0,E6=E8.features,E5=-1,E9=E6.length;while(++E5<E9){E7+=Ew(E6[E5])}return E7},Feature:function(E5){return Ew(E5.geometry)},Polygon:function(E5){return Ey(E5.coordinates)},MultiPolygon:function(E8){var E6=0,E7=E8.coordinates,E5=-1,E9=E7.length;while(++E5<E9){E6+=Ey(E7[E5])}return E6},GeometryCollection:function(E8){var E7=0,E6=E8.geometries,E5=-1,E9=E6.length;while(++E5<E9){E7+=Ew(E6[E5])}return E7}},0);function Ey(E7){var E6=Ex(E7[0]),E5=0,E8=E7.length;while(++E5<E8){E6-=Ex(E7[E5])}return E6}function e(FD){var FB=d3.geom.polygon(FD[0].map(Ez)),E5=FB.area(),E6=FB.centroid(E5<0?(E5*=-1,1):-1),FC=E6[0],FA=E6[1],E9=E5,E8=0,E7=FD.length;while(++E8<E7){FB=d3.geom.polygon(FD[E8].map(Ez));E5=FB.area();E6=FB.centroid(E5<0?(E5*=-1,1):-1);FC-=E6[0];FA-=E6[1];E9-=E5}return[FC,FA,6*E9]}var E2=E3.centroid=DI({Feature:function(E5){return E2(E5.geometry)},Polygon:function(E6){var E5=e(E6.coordinates);return[E5[0]/E5[2],E5[1]/E5[2]]},MultiPolygon:function(E6){var E5=0,FD=E6.coordinates,E7,FC=0,FB=0,FA=0,E9=-1,E8=FD.length;while(++E9<E8){E7=e(FD[E9]);FC+=E7[0];FB+=E7[1];FA+=E7[2]}return[FC/FA,FB/FA]}});function Ex(E5){return Math.abs(d3.geom.polygon(E5.map(Ez)).area())}E3.projection=function(E5){Ez=E5;return E3};E3.pointRadius=function(E5){if(typeof E5==="function"){E0=E5}else{E0=+E5;E4=Z(E0)}return E3};return E3};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(Ew){var Ey=Infinity,e=Infinity,Ev=-Infinity,Ex=-Infinity;Bk(Ew,function(Ez,E0){if(Ez<Ey){Ey=Ez}if(Ez>Ev){Ev=Ez}if(E0<e){e=E0}if(E0>Ex){Ex=E0}});return[[Ey,e],[Ev,Ex]]};function Bk(Ev,e){if(D0.hasOwnProperty(Ev.type)){D0[Ev.type](Ev,e)}}var D0={Feature:Ef,FeatureCollection:De,GeometryCollection:Cy,LineString:Dj,MultiLineString:Dw,MultiPoint:Dj,MultiPolygon:Ed,Point:ER,Polygon:BQ};function Ef(Ev,e){Bk(Ev.geometry,e)}function De(Ex,Ew){for(var e=Ex.features,Ev=0,Ey=e.length;Ev<Ey;Ev++){Bk(e[Ev].geometry,Ew)}}function Cy(Ex,Ew){for(var e=Ex.geometries,Ev=0,Ey=e.length;Ev<Ey;Ev++){Bk(e[Ev],Ew)}}function Dj(Ex,Ew){for(var e=Ex.coordinates,Ev=0,Ey=e.length;Ev<Ey;Ev++){Ew.apply(null,e[Ev])}}function Dw(E0,Ez){for(var Ew=E0.coordinates,Ey=0,E1=Ew.length;Ey<E1;Ey++){for(var Ev=Ew[Ey],Ex=0,e=Ev.length;Ex<e;Ex++){Ez.apply(null,Ev[Ex])}}}function Ed(E0,Ez){for(var Ew=E0.coordinates,Ey=0,E1=Ew.length;Ey<E1;Ey++){for(var Ev=Ew[Ey][0],Ex=0,e=Ev.length;Ex<e;Ex++){Ez.apply(null,Ev[Ex])}}}function ER(Ev,e){e.apply(null,Ev.coordinates)}function BQ(Ex,Ew){for(var e=Ex.coordinates[0],Ev=0,Ey=e.length;Ev<Ey;Ev++){Ew.apply(null,e[Ev])}}d3.geo.circle=function(){var E2=[0,0],Ez=90-0.01,E0=Ez*Cb,Ew=d3.geo.greatArc().target(Object);function Ev(){}function Ex(E3){return Ew.distance(E3)<E0}Ev.clip=function(E3){Ew.source(typeof E2==="function"?E2.apply(this,arguments):E2);return E1(E3)};var E1=DI({FeatureCollection:function(E4){var E3=E4.features.map(E1).filter(Object);return E3&&(E4=Object.create(E4),E4.features=E3,E4)},Feature:function(E4){var E3=E1(E4.geometry);return E3&&(E4=Object.create(E4),E4.geometry=E3,E4)},Point:function(E3){return Ex(E3.coordinates)&&E3},MultiPoint:function(E4){var E3=E4.coordinates.filter(Ex);return E3.length&&{type:E4.type,coordinates:E3}},LineString:function(E4){var E3=Ey(E4.coordinates);return E3.length&&(E4=Object.create(E4),E4.coordinates=E3,E4)},MultiLineString:function(E4){var E3=E4.coordinates.map(Ey).filter(function(E5){return E5.length});return E3.length&&(E4=Object.create(E4),E4.coordinates=E3,E4)},Polygon:function(E4){var E3=E4.coordinates.map(Ey);return E3[0].length&&(E4=Object.create(E4),E4.coordinates=E3,E4)},MultiPolygon:function(E4){var E3=E4.coordinates.map(function(E5){return E5.map(Ey)}).filter(function(E5){return E5[0].length});return E3.length&&(E4=Object.create(E4),E4.coordinates=E3,E4)},GeometryCollection:function(E4){var E3=E4.geometries.map(E1).filter(Object);return E3.length&&(E4=Object.create(E4),E4.geometries=E3,E4)}});function Ey(E8){var E7=-1,E5=E8.length,E6=[],FB,FA,E9,E4,E3;while(++E7<E5){E3=Ew.distance(E9=E8[E7]);if(E3<E0){if(FA){E6.push(Eu(FA,E9)((E4-E0)/(E4-E3)))}E6.push(E9);FB=FA=null}else{FA=E9;if(!FB&&E6.length){E6.push(Eu(E6[E6.length-1],FA)((E0-E4)/(E3-E4)));FB=FA}}E4=E3}if(FA&&E6.length){E3=Ew.distance(E9=E6[0]);E6.push(Eu(FA,E9)((E4-E0)/(E4-E3)))}return e(E6)}function e(E9){var E7=0,FA=E9.length,E6,E3,E4=FA?[E9[0]]:E9,E8,E5=Ew.source();while(++E7<FA){E8=Ew.source(E9[E7-1])(E9[E7]).coordinates;for(E6=0,E3=E8.length;++E6<E3;){E4.push(E8[E6])}}Ew.source(E5);return E4}Ev.origin=function(E3){if(!arguments.length){return E2}E2=E3;return Ev};Ev.angle=function(E3){if(!arguments.length){return Ez}E0=(Ez=+E3)*Cb;return Ev};Ev.precision=function(E3){if(!arguments.length){return Ew.precision()}Ew.precision(E3);return Ev};return Ev};d3.geo.greatArc=function(){var Ew=Bh,Ex=Bm,Ev=6*Cb;function e(){var Ez=typeof Ew==="function"?Ew.apply(this,arguments):Ew,Ey=typeof Ex==="function"?Ex.apply(this,arguments):Ex,E1=Eu(Ez,Ey),E2=Ev/E1.d,E0=0,E3=[Ez];while((E0+=E2)<1){E3.push(E1(E0))}E3.push(Ey);return{type:"LineString",coordinates:E3}}e.distance=function(){var Ez=typeof Ew==="function"?Ew.apply(this,arguments):Ew,Ey=typeof Ex==="function"?Ex.apply(this,arguments):Ex;return Eu(Ez,Ey).d};e.source=function(Ey){if(!arguments.length){return Ew}Ew=Ey;return e};e.target=function(Ey){if(!arguments.length){return Ex}Ex=Ey;return e};e.precision=function(Ey){if(!arguments.length){return Ev/Cb}Ev=Ey*Cb;return e};return e};function Bh(e){return e.source}function Bm(e){return e.target}function Eu(E8,E5){var Ex=E8[0]*Cb,E4=Math.cos(Ex),Ew=Math.sin(Ex),FA=E8[1]*Cb,Ez=Math.cos(FA),E9=Math.sin(FA),Ev=E5[0]*Cb,E3=Math.cos(Ev),e=Math.sin(Ev),E7=E5[1]*Cb,Ey=Math.cos(E7),E6=Math.sin(E7),E2=E0.d=Math.acos(Math.max(-1,Math.min(1,E9*E6+Ez*Ey*Math.cos(Ev-Ex)))),E1=Math.sin(E2);function E0(FD){var FC=Math.sin(E2-(FD*=E2))/E1,FG=Math.sin(FD)/E1,FB=FC*Ez*E4+FG*Ey*E3,FF=FC*Ez*Ew+FG*Ey*e,FE=FC*E9+FG*E6;return[Math.atan2(FF,FB)/Cb,Math.atan2(FE,Math.sqrt(FB*FB+FF*FF))/Cb]}return E0}d3.geo.greatCircle=d3.geo.circle;d3.geom={};d3.geom.contour=function(e,Ev){var E3=Ev||K(e),Ez=[],E1=E3[0],E0=E3[1],E4=0,E2=0,Ex=NaN,Ew=NaN,Ey=0;do{Ey=0;if(e(E1-1,E0-1)){Ey+=1}if(e(E1,E0-1)){Ey+=2}if(e(E1-1,E0)){Ey+=4}if(e(E1,E0)){Ey+=8}if(Ey===6){E4=Ew===-1?-1:1;E2=0}else{if(Ey===9){E4=0;E2=Ex===1?-1:1}else{E4=Bf[Ey];E2=Bd[Ey]}}if(E4!=Ex&&E2!=Ew){Ez.push([E1,E0]);Ex=E4;Ew=E2}E1+=E4;E0+=E2}while(E3[0]!=E1||E3[1]!=E0);return Ez};var Bf=[1,0,1,1,-1,0,-1,1,0,0,0,0,-1,0,-1,NaN],Bd=[0,-1,0,0,0,-1,0,0,1,-1,1,1,0,-1,0,NaN];function K(Ev){var e=0,Ew=0;while(true){if(Ev(e,Ew)){return[e,Ew]}if(e===0){e=Ew+1;Ew=0}else{e=e-1;Ew=Ew+1}}}d3.geom.hull=function(E3){if(E3.length<3){return[]}var E2=E3.length,Ey=E2-1,E9=[],E5=[],E0,Ez,E1=0,Ex,E7,Ev,E4,FA,E8,E6,Ew;for(E0=1;E0<E2;++E0){if(E3[E0][1]<E3[E1][1]){E1=E0}else{if(E3[E0][1]==E3[E1][1]){E1=(E3[E0][0]<E3[E1][0]?E0:E1)}}}for(E0=0;E0<E2;++E0){if(E0===E1){continue}E7=E3[E0][1]-E3[E1][1];Ex=E3[E0][0]-E3[E1][0];E9.push({angle:Math.atan2(E7,Ex),index:E0})}E9.sort(function(FC,FB){return FC.angle-FB.angle});E6=E9[0].angle;E8=E9[0].index;FA=0;for(E0=1;E0<Ey;++E0){Ez=E9[E0].index;if(E6==E9[E0].angle){Ex=E3[E8][0]-E3[E1][0];E7=E3[E8][1]-E3[E1][1];Ev=E3[Ez][0]-E3[E1][0];E4=E3[Ez][1]-E3[E1][1];if((Ex*Ex+E7*E7)>=(Ev*Ev+E4*E4)){E9[E0].index=-1}else{E9[FA].index=-1;E6=E9[E0].angle;FA=E0;E8=Ez}}else{E6=E9[E0].angle;FA=E0;E8=Ez}}E5.push(E1);for(E0=0,Ez=0;E0<2;++Ez){if(E9[Ez].index!==-1){E5.push(E9[Ez].index);E0++}}Ew=E5.length;for(;Ez<Ey;++Ez){if(E9[Ez].index===-1){continue}while(!B0(E5[Ew-2],E5[Ew-1],E9[Ez].index,E3)){--Ew}E5[Ew++]=E9[Ez].index}var e=[];for(E0=0;E0<Ew;++E0){e.push(E3[E5[E0]])}return e};function B0(Ex,Ew,Ev,E4){var E5,E3,E2,E1,E0,Ez,Ey;E5=E4[Ex];E3=E5[0];E2=E5[1];E5=E4[Ew];E1=E5[0];E0=E5[1];E5=E4[Ev];Ez=E5[0];Ey=E5[1];return((Ey-E2)*(E1-E3)-(E0-E2)*(Ez-E3))>0}d3.geom.polygon=function(e){e.area=function(){var Ex=0,Ey=e.length,Ew=e[Ey-1][0]*e[0][1],Ev=e[Ey-1][1]*e[0][0];while(++Ex<Ey){Ew+=e[Ex-1][0]*e[Ex][1];Ev+=e[Ex-1][1]*e[Ex][0]}return(Ev-Ew)*0.5};e.centroid=function(Ey){var Ez=-1,E2=e.length,Ew=0,E1=0,Ex,Ev=e[E2-1],E0;if(!arguments.length){Ey=-1/(6*e.area())}while(++Ez<E2){Ex=Ev;Ev=e[Ez];E0=Ex[0]*Ev[1]-Ev[0]*Ex[1];Ew+=(Ex[0]+Ev[0])*E0;E1+=(Ex[1]+Ev[1])*E0}return[Ew*Ey,E1*Ey]};e.clip=function(E1){var E3,Ey=-1,Ev=e.length,Ex,Ew,E4=e[Ev-1],E2,E0,Ez;while(++Ey<Ev){E3=E1.slice();E1.length=0;E2=e[Ey];E0=E3[(Ew=E3.length)-1];Ex=-1;while(++Ex<Ew){Ez=E3[Ex];if(T(Ez,E4,E2)){if(!T(E0,E4,E2)){E1.push(Dm(E0,Ez,E4,E2))}E1.push(Ez)}else{if(T(E0,E4,E2)){E1.push(Dm(E0,Ez,E4,E2))}}E0=Ez}E4=E2}return E1};return e};function T(Ew,Ev,e){return(e[0]-Ev[0])*(Ew[1]-Ev[1])<(e[1]-Ev[1])*(Ew[0]-Ev[0])}function Dm(E7,E6,FA,E9){var E5=E7[0],E4=E6[0],E3=FA[0],E1=E9[0],Ex=E7[1],Ew=E6[1],Ev=FA[1],e=E9[1],FB=E5-E3,Ey=E4-E5,FC=E1-E3,Ez=Ex-Ev,E8=Ew-Ex,E0=e-Ev,E2=(FC*Ez-E0*FB)/(E0*Ey-FC*E8);return[E5+E2*Ey,Ex+E2*E8]}d3.geom.voronoi=function(Ev){var e=Ev.map(function(){return[]});D6(Ev,function(Ey){var E4,E3,Ex,Ew,E1,Ez;if(Ey.a===1&&Ey.b>=0){E4=Ey.ep.r;E3=Ey.ep.l}else{E4=Ey.ep.l;E3=Ey.ep.r}if(Ey.a===1){E1=E4?E4.y:-1000000;Ex=Ey.c-Ey.b*E1;Ez=E3?E3.y:1000000;Ew=Ey.c-Ey.b*Ez}else{Ex=E4?E4.x:-1000000;E1=Ey.c-Ey.a*Ex;Ew=E3?E3.x:1000000;Ez=Ey.c-Ey.a*Ew}var E2=[Ex,E1],E0=[Ew,Ez];e[Ey.region.l.index].push(E2,E0);e[Ey.region.r.index].push(E2,E0)});return e.map(function(Ey,Ex){var Ew=Ev[Ex][0],Ez=Ev[Ex][1];Ey.forEach(function(E0){E0.angle=Math.atan2(E0[0]-Ew,E0[1]-Ez)});return Ey.sort(function(E1,E0){return E1.angle-E0.angle}).filter(function(E1,E0){return !E0||(E1.angle-Ey[E0-1].angle>1e-10)})})};var Bs={l:"r",r:"l"};function D6(Ez,Ex){var FD={list:Ez.map(function(e,FF){return{index:FF,x:e[0],y:e[1]}}).sort(function(FF,e){return FF.y<e.y?-1:FF.y>e.y?1:FF.x<e.x?-1:FF.x>e.x?1:0}),bottomSite:null};var Ew={list:[],leftEnd:null,rightEnd:null,init:function(){Ew.leftEnd=Ew.createHalfEdge(null,"l");Ew.rightEnd=Ew.createHalfEdge(null,"l");Ew.leftEnd.r=Ew.rightEnd;Ew.rightEnd.l=Ew.leftEnd;Ew.list.unshift(Ew.leftEnd,Ew.rightEnd)},createHalfEdge:function(FF,e){return{edge:FF,side:e,vertex:null,l:null,r:null}},insert:function(FF,e){e.l=FF;e.r=FF.r;FF.r.l=e;FF.r=e},leftBound:function(FF){var e=Ew.leftEnd;do{e=e.r}while(e!=Ew.rightEnd&&FC.rightOf(e,FF));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?FD.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?FD.bottomSite:e.edge.region[Bs[e.side]]}};var FC={bisect:function(FI,FG){var FH={region:{l:FI,r:FG},ep:{l:null,r:null}};var FF=FG.x-FI.x,e=FG.y-FI.y,FK=FF>0?FF:-FF,FJ=e>0?e:-e;FH.c=FI.x*FF+FI.y*e+(FF*FF+e*e)*0.5;if(FK>FJ){FH.a=1;FH.b=e/FF;FH.c/=FF}else{FH.b=1;FH.a=FF/e;FH.c/=e}return FH},intersect:function(FI,FH){var FN=FI.edge,FM=FH.edge;if(!FN||!FM||(FN.region.r==FM.region.r)){return null}var FL=(FN.a*FM.b)-(FN.b*FM.a);if(Math.abs(FL)<1e-10){return null}var FG=(FN.c*FM.b-FM.c*FN.b)/FL,FQ=(FM.c*FN.a-FN.c*FM.a)/FL,FP=FN.region.r,FK=FM.region.r,FF,FJ;if((FP.y<FK.y)||(FP.y==FK.y&&FP.x<FK.x)){FF=FI;FJ=FN}else{FF=FH;FJ=FM}var FO=(FG>=FJ.region.r.x);if((FO&&(FF.side==="l"))||(!FO&&(FF.side==="r"))){return null}return{x:FG,y:FQ}},rightOf:function(FK,FF){var FO=FK.edge,FI=FO.region.r,FR=(FF.x>FI.x);if(FR&&(FK.side==="l")){return 1}if(!FR&&(FK.side==="r")){return 0}if(FO.a===1){var FQ=FF.y-FI.y,FG=FF.x-FI.x,FL=0,FP=0;if((!FR&&(FO.b<0))||(FR&&(FO.b>=0))){FP=FL=(FQ>=FO.b*FG)}else{FP=((FF.x+FF.y*FO.b)>FO.c);if(FO.b<0){FP=!FP}if(!FP){FL=1}}if(!FL){var FS=FI.x-FO.region.l.x;FP=(FO.b*(FG*FG-FQ*FQ))<(FS*FQ*(1+2*FG/FS+FO.b*FO.b));if(FO.b<0){FP=!FP}}}else{var FH=FO.c-FO.a*FF.x,FN=FF.y-FH,FM=FF.x-FI.x,FJ=FH-FI.y;FP=(FN*FN)>(FM*FM+FJ*FJ)}return FK.side==="l"?FP:!FP},endPoint:function(FG,FF,e){FG.ep[FF]=e;if(!FG.ep[Bs[FF]]){return}Ex(FG)},distance:function(FH,FG){var FF=FH.x-FG.x,e=FH.y-FG.y;return Math.sqrt(FF*FF+e*e)}};var Ev={list:[],insert:function(FJ,FF,FK){FJ.vertex=FF;FJ.ystar=FF.y+FK;for(var FG=0,FI=Ev.list,e=FI.length;FG<e;FG++){var FH=FI[FG];if(FJ.ystar>FH.ystar||(FJ.ystar==FH.ystar&&FF.x>FH.vertex.x)){continue}else{break}}FI.splice(FG,0,FJ)},del:function(FH){for(var FG=0,FF=Ev.list,e=FF.length;FG<e&&(FF[FG]!=FH);++FG){}FF.splice(FG,1)},empty:function(){return Ev.list.length===0},nextEvent:function(FH){for(var FG=0,FF=Ev.list,e=FF.length;FG<e;++FG){if(FF[FG]==FH){return FF[FG+1]}}return null},min:function(){var e=Ev.list[0];return{x:e.vertex.x,y:e.ystar}},extractMin:function(){return Ev.list.shift()}};Ew.init();FD.bottomSite=FD.list.shift();var FE=FD.list.shift(),E1;var E6,E3,Ey,FA,E0;var E4,E5,FB,E7,E2;var E9,E8;while(true){if(!Ev.empty()){E1=Ev.min()}if(FE&&(Ev.empty()||FE.y<E1.y||(FE.y==E1.y&&FE.x<E1.x))){E6=Ew.leftBound(FE);E3=Ew.right(E6);E4=Ew.rightRegion(E6);E9=FC.bisect(E4,FE);E0=Ew.createHalfEdge(E9,"l");Ew.insert(E6,E0);E7=FC.intersect(E6,E0);if(E7){Ev.del(E6);Ev.insert(E6,E7,FC.distance(E7,FE))}E6=E0;E0=Ew.createHalfEdge(E9,"r");Ew.insert(E6,E0);E7=FC.intersect(E0,E3);if(E7){Ev.insert(E0,E7,FC.distance(E7,FE))}FE=FD.list.shift()}else{if(!Ev.empty()){E6=Ev.extractMin();Ey=Ew.left(E6);E3=Ew.right(E6);FA=Ew.right(E3);E4=Ew.leftRegion(E6);E5=Ew.rightRegion(E3);E2=E6.vertex;FC.endPoint(E6.edge,E6.side,E2);FC.endPoint(E3.edge,E3.side,E2);Ew.del(E6);Ev.del(E3);Ew.del(E3);E8="l";if(E4.y>E5.y){FB=E4;E4=E5;E5=FB;E8="r"}E9=FC.bisect(E4,E5);E0=Ew.createHalfEdge(E9,E8);Ew.insert(Ey,E0);FC.endPoint(E9,Bs[E8],E2);E7=FC.intersect(Ey,E0);if(E7){Ev.del(Ey);Ev.insert(Ey,E7,FC.distance(E7,E4))}E7=FC.intersect(E0,FA);if(E7){Ev.insert(E0,E7,FC.distance(E7,E4))}}else{break}}}for(E6=Ew.right(Ew.leftEnd);E6!=Ew.rightEnd;E6=Ew.right(E6)){Ex(E6.edge)}}d3.geom.delaunay=function(Ev){var e=Ev.map(function(){return[]}),Ew=[];D6(Ev,function(Ex){e[Ex.region.l.index].push(Ev[Ex.region.r.index])});e.forEach(function(E2,E1){var Ez=Ev[E1],Ey=Ez[0],E3=Ez[1];E2.forEach(function(E4){E4.angle=Math.atan2(E4[0]-Ey,E4[1]-E3)});E2.sort(function(E5,E4){return E5.angle-E4.angle});for(var E0=0,Ex=E2.length-1;E0<Ex;E0++){Ew.push([Ez,E2[E0],E2[E0+1]])}});return Ew};d3.geom.quadtree=function(E3,Ew,E2,e,E1){var Ev,Ey=-1,Ex=E3.length;if(Ex&&isNaN(E3[0].x)){E3=E3.map(l)}if(arguments.length<5){if(arguments.length===3){E1=e=E2;E2=Ew}else{Ew=E2=Infinity;e=E1=-Infinity;while(++Ey<Ex){Ev=E3[Ey];if(Ev.x<Ew){Ew=Ev.x}if(Ev.y<E2){E2=Ev.y}if(Ev.x>e){e=Ev.x}if(Ev.y>E1){E1=Ev.y}}var E6=e-Ew,E5=E1-E2;if(E6>E5){E1=E2+E6}else{e=Ew+E5}}}function E4(FD,FC,E9,FB,E8,FA){if(isNaN(FC.x)||isNaN(FC.y)){return}if(FD.leaf){var E7=FD.point;if(E7){if((Math.abs(E7.x-FC.x)+Math.abs(E7.y-FC.y))<0.01){Ez(FD,FC,E9,FB,E8,FA)}else{FD.point=null;Ez(FD,E7,E9,FB,E8,FA);Ez(FD,FC,E9,FB,E8,FA)}}else{FD.point=FC}}else{Ez(FD,FC,E9,FB,E8,FA)}}function Ez(FB,E9,FA,FG,E8,FE){var FF=(FA+E8)*0.5,FD=(FG+FE)*0.5,FH=E9.x>=FF,E7=E9.y>=FD,FC=(E7<<1)+FH;FB.leaf=false;FB=FB.nodes[FC]||(FB.nodes[FC]=DP());if(FH){FA=FF}else{E8=FF}if(E7){FG=FD}else{FE=FD}E4(FB,E9,FA,FG,E8,FE)}var E0=DP();E0.add=function(E7){E4(E0,E7,Ew,E2,e,E1)};E0.visit=function(E7){BS(E7,E0,Ew,E2,e,E1)};E3.forEach(E0.add);return E0};function DP(){return{leaf:true,nodes:[],point:null}}function BS(Ey,Ex,Ev,E2,e,E0){if(!Ey(Ex,Ev,E2,e,E0)){var E1=(Ev+e)*0.5,Ez=(E2+E0)*0.5,Ew=Ex.nodes;if(Ew[0]){BS(Ey,Ew[0],Ev,E2,E1,Ez)}if(Ew[1]){BS(Ey,Ew[1],E1,E2,e,Ez)}if(Ew[2]){BS(Ey,Ew[2],Ev,Ez,E1,E0)}if(Ew[3]){BS(Ey,Ew[3],E1,Ez,e,E0)}}}function l(e){return{x:e[0],y:e[1]}}d3.time={};var DO=Date;function EG(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}EG.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(){DZ.setUTCDate.apply(this._,arguments)},setDay:function(){DZ.setUTCDay.apply(this._,arguments)},setFullYear:function(){DZ.setUTCFullYear.apply(this._,arguments)},setHours:function(){DZ.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){DZ.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){DZ.setUTCMinutes.apply(this._,arguments)},setMonth:function(){DZ.setUTCMonth.apply(this._,arguments)},setSeconds:function(){DZ.setUTCSeconds.apply(this._,arguments)},setTime:function(){DZ.setTime.apply(this._,arguments)}};var DZ=Date.prototype;d3.time.format=function(e){var Ew=e.length;function Ev(Ez){var Ey=[],E0=-1,Ex=0,E2,E1;while(++E0<Ew){if(e.charCodeAt(E0)==37){Ey.push(e.substring(Ex,E0),(E1=Dt[E2=e.charAt(++E0)])?E1(Ez):E2);Ex=E0+1}}Ey.push(e.substring(Ex,E0));return Ey.join("")}Ev.parse=function(Ey){var E0={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},Ez=CG(E0,e,Ey,0);if(Ez!=Ey.length){return null}if("p" in E0){E0.H=E0.H%12+E0.p*12}var Ex=new DO();Ex.setFullYear(E0.y,E0.m,E0.d);Ex.setHours(E0.H,E0.M,E0.S,E0.L);return Ex};Ev.toString=function(){return e};return Ev};function CG(Ex,E2,E0,Ey){var E1,e,Ez=0,Ev=E2.length,Ew=E0.length;while(Ez<Ev){if(Ey>=Ew){return -1}E1=E2.charCodeAt(Ez++);if(E1==37){e=Ej[E2.charAt(Ez++)];if(!e||((Ey=e(Ex,E0,Ey))<0)){return -1}}else{if(E1!=E0.charCodeAt(Ey++)){return -1}}}return Ey}var As=d3.format("02d"),Ar=d3.format("03d"),Aq=d3.format("04d"),Ao=d3.format("2d");var Dt={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 BD[e.getMonth()].substring(0,3)},B:function(e){return BD[e.getMonth()]},c:d3.time.format("%a %b %e %H:%M:%S %Y"),d:function(e){return As(e.getDate())},e:function(e){return Ao(e.getDate())},H:function(e){return As(e.getHours())},I:function(e){return As(e.getHours()%12||12)},j:function(e){return Ar(1+d3.time.dayOfYear(e))},L:function(e){return Ar(e.getMilliseconds())},m:function(e){return As(e.getMonth()+1)},M:function(e){return As(e.getMinutes())},p:function(e){return e.getHours()>=12?"PM":"AM"},S:function(e){return As(e.getSeconds())},U:function(e){return As(d3.time.sundayOfYear(e))},w:function(e){return e.getDay()},W:function(e){return As(d3.time.mondayOfYear(e))},x:d3.time.format("%m/%d/%y"),X:d3.time.format("%H:%M:%S"),y:function(e){return As(e.getFullYear()%100)},Y:function(e){return Aq(e.getFullYear()%10000)},Z:DW,"%":function(e){return"%"}};var Ej={a:EF,A:BO,b:AV,B:Cl,c:CS,d:A3,e:A3,H:AN,I:AN,L:EB,m:D2,M:BY,p:Ea,S:B8,x:Et,X:Dz,y:g,Y:Am};function EF(Ev,e,Ew){return C4.test(e.substring(Ew,Ew+=3))?Ew:-1}function BO(Ev,e,Ew){Ay.lastIndex=0;var Ex=Ay.exec(e.substring(Ew,Ew+10));return Ex?Ew+=Ex[0].length:-1}var C4=/^(?:sun|mon|tue|wed|thu|fri|sat)/i,Ay=/^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/i;d3_time_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function AV(Ev,e,Ew){var Ex=Cp.get(e.substring(Ew,Ew+=3).toLowerCase());return Ex==null?-1:(Ev.m=Ex,Ew)}var Cp=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 Cl(Ev,e,Ew){EI.lastIndex=0;var Ex=EI.exec(e.substring(Ew,Ew+12));return Ex?(Ev.m=DG.get(Ex[0].toLowerCase()),Ew+=Ex[0].length):-1}var EI=/^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;var DG=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 BD=["January","February","March","April","May","June","July","August","September","October","November","December"];function CS(Ev,e,Ew){return CG(Ev,Dt.c.toString(),e,Ew)}function Et(Ev,e,Ew){return CG(Ev,Dt.x.toString(),e,Ew)}function Dz(Ev,e,Ew){return CG(Ev,Dt.X.toString(),e,Ew)}function Am(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+4));return Ex?(Ev.y=+Ex[0],Ew+=Ex[0].length):-1}function g(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.y=Aj()+ +Ex[0],Ew+=Ex[0].length):-1}function Aj(){return ~~(new Date().getFullYear()/1000)*1000}function D2(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.m=Ex[0]-1,Ew+=Ex[0].length):-1}function A3(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.d=+Ex[0],Ew+=Ex[0].length):-1}function AN(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.H=+Ex[0],Ew+=Ex[0].length):-1}function BY(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.M=+Ex[0],Ew+=Ex[0].length):-1}function B8(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+2));return Ex?(Ev.S=+Ex[0],Ew+=Ex[0].length):-1}function EB(Ev,e,Ew){Da.lastIndex=0;var Ex=Da.exec(e.substring(Ew,Ew+3));return Ex?(Ev.L=+Ex[0],Ew+=Ex[0].length):-1}var Da=/\s*\d+/;function Ea(Ev,e,Ew){var Ex=C.get(e.substring(Ew,Ew+=2).toLowerCase());return Ex==null?-1:(Ev.p=Ex,Ew)}var C=d3.map({am:0,pm:1});function DW(Ey){var Ex=Ey.getTimezoneOffset(),Ew=Ex>0?"-":"+",Ev=~~(Math.abs(Ex)/60),e=Math.abs(Ex)%60;return Ew+As(Ev)+As(e)}d3.time.format.utc=function(Ev){var e=d3.time.format(Ev);function Ew(Ex){try{DO=EG;var Ey=new DO();Ey._=Ex;return e(Ey)}finally{DO=Date}}Ew.parse=function(Ey){try{DO=EG;var Ex=e.parse(Ey);return Ex&&Ex._}finally{DO=Date}};Ew.toString=e.toString;return Ew};var B4=d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");d3.time.format.iso=Date.prototype.toISOString?Bt:B4;function Bt(e){return e.toISOString()}Bt.parse=function(e){return new Date(e)};Bt.toString=B4.toString;function Ba(Ez,e,Ev){function E2(E3){var E5=Ez(E3),E4=Ex(E5,1);return E3-E5<E4-E3?E5:E4}function E1(E3){e(E3=Ez(new DO(E3-1)),1);return E3}function Ex(E4,E3){e(E4=new DO(+E4),E3);return E4}function Ey(E5,E4,E3){var E6=E1(E5),E7=[];if(E3>1){while(E6<E4){if(!(Ev(E6)%E3)){E7.push(new Date(+E6))}e(E6,1)}}else{while(E6<E4){E7.push(new Date(+E6)),e(E6,1)}}return E7}function Ew(E6,E5,E4){try{DO=EG;var E3=new EG();E3._=E6;return Ey(E3,E5,E4)}finally{DO=Date}}Ez.floor=Ez;Ez.round=E2;Ez.ceil=E1;Ez.offset=Ex;Ez.range=Ey;var E0=Ez.utc=B6(Ez);E0.floor=E0;E0.round=B6(E2);E0.ceil=B6(E1);E0.offset=B6(Ex);E0.range=Ew;return Ez}function B6(e){return function(Ew,Ev){try{DO=EG;var Ex=new EG();Ex._=Ew;return e(Ex,Ev)._}finally{DO=Date}}}d3.time.second=Ba(function(e){return new DO(Math.floor(e/1000)*1000)},function(e,Ev){e.setTime(e.getTime()+Math.floor(Ev)*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=Ba(function(e){return new DO(Math.floor(e/60000)*60000)},function(e,Ev){e.setTime(e.getTime()+Math.floor(Ev)*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=Ba(function(e){var Ev=e.getTimezoneOffset()/60;return new DO((Math.floor(e/3600000-Ev)+Ev)*3600000)},function(e,Ev){e.setTime(e.getTime()+Math.floor(Ev)*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=Ba(function(e){return new DO(e.getFullYear(),e.getMonth(),e.getDate())},function(e,Ev){e.setDate(e.getDate()+Ev)},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 Ev=d3.time.year(e);return Math.floor((e-Ev)/86400000-(e.getTimezoneOffset()-Ev.getTimezoneOffset())/1440)};d3_time_weekdays.forEach(function(Ev,Ew){Ev=Ev.toLowerCase();Ew=7-Ew;var e=d3.time[Ev]=Ba(function(Ex){(Ex=d3.time.day(Ex)).setDate(Ex.getDate()-(Ex.getDay()+Ew)%7);return Ex},function(Ex,Ey){Ex.setDate(Ex.getDate()+Math.floor(Ey)*7)},function(Ey){var Ex=d3.time.year(Ey).getDay();return Math.floor((d3.time.dayOfYear(Ey)+(Ex+Ew)%7)/7)-(Ex!==Ew)});d3.time[Ev+"s"]=e.range;d3.time[Ev+"s"].utc=e.utc.range;d3.time[Ev+"OfYear"]=function(Ey){var Ex=d3.time.year(Ey).getDay();return Math.floor((d3.time.dayOfYear(Ey)+(Ex+Ew)%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=Ba(function(e){return new DO(e.getFullYear(),e.getMonth(),1)},function(e,Ev){e.setMonth(e.getMonth()+Ev)},function(e){return e.getMonth()});d3.time.months=d3.time.month.range;d3.time.months.utc=d3.time.month.utc.range;d3.time.year=Ba(function(e){return new DO(e.getFullYear(),0,1)},function(e,Ev){e.setFullYear(e.getFullYear()+Ev)},function(e){return e.getFullYear()});d3.time.years=d3.time.year.range;d3.time.years.utc=d3.time.year.utc.range;function Ai(e,Ev,Ew){function Ex(Ey){return e(Ey)}Ex.invert=function(Ey){return DY(e.invert(Ey))};Ex.domain=function(Ey){if(!arguments.length){return e.domain().map(DY)}e.domain(Ey);return Ex};Ex.nice=function(Ey){var Ez=DT(Ex.domain());return Ex.domain([Ey.floor(Ez[0]),Ey.ceil(Ez[1])])};Ex.ticks=function(Ey,Ez){var E2=DT(Ex.domain());if(typeof Ey!=="function"){var E1=E2[1]-E2[0],E3=E1/Ey,E0=d3.bisect(Cx,E3);if(E0==Cx.length){return Ev.year(E2,Ey)}if(!E0){return e.ticks(Ey).map(DY)}if(Math.log(E3/Cx[E0-1])<Math.log(Cx[E0]/E3)){--E0}Ey=Ev[E0];Ez=Ey[1];Ey=Ey[0].range}return Ey(E2[0],new Date(+E2[1]+1),Ez)};Ex.tickFormat=function(){return Ew};Ex.copy=function(){return Ai(e.copy(),Ev,Ew)};return d3.rebind(Ex,e,"range","rangeRound","interpolate","clamp")}function DT(Ev){var Ew=Ev[0],e=Ev[Ev.length-1];return Ew<e?[Ew,e]:[e,Ew]}function DY(e){return new Date(e)}function BX(e){return function(Ev){var Ew=e.length-1,Ex=e[Ew];while(!Ex[1](Ev)){Ex=e[--Ew]}return Ex[0](Ev)}}function CB(Ev){var e=new Date(Ev,0,1);e.setFullYear(Ev);return e}function EH(Ew){var Ex=Ew.getFullYear(),Ev=CB(Ex),e=CB(Ex+1);return Ex+(Ew-Ev)/(e-Ev)}var Cx=[1000,5000,15000,30000,60000,300000,900000,1800000,3600000,10800000,21600000,43200000,86400000,172800000,604800000,2592000000,7776000000,31536000000];var BN=[[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 DH=[[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 BL=d3.scale.linear(),m=BX(DH);BN.year=function(Ev,e){return BL.domain(Ev.map(EH)).ticks(e).map(CB)};d3.time.scale=function(){return Ai(d3.scale.linear(),BN,m)};var El=BN.map(function(e){return[e[0].utc,e[1]]});var A9=[[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 Co=BX(A9);function Be(Ev){var e=new Date(Date.UTC(Ev,0,1));e.setUTCFullYear(Ev);return e}function Di(Ew){var Ex=Ew.getUTCFullYear(),Ev=Be(Ex),e=Be(Ex+1);return Ex+(Ew-Ev)/(e-Ev)}El.year=function(Ev,e){return BL.domain(Ev.map(Di)).ticks(e).map(Be)};d3.time.scale.utc=function(){return Ai(d3.scale.linear(),El,Co)}})();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 AF=Box2D.Collision.Shapes.b2CircleShape,AE=Box2D.Collision.Shapes.b2PolygonShape,AB=Box2D.Collision.Shapes.b2Shape,AM=Box2D.Common.b2Settings,AN=Box2D.Common.Math.b2Math,AJ=Box2D.Common.Math.b2Sweep,X=Box2D.Common.Math.b2Transform,AQ=Box2D.Common.Math.b2Vec2,AI=Box2D.Collision.b2AABB,f=Box2D.Collision.b2Bound,T=Box2D.Collision.b2BoundValues,x=Box2D.Collision.b2Collision,AA=Box2D.Collision.b2ContactID,AC=Box2D.Collision.b2ContactPoint,P=Box2D.Collision.b2Distance,J=Box2D.Collision.b2DistanceInput,AU=Box2D.Collision.b2DistanceOutput,AL=Box2D.Collision.b2DistanceProxy,AO=Box2D.Collision.b2DynamicTree,AH=Box2D.Collision.b2DynamicTreeBroadPhase,AD=Box2D.Collision.b2DynamicTreeNode,m=Box2D.Collision.b2DynamicTreePair,AG=Box2D.Collision.b2Manifold,e=Box2D.Collision.b2ManifoldPoint,t=Box2D.Collision.b2Point,b=Box2D.Collision.b2RayCastInput,AK=Box2D.Collision.b2RayCastOutput,C=Box2D.Collision.b2Segment,AY=Box2D.Collision.b2SeparationFunction,AW=Box2D.Collision.b2Simplex,AT=Box2D.Collision.b2SimplexCache,AV=Box2D.Collision.b2SimplexVertex,AR=Box2D.Collision.b2TimeOfImpact,AP=Box2D.Collision.b2TOIInput,AS=Box2D.Collision.b2WorldManifold,Aa=Box2D.Collision.ClipVertex,AZ=Box2D.Collision.Features,AX=Box2D.Collision.IBroadPhase;AI.b2AABB=function(){this.lowerBound=new AQ;this.upperBound=new AQ};AI.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()};AI.prototype.GetCenter=function(){return new AQ((this.lowerBound.x+this.upperBound.x)/2,(this.lowerBound.y+this.upperBound.y)/2)};AI.prototype.GetExtents=function(){return new AQ((this.upperBound.x-this.lowerBound.x)/2,(this.upperBound.y-this.lowerBound.y)/2)};AI.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};AI.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};AI.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};AI.Combine=function(A,D){var B=new AI;B.Combine(A,D);return B};AI.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};x.b2Collision=function(){};x.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};x.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};x.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=x.EdgeSeparation(K,I,B,E,A);Q=parseInt(B-1>=0?B-1:R-1);N=x.EdgeSeparation(K,I,Q,E,A);M=parseInt(B+1<R?B+1:0);F=x.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=x.EdgeSeparation(K,I,B,E,A);if(O>D){H=B;D=O}else{break}}L[0]=H;return D};x.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};x.MakeClipPointVector=function(){var A=new Vector(2);A[0]=new Aa;A[1]=new Aa;return A};x.CollidePolygons=function(M,K,I,E,A){var S;M.m_pointCount=0;var Q=K.m_radius+E.m_radius;S=0;x.s_edgeAO[0]=S;var R=x.FindMaxSeparation(x.s_edgeAO,K,I,E,A);S=x.s_edgeAO[0];if(!(R>Q)){var O=0;x.s_edgeBO[0]=O;var B=x.FindMaxSeparation(x.s_edgeBO,E,A,K,I);O=x.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=AG.e_faceB;F=1}else{R=K;E=E;K=I;I=A;N=S;M.m_type=AG.e_faceA;F=0}S=x.s_incidentEdge;x.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=x.s_localTangent;N.Set(H.x-R.x,H.y-R.y);N.Normalize();A=x.s_localNormal;A.x=N.y;A.y=-N.x;E=x.s_planePoint;E.Set(0.5*(R.x+H.x),0.5*(R.y+H.y));B=x.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=x.s_tangent2;D.x=-B.x;D.y=-B.y;N=x.s_normal;N.x=B.y;N.y=-B.x;var G=x.s_v11,L=x.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=x.s_clipPoints1;R=x.s_clipPoints2;L=0;L=x.ClipSegmentToLine(H,S,D,-B.x*G.x-B.y*G.y+Q);if(!(L<2)){L=x.ClipSegmentToLine(R,H,B,O);if(!(L<2)){M.m_localPlaneNormal.SetV(A);M.m_localPoint.SetV(E);for(E=A=0;E<AM.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}}}}};x.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=AG.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}};x.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=AG.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=AG.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=AG.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=AG.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};x.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=x.MakeClipPointVector();Box2D.Collision.b2Collision.s_clipPoints1=x.MakeClipPointVector();Box2D.Collision.b2Collision.s_clipPoints2=x.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 AQ;Box2D.Collision.b2Collision.s_localNormal=new AQ;Box2D.Collision.b2Collision.s_planePoint=new AQ;Box2D.Collision.b2Collision.s_normal=new AQ;Box2D.Collision.b2Collision.s_tangent=new AQ;Box2D.Collision.b2Collision.s_tangent2=new AQ;Box2D.Collision.b2Collision.s_v11=new AQ;Box2D.Collision.b2Collision.s_v12=new AQ;Box2D.Collision.b2Collision.b2CollidePolyTempVec=new AQ;Box2D.Collision.b2Collision.b2_nullFeature=255});AA.b2ContactID=function(){this.features=new AZ};AA.prototype.b2ContactID=function(){this.features._m_id=this};AA.prototype.Set=function(A){this.key=A._key};AA.prototype.Copy=function(){var A=new AA;A.key=this.key;return A};Object.defineProperty(AA.prototype,"key",{enumerable:false,configurable:true,get:function(){return this._key}});Object.defineProperty(AA.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}});AC.b2ContactPoint=function(){this.position=new AQ;this.velocity=new AQ;this.normal=new AQ;this.id=new AA};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:AM.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(AN.MulTMV(S.R,H.GetNegative()));D.wA=AN.MulX(S,E.GetVertex(D.indexA));D.indexB=A.GetSupport(AN.MulTMV(Q.R,H));D.wB=AN.MulX(Q,A.GetVertex(D.indexB));D.w=AN.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=AN.Max(P.b2_gjkMaxIters,G);R.GetWitnessPoints(M.pointA,M.pointB);M.distance=AN.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=AN.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 AQ;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 AW;Box2D.Collision.b2Distance.s_saveA=new Vector_a2j_Number(3);Box2D.Collision.b2Distance.s_saveB=new Vector_a2j_Number(3)});J.b2DistanceInput=function(){};AU.b2DistanceOutput=function(){this.pointA=new AQ;this.pointB=new AQ};AL.b2DistanceProxy=function(){};AL.prototype.Set=function(A){switch(A.GetType()){case AB.e_circleShape:A=A instanceof AF?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 AB.e_polygonShape:A=A instanceof AE?A:null;this.m_vertices=A.m_vertices;this.m_count=A.m_vertexCount;this.m_radius=A.m_radius;break;default:AM.b2Assert(false)}};AL.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};AL.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]};AL.prototype.GetVertexCount=function(){return this.m_count};AL.prototype.GetVertex=function(A){if(A===undefined){A=0}AM.b2Assert(0<=A&&A<this.m_count);return this.m_vertices[A]};AO.b2DynamicTree=function(){};AO.prototype.b2DynamicTree=function(){this.m_freeList=this.m_root=null;this.m_insertionCount=this.m_path=0};AO.prototype.CreateProxy=function(B,F){var E=this.AllocateNode(),A=AM.b2_aabbExtension,D=AM.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};AO.prototype.DestroyProxy=function(A){this.RemoveLeaf(A);this.FreeNode(A)};AO.prototype.MoveProxy=function(B,E,D){AM.b2Assert(B.IsLeaf());if(B.aabb.Contains(E)){return false}this.RemoveLeaf(B);var A=AM.b2_aabbExtension+AM.b2_aabbMultiplier*(D.x>0?D.x:-D.x);D=AM.b2_aabbExtension+AM.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};AO.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)}}};AO.prototype.GetFatAABB=function(A){return A.aabb};AO.prototype.GetUserData=function(A){return A.userData};AO.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}}}}};AO.prototype.RayCast=function(H,G){if(this.m_root!=null){var F=G.p1,D=G.p2,A=AN.SubtractVV(F,D);A.Normalize();A=AN.CrossFV(1,A);var N=AN.AbsV(A),L=G.maxFraction,M=new AI,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}}}}}};AO.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 AD};AO.prototype.FreeNode=function(A){A.parent=this.m_freeList;this.m_freeList=A};AO.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}}};AO.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=AI.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)}}};AH.b2DynamicTreeBroadPhase=function(){this.m_tree=new AO;this.m_moveBuffer=new Vector;this.m_pairBuffer=new Vector;this.m_pairCount=0};AH.prototype.CreateProxy=function(A,D){var B=this.m_tree.CreateProxy(A,D);++this.m_proxyCount;this.BufferMove(B);return B};AH.prototype.DestroyProxy=function(A){this.UnBufferMove(A);--this.m_proxyCount;this.m_tree.DestroyProxy(A)};AH.prototype.MoveProxy=function(A,D,B){this.m_tree.MoveProxy(A,D,B)&&this.BufferMove(A)};AH.prototype.TestOverlap=function(B,E){var D=this.m_tree.GetFatAABB(B),A=this.m_tree.GetFatAABB(E);return D.TestOverlap(A)};AH.prototype.GetUserData=function(A){return this.m_tree.GetUserData(A)};AH.prototype.GetFatAABB=function(A){return this.m_tree.GetFatAABB(A)};AH.prototype.GetProxyCount=function(){return this.m_proxyCount};AH.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}}};AH.prototype.Query=function(A,B){this.m_tree.Query(A,B)};AH.prototype.RayCast=function(A,B){this.m_tree.RayCast(A,B)};AH.prototype.Validate=function(){};AH.prototype.Rebalance=function(A){if(A===undefined){A=0}this.m_tree.Rebalance(A)};AH.prototype.BufferMove=function(A){this.m_moveBuffer[this.m_moveBuffer.length]=A};AH.prototype.UnBufferMove=function(A){this.m_moveBuffer.splice(parseInt(this.m_moveBuffer.indexOf(A)),1)};AH.prototype.ComparePairs=function(){return 0};AH.__implements={};AH.__implements[AX]=true;AD.b2DynamicTreeNode=function(){this.aabb=new AI};AD.prototype.IsLeaf=function(){return this.child1==null};m.b2DynamicTreePair=function(){};AG.b2Manifold=function(){this.m_pointCount=0};AG.prototype.b2Manifold=function(){this.m_points=new Vector(AM.b2_maxManifoldPoints);for(var A=0;A<AM.b2_maxManifoldPoints;A++){this.m_points[A]=new e}this.m_localPlaneNormal=new AQ;this.m_localPoint=new AQ};AG.prototype.Reset=function(){for(var A=0;A<AM.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};AG.prototype.Set=function(A){this.m_pointCount=A.m_pointCount;for(var B=0;B<AM.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};AG.prototype.Copy=function(){var A=new AG;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 AQ;this.m_id=new AA};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)};t.b2Point=function(){this.p=new AQ};t.prototype.Support=function(){return this.p};t.prototype.GetFirstVertex=function(){return this.p};b.b2RayCastInput=function(){this.p1=new AQ;this.p2=new AQ};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};AK.b2RayCastOutput=function(){this.normal=new AQ};C.b2Segment=function(){this.p1=new AQ;this.p2=new AQ};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};AY.b2SeparationFunction=function(){this.m_localPoint=new AQ;this.m_axis=new AQ};AY.prototype.Initialize=function(H,G,F,D,A){this.m_proxyA=G;this.m_proxyB=D;var N=parseInt(H.count);AM.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=AY.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=AY.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=AN.CrossVF(AN.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=AY.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=AN.CrossVF(AN.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]);AN.MulX(F,L);L=AN.MulMV(F.R,AN.SubtractVV(D,G));AN.MulX(A,M);I=AN.MulMV(A.R,AN.SubtractVV(B,K));A=L.x*L.x+L.y*L.y;M=I.x*I.x+I.y*I.y;H=AN.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=AN.Clamp((L*H-F*M)/E,0,1)}if((L*I+H)/M<0){I=AN.Clamp((L-F)/A,0,1)}L=new AQ;L.x=G.x+I*(D.x-G.x);L.y=G.y+I*(D.y-G.y);M=new AQ;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=AY.e_faceB;this.m_axis=AN.CrossVF(AN.SubtractVV(B,K),1);this.m_axis.Normalize();this.m_localPoint=M}else{this.m_type=AY.e_faceA;this.m_axis=AN.CrossVF(AN.SubtractVV(D,G),1);this.m_localPoint=L}}}I<0&&this.m_axis.NegativeSelf()}};AY.prototype.Evaluate=function(B,F){var E,A,D=0;switch(this.m_type){case AY.e_points:E=AN.MulTMV(B.R,this.m_axis);A=AN.MulTMV(F.R,this.m_axis.GetNegative());E=this.m_proxyA.GetSupportVertex(E);A=this.m_proxyB.GetSupportVertex(A);E=AN.MulX(B,E);A=AN.MulX(F,A);return D=(A.x-E.x)*this.m_axis.x+(A.y-E.y)*this.m_axis.y;case AY.e_faceA:D=AN.MulMV(B.R,this.m_axis);E=AN.MulX(B,this.m_localPoint);A=AN.MulTMV(F.R,D.GetNegative());A=this.m_proxyB.GetSupportVertex(A);A=AN.MulX(F,A);return D=(A.x-E.x)*D.x+(A.y-E.y)*D.y;case AY.e_faceB:D=AN.MulMV(F.R,this.m_axis);A=AN.MulX(F,this.m_localPoint);E=AN.MulTMV(B.R,D.GetNegative());E=this.m_proxyA.GetSupportVertex(E);E=AN.MulX(B,E);return D=(E.x-A.x)*D.x+(E.y-A.y)*D.y;default:AM.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});AW.b2Simplex=function(){this.m_v1=new AV;this.m_v2=new AV;this.m_v3=new AV;this.m_vertices=new Vector(3)};AW.prototype.b2Simplex=function(){this.m_vertices[0]=this.m_v1;this.m_vertices[1]=this.m_v2;this.m_vertices[2]=this.m_v3};AW.prototype.ReadCache=function(G,F,E,D,A){AM.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=AN.MulX(E,L);B.wB=AN.MulX(A,I);B.w=AN.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=AN.MulX(E,L);B.wB=AN.MulX(A,I);B.w=AN.SubtractVV(B.wB,B.wA);this.m_count=1}};AW.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)}};AW.prototype.GetSearchDirection=function(){switch(this.m_count){case 1:return this.m_v1.w.GetNegative();case 2:var A=AN.SubtractVV(this.m_v2.w,this.m_v1.w);return AN.CrossVV(A,this.m_v1.w.GetNegative())>0?AN.CrossFV(1,A):AN.CrossVF(A,1);default:AM.b2Assert(false);return new AQ}};AW.prototype.GetClosestPoint=function(){switch(this.m_count){case 0:AM.b2Assert(false);return new AQ;case 1:return this.m_v1.w;case 2:return new AQ(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:AM.b2Assert(false);return new AQ}};AW.prototype.GetWitnessPoints=function(A,B){switch(this.m_count){case 0:AM.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:AM.b2Assert(false)}};AW.prototype.GetMetric=function(){switch(this.m_count){case 0:AM.b2Assert(false);return 0;case 1:return 0;case 2:return AN.SubtractVV(this.m_v1.w,this.m_v2.w).Length();case 3:return AN.CrossVV(AN.SubtractVV(this.m_v2.w,this.m_v1.w),AN.SubtractVV(this.m_v3.w,this.m_v1.w));default:AM.b2Assert(false);return 0}};AW.prototype.Solve2=function(){var A=this.m_v1.w,D=this.m_v2.w,B=AN.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}}};AW.prototype.Solve3=function(){var G=this.m_v1.w,F=this.m_v2.w,E=this.m_v3.w,D=AN.SubtractVV(F,G),A=AN.Dot(G,D),M=AN.Dot(F,D);A=-A;var K=AN.SubtractVV(E,G),L=AN.Dot(G,K),I=AN.Dot(E,K);L=-L;var B=AN.SubtractVV(E,F),H=AN.Dot(F,B);B=AN.Dot(E,B);H=-H;K=AN.CrossVV(D,K);D=K*AN.CrossVV(F,E);E=K*AN.CrossVV(E,G);G=K*AN.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}}}}}}};AT.b2SimplexCache=function(){this.indexA=new Vector_a2j_Number(3);this.indexB=new Vector_a2j_Number(3)};AV.b2SimplexVertex=function(){};AV.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};AR.b2TimeOfImpact=function(){};AR.TimeOfImpact=function(N){++AR.b2_toiCalls;var L=N.proxyA,K=N.proxyB,E=N.sweepA,A=N.sweepB;AM.b2Assert(E.t0==A.t0);AM.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;AR.s_cache.count=0;for(AR.s_distanceInput.useRadii=false;;){E.GetTransform(AR.s_xfA,R);A.GetTransform(AR.s_xfB,R);AR.s_distanceInput.proxyA=L;AR.s_distanceInput.proxyB=K;AR.s_distanceInput.transformA=AR.s_xfA;AR.s_distanceInput.transformB=AR.s_xfB;P.Distance(AR.s_distanceOutput,AR.s_cache,AR.s_distanceInput);if(AR.s_distanceOutput.distance<=0){R=1;break}AR.s_fcn.Initialize(AR.s_cache,L,AR.s_xfA,K,AR.s_xfB);var B=AR.s_fcn.Evaluate(AR.s_xfA,AR.s_xfB);if(B<=0){R=1;break}if(S==0){Q=B>U?AN.Max(U-N,0.75*U):AN.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(AR.s_xfA,I);A.GetTransform(AR.s_xfB,I);var D=AR.s_fcn.Evaluate(AR.s_xfA,AR.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(AR.s_xfA,M);A.GetTransform(AR.s_xfB,M);var F=AR.s_fcn.Evaluate(AR.s_xfA,AR.s_xfB);if(AN.Abs(F-Q)<0.025*N){O=M;break}if(F>Q){G=M;B=F}else{I=M;D=F}++H;++AR.b2_toiRootIters;if(H==50){break}}AR.b2_toiMaxRootIters=AN.Max(AR.b2_toiMaxRootIters,H);if(O<(1+100*Number.MIN_VALUE)*R){break}R=O;S++;++AR.b2_toiIters;if(S==1000){break}}AR.b2_toiMaxIters=AN.Max(AR.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 AT;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 AY;Box2D.Collision.b2TimeOfImpact.s_distanceOutput=new AU});AP.b2TOIInput=function(){this.proxyA=new AL;this.proxyB=new AL;this.sweepA=new AJ;this.sweepB=new AJ};AS.b2WorldManifold=function(){this.m_normal=new AQ};AS.prototype.b2WorldManifold=function(){this.m_points=new Vector(AM.b2_maxManifoldPoints);for(var A=0;A<AM.b2_maxManifoldPoints;A++){this.m_points[A]=new AQ}};AS.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 AG.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 AG.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 AG.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}}}};Aa.ClipVertex=function(){this.v=new AQ;this.id=new AA};Aa.prototype.Set=function(A){this.v.SetV(A.v);this.id.Set(A.id)};AZ.Features=function(){};Object.defineProperty(AZ.prototype,"referenceEdge",{enumerable:false,configurable:true,get:function(){return this._referenceEdge}});Object.defineProperty(AZ.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(AZ.prototype,"incidentEdge",{enumerable:false,configurable:true,get:function(){return this._incidentEdge}});Object.defineProperty(AZ.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(AZ.prototype,"incidentVertex",{enumerable:false,configurable:true,get:function(){return this._incidentVertex}});Object.defineProperty(AZ.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(AZ.prototype,"flip",{enumerable:false,configurable:true,get:function(){return this._flip}});Object.defineProperty(AZ.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,t=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+t*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=t;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 AI=Box2D.Common.Math.b2Math,AG=Box2D.Common.Math.b2Sweep,AB=Box2D.Common.Math.b2Transform,AC=Box2D.Common.Math.b2Vec2,AF=Box2D.Common.b2Color,AN=Box2D.Common.b2Settings,X=Box2D.Collision.b2AABB,AO=Box2D.Collision.b2ContactPoint,AM=Box2D.Collision.b2DynamicTreeBroadPhase,f=Box2D.Collision.b2RayCastInput,T=Box2D.Collision.b2RayCastOutput,t=Box2D.Collision.Shapes.b2CircleShape,x=Box2D.Collision.Shapes.b2EdgeShape,AD=Box2D.Collision.Shapes.b2MassData,P=Box2D.Collision.Shapes.b2PolygonShape,J=Box2D.Collision.Shapes.b2Shape,AS=Box2D.Dynamics.b2Body,AA=Box2D.Dynamics.b2BodyDef,AH=Box2D.Dynamics.b2ContactFilter,AK=Box2D.Dynamics.b2ContactImpulse,AE=Box2D.Dynamics.b2ContactListener,g=Box2D.Dynamics.b2ContactManager,AJ=Box2D.Dynamics.b2DebugDraw,e=Box2D.Dynamics.b2DestructionListener,m=Box2D.Dynamics.b2FilterData,b=Box2D.Dynamics.b2Fixture,AW=Box2D.Dynamics.b2FixtureDef,C=Box2D.Dynamics.b2Island,AV=Box2D.Dynamics.b2TimeStep,AU=Box2D.Dynamics.b2World,AR=Box2D.Dynamics.Contacts.b2Contact,AT=Box2D.Dynamics.Contacts.b2ContactFactory,AP=Box2D.Dynamics.Contacts.b2ContactSolver,AL=Box2D.Dynamics.Joints.b2Joint,AQ=Box2D.Dynamics.Joints.b2PulleyJoint;AS.b2Body=function(){this.m_xf=new AB;this.m_sweep=new AG;this.m_linearVelocity=new AC;this.m_force=new AC};AS.prototype.connectEdges=function(B,G,D){if(D===undefined){D=0}var A=Math.atan2(G.GetDirectionVector().y,G.GetDirectionVector().x);D=AI.MulFV(Math.tan((A-D)*0.5),G.GetDirectionVector());D=AI.SubtractVV(D,G.GetNormalVector());D=AI.MulFV(AN.b2_toiSlop,D);D=AI.AddVV(D,G.GetVertex1());var F=AI.AddVV(B.GetDirectionVector(),G.GetDirectionVector());F.Normalize();var E=AI.Dot(B.GetDirectionVector(),G.GetNormalVector())>0;B.SetNextEdge(G,D,F,E);G.SetPrevEdge(B,D,F,E);return A};AS.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&AS.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|=AU.e_newFixture;return B};AS.prototype.CreateFixture2=function(A,D){if(D===undefined){D=0}var B=new AW;B.shape=A;B.density=D;return this.CreateFixture(B)};AS.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&AS.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()}};AS.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()}};AS.prototype.SetTransform=function(A){this.SetPositionAndAngle(A.position,A.GetAngle())};AS.prototype.GetTransform=function(){return this.m_xf};AS.prototype.GetPosition=function(){return this.m_xf.position};AS.prototype.SetPosition=function(A){this.SetPositionAndAngle(A,this.GetAngle())};AS.prototype.GetAngle=function(){return this.m_sweep.a};AS.prototype.SetAngle=function(A){if(A===undefined){A=0}this.SetPositionAndAngle(this.GetPosition(),A)};AS.prototype.GetWorldCenter=function(){return this.m_sweep.c};AS.prototype.GetLocalCenter=function(){return this.m_sweep.localCenter};AS.prototype.SetLinearVelocity=function(A){this.m_type!=AS.b2_staticBody&&this.m_linearVelocity.SetV(A)};AS.prototype.GetLinearVelocity=function(){return this.m_linearVelocity};AS.prototype.SetAngularVelocity=function(A){if(A===undefined){A=0}if(this.m_type!=AS.b2_staticBody){this.m_angularVelocity=A}};AS.prototype.GetAngularVelocity=function(){return this.m_angularVelocity};AS.prototype.GetDefinition=function(){var A=new AA;A.type=this.GetType();A.allowSleep=(this.m_flags&AS.e_allowSleepFlag)==AS.e_allowSleepFlag;A.angle=this.GetAngle();A.angularDamping=this.m_angularDamping;A.angularVelocity=this.m_angularVelocity;A.fixedRotation=(this.m_flags&AS.e_fixedRotationFlag)==AS.e_fixedRotationFlag;A.bullet=(this.m_flags&AS.e_bulletFlag)==AS.e_bulletFlag;A.awake=(this.m_flags&AS.e_awakeFlag)==AS.e_awakeFlag;A.linearDamping=this.m_linearDamping;A.linearVelocity.SetV(this.GetLinearVelocity());A.position=this.GetPosition();A.userData=this.GetUserData();return A};AS.prototype.ApplyForce=function(A,B){if(this.m_type==AS.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}};AS.prototype.ApplyTorque=function(A){if(A===undefined){A=0}if(this.m_type==AS.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_torque+=A}};AS.prototype.ApplyImpulse=function(A,B){if(this.m_type==AS.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)}};AS.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=AI.AddVV(I,AI.CrossFV(F,AI.SubtractVV(G,B)));I=AI.AddVV(I,AI.CrossFV(F,AI.SubtractVV(D,B)));this.SetLinearVelocity(G);H.SetLinearVelocity(I);this.SetAngularVelocity(F);H.SetAngularVelocity(F);this.SynchronizeFixtures();H.SynchronizeFixtures();return H};AS.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()};AS.prototype.GetMass=function(){return this.m_mass};AS.prototype.GetInertia=function(){return this.m_I};AS.prototype.GetMassData=function(A){A.mass=this.m_mass;A.I=this.m_I;A.center.SetV(this.m_sweep.localCenter)};AS.prototype.SetMassData=function(A){AN.b2Assert(this.m_world.IsLocked()==false);if(this.m_world.IsLocked()!=true){if(this.m_type==AS.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&AS.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(AI.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)}}};AS.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==AS.b2_staticBody||this.m_type==AS.b2_kinematicBody)){for(var A=AC.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&AS.e_fixedRotationFlag)==0){this.m_I-=this.m_mass*(A.x*A.x+A.y*A.y);this.m_I*=this.m_inertiaScale;AN.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(AI.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)}};AS.prototype.GetWorldPoint=function(A){var B=this.m_xf.R;A=new AC(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};AS.prototype.GetWorldVector=function(A){return AI.MulMV(this.m_xf.R,A)};AS.prototype.GetLocalPoint=function(A){return AI.MulXT(this.m_xf,A)};AS.prototype.GetLocalVector=function(A){return AI.MulTMV(this.m_xf.R,A)};AS.prototype.GetLinearVelocityFromWorldPoint=function(A){return new AC(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))};AS.prototype.GetLinearVelocityFromLocalPoint=function(A){var B=this.m_xf.R;A=new AC(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 AC(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))};AS.prototype.GetLinearDamping=function(){return this.m_linearDamping};AS.prototype.SetLinearDamping=function(A){if(A===undefined){A=0}this.m_linearDamping=A};AS.prototype.GetAngularDamping=function(){return this.m_angularDamping};AS.prototype.SetAngularDamping=function(A){if(A===undefined){A=0}this.m_angularDamping=A};AS.prototype.SetType=function(A){if(A===undefined){A=0}if(this.m_type!=A){this.m_type=A;this.ResetMassData();if(this.m_type==AS.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()}}};AS.prototype.GetType=function(){return this.m_type};AS.prototype.SetBullet=function(A){if(A){this.m_flags|=AS.e_bulletFlag}else{this.m_flags&=~AS.e_bulletFlag}};AS.prototype.IsBullet=function(){return(this.m_flags&AS.e_bulletFlag)==AS.e_bulletFlag};AS.prototype.SetSleepingAllowed=function(A){if(A){this.m_flags|=AS.e_allowSleepFlag}else{this.m_flags&=~AS.e_allowSleepFlag;this.SetAwake(true)}};AS.prototype.SetAwake=function(A){if(A){this.m_flags|=AS.e_awakeFlag;this.m_sleepTime=0}else{this.m_flags&=~AS.e_awakeFlag;this.m_sleepTime=0;this.m_linearVelocity.SetZero();this.m_angularVelocity=0;this.m_force.SetZero();this.m_torque=0}};AS.prototype.IsAwake=function(){return(this.m_flags&AS.e_awakeFlag)==AS.e_awakeFlag};AS.prototype.SetFixedRotation=function(A){if(A){this.m_flags|=AS.e_fixedRotationFlag}else{this.m_flags&=~AS.e_fixedRotationFlag}this.ResetMassData()};AS.prototype.IsFixedRotation=function(){return(this.m_flags&AS.e_fixedRotationFlag)==AS.e_fixedRotationFlag};AS.prototype.SetActive=function(A){if(A!=this.IsActive()){var B;if(A){this.m_flags|=AS.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&=~AS.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}}};AS.prototype.IsActive=function(){return(this.m_flags&AS.e_activeFlag)==AS.e_activeFlag};AS.prototype.IsSleepingAllowed=function(){return(this.m_flags&AS.e_allowSleepFlag)==AS.e_allowSleepFlag};AS.prototype.GetFixtureList=function(){return this.m_fixtureList};AS.prototype.GetJointList=function(){return this.m_jointList};AS.prototype.GetControllerList=function(){return this.m_controllerList};AS.prototype.GetContactList=function(){return this.m_contactList};AS.prototype.GetNext=function(){return this.m_next};AS.prototype.GetUserData=function(){return this.m_userData};AS.prototype.SetUserData=function(A){this.m_userData=A};AS.prototype.GetWorld=function(){return this.m_world};AS.prototype.b2Body=function(B,E){this.m_flags=0;if(B.bullet){this.m_flags|=AS.e_bulletFlag}if(B.fixedRotation){this.m_flags|=AS.e_fixedRotationFlag}if(B.allowSleep){this.m_flags|=AS.e_allowSleepFlag}if(B.awake){this.m_flags|=AS.e_awakeFlag}if(B.active){this.m_flags|=AS.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==AS.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};AS.prototype.SynchronizeFixtures=function(){var A=AS.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)}};AS.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)};AS.prototype.ShouldCollide=function(A){if(this.m_type!=AS.b2_dynamicBody&&A.m_type!=AS.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};AS.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 AB;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});AA.b2BodyDef=function(){this.position=new AC;this.linearVelocity=new AC};AA.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=AS.b2_staticBody;this.active=true;this.inertiaScale=1};AH.b2ContactFilter=function(){};AH.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};AH.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 AH});AK.b2ContactImpulse=function(){this.normalImpulses=new Vector_a2j_Number(AN.b2_maxManifoldPoints);this.tangentImpulses=new Vector_a2j_Number(AN.b2_maxManifoldPoints)};AE.b2ContactListener=function(){};AE.prototype.BeginContact=function(){};AE.prototype.EndContact=function(){};AE.prototype.PreSolve=function(){};AE.prototype.PostSolve=function(){};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactListener.b2_defaultListener=new AE});g.b2ContactManager=function(){};g.prototype.b2ContactManager=function(){this.m_world=null;this.m_contactCount=0;this.m_contactFilter=AH.b2_defaultFilter;this.m_contactListener=AE.b2_defaultListener;this.m_contactFactory=new AT(this.m_allocator);this.m_broadPhase=new AM};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&AR.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&=~AR.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 AO});AJ.b2DebugDraw=function(){};AJ.prototype.b2DebugDraw=function(){};AJ.prototype.SetFlags=function(){};AJ.prototype.GetFlags=function(){};AJ.prototype.AppendFlags=function(){};AJ.prototype.ClearFlags=function(){};AJ.prototype.SetSprite=function(){};AJ.prototype.GetSprite=function(){};AJ.prototype.SetDrawScale=function(){};AJ.prototype.GetDrawScale=function(){};AJ.prototype.SetLineThickness=function(){};AJ.prototype.GetLineThickness=function(){};AJ.prototype.SetAlpha=function(){};AJ.prototype.GetAlpha=function(){};AJ.prototype.SetFillAlpha=function(){};AJ.prototype.GetFillAlpha=function(){};AJ.prototype.SetXFormScale=function(){};AJ.prototype.GetXFormScale=function(){};AJ.prototype.DrawPolygon=function(){};AJ.prototype.DrawSolidPolygon=function(){};AJ.prototype.DrawCircle=function(){};AJ.prototype.DrawSolidCircle=function(){};AJ.prototype.DrawSegment=function(){};AJ.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 AD}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=AI.SubtractVV(D.position,F.position);B.MoveProxy(this.m_proxy,this.m_aabb,F)}};AW.b2FixtureDef=function(){this.filter=new m};AW.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()==AS.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(AI.Clamp(1-D.dt*H.m_linearDamping,0,1));H.m_angularVelocity*=AI.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()!=AS.b2_staticBody){var A=D.dt*H.m_linearVelocity.x,E=D.dt*H.m_linearVelocity.y;if(A*A+E*E>AN.b2_maxTranslationSquared){H.m_linearVelocity.Normalize();H.m_linearVelocity.x*=AN.b2_maxTranslation*D.inv_dt;H.m_linearVelocity.y*=AN.b2_maxTranslation*D.inv_dt}A=D.dt*H.m_angularVelocity;if(A*A>AN.b2_maxRotationSquared){H.m_angularVelocity=H.m_angularVelocity<0?-AN.b2_maxRotation*D.inv_dt:AN.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(AN.b2_contactBaumgarte);E=true;for(H=0;H<this.m_jointCount;++H){G=this.m_joints[H];G=G.SolvePositionConstraints(AN.b2_contactBaumgarte);E=E&&G}if(A&&E){break}}this.Report(I.m_constraints);if(F){F=Number.MAX_VALUE;I=AN.b2_linearSleepTolerance*AN.b2_linearSleepTolerance;A=AN.b2_angularSleepTolerance*AN.b2_angularSleepTolerance;for(B=0;B<this.m_bodyCount;++B){H=this.m_bodies[B];if(H.GetType()!=AS.b2_staticBody){if((H.m_flags&AS.e_allowSleepFlag)==0){F=H.m_sleepTime=0}if((H.m_flags&AS.e_allowSleepFlag)==0||H.m_angularVelocity*H.m_angularVelocity>A||AI.Dot(H.m_linearVelocity,H.m_linearVelocity)>I){F=H.m_sleepTime=0}else{H.m_sleepTime+=D.dt;F=AI.Min(F,H.m_sleepTime)}}}if(F>=AN.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()!=AS.b2_staticBody){var G=D.dt*E.m_linearVelocity.x,F=D.dt*E.m_linearVelocity.y;if(G*G+F*F>AN.b2_maxTranslationSquared){E.m_linearVelocity.Normalize();E.m_linearVelocity.x*=AN.b2_maxTranslation*D.inv_dt;E.m_linearVelocity.y*=AN.b2_maxTranslation*D.inv_dt}G=D.dt*E.m_angularVelocity;if(G*G>AN.b2_maxRotationSquared){E.m_angularVelocity=E.m_angularVelocity<0?-AN.b2_maxRotation*D.inv_dt:AN.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(AN.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 AK});AV.b2TimeStep=function(){};AV.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};AU.b2World=function(){this.s_stack=new Vector;this.m_contactManager=new g;this.m_contactSolver=new AP;this.m_island=new C};AU.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;AU.m_warmStarting=true;AU.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 AA)};AU.prototype.SetDestructionListener=function(A){this.m_destructionListener=A};AU.prototype.SetContactFilter=function(A){this.m_contactManager.m_contactFilter=A};AU.prototype.SetContactListener=function(A){this.m_contactManager.m_contactListener=A};AU.prototype.SetDebugDraw=function(A){this.m_debugDraw=A};AU.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)}}};AU.prototype.Validate=function(){this.m_contactManager.m_broadPhase.Validate()};AU.prototype.GetProxyCount=function(){return this.m_contactManager.m_broadPhase.GetProxyCount()};AU.prototype.CreateBody=function(A){if(this.IsLocked()==true){return null}A=new AS(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};AU.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}};AU.prototype.CreateJoint=function(B){var E=AL.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};AU.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;AL.Destroy(B,null);--this.m_jointCount;if(E==false){for(B=A.GetContactList();B;){B.other==D&&B.contact.FlagForFiltering();B=B.next}}};AU.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};AU.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--};AU.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};AU.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};AU.prototype.SetWarmStarting=function(A){AU.m_warmStarting=A};AU.prototype.SetContinuousPhysics=function(A){AU.m_continuousPhysics=A};AU.prototype.GetBodyCount=function(){return this.m_bodyCount};AU.prototype.GetJointCount=function(){return this.m_jointCount};AU.prototype.GetContactCount=function(){return this.m_contactCount};AU.prototype.SetGravity=function(A){this.m_gravity=A};AU.prototype.GetGravity=function(){return this.m_gravity};AU.prototype.GetGroundBody=function(){return this.m_groundBody};AU.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&AU.e_newFixture){this.m_contactManager.FindNewContacts();this.m_flags&=~AU.e_newFixture}this.m_flags|=AU.e_locked;var A=AU.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=AU.m_warmStarting;this.m_contactManager.Collide();A.dt>0&&this.Solve(A);AU.m_continuousPhysics&&A.dt>0&&this.SolveTOI(A);if(A.dt>0){this.m_inv_dt0=A.inv_dt}this.m_flags&=~AU.e_locked};AU.prototype.ClearForces=function(){for(var A=this.m_bodyList;A;A=A.m_next){A.m_force.SetZero();A.m_torque=0}};AU.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 AC;new AC;new AC;var G;new X;new X;G=[new AC,new AC,new AC,new AC];var F=new AF(0,0,0);if(D&AJ.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()==AS.b2_staticBody){F.Set(0.5,0.9,0.5)}else{if(H.GetType()==AS.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&AJ.e_jointBit){for(H=this.m_jointList;H;H=H.m_next){this.DrawJoint(H)}}if(D&AJ.e_controllerBit){for(H=this.m_controllerList;H;H=H.m_next){H.Draw(this.m_debugDraw)}}if(D&AJ.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&AJ.e_aabbBit){B=this.m_contactManager.m_broadPhase;G=[new AC,new AC,new AC,new AC];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&AJ.e_centerOfMassBit){for(H=this.m_bodyList;H;H=H.m_next){G=AU.s_xf;G.R=H.m_xf.R;G.position=H.GetWorldCenter();this.m_debugDraw.DrawTransform(G)}}}};AU.prototype.QueryAABB=function(A,D){var B=this.m_contactManager.m_broadPhase;B.Query(function(E){return A(B.GetUserData(E))},D)};AU.prototype.QueryShape=function(B,F,D){if(D===undefined){D=null}if(D==null){D=new AB;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)};AU.prototype.QueryPoint=function(B,E){var D=this.m_contactManager.m_broadPhase,A=new X;A.lowerBound.Set(E.x-AN.b2_linearSlop,E.y-AN.b2_linearSlop);A.upperBound.Set(E.x+AN.b2_linearSlop,E.y+AN.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)};AU.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 AC((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)};AU.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};AU.prototype.RayCastAll=function(A,D){var B=new Vector;this.RayCast(function(E){B[B.length]=E;return 1},A,D);return B};AU.prototype.GetBodyList=function(){return this.m_bodyList};AU.prototype.GetJointList=function(){return this.m_jointList};AU.prototype.GetContactList=function(){return this.m_contactList};AU.prototype.IsLocked=function(){return(this.m_flags&AU.e_locked)>0};AU.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&=~AS.e_islandFlag}for(var B=this.m_contactList;B;B=B.m_next){B.m_flags&=~AR.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&AS.e_islandFlag)){if(!(H.IsAwake()==false||H.IsActive()==false)){if(H.GetType()!=AS.b2_staticBody){F.Clear();var G=0;B[G++]=H;for(H.m_flags|=AS.e_islandFlag;G>0;){I=B[--G];F.AddBody(I);I.IsAwake()==false&&I.SetAwake(true);if(I.GetType()!=AS.b2_staticBody){for(var A,E=I.m_contactList;E;E=E.next){if(!(E.contact.m_flags&AR.e_islandFlag)){if(!(E.contact.IsSensor()==true||E.contact.IsEnabled()==false||E.contact.IsTouching()==false)){F.AddContact(E.contact);E.contact.m_flags|=AR.e_islandFlag;A=E.other;if(!(A.m_flags&AS.e_islandFlag)){B[G++]=A;A.m_flags|=AS.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&AS.e_islandFlag)){B[G++]=A;A.m_flags|=AS.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()==AS.b2_staticBody){I.m_flags&=~AS.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()!=AS.b2_staticBody&&I.SynchronizeFixtures()}this.m_contactManager.FindNewContacts()};AU.prototype.SolveTOI=function(I){var G,D,H,F=this.m_island;F.Initialize(this.m_bodyCount,AN.b2_maxTOIContactsPerIsland,AN.b2_maxTOIJointsPerIsland,null,this.m_contactManager.m_contactListener,this.m_contactSolver);var E=AU.s_queue;for(G=this.m_bodyList;G;G=G.m_next){G.m_flags&=~AS.e_islandFlag;G.m_sweep.t0=0}for(H=this.m_contactList;H;H=H.m_next){H.m_flags&=~(AR.e_toiFlag|AR.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&AR.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()!=AS.b2_dynamicBody||G.IsAwake()==false)&&(D.GetType()!=AS.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);AN.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|=AR.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;AU.s_backupA.Set(G.m_sweep);AU.s_backupB.Set(D.m_sweep);G.Advance(A);D.Advance(A);B.Update(this.m_contactManager.m_contactListener);B.m_flags&=~AR.e_toiFlag;if(B.IsSensor()==true||B.IsEnabled()==false){G.m_sweep.Set(AU.s_backupA);D.m_sweep.Set(AU.s_backupB);G.SynchronizeTransform();D.SynchronizeTransform()}else{if(B.IsTouching()!=false){G=G;if(G.GetType()!=AS.b2_dynamicBody){G=D}F.Clear();B=H=0;E[H+B++]=G;for(G.m_flags|=AS.e_islandFlag;B>0;){G=E[H++];--B;F.AddBody(G);G.IsAwake()==false&&G.SetAwake(true);if(G.GetType()==AS.b2_dynamicBody){for(D=G.m_contactList;D;D=D.next){if(F.m_contactCount==F.m_contactCapacity){break}if(!(D.contact.m_flags&AR.e_islandFlag)){if(!(D.contact.IsSensor()==true||D.contact.IsEnabled()==false||D.contact.IsTouching()==false)){F.AddContact(D.contact);D.contact.m_flags|=AR.e_islandFlag;K=D.other;if(!(K.m_flags&AS.e_islandFlag)){if(K.GetType()!=AS.b2_staticBody){K.Advance(A);K.SetAwake(true)}E[H+B]=K;++B;K.m_flags|=AS.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&AS.e_islandFlag)){if(K.GetType()!=AS.b2_staticBody){K.Advance(A);K.SetAwake(true)}E[H+B]=K;++B;K.m_flags|=AS.e_islandFlag}}}}}}}H=AU.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&=~AS.e_islandFlag;if(G.IsAwake()!=false){if(G.GetType()==AS.b2_dynamicBody){G.SynchronizeFixtures();for(D=G.m_contactList;D;D=D.next){D.contact.m_flags&=~AR.e_toiFlag}}}}for(A=0;A<F.m_contactCount;++A){H=F.m_contacts[A];H.m_flags&=~(AR.e_toiFlag|AR.e_islandFlag)}for(A=0;A<F.m_jointCount;++A){H=F.m_joints[A];H.m_islandFlag=false}this.m_contactManager.FindNewContacts()}}}};AU.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=AU.s_jointColor;switch(D.m_type){case AL.e_distanceJoint:this.m_debugDraw.DrawSegment(G,A,E);break;case AL.e_pulleyJoint:I=D instanceof AQ?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 AL.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)}};AU.prototype.DrawShape=function(B,G,D){switch(B.m_type){case J.e_circleShape:var A=B instanceof t?B:null;this.m_debugDraw.DrawSolidCircle(AI.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]=AI.MulX(G,F[A])}this.m_debugDraw.DrawSolidPolygon(E,B,D);break;case J.e_edgeShape:A=B instanceof x?B:null;this.m_debugDraw.DrawSegment(AI.MulX(G,A.GetVertex1()),AI.MulX(G,A.GetVertex2()),D)}};Box2D.postDefs.push(function(){Box2D.Dynamics.b2World.s_timestep2=new AV;Box2D.Dynamics.b2World.s_xf=new AB;Box2D.Dynamics.b2World.s_backupA=new AG;Box2D.Dynamics.b2World.s_backupB=new AG;Box2D.Dynamics.b2World.s_timestep=new AV;Box2D.Dynamics.b2World.s_queue=new Vector;Box2D.Dynamics.b2World.s_jointColor=new AF(0.5,0.8,0.8);Box2D.Dynamics.b2World.e_newFixture=1;Box2D.Dynamics.b2World.e_locked=2})})();(function(){var AG=Box2D.Collision.Shapes.b2CircleShape,AE=Box2D.Collision.Shapes.b2EdgeShape,x=Box2D.Collision.Shapes.b2PolygonShape,AA=Box2D.Collision.Shapes.b2Shape,AD=Box2D.Dynamics.Contacts.b2CircleContact,AK=Box2D.Dynamics.Contacts.b2Contact,X=Box2D.Dynamics.Contacts.b2ContactConstraint,AL=Box2D.Dynamics.Contacts.b2ContactConstraintPoint,AJ=Box2D.Dynamics.Contacts.b2ContactEdge,f=Box2D.Dynamics.Contacts.b2ContactFactory,T=Box2D.Dynamics.Contacts.b2ContactRegister,n=Box2D.Dynamics.Contacts.b2ContactResult,o=Box2D.Dynamics.Contacts.b2ContactSolver,AB=Box2D.Dynamics.Contacts.b2EdgeAndCircleContact,P=Box2D.Dynamics.Contacts.b2NullContact,J=Box2D.Dynamics.Contacts.b2PolyAndCircleContact,AN=Box2D.Dynamics.Contacts.b2PolyAndEdgeContact,t=Box2D.Dynamics.Contacts.b2PolygonContact,AF=Box2D.Dynamics.Contacts.b2PositionSolverManifold,AI=Box2D.Dynamics.b2Body,AC=Box2D.Dynamics.b2TimeStep,g=Box2D.Common.b2Settings,AH=Box2D.Common.Math.b2Mat22,e=Box2D.Common.Math.b2Math,m=Box2D.Common.Math.b2Vec2,b=Box2D.Collision.b2Collision,AQ=Box2D.Collision.b2ContactID,C=Box2D.Collision.b2Manifold,AP=Box2D.Collision.b2TimeOfImpact,AO=Box2D.Collision.b2TOIInput,AM=Box2D.Collision.b2WorldManifold;Box2D.inherit(AD,Box2D.Dynamics.Contacts.b2Contact);AD.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;AD.b2CircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};AD.Create=function(){return new AD};AD.Destroy=function(){};AD.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B)};AD.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();b.CollideCircles(this.m_manifold,this.m_fixtureA.GetShape() instanceof AG?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AG?this.m_fixtureB.GetShape():null,B.m_xf)};AK.b2Contact=function(){this.m_nodeA=new AJ;this.m_nodeB=new AJ;this.m_manifold=new C;this.m_oldManifold=new C};AK.prototype.GetManifold=function(){return this.m_manifold};AK.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)};AK.prototype.IsTouching=function(){return(this.m_flags&AK.e_touchingFlag)==AK.e_touchingFlag};AK.prototype.IsContinuous=function(){return(this.m_flags&AK.e_continuousFlag)==AK.e_continuousFlag};AK.prototype.SetSensor=function(A){if(A){this.m_flags|=AK.e_sensorFlag}else{this.m_flags&=~AK.e_sensorFlag}};AK.prototype.IsSensor=function(){return(this.m_flags&AK.e_sensorFlag)==AK.e_sensorFlag};AK.prototype.SetEnabled=function(A){if(A){this.m_flags|=AK.e_enabledFlag}else{this.m_flags&=~AK.e_enabledFlag}};AK.prototype.IsEnabled=function(){return(this.m_flags&AK.e_enabledFlag)==AK.e_enabledFlag};AK.prototype.GetNext=function(){return this.m_next};AK.prototype.GetFixtureA=function(){return this.m_fixtureA};AK.prototype.GetFixtureB=function(){return this.m_fixtureB};AK.prototype.FlagForFiltering=function(){this.m_flags|=AK.e_filterFlag};AK.prototype.b2Contact=function(){};AK.prototype.Reset=function(A,D){if(A===undefined){A=null}if(D===undefined){D=null}this.m_flags=AK.e_enabledFlag;if(!A||!D){this.m_fixtureB=this.m_fixtureA=null}else{if(A.IsSensor()||D.IsSensor()){this.m_flags|=AK.e_sensorFlag}var B=A.GetBody(),E=D.GetBody();if(B.GetType()!=AI.b2_dynamicBody||B.IsBullet()||E.GetType()!=AI.b2_dynamicBody||E.IsBullet()){this.m_flags|=AK.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}};AK.prototype.Update=function(E){var B=this.m_oldManifold;this.m_oldManifold=this.m_manifold;this.m_manifold=B;this.m_flags|=AK.e_enabledFlag;var A=false;B=(this.m_flags&AK.e_touchingFlag)==AK.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&AK.e_sensorFlag){if(I){A=this.m_fixtureA.GetShape();I=this.m_fixtureB.GetShape();D=D.GetTransform();L=L.GetTransform();A=AA.TestOverlap(A,D,I,L)}this.m_manifold.m_pointCount=0}else{if(D.GetType()!=AI.b2_dynamicBody||D.IsBullet()||L.GetType()!=AI.b2_dynamicBody||L.IsBullet()){this.m_flags|=AK.e_continuousFlag}else{this.m_flags&=~AK.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|=AK.e_touchingFlag}else{this.m_flags&=~AK.e_touchingFlag}B==false&&A==true&&E.BeginContact(this);B==true&&A==false&&E.EndContact(this);(this.m_flags&AK.e_sensorFlag)==0&&E.PreSolve(this,this.m_oldManifold)};AK.prototype.Evaluate=function(){};AK.prototype.ComputeTOI=function(A,B){AK.s_input.proxyA.Set(this.m_fixtureA.GetShape());AK.s_input.proxyB.Set(this.m_fixtureB.GetShape());AK.s_input.sweepA=A;AK.s_input.sweepB=B;AK.s_input.tolerance=g.b2_linearSlop;return AP.TimeOfImpact(AK.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 AO});X.b2ContactConstraint=function(){this.localPlaneNormal=new m;this.localPoint=new m;this.normal=new m;this.normalMass=new AH;this.K=new AH};X.prototype.b2ContactConstraint=function(){this.points=new Vector(g.b2_maxManifoldPoints);for(var A=0;A<g.b2_maxManifoldPoints;A++){this.points[A]=new AL}};AL.b2ContactConstraintPoint=function(){this.localPoint=new m;this.rA=new m;this.rB=new m};AJ.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(AA.e_shapeTypeCount);for(var A=0;A<AA.e_shapeTypeCount;A++){this.m_registers[A]=new Vector(AA.e_shapeTypeCount);for(var B=0;B<AA.e_shapeTypeCount;B++){this.m_registers[A][B]=new T}}this.AddType(AD.Create,AD.Destroy,AA.e_circleShape,AA.e_circleShape);this.AddType(J.Create,J.Destroy,AA.e_polygonShape,AA.e_circleShape);this.AddType(t.Create,t.Destroy,AA.e_polygonShape,AA.e_polygonShape);this.AddType(AB.Create,AB.Destroy,AA.e_edgeShape,AA.e_circleShape);this.AddType(AN.Create,AN.Destroy,AA.e_polygonShape,AA.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 AQ};o.b2ContactSolver=function(){this.m_step=new AC;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 AM;Box2D.Dynamics.Contacts.b2ContactSolver.s_psm=new AF});Box2D.inherit(AB,Box2D.Dynamics.Contacts.b2Contact);AB.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;AB.b2EdgeAndCircleContact=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();this.b2CollideEdgeAndCircle(this.m_manifold,this.m_fixtureA.GetShape() instanceof AE?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AG?this.m_fixtureB.GetShape():null,B.m_xf)};AB.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()==AA.e_polygonShape);g.b2Assert(B.GetType()==AA.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 x?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AG?this.m_fixtureB.GetShape():null,B.m_xf)};Box2D.inherit(AN,Box2D.Dynamics.Contacts.b2Contact);AN.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;AN.b2PolyAndEdgeContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};AN.Create=function(){return new AN};AN.Destroy=function(){};AN.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B);g.b2Assert(A.GetType()==AA.e_polygonShape);g.b2Assert(B.GetType()==AA.e_edgeShape)};AN.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();this.b2CollidePolyAndEdge(this.m_manifold,this.m_fixtureA.GetShape() instanceof x?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof AE?this.m_fixtureB.GetShape():null,B.m_xf)};AN.prototype.b2CollidePolyAndEdge=function(){};Box2D.inherit(t,Box2D.Dynamics.Contacts.b2Contact);t.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;t.b2PolygonContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};t.Create=function(){return new t};t.Destroy=function(){};t.prototype.Reset=function(A,B){this.__super.Reset.call(this,A,B)};t.prototype.Evaluate=function(){var A=this.m_fixtureA.GetBody(),B=this.m_fixtureB.GetBody();b.CollidePolygons(this.m_manifold,this.m_fixtureA.GetShape() instanceof x?this.m_fixtureA.GetShape():null,A.m_xf,this.m_fixtureB.GetShape() instanceof x?this.m_fixtureB.GetShape():null,B.m_xf)};AF.b2PositionSolverManifold=function(){};AF.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}};AF.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 AE=Box2D.Common.b2Settings,AC=Box2D.Common.Math.b2Mat22,o=Box2D.Common.Math.b2Mat33,t=Box2D.Common.Math.b2Math,AB=Box2D.Common.Math.b2Vec2,AI=Box2D.Common.Math.b2Vec3,X=Box2D.Dynamics.Joints.b2DistanceJoint,AJ=Box2D.Dynamics.Joints.b2DistanceJointDef,AH=Box2D.Dynamics.Joints.b2FrictionJoint,f=Box2D.Dynamics.Joints.b2FrictionJointDef,T=Box2D.Dynamics.Joints.b2GearJoint,l=Box2D.Dynamics.Joints.b2GearJointDef,m=Box2D.Dynamics.Joints.b2Jacobian,x=Box2D.Dynamics.Joints.b2Joint,P=Box2D.Dynamics.Joints.b2JointDef,J=Box2D.Dynamics.Joints.b2JointEdge,AK=Box2D.Dynamics.Joints.b2LineJoint,n=Box2D.Dynamics.Joints.b2LineJointDef,AD=Box2D.Dynamics.Joints.b2MouseJoint,AG=Box2D.Dynamics.Joints.b2MouseJointDef,AA=Box2D.Dynamics.Joints.b2PrismaticJoint,g=Box2D.Dynamics.Joints.b2PrismaticJointDef,AF=Box2D.Dynamics.Joints.b2PulleyJoint,e=Box2D.Dynamics.Joints.b2PulleyJointDef,h=Box2D.Dynamics.Joints.b2RevoluteJoint,b=Box2D.Dynamics.Joints.b2RevoluteJointDef,AL=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 AB;this.m_localAnchor2=new AB;this.m_u=new AB};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 AB(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>AE.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=t.Clamp(I,-AE.b2_maxLinearCorrection,AE.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 t.Abs(I)<AE.b2_linearSlop};Box2D.inherit(AJ,Box2D.Dynamics.Joints.b2JointDef);AJ.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;AJ.b2DistanceJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new AB;this.localAnchorB=new AB};AJ.prototype.b2DistanceJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_distanceJoint;this.length=1;this.dampingRatio=this.frequencyHz=0};AJ.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(AH,Box2D.Dynamics.Joints.b2Joint);AH.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AH.b2FrictionJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new AB;this.m_localAnchorB=new AB;this.m_linearMass=new AC;this.m_linearImpulse=new AB};AH.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};AH.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)};AH.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_linearImpulse.x,A*this.m_linearImpulse.y)};AH.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_angularImpulse};AH.prototype.SetMaxForce=function(A){if(A===undefined){A=0}this.m_maxForce=A};AH.prototype.GetMaxForce=function(){return this.m_maxForce};AH.prototype.SetMaxTorque=function(A){if(A===undefined){A=0}this.m_maxTorque=A};AH.prototype.GetMaxTorque=function(){return this.m_maxTorque};AH.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};AH.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 AC;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}};AH.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=t.Clamp(this.m_angularImpulse+K,-M,M);K=this.m_angularImpulse-B;H-=Q*K;S+=O*K;M=t.MulMV(this.m_linearMass,new AB(-(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=t.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};AH.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 AB;this.localAnchorB=new AB};f.prototype.b2FrictionJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.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 AB;this.m_groundAnchor2=new AB;this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;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 AB(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==x.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 AA?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==x.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 AA?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<AE.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=x.e_gearJoint;this.joint2=this.joint1=null;this.ratio=1};m.b2Jacobian=function(){this.linearA=new AB;this.linearB=new AB};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};x.b2Joint=function(){this.m_edgeA=new J;this.m_edgeB=new J;this.m_localCenterA=new AB;this.m_localCenterB=new AB};x.prototype.GetType=function(){return this.m_type};x.prototype.GetAnchorA=function(){return null};x.prototype.GetAnchorB=function(){return null};x.prototype.GetReactionForce=function(){return null};x.prototype.GetReactionTorque=function(){return 0};x.prototype.GetBodyA=function(){return this.m_bodyA};x.prototype.GetBodyB=function(){return this.m_bodyB};x.prototype.GetNext=function(){return this.m_next};x.prototype.GetUserData=function(){return this.m_userData};x.prototype.SetUserData=function(A){this.m_userData=A};x.prototype.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()};x.Create=function(B){var A=null;switch(B.type){case x.e_distanceJoint:A=new X(B instanceof AJ?B:null);break;case x.e_mouseJoint:A=new AD(B instanceof AG?B:null);break;case x.e_prismaticJoint:A=new AA(B instanceof g?B:null);break;case x.e_revoluteJoint:A=new h(B instanceof b?B:null);break;case x.e_pulleyJoint:A=new AF(B instanceof e?B:null);break;case x.e_gearJoint:A=new T(B instanceof l?B:null);break;case x.e_lineJoint:A=new AK(B instanceof n?B:null);break;case x.e_weldJoint:A=new AL(B instanceof C?B:null);break;case x.e_frictionJoint:A=new AH(B instanceof f?B:null)}return A};x.Destroy=function(){};x.prototype.b2Joint=function(A){AE.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};x.prototype.InitVelocityConstraints=function(){};x.prototype.SolveVelocityConstraints=function(){};x.prototype.FinalizeVelocityConstraints=function(){};x.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=x.e_unknownJoint;this.bodyB=this.bodyA=this.userData=null;this.collideConnected=false};J.b2JointEdge=function(){};Box2D.inherit(AK,Box2D.Dynamics.Joints.b2Joint);AK.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AK.b2LineJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_localXAxis1=new AB;this.m_localYAxis1=new AB;this.m_axis=new AB;this.m_perp=new AB;this.m_K=new AC;this.m_impulse=new AB};AK.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};AK.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};AK.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(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))};AK.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.y};AK.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};AK.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))};AK.prototype.IsLimitEnabled=function(){return this.m_enableLimit};AK.prototype.EnableLimit=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableLimit=A};AK.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};AK.prototype.GetUpperLimit=function(){return this.m_upperTranslation};AK.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};AK.prototype.IsMotorEnabled=function(){return this.m_enableMotor};AK.prototype.EnableMotor=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableMotor=A};AK.prototype.SetMotorSpeed=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=A};AK.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};AK.prototype.SetMaxMotorForce=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_maxMotorForce=A};AK.prototype.GetMaxMotorForce=function(){return this.m_maxMotorForce};AK.prototype.GetMotorForce=function(){return this.m_motorImpulse};AK.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=x.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};AK.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(t.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(t.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(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){this.m_limitState=x.e_equalLimits}else{if(F<=this.m_lowerTranslation){if(this.m_limitState!=x.e_atLowerLimit){this.m_limitState=x.e_atLowerLimit;this.m_impulse.y=0}}else{if(F>=this.m_upperTranslation){if(this.m_limitState!=x.e_atUpperLimit){this.m_limitState=x.e_atUpperLimit;this.m_impulse.y=0}}else{this.m_limitState=x.e_inactiveLimit;this.m_impulse.y=0}}}}else{this.m_limitState=x.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}};AK.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!=x.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=t.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!=x.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 AB,-K,-H);this.m_impulse.Add(I);if(this.m_limitState==x.e_atLowerLimit){this.m_impulse.y=t.Max(this.m_impulse.y,0)}else{if(this.m_limitState==x.e_atUpperLimit){this.m_impulse.y=t.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};AK.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=AC.FromAngle(H);K=AC.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=t.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(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){F=t.Clamp(S,-AE.b2_maxLinearCorrection,AE.b2_maxLinearCorrection);M=t.Abs(S);O=true}else{if(S<=this.m_lowerTranslation){F=t.Clamp(S-this.m_lowerTranslation+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);M=this.m_lowerTranslation-S;O=true}else{if(S>=this.m_upperTranslation){F=t.Clamp(S-this.m_upperTranslation+AE.b2_linearSlop,0,AE.b2_maxLinearCorrection);M=S-this.m_upperTranslation;O=true}}}}this.m_perp=t.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 AB;U=this.m_perp.x*E+this.m_perp.y*R;M=t.Max(M,t.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<=AE.b2_linearSlop&&L<=AE.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 AB;this.localAnchorB=new AB;this.localAxisA=new AB};n.prototype.b2LineJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.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(AD,Box2D.Dynamics.Joints.b2Joint);AD.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AD.b2MouseJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.K=new AC;this.K1=new AC;this.K2=new AC;this.m_localAnchor=new AB;this.m_target=new AB;this.m_impulse=new AB;this.m_mass=new AC;this.m_C=new AB};AD.prototype.GetAnchorA=function(){return this.m_target};AD.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor)};AD.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse.x,A*this.m_impulse.y)};AD.prototype.GetReactionTorque=function(){return 0};AD.prototype.GetTarget=function(){return this.m_target};AD.prototype.SetTarget=function(A){this.m_bodyB.IsAwake()==false&&this.m_bodyB.SetAwake(true);this.m_target=A};AD.prototype.GetMaxForce=function(){return this.m_maxForce};AD.prototype.SetMaxForce=function(A){if(A===undefined){A=0}this.m_maxForce=A};AD.prototype.GetFrequency=function(){return this.m_frequencyHz};AD.prototype.SetFrequency=function(A){if(A===undefined){A=0}this.m_frequencyHz=A};AD.prototype.GetDampingRatio=function(){return this.m_dampingRatio};AD.prototype.SetDampingRatio=function(A){if(A===undefined){A=0}this.m_dampingRatio=A};AD.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};AD.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)};AD.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)};AD.prototype.SolvePositionConstraints=function(){return true};Box2D.inherit(AG,Box2D.Dynamics.Joints.b2JointDef);AG.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;AG.b2MouseJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.target=new AB};AG.prototype.b2MouseJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.e_mouseJoint;this.maxForce=0;this.frequencyHz=5;this.dampingRatio=0.7};Box2D.inherit(AA,Box2D.Dynamics.Joints.b2Joint);AA.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AA.b2PrismaticJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_localXAxis1=new AB;this.m_localYAxis1=new AB;this.m_axis=new AB;this.m_perp=new AB;this.m_K=new o;this.m_impulse=new AI};AA.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};AA.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};AA.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(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))};AA.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.y};AA.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};AA.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))};AA.prototype.IsLimitEnabled=function(){return this.m_enableLimit};AA.prototype.EnableLimit=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableLimit=A};AA.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};AA.prototype.GetUpperLimit=function(){return this.m_upperTranslation};AA.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};AA.prototype.IsMotorEnabled=function(){return this.m_enableMotor};AA.prototype.EnableMotor=function(A){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableMotor=A};AA.prototype.SetMotorSpeed=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=A};AA.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};AA.prototype.SetMaxMotorForce=function(A){if(A===undefined){A=0}this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_maxMotorForce=A};AA.prototype.GetMotorForce=function(){return this.m_motorImpulse};AA.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=x.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};AA.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(t.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(t.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(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){this.m_limitState=x.e_equalLimits}else{if(F<=this.m_lowerTranslation){if(this.m_limitState!=x.e_atLowerLimit){this.m_limitState=x.e_atLowerLimit;this.m_impulse.z=0}}else{if(F>=this.m_upperTranslation){if(this.m_limitState!=x.e_atUpperLimit){this.m_limitState=x.e_atUpperLimit;this.m_impulse.z=0}}else{this.m_limitState=x.e_inactiveLimit;this.m_impulse.z=0}}}}else{this.m_limitState=x.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}};AA.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!=x.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=t.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!=x.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 AI,-H,-K,-I);this.m_impulse.Add(I);if(this.m_limitState==x.e_atLowerLimit){this.m_impulse.z=t.Max(this.m_impulse.z,0)}else{if(this.m_limitState==x.e_atUpperLimit){this.m_impulse.z=t.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 AB,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 AB,-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};AA.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=AC.FromAngle(H),A=AC.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=t.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(t.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*AE.b2_linearSlop){L=t.Clamp(S,-AE.b2_maxLinearCorrection,AE.b2_maxLinearCorrection);Q=t.Abs(S);O=true}else{if(S<=this.m_lowerTranslation){L=t.Clamp(S-this.m_lowerTranslation+AE.b2_linearSlop,-AE.b2_maxLinearCorrection,0);Q=this.m_lowerTranslation-S;O=true}else{if(S>=this.m_upperTranslation){L=t.Clamp(S-this.m_upperTranslation+AE.b2_linearSlop,0,AE.b2_maxLinearCorrection);Q=S-this.m_upperTranslation;O=true}}}}this.m_perp=t.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 AI;U=this.m_perp.x*E+this.m_perp.y*R;A=B-H-this.m_refAngle;Q=t.Max(Q,t.Abs(U));M=t.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 AB,-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<=AE.b2_linearSlop&&M<=AE.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 AB;this.localAnchorB=new AB;this.localAxisA=new AB};g.prototype.b2PrismaticJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.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(AF,Box2D.Dynamics.Joints.b2Joint);AF.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AF.b2PulleyJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new AB;this.m_groundAnchor2=new AB;this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_u1=new AB;this.m_u2=new AB};AF.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};AF.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};AF.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse*this.m_u2.x,A*this.m_impulse*this.m_u2.y)};AF.prototype.GetReactionTorque=function(){return 0};AF.prototype.GetGroundAnchorA=function(){var A=this.m_ground.m_xf.position.Copy();A.Add(this.m_groundAnchor1);return A};AF.prototype.GetGroundAnchorB=function(){var A=this.m_ground.m_xf.position.Copy();A.Add(this.m_groundAnchor2);return A};AF.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)};AF.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)};AF.prototype.GetRatio=function(){return this.m_ratio};AF.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=t.Min(A.maxLengthA,this.m_constant-this.m_ratio*AF.b2_minPulleyLength);this.m_maxLength2=t.Min(A.maxLengthB,(this.m_constant-AF.b2_minPulleyLength)/this.m_ratio);this.m_limitImpulse2=this.m_limitImpulse1=this.m_impulse=0};AF.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>AE.b2_linearSlop?this.m_u1.Multiply(1/F):this.m_u1.SetZero();D>AE.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=x.e_inactiveLimit;this.m_impulse=0}else{this.m_state=x.e_atUpperLimit}if(F<this.m_maxLength1){this.m_limitState1=x.e_inactiveLimit;this.m_limitImpulse1=0}else{this.m_limitState1=x.e_atUpperLimit}if(D<this.m_maxLength2){this.m_limitState2=x.e_inactiveLimit;this.m_limitImpulse2=0}else{this.m_limitState2=x.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}};AF.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==x.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=t.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==x.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=t.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==x.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=t.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)}};AF.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==x.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>AE.b2_linearSlop?this.m_u1.Multiply(1/G):this.m_u1.SetZero();M>AE.b2_linearSlop?this.m_u2.Multiply(1/M):this.m_u2.SetZero();G=this.m_constant-G-this.m_ratio*M;A=t.Max(A,-G);G=t.Clamp(G+AE.b2_linearSlop,-AE.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==x.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>AE.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=t.Max(A,-G);G=t.Clamp(G+AE.b2_linearSlop,-AE.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==x.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>AE.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=t.Max(A,-G);G=t.Clamp(G+AE.b2_linearSlop,-AE.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<AE.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 AB;this.groundAnchorB=new AB;this.localAnchorA=new AB;this.localAnchorB=new AB};e.prototype.b2PulleyJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.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*AF.b2_minPulleyLength;this.maxLengthB=(H-AF.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 AC;this.K1=new AC;this.K2=new AC;this.K3=new AC;this.impulse3=new AI;this.impulse2=new AB;this.reduced=new AB;this.m_localAnchor1=new AB;this.m_localAnchor2=new AB;this.m_impulse=new AI;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 AB(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=x.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(t.Abs(this.m_upperAngle-this.m_lowerAngle)<2*AE.b2_angularSlop){this.m_limitState=x.e_equalLimits}else{if(I<=this.m_lowerAngle){if(this.m_limitState!=x.e_atLowerLimit){this.m_impulse.z=0}this.m_limitState=x.e_atLowerLimit}else{if(I>=this.m_upperAngle){if(this.m_limitState!=x.e_atUpperLimit){this.m_impulse.z=0}this.m_limitState=x.e_atUpperLimit}else{this.m_limitState=x.e_inactiveLimit;this.m_impulse.z=0}}}}else{this.m_limitState=x.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!=x.e_equalLimits){D=this.m_motorMass*-(M-K-this.m_motorSpeed);B=this.m_motorImpulse;E=N.dt*this.m_maxMotorTorque;this.m_motorImpulse=t.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!=x.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==x.e_equalLimits){this.m_impulse.Add(this.impulse3)}else{if(this.m_limitState==x.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==x.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!=x.e_inactiveLimit){N=H.m_sweep.a-G.m_sweep.a-this.m_referenceAngle;var O=0;if(this.m_limitState==x.e_equalLimits){N=t.Clamp(N-this.m_lowerAngle,-AE.b2_maxAngularCorrection,AE.b2_maxAngularCorrection);O=-this.m_motorMass*N;D=t.Abs(N)}else{if(this.m_limitState==x.e_atLowerLimit){N=N-this.m_lowerAngle;D=-N;N=t.Clamp(N+AE.b2_angularSlop,-AE.b2_maxAngularCorrection,0);O=-this.m_motorMass*N}else{if(this.m_limitState==x.e_atUpperLimit){D=N=N-this.m_upperAngle;N=t.Clamp(N-AE.b2_angularSlop,0,AE.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*AE.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<=AE.b2_linearSlop&&D<=AE.b2_angularSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2RevoluteJoint.tImpulse=new AB});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 AB;this.localAnchorB=new AB};b.prototype.b2RevoluteJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.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(AL,Box2D.Dynamics.Joints.b2Joint);AL.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;AL.b2WeldJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new AB;this.m_localAnchorB=new AB;this.m_impulse=new AI;this.m_mass=new o};AL.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};AL.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)};AL.prototype.GetReactionForce=function(A){if(A===undefined){A=0}return new AB(A*this.m_impulse.x,A*this.m_impulse.y)};AL.prototype.GetReactionTorque=function(A){if(A===undefined){A=0}return A*this.m_impulse.z};AL.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};AL.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()}};AL.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 AI;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};AL.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*AE.b2_linearSlop,A=Math.sqrt(Q*Q+M*M),S=t.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 AI;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<=AE.b2_linearSlop&&S<=AE.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 AB;this.localAnchorB=new AB};C.prototype.b2WeldJointDef=function(){this.__super.b2JointDef.call(this);this.type=x.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)!="undefined"){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.25;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)"}}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)}}}}})(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={};F.toString=function(){return"Token ID="+this.setting.ID};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){for(var B=0;B<C.settings.data.model.length;B++){this.buffer[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){for(var B=C.decay.tokens-1;B>=0;B--){this.update(C,B,C.tokens.length)}},strategy:function(){if(flocullateBuffer.length>0){if(chart.flocullate.strategy=="Size"&&flocullateBuffer.length>=chart.flocullate.bufferSize){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($){$.fn._vs.strata={stratas:[],init:function(_this){if(_this.settings.chart.type!="StackedAreaChart"){_this.strata.create_strata(_this);return}settings=_this.settings;if((typeof(settings.data.strata)!="function")&&(typeof(settings.data.strata)=="undefined"||settings.data.strata.length==0)){for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,value:function(t,s){return 0},};_this.strata.stratas[i]=[defaultStrata]}_this.strata.create_strata(_this);return}if(typeof settings.data.strata!="function"){if(typeof(settings.data.strata=="object")&&typeof(settings.data.strata[0])!="undefined"&&(typeof settings.data.strata[0][0].value!="undefined")&&typeof(settings.data.strata[0][0].value=="string")){var NB_STRATA=settings.data.strata[0].length;for(var i=0;i<settings.data.model.length;i++){_this.strata.stratas[i]=[];for(var n=0;n<NB_STRATA;n++){(function(a,b){var t=null;if((typeof settings.data.strata[a]!="undefined")&&(typeof settings.data.strata[a][b]!="undefined")&&(typeof settings.data.strata[a][b].texture!="undefined")){t=settings.data.strata[a][b].texture}var defaultStrata={};defaultStrata={label:settings.data.model[i].label+"_"+a,category:a,texture:t,value:function(){r=eval("f="+settings.data.strata[a][b].value);return r()}};_this.strata.stratas[a].push(defaultStrata)})(i,n)}}_this.strata.create_strata(_this);return}if(typeof(settings.data.strata[0])!="undefined"&&typeof(settings.data.strata[0][0])!="undefined"&&typeof(settings.data.strata[0][0].initValue!="undefined")){for(var c=0;c<settings.data.model.length;c++){var defaultStrata={label:settings.data.model[c].label+"_"+c,category:i,value:function(t,s){if(t.selectAll("category",s)){return settings.data.strata[s][0].initValue+t.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length}else{return settings.data.strata[s][0].initValue}},};_this.strata.stratas[c]=[defaultStrata]}_this.strata.create_strata(_this);return}else{if(settings.data.strata[0].length==0){for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,value:function(t,s){if(t.selectAll("category",s)){return t.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length}else{return 0}},};_this.strata.stratas[i]=[defaultStrata]}_this.strata.create_strata(_this);return}else{var NB_STRATA=settings.data.strata[0].length;settings.data.strata_param=settings.data.strata;function fstrata(){var a=Array();for(var s=0;s<mySettings.data.model.length;s++){a.push(fstratum(s))}return a}function fstratum(a){var b=Array(NB_STRATA);for(var r=0;r<b.length;r++){b[r]=Array()}if(typeof _this!="undefined"){var tokens=_this.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length;for(var k=0;k<tokens.length;k++){var tk=tokens[k];for(var r=0;r<b.length;r++){if(tk<_this.settings.stream.now-2*(r)&&tk>=_this.settings.stream.now-2*(r+1)){b[b.length-r-1].push(tk)}}}}var res=Array();for(var j=0;j<NB_STRATA;j++){var val=b[j].length;(function(v){res.push({value:function(){return v},label:"Strata "+j,category:a})})(val)}return res}_this.settings.data.strata=function(){return fstrata()};_this.strata.stratas=_this.settings.data.strata();_this.strata.create_strata(_this);return}}}if((typeof settings.data.strata=="function")||settings.data.strata[0].length>0||_this.strata.stratas.length>0){if(typeof settings.data.strata=="function"||(settings.data.strata[0].length>0&&typeof(settings.data.strata[0])=="object")){if(typeof settings.data.strata=="function"){_this.strata.stratas=settings.data.strata()}else{if(typeof settings.data.strata[0].value=="function"){for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,initValue:settings.data.model[i].value,value:function(t,s){return settings.data.strata[i]},};_this.strata.stratas[i]=[defaultStrata]}}else{for(var i=0;i<settings.data.model.length;i++){var defaultStrata={label:settings.data.model[i].label+"_"+i,category:i,initValue:settings.data.model[i].value,value:function(t,s){if(typeof(t.selectAll("category",s).length)=="undefined"){return this.initValue}if(t.selectAll("category",s)){return this.initValue+t.selectAll("category",s).attr("state").filter(function(d){if(d==2){return d}}).length}else{return 0}},};_this.strata.stratas[i]=[defaultStrata]}}}}_this.strata.create_strata(_this)}},selectAll:function(_this,key,value){result=[];result.attr=function(key,value,param){var r=[];result.forEach(function(i){q=i.attr(key,value,param);r.push(q)});return r};if(typeof(value)=="undefined"&&typeof(key)=="undefined"){return this.stratas}else{for(var i=_this.strata.stratas.length-1;i>=0;i--){if(_this.strata.stratas[i].attr(key)==value){result.push(_this.strata.stratas[i]);break}}}if(typeof(result[0])=="undefined"){return false}else{return result[0]}},add:function(_this,setting){var strata=function(){};strata.myobj=setting;strata.attr=function(key,value,param){if(typeof(value)=="undefined"){if(typeof(this[key])!="undefined"){return this[key]()}else{return this.myobj[key]}}else{if(typeof(this[key])!="undefined"){this[key](value,param)}else{this.myobj[key]=value}}return this};return strata},remove:function(_this,key,value){},strata_layers:function(_this,n,m,p){var sn=d3.scale.linear().domain([1,m-2]).range([Math.PI/2,2*Math.PI-Math.PI/2]);var logscale=d3.scale.pow().exponent(10).domain([0,m]).range([0,1]);return d3.range(n).map(function(i){var r=5*Math.random();return d3.range(m).map(function(j){if(_this.settings.sedimentation.aggregation.strataType=="sin"){if(i==1){return 20}var x=5+r*5*Math.sin(sn(j))+(i*50);if(x<0){return -x}else{return x}}else{if(_this.settings.sedimentation.aggregation.strataType=="log"){return i+1}else{if(typeof(p)=="undefined"){p=0}return _this.strata.stratas[p][i].value(_this,p)}}}).map(stream_index)});function stream_index(d,i){return{x:i,y:Math.max(0,d)}}},create_strata:function(_this){if(_this.settings.chart.type=="StackedAreaChart"){var w=_this.settings.chart.width/_this.settings.data.model.length,h=_this.settings.sedimentation.aggregation.height;var color=_this.token.colorRange;if(typeof _this.settings.options.canvasFirst!="undefined"&&_this.settings.options.canvasFirst==false){var vis=d3.select("#"+_this.settings.DOMelement.id).insert("div",":first-child").style("position","absolute").attr("class","vis").style("z-index",10).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height).append("g").attr("transform","translate("+_this.settings.chart.x+","+_this.settings.chart.y+")")}else{var vis=d3.select("#"+_this.settings.DOMelement.id).append("div").attr("class","vis").style("z-index",10).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height).append("g").attr("transform","translate("+_this.settings.chart.x+","+_this.settings.chart.y+")")}var sn=_this.strata.stratas[0].length,sm=20;smx=sm-1,smy=0;var sum_strata=_this.strata.stratas.map(function(d,i){for(var v=0,res=0;v<d.length;v++){res+=d[v].value(_this,i)}return res});var y=d3.scale.linear().domain([0,Math.max(d3.max(sum_strata),_this.settings.sedimentation.aggregation.maxData)]).range([0,_this.settings.sedimentation.aggregation.height]);var g=vis.selectAll("g.gcol").data(_this.strata.stratas,function(d){return[d]}).enter().append("g").attr("transform",function(d,i){var align=_this.settings.sedimentation.aggregation.height;if(_this.settings.sedimentation.aggregation.invertStrata){align=2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i])}return"translate("+(i*w)+", "+(_this.settings.chart.height-align)+")"}).attr("class",function(d,i){return"gcol col_"+i});var gpath=g.selectAll(".gpath").data(function(d,i){var sd=d3.layout.stack().offset("expand")(_this.strata.strata_layers(_this,d.length,sm,i));smy=d3.max(sd,function(d){return d3.max(d,function(d){return d.y0+d.y})});sd.map(function(d){d.map(function(d){d.col=i;return d})});return sd}).enter().append("g").attr("class","gpath");var area=d3.svg.area().x(function(d){return _this.settings.chart.spacer+d.x*(w-2*_this.settings.chart.spacer)/smx}).y0(function(d){return(h-d.y0*d.offshit)}).y1(function(d){return(h-(d.y+d.y0)*d.offshit)});var pathlayer=gpath.append("path").attr("d",function(d,i){_this.chartUpdate(i,-y(sum_strata[i])-(h-_this.settings.chart.height));hh=0;d.map(function(dd){dd.offshit=hh;return dd});return area(d)});pathlayer.style("fill",function(d,i){if(_this.strata.stratas[d[0].col][i].texture!=null){return"url(#RectanglePattern_"+d[0].col+"_"+i+")"}else{return d3.rgb(color(d[0].col)).darker(_this.strata.stratas[d[0].col].length/2-(i+1)/2)}}).attr("class",function(d,i){return"gcol col_"+d[0].col+" layer_"+i});var patternWidth=w/1;var patternHeight=patternWidth;if(typeof _this.settings.data.strata!="undefined"){for(var s=0;s<_this.settings.data.strata.length;s++){for(var l=0;l<_this.settings.data.strata[s].length;l++){if(_this.settings.data.strata[s][l].texture!=null){var pattern=vis.append("pattern").attr("id","RectanglePattern_"+s+"_"+l).attr("height",patternHeight).attr("width",patternWidth).attr("patternTransform","translate(0, 0) scale("+_this.settings.data.strata[s][l].texture.size+", "+_this.settings.data.strata[s][l].texture.size+") rotate(0)").attr("patternUnits","userSpaceOnUse");pattern.append("image").attr("x",0).attr("y",0).attr("height",patternHeight).attr("width",patternWidth).attr("xlink:href",function(){return _this.settings.data.strata[s][l].texture.url})}}}}}else{if(_this.settings.chart.type=="CircleLayout"){var svg=d3.select("#"+_this.settings.DOMelement.id).append("div").attr("class","vis").attr("width",_this.settings.width).attr("height",_this.settings.height).append("svg").attr("width",_this.settings.width).attr("height",_this.settings.height);if(typeof(_this.settings.chart.treeLayout)!="undefined"){for(var i=0;i<_this.settings.data.model.length;i++){var data=_this.settings.data.strata[i];var color=function(s){return _this.token.colorRange(i)};_this.strata.create_pie_chart(_this,data,svg,data[0].value,color,((i+1/2))*_this.settings.chart.width/(_this.settings.data.model.length)+_this.settings.chart.x,_this.settings.chart.y+_this.settings.chart.height/6)}}else{var data=_this.settings.data.strata.map(function(d){return{value:d[0].value}});var color=_this.token.colorRange;_this.strata.create_pie_chart(_this,data,svg,_this.settings.chart.radius,color,_this.settings.chart.x+_this.settings.chart.width/2,_this.settings.chart.y+_this.settings.chart.height/2)}}}},create_pie_chart:function(_this,data,svg,r,color,posx,posy){var w=_this.settings.width/_this.settings.data.model.length,h=_this.settings.sedimentation.aggregation.height;var x=d3.scale.linear().domain([0,_this.settings.data.strata.length-1]).range([0,_this.settings.width]);var y=d3.scale.linear().domain([0,d3.max(data,function(d){return d.value})]).rangeRound([0,h]);var wp=_this.settings.width,hp=_this.settings.height,hhp=_this.settings.sedimentation.aggregation.height;labelr=r+30,donut=d3.layout.pie().sort(null),arc=d3.svg.arc().innerRadius(0).outerRadius(r);var id=Math.random();svg.append("g.arcs_"+id).attr("class","arcs_"+id);var garcs=svg.selectAll(".arcs").data(donut(data.map(function(d,i){return d.value}))).enter().append("svg:g").attr("transform","translate("+posx+","+posy+")");var hh=0;var area=d3.svg.area().x(function(d){return _this.settings.chart.spacer+d.x*(w-2*_this.settings.chart.spacer)/smx}).y0(function(d){return(h-d.y0*hh)}).y1(function(d){return(h-(d.y+d.y0)*hh)});var arcs=garcs.append("path").attr("fill",function(d,i){return color(i)}).attr("d",function(d,i){return arc(d)}).each(function(d){this._current=d})},update:function(_this){if(typeof(_this.strata.stratas)=="undefined"||_this.strata.stratas.length==0){return}if(typeof settings.data.strata=="function"){_this.strata.stratas=settings.data.strata()}var sn=_this.strata.stratas[0].length,sm=20;smx=sm-1,smy=0;var w=_this.settings.chart.width/_this.settings.data.model.length,h=_this.settings.sedimentation.aggregation.height;var color=_this.token.colorRange;var area=d3.svg.area().x(function(d){return _this.settings.chart.spacer+d.x*(w-2*_this.settings.chart.spacer)/smx}).y0(function(d){return(h-d.y0*d.offshit)}).y1(function(d){return(h-(d.y+d.y0)*d.offshit)});var sum_strata=_this.strata.stratas.map(function(d,i){for(var v=0,res=0;v<d.length;v++){res+=d[v].value(_this,i)}return res});var y=d3.scale.linear().domain([0,Math.max(d3.max(sum_strata),_this.settings.sedimentation.aggregation.maxData)]).range([0,_this.settings.sedimentation.aggregation.height]);var vis=d3.select("#"+_this.settings.DOMelement.id);var g=vis.selectAll("g.gcol");if(_this.settings.sedimentation.aggregation.invertStrata){g.transition().duration(100).attr("transform",function(d,i){var align=_this.settings.sedimentation.aggregation.height;align=2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i]);return"translate("+(i*w)+", "+(_this.settings.chart.height-(2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i])))+")"})}var gpath=g.selectAll("path").data(function(d,i){var sd=d3.layout.stack().offset("expand")(_this.strata.strata_layers(_this,d.length,sm,i));smy=d3.max(sd,function(d){return d3.max(d,function(d){return d.y0+d.y})});sd.map(function(d){d.map(function(d){d.col=i;return d})});return sd});if(_this.settings.chart.type=="StackedAreaChart"){var pathlayer=vis.selectAll("path").transition().duration(100).attr("d",function(d,i){if(!_this.settings.sedimentation.aggregation.invertStrata){_this.chartUpdate(i,-y(sum_strata[i])-(h-_this.settings.chart.height));hh=_this.settings.chart.height-_this.chart.getPosition(_this)[d[0].col].y}else{_this.chartUpdate(i,-2*h+_this.settings.chart.height);hh=y(sum_strata[d[0].col])}d.map(function(dd){dd.offshit=hh;return dd});return area(d)})}}}})(jQuery);(function(A){A.fn._vs.chart.StackedAreaChart=function(F,E,D){var C;this.init=function(G){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;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;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);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);
\ No newline at end of file
--- a/integ/js/vs/_VisualSedimentation.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-// ....................................................................
-// Load Lib
-// ....................................................................
-
-var scripts = document.getElementsByTagName('script'),
- currentScriptSrc = scripts[scripts.length-1].src,
- _vsDirectory = currentScriptSrc.replace('_VisualSedimentation.js', '');
-
-// external Librairy
-includeJS(_vsDirectory+'lib/d3/d3.v2.js');
-includeJS(_vsDirectory+'lib/jQuery/jquery-1.4.2.min.js');
-includeJS(_vsDirectory+'lib/Box2DWeb/Box2DWeb-2.1.a.3.min.js');
-
-// Core, n_vsDirectory+'d
-includeJS(_vsDirectory+'_vs.js');
-includeJS(_vsDirectory+'_vs.phy.js');
-includeJS(_vsDirectory+'_vs.chart.js');
-includeJS(_vsDirectory+'_vs.draw.js');
-includeJS(_vsDirectory+'_vs.token2.js');
-includeJS(_vsDirectory+'_vs.stream.js');
-includeJS(_vsDirectory+'_vs.decay.js');
-includeJS(_vsDirectory+'_vs.strata.js');
-
-
-includeJS(_vsDirectory+'_vs.flocculate.js');
-includeJS(_vsDirectory+'_vs.aggregate.js');
-
-// js by C_vsDirectory+' type
-includeJS(_vsDirectory+'_vs.chart.stackedareachart.js');
-includeJS(_vsDirectory+'_vs.chart.circlelayout.js');
-
-//console.log("stratas",$.fn._vs.strata)
-
-
-if(typeof(_vsCustomlayout)!="undefined"){
- includeJS(_vsCustomlayout);
- console.log("custom layout")
-}
-
-function includeJS(fJS){
- document.write('<script type="text/javascript" src="'+ fJS + '"></script>');
-}
-
-function includeCSS(fCSS) {
- document.write(' <link type="text/css" href="'+ fCSS + '" rel="stylesheet"/>');
-}
-
-function GUID()
-{
- var S4 = function ()
- {
- return Math.floor(
- Math.random() * 0x10000 /* 65536 */
- ).toString(16);
- };
-
- return (
- S4() + S4() + "-" +
- S4() + "-" +
- S4() + "-" +
- S4() + "-" +
- S4() + S4() + S4()
- );
-}
-
-// ....................................................................
-// If we want to replace Jquery ...
-// ....................................................................
-//var visualSedimentation, _vs;
-//(function() {
-//
-// visualSedimentation = _vs = function(selector) {
-// return new VisualSedimentation(selector);
-// };
-//
-// var VisualSedimentation = function(selector) {
-// // Lets make a really simplistic selector implementation for demo purposes
-// this.node = document.getElementById(selector);
-// /*
-// for (var i = 0; i < nodes.length; i++) {
-// this[i] = nodes[i];
-// }
-// this.length = nodes.length;
-// */
-// return this;
-// };
-//
-// // Expose the prototype object via visualSedimentation.fn so methods can be added later
-// visualSedimentation.fn = VisualSedimentation.prototype = {
-// // API Methods
-// hide: function() {
-// this.node.style.display = 'none';
-// return this;
-// },
-// show: function() {
-// this.node.style.display = 'block';
-// return this;
-// },
-// remove: function() {
-// for (var i = 0; i < this.length; i++) {
-// this[i].parentNode.removeChild(this[i]);
-// }
-// return this;
-// }
-// // More methods here, each using 'return this', to enable chaining
-// };
-//
-//}());
--- a/integ/js/vs/_vs.aggregate.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,470 +0,0 @@
-(function ($) {
-
- $.fn._vs.aggregate = {
- defaultSettings:{
- },
-
- // Returns n layers
- strata_layers: function (_this, n, m, p) {
- var sn = d3.scale.linear().domain([1, m-2]).range([Math.PI/2, 2*Math.PI-Math.PI/2]);
- var logscale = d3.scale.pow().exponent(10).domain([0, m]).range([0,1]);
-
- return d3.range(n).map(function(i) {
- var r = 5*Math.random();
-
- return d3.range(m).map(function(j) {
-
- if(_this.settings.sedimentation.aggregation.strataType=="sin") {
- if(i==1) return 20;
- var x = 5+r*5*Math.sin(sn(j))+(i*50);
- if(x<0) return -x; else return x;
- } else if(_this.settings.sedimentation.aggregation.strataType=="log") {
- return i+1;
- //return logscale(j);//logscale(i);
- } else {
- if(typeof(p)=='undefined')
- p=0;
- return _this.settings.data.strata[p][i].value;
- }
- }).map(stream_index);
- });
-
- function stream_index(d, i) {
- return {x: i, y: Math.max(0, d)};
- }
-
- },
-
- init:function (_this){
-
- // Skip layers if no strata is defined
- if(typeof(_this.settings.data.strata)=='undefined' || _this.settings.data.strata.length==0 || _this.settings.data.strata[0].length==0)
- return;
-
- var color = _this.token.colorRange;
-
-
- if(_this.settings.chart.type=='StackedAreaChart') {
-
- var w = _this.settings.chart.width/_this.settings.data.model.length,
- h = _this.settings.sedimentation.aggregation.height;
-
- var vis = d3.select("#"+_this.settings.DOMelement.id)
- //.insert("div", ":first-child")
- .append("div")
- .attr("class", "vis")
- // .style("position", "relative")
- .style("z-index", 10)
- .append("svg")
- .attr("width", _this.settings.width)
- .attr("height", _this.settings.height)
-
- .append("g")
- .attr("transform", "translate(" + _this.settings.chart.x + "," + _this.settings.chart.y + ")");
-
- var g = vis.selectAll("g.gcol")
- .data(_this.settings.data.strata, function(d) {return [d];})
- .enter()
- .append("g")
- .attr("transform", function(d, i) {
- return "translate("+(i*w)+", "+(_this.settings.chart.height-_this.settings.sedimentation.aggregation.height)+")";
- }).attr("class", function(d,i) { return "gcol col_"+i;});;
-
- var data =_this.settings.data.strata.map(function(d) { return {value:d[0].value};});
-
- var sn = _this.settings.data.strata[0].length, // number of layers
- sm = 20; // number of samples per layer
- smx = sm - 1, smy = 0;
-
- var hh=0;
-
- // Rectangular strata
- var area = d3.svg.area()
- .x(function(d) { return _this.settings.chart.spacer+d.x * (w-2*_this.settings.chart.spacer) / smx; })
- .y0(function(d) { return (h - d.y0 * hh); }) //hh/smy
- .y1(function(d) { return (h - (d.y + d.y0) * hh ); }); //hh/smy
-
- var hhh = [];
-
- var gpath = g.selectAll("gpath")
- .data(function(d,i) {
- var sd = d3.layout.stack().offset("expand")(_this.aggregate.strata_layers(_this, d.length, sm, i));
- smy = d3.max(sd, function(d) {
- return d3.max(d, function(d) {
- return d.y0 + d.y;
- });
- });
- sd.map(function(d) {d.map(function(d) {d.col=i;return d;});}); // Put col # in data
- return sd;
- })
- .enter().append("g").attr("class", "gpath");
-
- gpath.append("path")
- .attr("d", function(d,i) {
- hh = _this.settings.chart.height-_this.chart.getPosition(_this)[d[0].col].y;
- return area(d);
- }).style("fill", function(d,i) {
- if(_this.settings.data.strata[d[0].col][i].texture!=null) {
- return "url(#RectanglePattern_"+d[0].col+"_"+i+")";
- } else {
-
- return d3.rgb(color(d[0].col))
- .darker(_this.settings.data.strata[d[0].col].length/2-(i+1)/2); // The more away from the token, the darker
- }
- })
- .attr("class", function(d,i) { return "layer";})
- .attr("class", function(d,i) { return "col_"+d[0].col+" layer_"+i;});
-
- // Textures
- // strata.texture: {url:"../..", size:1},
- var patternWidth = w/1;
- var patternHeight = patternWidth;
-
- for(var s=0; s<_this.settings.data.strata.length; s++) {
- for(var l=0; l<_this.settings.data.strata[s].length; l++) {
- if(_this.settings.data.strata[s][l].texture!=null) {
-
- var pattern = vis.append('pattern')
- .attr('id','RectanglePattern_'+s+"_"+l)
- .attr('height', patternHeight)
- .attr('width', patternWidth)
- .attr('patternTransform', 'translate(0, 0) scale('+_this.settings.data.strata[s][l].texture.size+', '+_this.settings.data.strata[s][l].texture.size+') rotate(0)')
- .attr('patternUnits','userSpaceOnUse');
-
- pattern.append('image')
- .attr('x', 0)
- .attr('y', 0)
- .attr('height', patternHeight)
- .attr('width', patternWidth)
- .attr('xlink:href', function() { return _this.settings.data.strata[s][l].texture.url;});
- }
- }
- }
-
- // PIE CHAR
- } else if(_this.settings.chart.type=='CircleLayout') {
-
- // strata
- var svg = d3.select("#"+_this.settings.DOMelement.id)
- .append("div")
- .attr("class", "vis")//.style("margin-top", "-"+_this.settings.height+"px")
- .attr("width", _this.settings.width)
- .attr("height", _this.settings.height)
- .append("svg")
- .attr("width", _this.settings.width)
- .attr("height", _this.settings.height);
-
- // bubble chart
- if(typeof(_this.settings.chart.treeLayout)!="undefined") {
-
- for(var i=0; i<_this.settings.data.model.length; i++) {
- var data =_this.settings.data.strata[i];
- var color = function(s) { return _this.token.colorRange(i)};
- _this.aggregate.create_pie_chart(_this, data, svg, data[0].value, color,
- ((i+1/2))*_this.settings.chart.width/(_this.settings.data.model.length)+_this.settings.chart.x,
- _this.settings.chart.y+_this.settings.chart.height/6);
-
- }
-
- } else {
- var data =_this.settings.data.strata.map(function(d) { return {value:d[0].value};});
- console.log(_this.settings.data.strata, data);
- var color = _this.token.colorRange;
- _this.aggregate.create_pie_chart(_this, data, svg, _this.settings.chart.radius, color,
- _this.settings.chart.x+_this.settings.chart.width/2,
- _this.settings.chart.y+_this.settings.chart.height/2);
- }
-
- }
- },
-
- create_pie_chart: function(_this, data, svg, r, color, posx, posy) {
-
- var w = _this.settings.width/_this.settings.data.model.length,
- h = _this.settings.sedimentation.aggregation.height;//_this.settings.height;
-/*
- var vis = d3.select("#"+_this.settings.DOMelement.id)
- .append("div")
- .attr("class", "vis") //.style("margin-top", "-"+_this.settings.height+"px")//+_this.settings.DOMelement.id
- .append("svg")
- .attr("width", _this.settings.width)
- .attr("height", _this.settings.height);
-
- var g = vis.selectAll("g")
- .data(_this.settings.data.strata, function(d) {return [d];})
- .enter()
- .append("g")
- .attr("transform", function(d, i) {
- return "translate("+(i*w)+", "+(_this.settings.height-_this.settings.sedimentation.aggregation.height)+")";
- });
- */
- var x = d3.scale.linear()
- .domain([0, _this.settings.data.strata.length-1])
- .range([0, _this.settings.width]);
-
-
- var y = d3.scale.linear()
- .domain([0, d3.max(data, function(d) {return d.value; })])
- .rangeRound([0, h]);
-
- /*
- var sn = _this.settings.data.strata[0].length, // number of layers
- sm = 20; // number of samples per layer
-
- var sdata0 = d3.layout.stack().offset("expand")(strata_layers(sn, sm)),
- sdata1 = d3.layout.stack().offset("expand")(strata_layers(sn, sm)),
- smx = sm - 1, smy = 0;
- */
-
- // CIRCLE
- var wp = _this.settings.width,
- hp = _this.settings.height,
- hhp = _this.settings.sedimentation.aggregation.height;
- //Math.min(w, hh) / 2,
- labelr = r + 30, // radius for label anchor
- donut = d3.layout.pie().sort(null),
- arc = d3.svg.arc().innerRadius(0).outerRadius(r);
-
- var id=Math.random();
- svg.append("g.arcs_"+id)
- .attr("class", "arcs_"+id);
-
- var garcs = svg.selectAll(".arcs")
- .data(donut(data.map(function(d, i) { return d.value})))
- .enter().append("svg:g").attr("transform", "translate(" + posx + "," + posy + ")");
- /*
- var arcs = garcs.append("path")
- .attr("fill", function(d, i) { return color(i); })
- .attr("d", function(d) {
-
-
- return arc(d);
-
- })
- .each(function(d) { this._current = d; });
-
- */
- // END CIRCLE
-
-
- var hh=0;
-
- // Rectangular strata
- var area = d3.svg.area()
- .x(function(d) { return _this.settings.chart.spacer+d.x * (w-2*_this.settings.chart.spacer) / smx; })
- .y0(function(d) { return (h - d.y0 * hh); }) //hh/smy
- .y1(function(d) { return (h - (d.y + d.y0) * hh ); }); //hh/smy
-
- var arcs = garcs.append("path")
- .attr("fill", function(d, i) { return color(i); })
- .attr("d", function(d,i) {
-
- /*
-.data(function(d,i) {
- var sd = d3.layout.stack().offset("expand")(strata_layers(d.length, sm));
- smy = d3.max(sd, function(d) {
- return d3.max(d, function(d) {
- return d.y0 + d.y;
- });
- });
- sd.map(function(d) {d.map(function(d) {d.col=i;return d;});}); // Put col # in data
- return sd;
- })
- */
- return arc(d);
-
- })
- .each(function(d) { this._current = d; });
-
- /*
- var hhh = [];
-
- g.selectAll("path")
- .data(function(d,i) {
- var sd = d3.layout.stack().offset("expand")(strata_layers(d.length, sm));
- smy = d3.max(sd, function(d) {
- return d3.max(d, function(d) {
- return d.y0 + d.y;
- });
- });
- sd.map(function(d) {d.map(function(d) {d.col=i;return d;});}); // Put col # in data
- return sd;
- })
- .enter().append("path")
- .attr("d", function(d,i) {
- hh = 450-_this.chart.getPosition(_this)[d[0].col].y;
- return area(d);
- }).style("fill", function(d,i) {
- if(_this.settings.data.strata[d[0].col][i].texture!=null) {
- return "url(#RectanglePattern_"+d[0].col+"_"+i+")";
- } else {
- // The more away from the token, the darker
- return d3.rgb(color(d[0].col)).darker(_this.settings.data.strata[d[0].col].length/2-(i+1)/2);
- }
- });
-
-*/
-
-
- /* else if(_this.settings.chart.type=='CircleLayout2') {
-
- var data1 = _this.settings.data.strata,
- data = data1,
- data2 = _this.settings.data.strata; // 2nd dataset if we want to update
-
- console.log("data", data);
-
- var w = _this.settings.width,
- h = _this.settings.height,
- hh = _this.settings.sedimentation.aggregation.height;
- r = _this.settings.chart.radius,//Math.min(w, hh) / 2,
- labelr = r + 30, // radius for label anchor
- donut = d3.layout.pie().sort(null),
- arc = d3.svg.arc().innerRadius(0).outerRadius(r);
-
- console.log("donut", donut(data));
-
- // strata
-
- var svg = d3.select("#"+_this.settings.DOMelement.id).attr("class", "vis")//.style("margin-top", "-"+_this.settings.height+"px")
- .append("svg:svg")
- .attr("width", w)
- .attr("height", h)
- //.style("position", "absolute")
- .append("svg:g")
- .attr("class", "arcs")
- .attr("transform", "translate(" + (w/2) + "," + (h/2) + ")");
-
- var ddd = donut(_this.settings.data.strata.map(function(d, i) { return d[0].value}));
-
-
- var garcs = svg.selectAll("g")
- .data(donut(data.map(function(d, i) { return d[0].value})))
- .enter().append("svg:g");
-
- var arcs = garcs.append("path")
- .attr("fill", function(d, i) { return color(i); })
- .attr("d", function(d) { return arc(d);})
- .each(function(d) { this._current = d; });
-
-
- var labels = garcs.append("svg:text")
- .attr("transform", function(d) {
- var c = arc.centroid(d),
- x = c[0],
- y = c[1],
- h = Math.sqrt(x*x + y*y); // pythagorean theorem for hypotenuse
- return "translate(" + (x/h * labelr) + ',' +
- (y/h * labelr) + ")";
- })
- .attr("dy", ".35em")
- .attr("text-anchor", function(d) {
- return (d.endAngle + d.startAngle)/2 > Math.PI ? // are we past the center?
- "end" : "start";
- })
- .text(function(d, i) { return _this.settings.data.model[i].label; }); //.toFixed(2) if num val
-
- d3.select(window).on("click", function() {
- data = data === data1 ? data2 : data1; // swap the data
- arcs = arcs.data(donut(data.map(function(d) { return d[0].value}))); // recompute the angles and rebind the data
- arcs.transition().duration(750).attrTween("d", arcTween); // redraw the arcs
-
- labels.data(donut(data.map(function(d,i) { return d[0].value})))
- .transition().duration(750).attr("transform", function(d) {
- var c = arc.centroid(d),
- x = c[0],
- y = c[1],
- // pythagorean theorem for hypotenuse
- h = Math.sqrt(x*x + y*y);
-
- return "translate(" + (x/h * labelr) + ',' +
- (y/h * labelr) + ")";
- })
- .attr("dy", ".35em")
- .attr("text-anchor", function(d) {
- // are we past the center?
- return (d.endAngle + d.startAngle)/2 > Math.PI ?
- "end" : "start";
- })
- .text(function(d, i) { return _this.settings.data.model[i].label}); //d.value.toFixed(2); });
- });
-
- // Store the currently-displayed angles in this._current.
- // Then, interpolate from this._current to the new angles.
- function arcTween(a) {
- var i = d3.interpolate(this._current, a);
- this._current = i(0);
- return function(t) {
- return arc(i(t));
- };
- }
- } // end if char/pie layout
- */
-
- },
-
- update : function (_this) {
-
- if(typeof(_this.settings.data.strata)=='undefined' || _this.settings.data.strata.length==0 || _this.settings.data.strata[0].length==0) // Skip layers if no strata is defined
- return;
-
- var w = _this.settings.chart.width/_this.settings.data.model.length;
- var h = _this.settings.sedimentation.aggregation.height;
-
- var x = d3.scale.linear()
- .domain([0, _this.settings.data.strata.length-1])
- .range([0, _this.settings.width]);
-
- var data =_this.settings.data.strata.map(function(d) { return {value:d[0].value};});
-
- var sum_strata =_this.settings.data.strata.map(
- function(d) {
- for(var v=0, res=0; v<d.length; v++)
- res+=d[v].value;
- return res;
- });
-
- var y = d3.scale.linear()
- .domain([0, d3.max(sum_strata)])
- .range([0, _this.settings.sedimentation.aggregation.height]);
-
- var sn = _this.settings.data.strata[0].length, // number of layers
- sm = 20; // number of samples per layer
- smx = sm - 1, smy = 0;
-
- var hh=0;
-
- // Rectangular strata
- var area = d3.svg.area()
- .x(function(d) { return _this.settings.chart.spacer+d.x * (w-2*_this.settings.chart.spacer) / smx; })
- .y0(function(d) { return (h - d.y0 * hh); }) //hh/smy
- .y1(function(d) { return (h - (d.y + d.y0) * hh ); }); //hh/smy
-
- var vis = d3.select("svg");
- var g = vis.selectAll(".gcol");
-
- g.data(_this.settings.data.strata, function(d,i) { return [d];});
-
- var gpath = g.selectAll(".gpath")
- .data(function(d,i) {
- var sd = d3.layout.stack().offset("expand")(_this.aggregate.strata_layers(_this, d.length, sm, i));
- smy = d3.max(sd, function(d) {
- return d3.max(d, function(d) {
- return d.y0 + d.y;
- });
- });
- sd.map(function(d) {d.map(function(d) {d.col=i;return d;});}); // Put col # in data
- return sd;
- });
-
- gpath.select("path")
- .transition()
- .duration(100)
- .attr("d", function(d,i) {
- _this.chartUpdate(i, -y(sum_strata[i])-(h-_this.settings.chart.height));
- hh = _this.settings.chart.height-_this.chart.getPosition(_this)[d[0].col].y;
- return area(d);
- });
- }
- }
-})(jQuery);
--- a/integ/js/vs/_vs.barchart.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-(function ($) {
-
- $.extend($.fn.visualSedimentation.vs,test = function(){
- console.log("ici visualSedimentation.fn.test")
- });
-
-})(jQuery);
--- a/integ/js/vs/_vs.chart.circlelayout.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,331 +0,0 @@
-(function ($) {
-
-$.fn._vs.chart.CircleLayout = function(_this,fn,options) {
-
- var mouseJointTest;
- var csX;
- var csY;
- var treeLayout;
- var initValue = []; // Initiation des valeurs
- var tdv = 0; // Incoming point
- var _this;
-
- this.init = function (_this,options){
- console.log('Circle Layout Init')
- this._this = _this
- gravity = new _this.phy.b2Vec2(0, 0); // Zero gravity
- _this.world.m_gravity = gravity;
- _this.chartPhySetup = {grounds:[],wall:[]}
- this.treeLayout = _this.settings.chart.treeLayout;
-
- for (var i=0; i<_this.settings.data.model.length; i++) {
- _this.settings.data.strata[i][0].value = _this.settings.data.strata[i][0].initValue;
- }
-
- // process data distribution to form layout
- for (var i = 0; i <_this.settings.data.model.length; i++) {
- //console.log("-->",_this.settings.data.model[i])
- _this.settings.data.model[i].value=0
- for (var j = 0; j <_this.settings.data.strata[i].length; j++) {
- //console.log("-->",_this.settings.data.strata[i][j].value)
- _this.settings.data.model[i].value += _this.settings.data.strata[i][j].value
- }
- //console.log("-->",_this.settings.data.model[i].value)
- initValue.push(_this.settings.data.model[i].value)
- tdv += _this.settings.data.model[i].value
- }
-
- if(this.treeLayout){
- console.log("ici")
- this.setupBubbleChartPhysics(_this);
- }else{
- this.setupPieChartPhysics(_this);
- }
-
- };
-
- this.setupPieChartPhysics = function(_this){
-
- console.log("w",_this.settings.width)
- // Pivot drawing
- var radius = _this.settings.chart.radius
- csX = _this.settings.chart.width/2+_this.settings.chart.x
- csY = _this.settings.chart.height/2+_this.settings.chart.y
- var axis = pivot(csX,csY,radius, _this.settings.chart.wallColor);
-
- //targets
- for (var i = 0; i< _this.settings.data.model.length; i++) {
- _this.settings.sedimentation.incoming.target[i] = {x:csX,y:csY};
- }
-
- // Separation
- var wall = []
- var spacer = _this.settings.chart.spacer;
-
- // Incoming point
- var p = 0;
-
- console.log("tdv",tdv)
-
- if (tdv==0){
- for (var i = 0; i <_this.settings.data.length; i++) {
- initValue[i] = 1;
- }
- tdv = initValue.length
- }
-
- for (var i = 0; i <initValue.length; i++) {
- v = initValue[i]
- a2 = ((v/2+p)/tdv)*360-90
- p += v
- a = (p/tdv)*360-90
- c = circularCoordinate(a2,radius*5,csX,csY)
-
- // incomming point setup
- console.log(c)
- _this.settings.sedimentation.incoming.point[i] = c
-
- // Bounds Wall drawing
- _this.chartPhySetup.grounds[i]= this.createBox(
- _this,
- csX,
- csY,
- spacer,
- radius,
- a,
- radius,
- 'wall',
- _this.settings.chart.wallColor);
- }
- console.log("w",_this.settings.chart.width)
-
- };
-
- this.update = function(_this,options){
- console.log("update")
- var defaultOptions = {cat:0,r:0}
- options.r-=90
- var angle = (options.r+90)*(Math.PI/180)
-
- var c = circularCoordinate(options.r,
- _this.settings.chart.radius,
- _this.settings.chart.width/2+_this.settings.chart.x,
- _this.settings.chart.height/2+_this.settings.chart.y)
-
- if(_this.chartPhySetup.grounds[options.cat]!=null) {
- var myBody = _this.chartPhySetup.grounds[options.cat].GetBody();
- var myPos = myBody.GetWorldCenter();
- var myAngle= myBody.GetAngle()
- //console.log(myAngle)
- myPos.y = c.y/ _this.settings.options.scale
- myPos.x = c.x/ _this.settings.options.scale
- myAngle = angle
- myBody.SetPosition(myPos);
- myBody.SetAngle(myAngle);
- //console.log(myBody)
- }
- }
-
- // default token for stream
- this.token = function (_this,options){
- var i = options;
- //console.log(options)
- var token = {
- x:(_this.settings.sedimentation.incoming.point[i].x+(Math.random()*2)),
- y:(_this.settings.sedimentation.incoming.point[i].y+(Math.random()*1)),
- t:_this.now(),
- size:_this.settings.sedimentation.token.size.original,
- category:i,
- phy:{
- density:10,
- friction:0,
- restitution:0
- },
- targets:[{
- // bizare x/2 or x ...
- x: _this.settings.sedimentation.incoming.target[i].x,
- y: _this.settings.sedimentation.incoming.target[i].y
- }]
- }
- return token;
- }
-
- function circularCoordinate(degree,radius,posX,posY){
- j = degree*Math.PI/180
- var x = (Math.cos(j) * radius)+posX;
- var y = (Math.sin(j) * radius)+posY;
- var c = {x:x,y:y}
- return c
- }
-
- function pivot (centerSceneX,centerSceneY,radius,color){
- var scale = _this.settings.options.scale
- var fixDef = new _this.phy.b2FixtureDef;
-
- fixDef.density = 1.0;
- fixDef.friction = 0.5;
- fixDef.restitution = 0.2;
- var bodyDef = new _this.phy.b2BodyDef;
- fixDef.shape = new _this.phy.b2CircleShape(radius/scale);
- bodyDef.position.Set(centerSceneX/scale, centerSceneY/scale);
-
- var axis = _this.world.CreateBody(bodyDef).CreateFixture(fixDef);
- axis.m_userData = {type:"wall",familyID:null,fillStyle:color,strokeStyle:color,r:radius}
- return axis;
- }
-
- this.createBox = function (_this,x,y,w,h,a,r,type,color){
- var scale = _this.settings.options.scale
- var fixDef = new _this.phy.b2FixtureDef;
- var c = circularCoordinate(a,r,x,y)
-
- fixDef.density = 1.0;
- fixDef.friction = 0.5;
- fixDef.restitution = 0.2;
-
- var bodyDef = new _this.phy.b2BodyDef;
- var angle = (a+90)*(Math.PI/180)
- bodyDef.angle = angle;//a+80 ;
- //create ground
- bodyDef.type = _this.phy.b2Body.b2_staticBody;
- fixDef.shape = new _this.phy.b2PolygonShape;
- fixDef.shape.SetAsBox(w/scale, h/scale);
- bodyDef.position.Set(c.x/scale,c.y/scale );
- var box = _this.world.CreateBody(bodyDef).CreateFixture(fixDef);
- box.m_userData = {type:type,fillStyle:color,w:w,h:h,r:r}
- //console.log(box)
- return box
- }
-
- this.getPosition = function(_this){
- var result =[]
- for (var i = 0; i < _this.chartPhySetup.grounds.length; i++) {
- myElement = _this.chartPhySetup.grounds[i]
- myBody = myElement.GetBody();
- //console.log(myBody.GetAngle())
- result.push({
- x:(myBody.GetWorldCenter().x* _this.settings.options.scale),
- y:(myBody.GetWorldCenter().y* _this.settings.options.scale),
- a:myBody.GetAngle(),
- w:myElement.m_userData.w,
- h:myElement.m_userData.h,
- r:myElement.m_userData.r,
- })
- };
- return result
- }
-
-
-// --------- --------- --------- --------- --------- --------- ---------
-// Bubble ---------
- this.setupBubbleChartPhysics= function(_this){
- console.log("setupBubbleChartPhysics")
-
- var colSize = ( _this.settings.chart.width/ _this.settings.data.model.length)
- var colBwid = _this.settings.chart.spacer
- var colYpos = _this.settings.chart.height/2+_this.settings.y+colBwid
- var Ypos = 0;//chart.position.y;
- var Xpos = 0;//chart.position.x;
- var NumCol = _this.settings.chart.column;
- // console.log(Xpos)
- // console.log( _this.settings.width)
-
- // array layout
- for( var i = 0 ; i<_this.settings.data.model.length; i++) {
-
- Xpos = _this.settings.chart.x+(i%NumCol*colBwid)+(colBwid/2)
- Ypos = _this.settings.chart.y+Math.floor(i/NumCol)*colBwid+(colBwid/2)
- //console.log("- "+i+" x:"+Xpos+" y:"+Ypos);
- _this.settings.sedimentation.incoming.target[i] = {x:Xpos,y:Ypos};
-
- pivot[i] = creatMyBubblePivot(Xpos,
- Ypos,
- _this.settings.chart.spacer,
- i);
-
- _this.settings.data.model[i].incomingPoint = {
- x:Xpos,
- y:Ypos
- };
-
- }
-
- }
-function creatMyBubblePivot(Xpos,Ypos,radius,id){
- console.log("CreatMyBubblePivot",Xpos,Ypos,radius,id)
-
- var scale = _this.settings.options.scale
- var fixDef = new _this.phy.b2FixtureDef;
- var colorRange = d3.scale.category10()
-
- fixDef.density = 10000;
- fixDef.friction = 0.0;
- fixDef.restitution= 0.0;
-
- var bodyDef = new _this.phy.b2BodyDef;
- fixDef.shape = new _this.phy.b2CircleShape(radius*scale);
- bodyDef.position.Set(Xpos/scale, Ypos/scale);
-
- var axis = _this.world.CreateBody( bodyDef);
- var axisf = axis.CreateFixture(fixDef);
-
- console.log(id,colorRange(id))
- axisf.m_userData = {
- type:"BubblePivot",
- familyID:id,
- fillStyle:_this.settings.chart.wallColor
- }
- console.log(id,axisf)
-
- axisf.m_shape.m_radius = _this.settings.data.model[id].value/scale;
- //console.log(Xpos,Ypos)
- return axisf;
-}
-
-this.getPivotPosition =function (id){
-
- //console.log(_this.settings.data.model)
-
- if(typeof(id)!="undefined"){
- return this.pivot
- } else{
- var result=[];
- for( var i = 0 ; i<_this.settings.data.model.length; i++) {
- result.push(_this.settings.data.model[i])
- }
- return result
- }
-}
-
-function updatePivotFixPosition(x,y,id){
- var myBody = pivot[id].GetBody();
- myBody.SetPosition(new b2Vec2(x/scale, y/scale));
- _this.settings.data.model[id].incomingPoint.x=x;
- _this.settings.data.model[id].incomingPoint.y=y;
- setFlowSpeed(speedFlow);
-
-}
-function setPivotPosition(x,y,id){
- for( var i = 0 ; i<categorys[id].joins.length; i++) {
- categorys[id].joins[i].SetTarget(new b2Vec2(x/scale, y/scale));
- }
-}
-function setPivotRadius(r,id){
- //nBodies[b].m_shape.m_radius
- pivot[id].m_shape.m_radius=r;
-}
-
-
-// Bubble ---------
-// --------- --------- --------- --------- --------- --------- ---------
- if (typeof(fn)!=undefined){
- var result = this[fn](_this,options);
- if (typeof(result)!=undefined){
- return result
- }
- }
-
-}
-
-
-})(jQuery);
--- a/integ/js/vs/_vs.chart.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-(function ($) {
-$.fn.vs.chart = {
- /*
- actually empty everything is in
- _vs.AxisLabelLayout.js,
- _vs.AxisLayout.js,
- _vs.CircleLayout.js,
- _vs.CollapsedStackLayout.js,
- _vs.GridLayout.js,
- _vs.StackedAreaChart.js
-
-
- this.update = function(_this,options){
- var defaultOptions = {cat:0,y:0}
- if(_this.chartPhySetup.grounds[options.cat]!=null) {
- var myBody = _this.chartPhySetup.grounds[options.cat].GetBody();
- var myPos = myBody.GetWorldCenter();
- myPos.y-=options.y/ _this.settings.options.scale;
- myBody.SetPosition(myPos);
- //console.log(myBody)
- }
- }
-
- this.getPosition = function(_this){
- var result =[]
- for (var i = 0; i < _this.chartPhySetup.grounds.length; i++) {
- myBody = _this.chartPhySetup.grounds[i].GetBody();
-
- console.log(myBody.GetWorldCenter())
-
- result.push({
- x:(myBody.GetWorldCenter().x* _this.settings.options.scale),
- y:(myBody.GetWorldCenter().y* _this.settings.options.scale),
- a:myBody.GetAngle()
- })
-
- };
- return result
- }
- */
-}
-
-
-})(jQuery);
--- a/integ/js/vs/_vs.chart.stackedareachart.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-(function ($) {
-
-$.fn._vs.chart.StackedAreaChart = function(_this,fn,options) {
- var mouseJointTest;
-
- this.init = function (_this){
- console.log('StackedAreaChart Init')
- gravity = new _this.phy.b2Vec2(0.001, 10);
- _this.world.m_gravity = gravity;
- _this.chartPhySetup = {grounds:[],wall:[]}
- this.setupChartPhysics(_this);
- //dataFlow(categorys);
- };
-
- this.setupChartPhysics = function(_this){
-
- // Ground
- var spacer = _this.settings.chart.spacer;
- console.log(_this.settings.chart)
-
- // Bounds for bar chart
- var colSize = (_this.settings.chart.width/_this.settings.data.model.length)
- var colBwid = spacer;
- var colYpos = _this.settings.chart.height/2+_this.settings.chart.y
-
- // height of lift
- var agreHeight = _this.settings.chart.height - _this.settings.sedimentation.aggregation.height
- console.log(agreHeight)
-
- var tdv = 0;
- for (var i = 0; i <_this.settings.data.model.length; i++) {
- _this.settings.data.model[i].value=0
- if(typeof(_this.settings.data.strata)!="undefined"){
- if(typeof(_this.settings.data.strata[i])!="undefined"){
- for (var j = 0; j <_this.settings.data.strata[i].length; j++) {
- _this.settings.data.model[i].value += _this.settings.data.strata[i][j].value
- }
- }
- }
- tdv += _this.settings.data.model[i].value
- }
-
-
- for( var i = 0 ; i<_this.settings.data.model.length+1 ; i++) {
- var colXpos = _this.settings.chart.x+(i*colSize);
- _this.chartPhySetup.wall[i] = this.createMyChartBox (
- _this,
- colXpos,
- colYpos,
- colBwid,
- _this.settings.chart.height/2,
- "wall",
- _this.settings.chart.wallColor);
-
- console.log(colXpos,colYpos)
-
- // Fix incomming points for tokens
- if(i<_this.settings.data.model.length){
- _this.settings.sedimentation.incoming.point[i]={
- x:colXpos+(colSize/2),
- y:_this.settings.y
- }
- }
-
-
- // Create lift
- if(i<_this.settings.data.model.length){
- _this.chartPhySetup.grounds[i] = this.createMyChartBox (
- _this,
- colXpos+(colSize/2),
- _this.settings.chart.height+_this.settings.chart.y+_this.settings.sedimentation.aggregation.height,
- colSize/2,
- _this.settings.chart.height,
- "lift",
- "rgba(250,250,250,0)");
-
- // Move Lift to data
- // based on scale (data / all data * height )
- /*
- if(_this.settings.data.model[i].value>=0){
- // ?????
- var liftPosition = (_this.settings.data.model[i].value/tdv*(_this.settings.chart.height-_this.settings.sedimentation.aggregation.height))
- }else{
- var liftPosition = 0
- }*/
- this.update(_this,{cat:i,y:_this.settings.chart.height});
- }
- }
- };
-
- this.token = function (_this,options){
- //console.log('token query')
- var i = options;
- var token = {
-
- x:(_this.settings.sedimentation.incoming.point[i].x+(Math.random()*2)),
- y:(_this.settings.sedimentation.incoming.point[i].y+(Math.random()*1)),
- t:_this.now(),
- size:_this.settings.sedimentation.token.size.original,
- category:i,
- lineWidth:0,
-
- }
- return token;
- }
-
- this.createMyChartBox = function (_this,x,y,w,h,type,color){
- var scale = _this.settings.options.scale
- var fixDef = new _this.phy.b2FixtureDef;
- fixDef.density = 1.0;
- fixDef.friction = 0.5;
- fixDef.restitution = 0.2;
-
- var bodyDef = new _this.phy.b2BodyDef;
- //create ground
- bodyDef.type = _this.phy.b2Body.b2_staticBody;
- fixDef.shape = new _this.phy.b2PolygonShape;
- fixDef.shape.SetAsBox(w/scale, h/scale);
- bodyDef.position.Set(x/scale,y/scale );
- var box = _this.world.CreateBody(bodyDef).CreateFixture(fixDef);
- box.m_userData = {type:type,fillStyle:color,w:w,h:h,x:x,y:y}
- //console.log(box)
- return box
- }
-
- this.update = function(_this,options){
- var defaultOptions = {cat:0,y:0}
- if(_this.chartPhySetup.grounds[options.cat]!=null) {
- var myBody = _this.chartPhySetup.grounds[options.cat].GetBody();
- var myPos = myBody.GetWorldCenter();
- myPos.y = (options.y
- + _this.settings.chart.height
- +_this.settings.chart.y
- +_this.settings.sedimentation.aggregation.height)/ _this.settings.options.scale
- myBody.SetPosition(myPos);
- //console.log(myBody)
- }
- }
-
-
- this.getPositionOld = function(_this){
- var result =[]
- for (var i = 0; i < _this.chartPhySetup.grounds.length; i++) {
- myElement = _this.chartPhySetup.grounds[i]
- myBody = myElement.GetBody();
- result.push({
- x:(myBody.GetWorldCenter().x* _this.settings.options.scale),
- y:(myBody.GetWorldCenter().y* _this.settings.options.scale),
- a:myBody.GetAngle(),
- w:myElement.m_userData.w,
- h:myElement.m_userData.h,
- r:myElement.m_userData.r,
- })
- };
- return result
- }
-
-
- this.getPosition = function(_this){
- var result =[]
- for (var i = 0; i < _this.chartPhySetup.grounds.length; i++) {
- myElement = _this.chartPhySetup.grounds[i]
- myBody = myElement.GetBody();
- //console.log("myBody.GetWorldCenter().y",myBody.GetWorldCenter().y)
- result.push({
- x:(myBody.GetWorldCenter().x* _this.settings.options.scale),
- y:(myBody.GetWorldCenter().y* _this.settings.options.scale)
- - _this.settings.chart.height
- - _this.settings.chart.y
- ,
- a:myBody.GetAngle(),
- w:myElement.m_userData.w,
- h:myElement.m_userData.h,
- r:myElement.m_userData.r,
- })
- };
- return result
- }
-
-
-
- if (typeof(fn)!=undefined){
- var result = this[fn](_this,options);
- if (typeof(result)!=undefined){
- return result
- }
- }
-
-}
-
-
-})(jQuery);
--- a/integ/js/vs/_vs.decay.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-(function ($) {
-
-$.fn._vs.decay = {
- tokens:[],
- update:function(_this) {
- var incrementationStrate = 1;
- var top = _this.settings.sedimentation.suspension.height
- var height = _this.settings.height
- var intervalStrate = _this.settings.sedimentation.token.size/4
- var power = _this.settings.sedimentation.suspension.decay.power
- var scale = _this.settings.options.scale
- var limit = _this.settings.sedimentation.token.size.minimum
-
- if(power==null){var power = 0}
-
- for(var b = 0; b < this.tokens.length; b++) {
- var tokenSize = this.tokens[b].attr("size")
- if(power!=0){
- this.tokens[b].attr("size",tokenSize/power)
- }
- // Flocculate
-
- if(tokenSize<=limit){
- if (_this.settings.sedimentation.flocculate.strategy!=null){
- _this.flocculate.destroyIt(_this,this.tokens[b]);
- _this.strata.update(_this);
- }
- }
- }
- }
-}
-
-})(jQuery);
--- a/integ/js/vs/_vs.draw.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +0,0 @@
-(function ($) {
-
-$.fn._vs.draw = {
-
- settings:{
- draw:{
- trail:1,
- showLayout:false
- }
- },
-
- update:function(_this){
- /* refresh rate of canvas (show trail) */
- //console.log(_this.ctx)
- if(this.settings.draw.trail==1) {
- _this.ctx.clearRect(0, 0, _this.ctx.canvas.clientWidth, _this.ctx.canvas.clientHeight);
- }else{
- debugDrawChart(0,
- 0,
- ctx.canvas.clientWidth,
- ctx.canvas.clientHeight,
- "rgba(255,255,255,"+this.settings.draw.trail+")",
- ctx);
- }
-
- /* Draw body(s) from box2d */
- for( var b = _this.world.GetBodyList() ; b ; b = b.GetNext()) {
- for (var s = b.GetFixtureList(); s != null; s = s.GetNext()) {
- this.drawShape(_this,s);
- }
- }
-
- /* Show wireframe mode */
- 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 (x,y,w,h,color,ctx) {
- ctx.save();
- ctx.translate(0,0);
- ctx.fillStyle = color;
- ctx.beginPath();
- ctx.rect(x,y,w,h);
- ctx.closePath();
- ctx.strokeStyle ="#000"
- ctx.lineWidth = 0.5;
- ctx.stroke();
- ctx.restore();
- },
- clippedBackgroundImage:function( ctx, img,x,y ){
- ctx.save();
- ctx.clip();
- //console.log(img)
- ctx.drawImage(img,
- x-(img.height/2),
- y-(img.width/2),
- img.width,
- img.height);
- ctx.restore();
- },
- haveTexture:function(s){
- var result = false
- if(typeof(s.m_userData.texture)!="undefined"){
- if(typeof(s.m_userData.texture.img)!="undefined"){
- if(s.m_userData.texture.img.complete){
- result = true
- }
- }
- }
- return result
- },
-
- drawShape: function (_this,s) {
- var b = s.GetBody();
- var position = b.GetPosition();
- var angle = b.GetAngle();
- var radiusCoef = 9;
- var radiusCoefMax=10
- var scale = _this.settings.options.scale
-
- // add x and y to userData
- s.m_userData.x = b.GetWorldCenter().x*scale
- s.m_userData.y = b.GetWorldCenter().y*scale
-
-
-
- if(typeof(s)!="undefined"){
- switch (s.GetType()){
- case 0: // round
-
- switch (s.m_userData){
- case null:
- _this.ctx.fillStyle = "rgba(255,0,0,1)";
- break;
- default:
- _this.ctx.fillStyle = s.m_userData.fillStyle;
- break
- }
-
- var radius = s.m_shape.m_radius
-
- // round token
- if(_this.settings.sedimentation.token.visible==true){
-
- _this.ctx.save();
- _this.ctx.translate(position.x*scale, position.y*scale);
- _this.ctx.rotate(angle);
- _this.ctx.beginPath();
- var h = (radius/radiusCoefMax*radiusCoef)*scale
-
- //console.log(s.m_userData.strokeStyle)
- if(typeof(s.m_userData.strokeStyle)!="undefined"){
- _this.ctx.strokeStyle = s.m_userData.strokeStyle
- } else{
- _this.ctx.strokeStyle = "rgba(0,0,0,0)"
- }
-
- if(typeof(s.m_userData.lineWidth)!="undefined"){
- _this.ctx.lineWidth = s.m_userData.lineWidth
- } else {
- _this.ctx.lineWidth = 0
- }
-
- _this.ctx.arc(0, 0,h, 0, Math.PI*2, true);
-
- if(this.haveTexture(s)){
- this.clippedBackgroundImage(_this.ctx,s.m_userData.texture.img
- ,0
- ,0);
- }
- _this.ctx.closePath();
-
- if(_this.settings.options.layout==true){
- _this.ctx.strokeStyle = "#000"
- _this.ctx.lineWidth = 0.5
- _this.ctx.stroke();
- }else{
- if(!this.haveTexture(s))_this.ctx.fill();
- _this.ctx.stroke();
-
- }
-
- _this.ctx.restore();
-
- }
-
-
- break
- case 1: // vertice (polygon and squares ...)
-
- //if(s.m_userData.type != "wall" && s.m_userData.type != "lift")console.log("draw",s.m_userData)
-
- switch (s.m_userData){
- case null:
- _this.ctx.fillStyle = "rgba(255,0,0,1)";
- break;
- default:
- _this.ctx.fillStyle = s.m_userData.fillStyle;
- break
- }
-
- var width = s.m_shape.m_vertices[0].x*scale
- var height = s.m_shape.m_vertices[0].y*scale
- var posx = position.x*scale-s.m_shape.m_vertices[0].x*scale
- var posy = position.y*scale-s.m_shape.m_vertices[0].y*scale
-
- _this.ctx.save();
- _this.ctx.translate(position.x*scale, position.y*scale);
- _this.ctx.rotate(angle);
- _this.ctx.beginPath();
-
- //if(s.m_userData.ID==1 ){ console.log(s.m_userData.lineWidth) }
- //if(typeof(s.m_userData.fillStyle)!="undefined") _this.ctx.fillStyle = s.m_userData.fillStyle
- if(typeof(s.m_userData.strokeStyle)!="undefined"){ _this.ctx.strokeStyle = s.m_userData.strokeStyle
- } else{ _this.ctx.strokeStyle = s.m_userData.fillStyle}
-
- if(typeof(s.m_userData.lineWidth)!="undefined"){ _this.ctx.lineWidth = s.m_userData.lineWidth
- } else{ _this.ctx.lineWidth = 0}
-
-
- for (var i = 0; i < s.m_shape.m_vertices.length; i++) {
- var points = s.m_shape.m_vertices;
- //var this = {x:0,y:0}
- _this.ctx.moveTo(( points[0].x) * scale, (points[0].y) * scale);
- for (var j = 1; j < points.length; j++) {
- _this.ctx.lineTo((points[j].x ) * scale, (points[j].y ) * scale);
- }
- _this.ctx.lineTo(( points[0].x) * scale, ( points[0].y) * scale);
- }
- _this.ctx.closePath();
- _this.ctx.fill();
-
- // pour le debug mode
- if(_this.settings.options.layout==true){
- _this.ctx.lineWidth = 0.1;
- _this.ctx.strokeStyle ="rgb(0,0,0)"
- _this.ctx.stroke();
-
- // incomming points Drawer
- //for (var i = _this.settings.sedimentation.incoming.point.length - 1; i >= 0; i--) {
- //
- //_this.settings.sedimentation.incoming.point[i].y
- // draw green
- //_this.ctx.font = '40px Arial';
- //_this.ctx.fillText("x", _this.settings.sedimentation.incoming.point[i].x, _this.settings.sedimentation.incoming.point[i].y);
- //_this.ctx.fillStyle = "rgb(0,250,0,0.5)";
-
- //};
-
- }else{
- _this.ctx.stroke();
- }
- _this.ctx.restore();
-
- break;
- case 2:
-
- break;
- _this.ctx.fillStyle = "rgb(0,0,0)";
- }
- }
-
- // Call back draw
- if(typeof(s.m_userData.callback)!="undefined"){
- if(typeof(s.m_userData.callback.draw)=="function"){
- var t = _this.select('ID',s.m_userData.ID)
- s.m_userData.callback.draw(t)
- }
- }
-
- //if(s.m_userData.fillStyle=="black"){
- // console.log(s.m_userData.cycle,"",s)
- //}
- }
-}
-
-})(jQuery);
--- a/integ/js/vs/_vs.flocculate.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-(function ($) {
-//console.log("flocullate loaded")
-$.fn._vs.flocculate = {
-
- buffer:[],
-
- init:function(_this){
- console.log("init flocculate",_this)
- // create one buffer by data model (categorys)
- for (var i =0; i<_this.settings.data.model.length; i++) {
- this.buffer[i] = []
- console.log(i)
- };
- },
-
-
- // OLD STUFF NOT USED
- addtobuffer:function(_this,token){
- c = token.attr("category")
- bufferSize =_this.settings.sedimentation.flocculate.bufferSize
- this.buffer[c].push(token)
- _this.decay.tokens.splice(_this.decay.tokens.indexOf(token),1)
- //
- token.attr("callback","bufferFlocculation",token)
-
- if(this.buffer[c].length > bufferSize){
- //console.log("order")
- this.update(_this,c,bufferSize)
- }
- },
-
- destroyIt:function(_this,token){
- token.attr("callback","flocculation",token) // callback
- token.attr("state",2) // flocullating state
- //token.myobj=null
- // console.log(token.attr('ID'))
- var del = _this.world.DestroyBody(token.myobj.GetBody());
-
- return del
- },
-
- update:function(_this,c,nbtokens) {
- if(_this.settings.sedimentation.flocculate.number==1){
- while(this.buffer[c].length > nbtokens) {
- var token = this.buffer[c].shift();
- this.destroyIt(_this,token)
- }
- }else {
- while(this.buffer[c].length > _this.settings.sedimentation.flocculate.number) {
- var token = this.buffer[c].shift();
- this.destroyIt(_this,token)
- }
- }
-
- },
-
- disapear:function(_this,token){
- ///draft doesn't work
- window.setInterval(
- function(){token.update(self);},
- self.settings.options.refresh/2
- );
- },
-
- all:function(_this) {
- // TODO destroy all
- console.log(_this.settings.data)
- for (var i = _this.decay.tokens - 1; i >= 0; i--) {
- console.log(_this.decay.tokens)
- this.update(_this,i,_this.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);
--- a/integ/js/vs/_vs.hearder.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*!
- * 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
- */
\ No newline at end of file
--- a/integ/js/vs/_vs.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,649 +0,0 @@
-// ....................................................................
-// Main Visual Sedimentation Code
-// ....................................................................
-
-// TODO :
-// - callback on rollOut
-
-(function($){
-
-// Name Space Plug in Jquery Objects
-$.fn.vs = function (){}
-$.fn._vs={}
-
-// All this objects are define in correspondant .js files
-$.fn._vs.token = {}
-$.fn._vs.draw = {}
-$.fn._vs.stream = {}
-$.fn._vs.chart = {}
-$.fn._vs.phy = {}
-$.fn._vs.decay = {}
-$.fn._vs.flocculate = {}
-$.fn._vs.strata = {}
-$.fn._vs.aggregate = {}
-
-
-// Core Classe
-var VisualSedimentation = function(element,options){
-
- // Attach objects
- this.token = $.fn._vs.token
- this.draw = $.fn._vs.draw
- this.stream = $.fn._vs.stream
- this.chart = $.fn._vs.chart
- this.phy = $.fn._vs.phy
- this.decay = $.fn._vs.decay
- this.flocculate = $.fn._vs.flocculate
- this.strata = $.fn._vs.strata
-// this.aggregate = $.fn._vs.aggregate
- this.requestAnimFrame;
-
-
- // Mouse object have to be refactor
- this.mouse ={}
- this.mouse.x = 0
- this.mouse.y = 0
- this.mouse.isMouseDragging = false
- this.mouse.isMouseDown = false
- this.mouse.selectedBody = null
-
-
- // Variables
- this.dataFlow = [];
- this.chartPhySetup= {}
- this.tokens = [];
- this.world = null;
- this.ctx = null;
- var elem = $(element);
- var self = this;
- var tokens = [];
- var B2D;
- var canvas;
-
-
- // Default Settings
- var defaultSettings = {
- 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',
- /*
- name are based on prefuse tollokit layout :
- - CircleLayout,
- - StackedAreaChart,
- //- bubbleAreaChart,
- x AxisLabelLayout,
- x AxisLayout,
- x CollapsedStackLayout,
- x GridLayout,
- */
- spacer:5,
- //treeLayout:false,
- column:3,
- wallColor:"rgba(230,230,230,0)",
- label:true,
- radius:10 // for CircleLayout
- },
- 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}, // fill color, shape,
- incoming:{
- strategy:1, // 1 = one element by one, more = by Groupe
- 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, // 1 = one element by one, more = by groupe of n
- action:"buffer", // [buffer,continue]
- strategy:"Size", // [BufferSize, Time, AcummulationAreaHeight, Fps, Manual]
- bufferSize:5, // number of token to make floculation
- bufferTime:1000, // time buffer to make flocullation
- bufferHeight:50, // height (pixel) to make floculation
- bufferFrameRate:25, // if the computer is to slow floculate
- buffer:[]
- },
- suspension:{
- height:null, // pourcent,adaptative
- incomming:'top',
- decay:{power:1.001}, // null
- refresh:200
- },
- accumulation:{height:null}, // pourcent ,adaptative
- aggregation:{height:0, maxData:0, invertStrata:false}, // pourcent ,adaptative
- },
- options:{
- refresh:1000/25,
- panel:false,
- scale:30,
- layout:false,
- canvasFirst:true
- }
- }
-
-
- this.now = function(){
- return(new Date().getTime())
- }
-
- // get Box2d World
- this.globalDecay = function (value){
- if(typeof(value)=='undefined'){
- return this.settings.sedimentation.suspension.decay.power
- }else{
- return this.settings.sedimentation.suspension.decay.power=value
- }
- }
-
- // get Box2d World
- this.getWorld = function (){
- return this.world;
- }
-
- this.chartUpdate = function (cat,y){
- var options = {cat:cat,y:y}
- this.chart[this.settings.chart.type](self,'update',options)
- }
-
- // Todo ......
- this.flocculateTokens = function (number){
- return this.flocculate.update(self,number)
- }
-
- // TODO DESTROY ALL TOKENS
- this.flocculateAll = function(){
- return this.flocculate.all(self)
- }
-
- // Add token function
- this.addToken = function (element){
- //var token = this.token.addToken(self,element)
- return this.token.addToken(self,element);
- }
-
- // Select token fonction
- this.selectAll = function (key,value){
- return this.token.selectAll(self,key,value);
- }
-
- // Select token fonction
- this.select = function (key,value){
- return this.token.select(self,key,value);
- }
-
- // update a categoryr in the chart
- this.updateAll = function (values){
- var tokens = this.chart.updateAll(self,key,value)
- return tokens;
- }
-
- // update a category in the chart
- this.update = function (key,value){
- var tokens = this.chart.update(self,key,value)
- return tokens;
- }
-
-
- /// Settings without
-
-
- //////////////////////////////////////////////////////// TO CLEAN
- // SAM @ROM1 : are you sure you need that ? extend doing it well normally
- // Merge options with defaults
- // http://stackoverflow.com/questions/171251/how-can-i-merge-properties-of-two-javascript-objects-dynamically
-
- //console.log("////////")
- //options.model = modelToStrata(options.data.model)
-
- function merge_options(obj1,obj2){
- var obj3 = {};
- for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
- for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
- return obj3;
- }
-
- merge_options(defaultSettings, options);
- if(options.data!=undefined)
- defaultSettings.data = options.data;
-
- ////////////////////////////////////////////////////////////////////////////////////
- // Merge option and add the DOMelement to setting
- //this.settings = $.extend(defaultSettings, options || {});
- this.settings = $.extend(true,defaultSettings, options);
- this.settings.DOMelement = element
- //console.log('settings after extend',this.settings)
-
- // -----------------------------------------------
- // SIMPLE DEFAULT SETTING FOR RETRO COMPATIBILITY
- //
- 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=[]}
-
- // FOR ROM1 setting by default aggregation :
- 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
- }
- }
- // END
-
-
- // Initialisation - Private method
- this.init = function(){
- // requestAnim shim layer by Paul Irish
- // not use yet, to add
- this.requestAnimFrame = (function(){
- return window.requestAnimationFrame ||
- window.webkitRequestAnimationFrame ||
- window.mozRequestAnimationFrame ||
- window.oRequestAnimationFrame ||
- window.msRequestAnimationFrame ||
- function(/* function */ callback, /* DOMElement */ element){
- window.setTimeout(callback, 1000 / 60);
- };
- })();
-
- //console.log(this.settings)
- //console.log('Initialisation');
-
- // Create the physical simulation
- this.world = new this.phy.b2World(
- new this.phy.b2Vec2(0, 0) //gravity
- , true //allow sleep
- );
-
- // Create container and canvas for physical simulation drawing
- var container = element.appendChild(document.createElement("div"));
- container.id = "box_sediviz_"+GUID()
- container.width = this.settings.width; // TOFIX
- container.height = this.settings.height;
-
- //console.log(container.id)
- // Allocate the new Element
- this.settings.DOMelement = container
-
- canvas = container.appendChild(document.createElement("canvas"));
- canvas.id = "canvas";
- canvas.width = this.settings.width; // TOFIX
- canvas.height = this.settings.height;
- canvas.style.position = "absolute"
-
- //console.log(this.settings.width,this.settings.height)
- this.ctx = canvas.getContext("2d");
-
- // Construct the Chart
- this.chart[this.settings.chart.type](self,'init')
-
-
- // Draw d3
- //if(typeof(this.settings.options.debugaggregate)=="undefined"){
- // this.aggregate.init(self);
- //}
- // Initiatlise stream
- this.stream.init(self)
- // Initiatlise decay
- this.flocculate.init(self)
- // Update stream
- this.stream.update(self);
-
- // Initiatlise tokens
- this.token.init(self)
-
- //FORCE UPDATE CHART due to (bug positionnement ) @rom1
- this.strata.init(this)
-
- // Update the physical simulation
- window.setInterval(
- function(){self.update(self);},
- self.settings.options.refresh/2
- );
- // Refresh canvas drawings
- window.setInterval(
- function(){self.draw.update(self);},
- self.settings.options.refresh
- );
- // Update Decay
- window.setInterval(
- function(){self.decay.update(self);},
- self.settings.sedimentation.suspension.refresh
- );
- //this.decay.update(self);
-
- self.strata.update(self)
-
-
- // MOUSE PART
- // inspired by box2d stuffs, have to clean and finish this !
- // http://www.emanueleferonato.com/2008/11/20/dragging-objects-with-box2d-flash/
- // --------------------------
- this.getBodyAtMouse=function (_this) {
-
- var x = _this.mouse.x/_this.settings.options.scale
- var y =_this.mouse.y/_this.settings.options.scale
- var mousePVec = new _this.phy.b2Vec2(x,y);
- var aabb = new _this.phy.b2AABB();
- var area = 0.001
-
- //console.log(_this.mouse.x,_this.mouse.y)
- aabb.lowerBound.Set(x - area, y - area);
- aabb.upperBound.Set(x + area, y + area);
-
- // Query the world for overlapping shapes.
- _this.mouse.selectedToken = null;
-
- // MERCI JULIEN POUR LE CLOSURE
- //selectedBody
- _this.world.QueryAABB(function(fixture){
- return getBodyCB(fixture,_this,mousePVec)
- }, aabb);
-
- return _this.mouse.selectedToken;
- }
- //http://stackoverflow.com/questions/11674200/how-to-send-prototype-method-as-a-callback-in-javascript
- // pb here
- function getBodyCB(fixture,_this,mousePVec) {
- //console.log("phy",phy)
- //console.log("fixture",fixture.m_userData.type,fixture)
- //_this.mouse.elementpoi = fixture.GetBody()
- _this.mouse.selectedToken = fixture;
-
- if(fixture.GetBody().GetType() != _this.phy.b2Body.b2_staticBody) {
- if(fixture.GetShape().TestPoint(fixture.GetBody().GetTransform(), mousePVec)) {
- _this.mouse.selectedToken = fixture;
- return false;
- }
- }
- return true;
- }
-
- this.handleMouseMove = function(e,_this) {
- canvasPosition = DOMabsOffset(_this.settings.DOMelement)
- _this.mouse.x = (e.clientX - (canvasPosition.offsetLeft- this.getScrollPosition()[0]));
- _this.mouse.y = (e.clientY - (canvasPosition.offsetTop- this.getScrollPosition()[1]));
- //if( _this.mouse.isMouseDown){ console.log(_this.mouse.y,canvasPosition.y)}
- //console.log("mouse",e.clientX,e.clientY )
- //console.log("mouse",canvasPosition.x,canvasPosition.y )
- //console.log("=",_this.mouse.x,_this.mouse.y)
- };
- // from
- this.getScrollPosition= function(){
- return Array((document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft,(document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop);
- }
-
- document.addEventListener("mousemove", function (e){onDocumentMouseMove(e,self)});
- document.addEventListener("mouseup", function (e){onDocumentMouseUp(e,self)});
- document.addEventListener("mousedown", function (e){onDocumentMouseDown(e,self)});
-
-
-
- function onDocumentMouseOver(e,_this) {
-
- var s = _this.getBodyAtMouse(_this);
- if(s!=null){
- if(typeof(s.m_userData)!="undefined"){
- if(typeof(s.m_userData.callback)!="undefined"){
- if(typeof(s.m_userData.callback.mouseover)=="function"){
- var t = _this.select('ID',s.m_userData.ID)
- s.m_userData.callback.mouseover(t)
- }
-
- if(typeof(s.m_userData.callback.mouseout)=="function"){
- //console.log("mouseout exist")
- var t = _this.select('ID',s.m_userData.ID)
- var mouseoutTrigger
- var rollOut = function(){
- var mt = mouseoutTrigger
- var tt = t
- var ici = _this
- var ss = s
- return function(){
- var s = ici.getBodyAtMouse(ici);
- var mo = false;
- if(s!=null){
- if(typeof(s.m_userData)!="undefined"){
- if(s.m_userData.ID==tt.attr('ID')){
- mo=false
- }else{
- mo=true
- }
- }else{
- mo=true
- }
- }else{
- mo=true;
- }
- if(mo){
- ss.m_userData.callback.mouseout(tt)
- clearInterval(mouseoutTrigger)
- }
- }
- };
- mouseoutTrigger = window.setInterval(rollOut(),100)
- }
- }
- }
- }
- }
-
- function onDocumentMouseDown(e,_this) {
- //console.log("onDocumentMouseDown")
- _this.mouse.isMouseDown = true;
- // return false;
- _this.handleMouseMove(e,_this);
- var s = _this.getBodyAtMouse(_this);
- if(s!=null){
- if(typeof(s.m_userData)!="undefined"){
- if(typeof(s.m_userData.callback)!="undefined"){
- if(typeof(s.m_userData.callback.onclick)=="function"){
- var t = _this.select('ID',s.m_userData.ID)
- s.m_userData.callback.onclick(t)
- }
- }
- }
- }
- }
-
- function onDocumentMouseUp(e,_this) {
- _this.mouse.isMouseDown = false;
- // isMouseDown = false;
- // return false;
- //console.log("onDocumentMouseUp")
- }
- function onDocumentMouseMove( e,_this ) {
-
- if(_this.mouse.isMouseDown){
- _this.mouse.isMouseDragging = true;
- _this.mouse.x = e.clientX;
- _this.mouse.y = e.clientY;
-
- }else{
- _this.handleMouseMove(e,_this);
- onDocumentMouseOver("move",_this)
- }
- //console.log("m",_this)
- }
- }
-
-
- this.mouse.update = function (s) {
- if(isMouseDown && (!mouseJoint)) {
- var body = getBodyAtMouse();
- if(body) {
- var md = new b2MouseJointDef();
- md.bodyA = world.GetGroundBody();
- md.bodyB = body;
- md.target.Set(mouseX, mouseY);
- md.collideConnected = true;
- md.maxForce = 300.0 * body.GetMass();
- mouseJoint = world.CreateJoint(md);
- body.SetAwake(true);
- }
- }
-
- if(mouseJoint) {
- if(isMouseDown) {
- mouseJoint.SetTarget(new b2Vec2(mouseX, mouseY));
- } else {
- world.DestroyJoint(mouseJoint);
- mouseJoint = null;
- }
- }
-
- };
-
-
-
- // MOUSE END
- // --------------------------
-
- this.update = function (s) {
- this.world.Step(1 / 60, 10, 10);
- this.world.DrawDebugData();
- this.world.ClearForces();
- //console.log('u')
- }
-
- var drawInit = 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(
- $.fn.vs.draw.refresh(ctx,world,this.settings)
- , this.settings.options.refresh);
- console.log("draw Init ")
- }
-
-
- var DOMabsOffset = function(target){
- var top = target.offsetTop;
- var left = target.offsetLeft;
-
- while(target = target.offsetParent) {
- top += target.offsetTop;
- left += target.offsetLeft;
- }
-
- return {offsetLeft:left, offsetTop:top};
- };
-
- // GUID generator from :
- // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
- var GUID = function(){
- var S4 = function ()
- {
- return Math.floor(
- Math.random() * 0x10000 /* 65536 */
- ).toString(16);
- };
-
- return (
- S4() + S4() + "-" +
- S4() + "-" +
- S4() + "-" +
- S4() + "-" +
- S4() + S4() + S4()
- );
- }
-
- // clone object
- // http://stackoverflow.com/questions/728360/copying-an-object-in-javascript
- function clone(obj) {
- if (null == obj || "object" != typeof obj) return obj;
- var copy = obj.constructor();
- for (var attr in obj) {
- if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
- }
- return copy;
- }
- this.utile = {}
- this.utile.GUID = GUID
- this.utile.clone = clone
-
- this.settings = $.extend(this.settings, {} || {});
- //console.log("ici",this.settings)
- this.init();
-
- };
-
-$.fn.vs = function(options){
- if (!arguments.length){var options={}}
- //console.log('$.fn.vs settings',options)
- return this.each(function(){
- var element = $(this);
- // Return early if this element already has a plugin instance
- if (element.data('VisualSedimentation')) return;
- var visualSedimentation = new VisualSedimentation(this,options);
- // Store plugin object in this element's data
- element.data('visualSedimentation', visualSedimentation);
- //visualSedimentation.test();
- });
- };
-
-})(jQuery);
-
-
-
-
-
--- a/integ/js/vs/_vs.mouse.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-(function ($) {
-$.fn._vs.mouse = {
- init:function(){},
- }
-})
\ No newline at end of file
--- a/integ/js/vs/_vs.old.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-// ....................................................................
-// Bar Chart Plug In
-// ....................................................................
-(function($){
-
-var VisualSedimentation = function(element,options){
-
- var elem = $(element);
- var self = this;
-
- var world;
- var nBodies = [];
- var B2D;
- var canvas;
- var 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;
-
-
- // Default options
- var defaultSettings = {
- width:500,
- height:440,
- layout:'StackedAreaChart',// AxisLabelLayout, AxisLayout, CircleLayout, CollapsedStackLayout, GridLayout, StackedAreaChart
- data:{initial:[{label:'Label A',value:20},
- {label:'Label B',value:10},
- {label:'Label C',value:10}],
- stream:{provider:"generator",
- frequency:1000/60
- },
- }
- ,
- sedimentation:{
- token:{size:20}, // fill color, shape,
- flocullate:{
- limit:5, // object size limit before floculate = 2pixels
- animation:"collective", // [step,group,bySet]
- action:"buffer", // [buffer,continue]
- startegy:"Size", // [BufferSize, Time, AcummulationAreaHeight, Fps, Manual]
- bufferSize:50, // number of token to make floculation
- bufferTime:10000, // time buffer to make flocullation
- bufferHeight:50, // height (pixel) to make floculation
- bufferFrameRate:25 // if the computer is to slow floculate
- },
- suspension:{height:null,incomming:'top'}, // pixel,pourcent,adaptative
- accumulation:{height:null}, // pixel,pourcent,adaptative
- agregation:{height:300}, // pixel,pourcent,adaptative
- },
- options:{spacer:10,
- wallColor:"rgba(230,230,230,0)",
- label:true,
- panel:true,
- refresh:1000/1000,
- panel:false
- }
- }
- // Merge options with defaults
- this.settings = $.extend(defaultSettings, options || {});
-
- // Public method
- this.publicMethod = function(){
- console.log('publicMethod() called!');
- };
-
- // Initialisation - Private method
- this.init = function(){
- console.log(this.settings)
- console.log('Initialisation');
- //console.log(defaultSettings);
- // Create the physical simulation
- world = new b2World(
- new b2Vec2(0, 10) //gravity
- , true //allow sleep
- );
-
- // Create container and canvas for physical simulation drawing
- var container = element.appendChild(document.createElement("div"));
- container.id = "boxsediviz"
- canvas = container.appendChild(document.createElement("canvas"));
- canvas.id = "canvas";
- canvas.width = this.settings.width; // TOFIX
- canvas.height = this.settings.height;
- console.log(element)
-
- //Update the physical simulation
- window.setInterval(update, 1000 / 60);
- };
-
- var update = function () {
- world.Step(1 / 60, 10, 10);
- world.DrawDebugData();
- world.ClearForces();
- }
-
- var drawInit = function(){
- ctx = canvas.getContext("2d");
- ctx.fillStyle = "rgb(200,0,0)";
- ctx.font = "14pt Calibri,Geneva,Arial";
- ctx.fillText("Canvas ready for Visual Sedimentation ", 10, 20);
- window.setInterval(
- $.fn.vs.draw.refresh(ctx,world,this.settings)
- , this.settings.options.refresh);
- console.log("draw Init ")
- }
-
- this.stream = $.fn.vs.stream;
- this.draw = $.fn.vs.draw;
- this.tokens = $.fn.vs.tokens;
- this.decay = $.fn.vs.decay;
- this.flocculate = $.fn.vs.flocculate;
-
-
- this.init();
- //drawInit();
-
- this.stream.test();
- };
-
-visualSedimentation.fn = VisualSedimentation.prototype = {
- // API Methods
- hide: function() {
- this.node.style.display = 'none';
- return this;
- },
-
- /* gr:function(){
- console.log("test ....")
- }*/
- // More methods here, each using 'return this', to enable chaining
-};
-
-
-visualSedimentation.fn.gr= function(){
- console.log("ici VsBarChart.fn.draw")
-};
-
-$.fn.visualSedimentation = VisualSedimentation;
-
-$.fn.vs = function(f,options){
- console.log(this);
- return this.each(function(){
- var element = $(this);
- // Return early if this element already has a plugin instance
- if (element.data('VisualSedimentation')) return;
- var visualSedimentation = new VisualSedimentation(this,options);
- // Store plugin object in this element's data
- element.data('visualSedimentation', visualSedimentation);
- //visualSedimentation.test();
- });
- };
-$.fn.visualSedimentation.vs = VisualSedimentation;
-
-})(jQuery);
-
-
-
-
-
--- a/integ/js/vs/_vs.phy.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-(function ($) {
-
-$.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);
--- a/integ/js/vs/_vs.strata.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,616 +0,0 @@
-(function ($) {
-$.fn._vs.strata = {
-
- stratas: [],
-
- // Create stratas
- init:function(_this) {
-
- if(_this.settings.chart.type!='StackedAreaChart') {
-
- _this.strata.create_strata(_this);
- return;
- }
- settings = _this.settings;
-
- // No strata or empty strata, so nothing happens
- if( (typeof(settings.data.strata) != 'function') && (typeof(settings.data.strata) == "undefined" || settings.data.strata.length == 0)) { // || settings.data.strata.length == 0) {
-
- for (var i=0; i<settings.data.model.length; i++) {
-
- var defaultStrata = {
- label: settings.data.model[i].label+"_"+i,
- category: i,
- value: function(t, s) { return 0;},
- }
- _this.strata.stratas[i] = [defaultStrata];
- };
-
- _this.strata.create_strata(_this);
- return;
- }
-
- if(typeof settings.data.strata != 'function') {
-
- // Serialized function in JSON
- if(typeof(settings.data.strata == "object") && typeof(settings.data.strata[0]) != "undefined" && (typeof settings.data.strata[0][0].value != "undefined") && typeof(settings.data.strata[0][0].value == "string")) {
-
- var NB_STRATA = settings.data.strata[0].length;
-
- // Create default strata object
- for (var i=0; i<settings.data.model.length; i++) {
- _this.strata.stratas[i] = [];
- // Create default strata object
- for (var n=0; n<NB_STRATA; n++) {
- (function(a,b) {
- var t=null;
- if( (typeof settings.data.strata[a] !="undefined") && (typeof settings.data.strata[a][b] !="undefined") && (typeof settings.data.strata[a][b].texture!="undefined"))
- t = settings.data.strata[a][b].texture;
- var defaultStrata = {};
-
- defaultStrata = {
- label: settings.data.model[i].label+"_"+a,
- category: a,
- texture: t,
- value: function() { r=eval("f="+settings.data.strata[a][b].value); return r();}
- }
-
-
- _this.strata.stratas[a].push(defaultStrata);
- })(i,n);
- }
- }
- _this.strata.create_strata(_this);
-
- return;
- }
-
- if(typeof(settings.data.strata[0]) != "undefined" && typeof(settings.data.strata[0][0]) != "undefined" && typeof(settings.data.strata[0][0].initValue != "undefined" ) ) {
-
- for (var c=0; c<settings.data.model.length; c++) {
- var defaultStrata = {
- label: settings.data.model[c].label+"_"+c,
- category: i,
- value: function(t, s) {
- if(t.selectAll("category", s)) {
-
- return settings.data.strata[s][0].initValue+t.selectAll("category", s).attr("state").filter(function(d) {if(d==2) return d}).length;
- } else
- return settings.data.strata[s][0].initValue;
- },
- }
- _this.strata.stratas[c] = [defaultStrata];
- };
- _this.strata.create_strata(_this);
- return;
-
- } else if(settings.data.strata[0].length == 0) { // Default bar chart
-
- // Create default strata object
- for (var i=0; i<settings.data.model.length; i++) {
-
- var defaultStrata = {
- label: settings.data.model[i].label+"_"+i,
- category: i,
- value: function(t, s) {
- if(t.selectAll("category", s)) {
- return t.selectAll("category", s).attr("state").filter(function(d) {if(d==2) return d}).length;
- } else
- return 0;
- },
- }
- _this.strata.stratas[i] = [defaultStrata];
- };
- _this.strata.create_strata(_this);
- return;
-
- } else {
-
- var NB_STRATA = settings.data.strata[0].length;
- settings.data.strata_param = settings.data.strata;
-
- function fstrata() {
- var a = Array();
- for(var s=0; s<mySettings.data.model.length; s++)
- a.push(fstratum(s));
- return a;
- }
-
- function fstratum(a) {
-
- var b = Array(NB_STRATA);
- for(var r=0; r<b.length; r++)
- b[r] = Array();
-
- if(typeof _this != "undefined") {
-
- var tokens = _this.selectAll("category", s).attr("state").filter(function(d) {if(d==2) return d}).length;
-
- for(var k=0; k<tokens.length; k++) {
- var tk = tokens[k];
-
-
- for(var r=0; r<b.length; r++) {
-
- if(tk < _this.settings.stream.now-2*(r) && tk >= _this.settings.stream.now-2*(r+1))
- b[b.length-r-1].push(tk)
- }
- }
-
- }
- var res = Array();
-
- for(var j=0; j<NB_STRATA; j++) {
- var val = b[j].length;
- (function(v) {
- res.push({value: function() { return v; }, label:"Strata "+j, category:a}) // b[j].length
- })(val);
-
- }
- return res;
- }
-
- _this.settings.data.strata = function() {return fstrata()};
- _this.strata.stratas = _this.settings.data.strata();
- _this.strata.create_strata(_this);
- return;
- }
-
- }
-
- if((typeof settings.data.strata == 'function') || settings.data.strata[0].length > 0 || _this.strata.stratas.length>0) {
-
- // Strata have been defined, put them in the internal object
- if(typeof settings.data.strata == 'function' || (settings.data.strata[0].length > 0 && typeof(settings.data.strata[0])=="object")) {
-
- // Strata have been defined as functions
- if(typeof settings.data.strata == 'function') {
- _this.strata.stratas = settings.data.strata();
-
- } else if(typeof settings.data.strata[0].value == 'function') {
-
- for (var i=0; i<settings.data.model.length; i++) {
-
- var defaultStrata = {
- label: settings.data.model[i].label+"_"+i,
- category: i,
- initValue: settings.data.model[i].value,
- value: function(t, s) {
- return settings.data.strata[i];
- },
- }
-
- _this.strata.stratas[i] = [defaultStrata];
-
- }
-
- } else { // Numerical values as strata
-
- for (var i=0; i<settings.data.model.length; i++) {
- var defaultStrata = {
- label: settings.data.model[i].label+"_"+i,
-
- category: i,
- initValue: settings.data.model[i].value,
-
- value: function(t, s) {
- if(typeof(t.selectAll("category", s).length) == "undefined")
- return this.initValue;
- if(t.selectAll("category", s)) {
- return this.initValue+t.selectAll("category", s).attr("state").filter(function(d) {if(d==2) return d}).length;
- } else
- return 0;
- },
- }
-
- _this.strata.stratas[i] = [defaultStrata];
- };
- }
- }
- _this.strata.create_strata(_this);
- }
- // _this.strata.update(_this);
- },
-
- // select stratas
- selectAll:function(_this,key,value){
- result = []
- result.attr = function(key,value,param){
- var r=[]
- result.forEach(function(i){
- q = i.attr(key,value,param)
- r.push(q)
- })
- return r
- }
-
- if(typeof(value) == "undefined" && typeof(key) == "undefined"){
- return this.stratas
- }else{
- for (var i = _this.strata.stratas.length - 1; i >= 0; i--) {
- if(_this.strata.stratas[i].attr(key) == value){
- result.push(_this.strata.stratas[i])
- break;
- }
- }
- }
- if(typeof(result[0])=="undefined"){
- return false
- }else{
- return result[0];
- }
- },
-
- // Create stratas
- add:function(_this,setting){
-
- var strata = function (){}
- strata.myobj = setting
-
- strata.attr = function(key,value,param){
- if(typeof(value) == "undefined"){
- if(typeof(this[key])!="undefined"){
- return this[key]()
- }else{
- return this.myobj[key]
- }
- }else{
- if(typeof(this[key])!="undefined"){
- this[key](value,param)
- }else{
- this.myobj[key]=value
- }
- }
- return this
- }
- return strata
- },
-
- // remove stratas
- remove:function(_this,key,value){
-
- },
-
- // Returns n layers
- strata_layers: function (_this, n, m, p) {
-
- // Scales for setting up the strata layers
- var sn = d3.scale.linear().domain([1, m-2]).range([Math.PI/2, 2*Math.PI-Math.PI/2]);
- var logscale = d3.scale.pow().exponent(10).domain([0, m]).range([0,1]);
-
- return d3.range(n).map(function(i) {
- // For customs layers
- var r = 5*Math.random();
-
- return d3.range(m).map(function(j) {
-
- if(_this.settings.sedimentation.aggregation.strataType=="sin") {
- if(i==1) return 20;
- var x = 5+r*5*Math.sin(sn(j))+(i*50);
- if(x<0) return -x; else return x;
- } else if(_this.settings.sedimentation.aggregation.strataType=="log") {
- return i+1;
- //return logscale(j);//logscale(i);
- } else {
- if(typeof(p)=='undefined')
- p=0;
- return _this.strata.stratas[p][i].value(_this, p);
- }
- }).map(stream_index);
- });
- function stream_index(d, i) {
- return {x: i, y: Math.max(0, d)};
- }
- },
- // Strata creation
- create_strata: function(_this) {
-
- if(_this.settings.chart.type=='StackedAreaChart') {
-
- // Local variables for clearer code
- var w = _this.settings.chart.width/_this.settings.data.model.length,
- h = _this.settings.sedimentation.aggregation.height;
- var color = _this.token.colorRange;
-
- if(typeof _this.settings.options.canvasFirst != "undefined" && _this.settings.options.canvasFirst == false) {
-
- // Create a .vis element that overlays the canvas
- var vis = d3.select("#"+_this.settings.DOMelement.id)
- .insert("div", ":first-child")
- .style("position", "absolute")
- .attr("class", "vis")
- .style("z-index", 10)
- .append("svg")
- .attr("width", _this.settings.width)
- .attr("height", _this.settings.height)
- .append("g")
- .attr("transform", "translate(" + _this.settings.chart.x + "," + _this.settings.chart.y + ")");
- } else {
-
- var vis = d3.select("#"+_this.settings.DOMelement.id)
- .append("div")
- .attr("class", "vis")
- .style("z-index", 10)
- .append("svg")
- .attr("width", _this.settings.width)
- .attr("height", _this.settings.height)
- .append("g")
- .attr("transform", "translate(" + _this.settings.chart.x + "," + _this.settings.chart.y + ")");
- }
-
- var sn = _this.strata.stratas[0].length, // number of layers
- sm = 20; // number of samples per layer
- smx = sm - 1, smy = 0;
-
-
- var sum_strata = _this.strata.stratas.map(
- function(d, i) {
- for(var v=0, res=0; v<d.length; v++)
- res+=d[v].value(_this, i);
- return res;
- });
-
-
- var y = d3.scale.linear()
- .domain([0, Math.max(d3.max(sum_strata), _this.settings.sedimentation.aggregation.maxData)])
- .range([0, _this.settings.sedimentation.aggregation.height]);
-
- // Create a group layer that contains all the future strata groups .gpath
- var g = vis.selectAll("g.gcol")
- .data(_this.strata.stratas, function(d) {return [d];})
- .enter()
- .append("g")
- .attr("transform", function(d, i) {
-
- var align = _this.settings.sedimentation.aggregation.height;
- if(_this.settings.sedimentation.aggregation.invertStrata) {
- align =2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i]);
- }
- return "translate("+(i*w)+", "+(_this.settings.chart.height-align)+")";
- }).attr("class", function(d,i) { return "gcol col_"+i;});;
-
- // Group path for each strata group
- var gpath = g.selectAll(".gpath")
- .data(function(d, i) {
- var sd = d3.layout.stack().offset("expand")(_this.strata.strata_layers(_this, d.length, sm, i));
- smy = d3.max(sd, function(d) {
- return d3.max(d, function(d) {
- return d.y0 + d.y;
- });
- });
- sd.map(function(d) {d.map(function(d) {d.col=i;return d;});}); // Put col # in data
- return sd;
- })
- .enter().append("g").attr("class", "gpath");
-
-
- // Rectangular strata
- var area = d3.svg.area()
- .x(function(d) { return _this.settings.chart.spacer+d.x * (w-2*_this.settings.chart.spacer) / smx; })
- .y0(function(d) { return (h - d.y0 * d.offshit); })
- .y1(function(d) { return (h - (d.y + d.y0) * d.offshit ); });
-
- var pathlayer = gpath.append("path")
- .attr("d", function(d,i) {
-
- _this.chartUpdate(i, -y(sum_strata[i])-(h-_this.settings.chart.height));
- hh = 0;//_this.settings.chart.height-_this.chart.getPosition(_this)[d[0].col].y;
- d.map(function(dd) {
- dd.offshit = hh;
- return dd;
- });
- return area(d);
- });
-
- // Customize layers with color and texture
- pathlayer.style("fill", function(d,i) {
- if(_this.strata.stratas[d[0].col][i].texture!=null) {
- return "url(#RectanglePattern_"+d[0].col+"_"+i+")";
- } else {
- return d3.rgb(color(d[0].col))
- .darker(_this.strata.stratas[d[0].col].length/2-(i+1)/2); // The more away from the token, the darker
- }
- })
- .attr("class", function(d,i) { return "gcol col_"+d[0].col+" layer_"+i;});
-
- // Textures
- var patternWidth = w/1;
- var patternHeight = patternWidth;
-
- if(typeof _this.settings.data.strata != "undefined") {
- for(var s=0; s<_this.settings.data.strata.length; s++) {
- for(var l=0; l<_this.settings.data.strata[s].length; l++) {
- if(_this.settings.data.strata[s][l].texture!=null) {
-
- var pattern = vis.append('pattern')
- .attr('id','RectanglePattern_'+s+"_"+l)
- .attr('height', patternHeight)
- .attr('width', patternWidth)
- .attr('patternTransform', 'translate(0, 0) scale('+_this.settings.data.strata[s][l].texture.size+', '+_this.settings.data.strata[s][l].texture.size+') rotate(0)')
- .attr('patternUnits','userSpaceOnUse');
-
- pattern.append('image')
- .attr('x', 0)
- .attr('y', 0)
- .attr('height', patternHeight)
- .attr('width', patternWidth)
- .attr('xlink:href', function() { return _this.settings.data.strata[s][l].texture.url;});
- }
- }
- }
- }
- } else if(_this.settings.chart.type=='CircleLayout') {
-
-
- // strata
- var svg = d3.select("#"+_this.settings.DOMelement.id)
- .append("div")
- .attr("class", "vis")//.style("margin-top", "-"+_this.settings.height+"px")
- .attr("width", _this.settings.width)
- .attr("height", _this.settings.height)
- .append("svg")
- .attr("width", _this.settings.width)
- .attr("height", _this.settings.height);
-
- // bubble chart
- if(typeof(_this.settings.chart.treeLayout)!="undefined") {
-
- for(var i=0; i<_this.settings.data.model.length; i++) {
- var data =_this.settings.data.strata[i];
- var color = function(s) { return _this.token.colorRange(i)};
- _this.strata.create_pie_chart(_this, data, svg, data[0].value, color,
- ((i+1/2))*_this.settings.chart.width/(_this.settings.data.model.length)+_this.settings.chart.x,
- _this.settings.chart.y+_this.settings.chart.height/6);
- }
- } else {
- var data =_this.settings.data.strata.map(function(d) { return {value:d[0].value};});
- var color = _this.token.colorRange;
- _this.strata.create_pie_chart(_this, data, svg, _this.settings.chart.radius, color,
- _this.settings.chart.x+_this.settings.chart.width/2,
- _this.settings.chart.y+_this.settings.chart.height/2);
- }
- }
- },
- create_pie_chart: function(_this, data, svg, r, color, posx, posy) {
-
- var w = _this.settings.width/_this.settings.data.model.length,
- h = _this.settings.sedimentation.aggregation.height;//_this.settings.height;
-
- var x = d3.scale.linear()
- .domain([0, _this.settings.data.strata.length-1])
- .range([0, _this.settings.width]);
-
-
- var y = d3.scale.linear()
- .domain([0, d3.max(data, function(d) {return d.value; })])
- .rangeRound([0, h]);
-
- // CIRCLE
- var wp = _this.settings.width,
- hp = _this.settings.height,
- hhp = _this.settings.sedimentation.aggregation.height;
- //Math.min(w, hh) / 2,
- labelr = r + 30, // radius for label anchor
- donut = d3.layout.pie().sort(null),
- arc = d3.svg.arc().innerRadius(0).outerRadius(r);
-
- var id=Math.random();
- svg.append("g.arcs_"+id)
- .attr("class", "arcs_"+id);
-
- var garcs = svg.selectAll(".arcs")
- .data(donut(data.map(function(d, i) { return d.value})))
- .enter().append("svg:g").attr("transform", "translate(" + posx + "," + posy + ")");
-
- var hh=0;
-
- // Rectangular strata
- var area = d3.svg.area()
- .x(function(d) { return _this.settings.chart.spacer+d.x * (w-2*_this.settings.chart.spacer) / smx; })
- .y0(function(d) { return (h - d.y0 * hh); }) //hh/smy
- .y1(function(d) { return (h - (d.y + d.y0) * hh ); }); //hh/smy
-
- var arcs = garcs.append("path")
- .attr("fill", function(d, i) { return color(i); })
- .attr("d", function(d,i) {
-
- return arc(d);
-
- })
- .each(function(d) { this._current = d; });
-
-
- },
- update: function(_this) {
- // No strata or empty strata, so nothing happens
- if(typeof(_this.strata.stratas) == "undefined" || _this.strata.stratas.length == 0) {
- //TODO: create virtual strata to store all the flocculated ones
- return;
- }
-
- // If strata are functions, then refresh them
- if(typeof settings.data.strata == 'function') {
- _this.strata.stratas = settings.data.strata();
- }
- var sn = _this.strata.stratas[0].length, // number of layers
- sm = 20; // number of samples per layer
- smx = sm - 1, smy = 0;
-
- // Local variables for clearer code
- var w = _this.settings.chart.width/_this.settings.data.model.length,
- h = _this.settings.sedimentation.aggregation.height;
- var color = _this.token.colorRange;
-
- // Rectangular strata
- var area = d3.svg.area()
- .x(function(d) { return _this.settings.chart.spacer+d.x * (w-2*_this.settings.chart.spacer) / smx; })
- .y0(function(d) { return (h - d.y0 * d.offshit); })
- .y1(function(d) { return (h - (d.y + d.y0) * d.offshit ); });
-
- var sum_strata = _this.strata.stratas.map(
- function(d, i) {
- for(var v=0, res=0; v<d.length; v++) {
- res+=d[v].value(_this, i);
- }
- return res;
- });
-
- var y = d3.scale.linear()
- .domain([0, Math.max(d3.max(sum_strata), _this.settings.sedimentation.aggregation.maxData)])
- .range([0, _this.settings.sedimentation.aggregation.height]);
-
- var vis = d3.select("#"+_this.settings.DOMelement.id)
-
- var g = vis.selectAll("g.gcol")
-
-
- if(_this.settings.sedimentation.aggregation.invertStrata) {
- g.transition().duration(100).attr("transform", function(d, i) {
- var align = _this.settings.sedimentation.aggregation.height;
- align =2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i]);
- return "translate("+(i*w)+", "+(_this.settings.chart.height-(2*_this.settings.sedimentation.aggregation.height-y(sum_strata[i])))+")";
- });
- }
-
- // Update the group data model
- var gpath = g.selectAll("path")
- .data(function(d, i) {
- var sd = d3.layout.stack().offset("expand")(_this.strata.strata_layers(_this, d.length, sm, i));
-
- smy = d3.max(sd, function(d) {
- return d3.max(d, function(d) {
- return d.y0 + d.y;
- });
- });
- sd.map(function(d) {
- d.map(function(d) {
- d.col=i;
- return d;
- });
- }); // Put col # in data
- return sd;
- });
-
- if(_this.settings.chart.type=='StackedAreaChart') {
- // Adding strata layers
- var pathlayer = vis.selectAll("path")
- .transition().duration(100).attr("d", function(d,i) {
-
- if(!_this.settings.sedimentation.aggregation.invertStrata) {
- _this.chartUpdate(i, -y(sum_strata[i])-(h-_this.settings.chart.height));
- hh = _this.settings.chart.height-_this.chart.getPosition(_this)[d[0].col].y;
- } else {
- _this.chartUpdate(i, -2*h+_this.settings.chart.height);
- hh = y(sum_strata[d[0].col]);
- }
- d.map(function(dd) {
- dd.offshit = hh;
- return dd;
- });
- return area(d);
- });
- }
- }
- //return {};
- }
-})(jQuery);
\ No newline at end of file
--- a/integ/js/vs/_vs.stream.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-// ....................................................................
-// Stream function
-//
-// ....................................................................
-
-(function ($) {
-
-$.fn._vs.stream = {
- i:null,
- buffer:[],
- speed:10000/6,
- strategy:null,
- type:null,
-
- init:function(_this){
- this.speed = _this.settings.data.stream.refresh
- type = _this.settings.data.stream.provider
- },
-
- push:function(elements){
- console.log(elements)
- for (var i = elements.length - 1; i >= 0; i--) {
- buffer.push(elements)
- };
- },
-
- update:function (_this){
- if(type=='generator'){
- for(var i = 0 ; i<_this.settings.data.model.length ; i++) {
- _this.dataFlow[i] = setInterval(
- (function(i,_this){
- return function() {
- _this.settings.data.stream.now++
- // find the element inside the chart conf files
- var token = _this.chart[_this.settings.chart.type](_this,'token',i)
- _this.addToken(token);
- }
- })(i,_this)
- ,this.speed);
- }
-
- }else if (type=='tokens'){
-
- _this.dataFlow[0] = setInterval(
- (function(i,_this){
- return function() {
-
- _this.settings.data.stream.now++
- //if(){
- //console.log('tokens',_this.settings.stream.now)
- for(var i = 0 ; i<_this.settings.data.tokens.length ; i++) {
- if(_this.settings.data.tokens[i].t==_this.settings.data.stream.now){
- _this.addToken(_this.settings.data.tokens[i]);
- }
- }
- //}
- }
- })(i,_this)
- ,this.speed);
-
- }else{
- //console.log('direct no stream')
- }
- },
- generator:function(_this,fn){
- /*
- function sine(){}
- function cosine(){}
- function tane(){}
- */
- },
- test:function (_this){
- _this.tokens.push(
- _this.token.createDataBarBall(
- _this,
- (_this.settings.sedimentation.incoming[i].x+(Math.random()*2)),
- (_this.settings.sedimentation.incoming[i].y+(Math.random()*1)),
- _this.settings.sedimentation.token.size,
- i)
- )
- },
- setSpeed:function(_this,speed){
- speedFlow = speed;
- for( var i = 0 ; i<categorys.length ; i++) {
- window.clearInterval(dataFlow[i]);
- }
- window.clearInterval(decayFlow);
- dataFlow(categorys);
- }
-}
-
-
-})(jQuery);
--- a/integ/js/vs/_vs.token2.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,601 +0,0 @@
-(function ($) {
-$.fn._vs.token = {
-
- // alias for d3 color scale D3
- colorRange:function(){},
-
- init:function(_this){
- // Color scale import form d3
- // todo shape management
- this.colorRange = _this.settings.chart.colorRange
- },
- ID:function(_this){
- _this.settings.data.tokenPast+=1
- return _this.settings.data.tokenPast
- },
- selectAll:function(_this,key,value){
- // DRAFT VERSION writing select All ......
- var result = []
- var all = false
- result.flocculate = function(){
- var r=[]
- result.forEach(function(i){
- q = i.flocculate()
- r.push(q)
- })
- return r
- }
- result.attr = function(key,value,param){
- var r=[]
- result.forEach(function(i){
- //console.log(key,value,param)
- q = i.attr(key,value,param)
- //console.log("q",q)
- r.push(q)
- })
- return r
- }
-
- result.b2dObj = function(key,value,param){
- var r=[]
- result.forEach(function(i){
- //console.log(key,value,param)
- q = i.myobj
- //console.log("q",q)
- r.push(q)
- })
- return r
- }
-
- if(typeof(value) == "undefined" && typeof(key) == "undefined"){
- all =true
- }
-
- for (var i = _this.tokens.length - 1; i >= 0; i--) {
- if(_this.tokens[i].attr(key) == value || all==true){
- result.push(_this.tokens[i])
- }
- }
- return result;
- },
-
- select:function(_this,key,value){
- result = []
- if(typeof(value) == "undefined" && typeof(key) == "undefined"){
- return _this.tokens
- }else{
- for (var i = _this.tokens.length - 1; i >= 0; i--) {
- if(_this.tokens[i].attr(key) == value){
- result.push(_this.tokens[i])
- break;
- }
- }
- }
- if(typeof(result[0])=="undefined"){
- return false
- }else{
- return result[0];
- }
- },
-
-
- addToken:function (_this,element){
- //default token setting
- var defaultTokenSetting ={
- x:50,y:50, // positions
- t:null, // time
- category:1,// data category
- state:0, // state
- /*
- 0 = Not Enter in the stage,
- 1 = suspension,
- 2 = floculation,
- 2 + n = _this.strata.list[n]
- */
-
- // Graphic Parameter
- size:10, fillStyle:'###', strokeStyle:'rgba(0,0,0,0)', lineWidth:0, texture:undefined,
- shape:{type:'round'}, // vertice, box, round, ?? svg path with json serialisation {}
- userdata:{},
-
- // Interactions callbacks
- callback:{},
-
- // Physical parameters
- phy:{ density:10,friction:0,restitution:0},
- targets:[/*{x:null,y:null}*/],
- elbow:{/*x:null,y:null*/}
- }
-
- var result = null;
- var myobj = null
- var token = {}
-
- token.toString = function() {
- return "Token ID="+this.setting.ID;
- }
-
- //console.log(element)
- if(typeof(element)=='undefined'){
- token.setting = defaultTokenSetting
- token.setting.ID = this.ID(_this)
- } else {
- token.setting = element
- if(typeof(token.setting.phy) =='undefined') {token.setting.phy = defaultTokenSetting.phy}
- if(typeof(token.setting.t) =='undefined') {token.setting.t = _this.settings.stream.now}
- if(typeof(token.setting.x) =='undefined') {token.setting.x = _this.settings.sedimentation.incoming.point[element.category].x+(Math.random()*2)}
- if(typeof(token.setting.y) =='undefined') {token.setting.y = _this.settings.sedimentation.incoming.point[element.category].y+(Math.random()*2)}
- if(typeof(token.setting.size) =='undefined') {token.setting.size = _this.settings.sedimentation.token.size.original}
- if(typeof(token.setting.targets)=='undefined') {token.setting.targets=[]}
- token.setting.ID = token.setting.ID = this.ID(_this)
- if(typeof(token.setting.state) =='undefined') {token.setting.state = 0}
- if(typeof(token.setting.shape) =='undefined') {token.setting.shape = defaultTokenSetting.shape }
- }
-
- token.myobj = this.create(_this,token.setting)
- //console.log("token.myobj",token.myobj)
-
- token.flocculate = function(){
- _this.tokens.indexOf(this)
- _this.flocculate.destroyIt(_this,this)
- return this
- }
-
- token.attr = function(key,value,param){
- //console.log("attr",this.myobj)
- if(typeof(value) == "undefined"){
- if(typeof(this[key])!="undefined"){
- return this[key]()
- }else{
- return this.myobj.m_userData[key]
- }
- }else{
- if(typeof(this[key])!="undefined"){
- this[key](value,param)
- }else{
- this.myobj.m_userData[key]=value
- }
- }
- return this
- }
-
- token.callback = function(value,param){
- if (!arguments.length){return this.myobj.m_userData.callback}
- if (typeof(this.myobj.m_userData.callback[value])=="function"){
- return this.myobj.m_userData.callback[value](param)
- } else {
- return function(param){console.log("callback undefined")}
- }
- }
-
- token.size = function(value){
- //console.log(this.attr('state'))
- 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 = value/this.myobj.m_userData.scale
- }
- }
- token.b2dObj = function(){
- if(this.myobj!=null && this.attr('state')<2){
- return this.myobj
- }
- }
-
- token.texture = function(value){
- if (!arguments.length){return this.myobj.m_userData.texture.img.src;}
- console.log("texture",value)
- this.myobj.m_userData.texture={}
- this.myobj.m_userData.texture.img = new Image();
- this.myobj.m_userData.texture.img.src = value
- }
-
- //console.log("token",token)
- _this.tokens.push(token)
- _this.decay.tokens.push(token)
-
- // Execute suspension callback
- if(typeof(this.myobj.m_userData.callback)!="undefined"){
- if(typeof(this.myobj.m_userData.callback.suspension)=="function"){
- var t = _this.select('ID',token.setting.ID)
- this.myobj.m_userData.callback.suspension(t)
- }
- }
-
- return token
- },
-
- // CREATE IS A TRY TO UNIFY TOKEN PRODUCTION
- create:function(_this,token) {
- //targetX,targetY, x, y,size,family
- //console.log("create",token)
- token.scale = scale = _this.settings.options.scale
-
- //console.log("DBT")
- var xPos = token.x/scale+(Math.random()*0.1);
- var yPos = token.y/scale+(Math.random()*0.1);
-
- // CREATE BALL
- var fixDef = new Box2D.Dynamics.b2FixtureDef;
- fixDef.density = 0.1;
- fixDef.friction = 0.0;
- fixDef.restitution = 0.0;
- //console.log(token)
-
- // round
- if(token.shape.type == "round"){
- fixDef.shape = new Box2D.Collision.Shapes.b2CircleShape(token.size/scale);
- // or polygon
- }else if(token.shape.type == "polygons"){
- //fixDef.shape = new Box2D.Collision.Shapes.b2PolygonShape;
- fixDef = this.setPolygons(_this,token,fixDef)
- }else if(token.shape.type == "box"){
- fixDef.shape = new Box2D.Collision.Shapes.b2PolygonShape;
- //console.log(fixDef)
- fixDef.shape.SetAsBox(token.shape.width/scale,token.shape.height/scale)
- }
-
- var bodyDef = new Box2D.Dynamics.b2BodyDef;
- bodyDef.type = Box2D.Dynamics.b2Body.b2_dynamicBody;
- bodyDef.position.x = token.x/scale;//+(Math.random())
- bodyDef.position.y = token.y/scale;
-
- this.myobj = _this.world.CreateBody(bodyDef).CreateFixture(fixDef)
-
- if(typeof(token.texture)!="undefined"){
- token.texture.img = new Image();
- token.texture.img.src = token.texture.src
- }
-
- if(typeof(token.impulse)!="undefined"){
- this.applyImpulse(this.myobj,token.impulse.angle,token.impulse.power);
- }
-
- if(typeof(token.fillStyle) =="undefined"){ token.fillStyle = this.colorRange(token.category) }
- //if(typeof(token.stokeStyle)=="undefined"){ token.stokeStyle = "#000"}//"rgba(0,0,0,0.5)" }
- if(typeof(token.lineWidth) =="undefined"){ token.lineWidth = 0 }
- if(typeof(token.type) =="undefined"){ token.type="token" }
- if(typeof(token.callback) =="undefined"){
- token.callback = {}
- // {
- // suspension:undefined,
- // flocculation:undefined,
- // draw:undefined,
- // mouseover:undefined,
- // mouseout:undefined,
- // click:undefined
- // }
- }
-
- this.myobj.m_userData = token
- this.myobj.attr = this.attr// function (){console.log(this)}
- 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; // now in the world
-
- if(token.targets.length==0 && _this.settings.chart.type=="CircleLayout"){
- token.targets[0]={
- x: _this.settings.sedimentation.incoming.target[token.category].x,
- y: _this.settings.sedimentation.incoming.target[token.category].y
- }
- }
-
- if(token.targets.length>0){
- //console.log()
- //CREATE JOIN MOUVEMENT TO TARGET
- var md = new _this.phy.b2MouseJointDef();
- md.bodyA = _this.world.GetGroundBody();
- md.bodyB = this.myobj.GetBody();
- md.target.Set(xPos,yPos);
- md.collideConnected = true;
- md.maxForce = 50 * this.myobj.GetBody().GetMass();
- mouseJoint = _this.world.CreateJoint(md);
- mouseJoint.SetTarget(new _this.phy.b2Vec2(token.targets[0].x/scale, token.targets[0].y/scale));
- }
-
- // ADD INFO IN OBJECT
- //categorys[family].value+=1;
- //setTimeout(function(){mouseJoint.SetTarget(chart.position.x/scale, chart.position.y/scale)},1000);
- //categorys[family].joins.push(mouseJoint);
-
- return this.myobj;
- },
-
- applyImpulse:function(bodyId, degrees, power) {
- var body = bodyId.GetBody();
- body.ApplyImpulse(new Box2D.Common.Math.b2Vec2(Math.cos(degrees * (Math.PI / 180)) * power,
- Math.sin(degrees * (Math.PI / 180)) * power),
- body.GetWorldCenter());
- },
-
-
- setPolygons:function (_this,token,fixDef){
-
- fixDef.shape = new Box2D.Collision.Shapes.b2PolygonShape;
-
- if(token.shape.points==null){
- token.shape.points = [{x: -1, y: -1}, {x: 1, y: -1}, {x: -1, y:-1},{x: 1, y:-1}]
- };
-
- for (var i = 0; i < token.shape.points.length; i++) {
- var vec = new Box2D.Common.Math.b2Vec2();
- vec.Set(token.shape.points[i].x/scale, token.shape.points[i].y/scale);
- token.shape.points[i] = vec;
- }
-
- fixDef.shape.SetAsArray(token.shape.points, token.shape.points.length);
- return fixDef;
- },
-
-
- createDataBarBall:function (_this, x, y,size,family) {
- //console.log(Math.round(family)) ;
- var fixDef = new Box2D.Dynamics.b2FixtureDef;
- fixDef.density = 10.0;
- fixDef.friction = 0.5;
- fixDef.restitution = 0.2;
- fixDef.shape = new Box2D.Collision.Shapes.b2CircleShape(size/_this.settings.options.scale);
-
- var bodyDef = new Box2D.Dynamics.b2BodyDef;
- bodyDef.type = Box2D.Dynamics.b2Body.b2_dynamicBody;
- bodyDef.position.x = x/_this.settings.options.scale;//+(Math.random())
- bodyDef.position.y = y/_this.settings.options.scale;
-
- var myobj = _this.world.CreateBody(bodyDef).CreateFixture(fixDef)
- myobj.m_userData={type:"BarChartBall",
- familyID:'family',
- fillColor:this.colorRange(family)} //dynamiq
- //console.log(myobj);
- return myobj;
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- // ....................................................................
- // OLD OLD OLD Physicals elements
- // !!!!!!!!!!!!!!!!!! Have to clean
- // ....................................................................
-
- // !!!!!!!!!! To mix withe the one in piechart and bar chart ::: createBox
- createBox:function (world, x, y, width, height, angle, fillColor, fixed) {
- if (typeof(fixed) == 'undefined') fixed = true;
- var fixDef = new b2FixtureDef;
- if (!fixed) fixDef.density = 100.0;
- fixDef.friction = 0.6;
- fixDef.restitution = 0.3;
-
- var bodyDef = new b2BodyDef;
- bodyDef.type = b2Body.b2_staticBody;
- bodyDef.angle = angle ;//* b2Settings.b2_pi;
- fixDef.shape = new b2PolygonShape;
- fixDef.shape.SetAsBox(width/scale, height/scale);
- bodyDef.position.Set(x/scale, y/scale);
- var myobj = world.CreateBody(bodyDef).CreateFixture(fixDef)
- myobj.m_userData = {type:"Wall",fillColor:fillColor}
- console.log(myobj.m_userData)
- return myobj;
-
- },
- createBoxPie:function (world,axis, x, y, width, height, angle, fillColor) {
- var bodyDef = new b2BodyDef;
- bodyDef.type = Box2D.Dynamics.b2Body.b2_dynamicBody;
- var fixDef = new Box2D.Dynamics.b2FixtureDef;
- fixDef.shape = new b2PolygonShape;
- fixDef.shape.SetAsBox(width/scale, height/scale);
- fixDef.density = 1000000.0;
- fixDef.friction = 0.5;
- fixDef.restitution = 0.2;
- bodyDef.position.Set(x/scale, y/scale);
- bodyDef.angle = 0;
- var myobj = world.CreateBody(bodyDef).CreateFixture(fixDef);
- myobj.m_userData = {type:"Wall",fillColor:fillColor}
-
- return myobj;
-
- },
- createBox0D:function (world, x, y, width, height, fixed) {
- if (typeof(fixed) == 'undefined') fixed = true;
- var boxSd = new b2BoxDef();
- boxSd.restitution = -0.6;
- boxSd.friction = .3;
- if (!fixed) boxSd.density = 0.01;
- boxSd.extents.Set(width, height);
- var boxBd = new b2BodyDef();
- boxBd.AddShape(boxSd);
- boxBd.position.Set(x,y);
- return world.CreateBody(boxBd)
- },
- createHiddenBox:function (world, x, y, width, height, fixed) {
- if (typeof(fixed) == 'undefined') fixed = true;
- var boxSd = new b2BoxDef();
- boxSd.restitution = 0.6;
- boxSd.friction = .3;
- if (!fixed) boxSd.density = 1.0;
- boxSd.extents.Set(width, height);
- var boxBd = new b2BodyDef();
- boxBd.AddShape(boxSd);
- boxBd.position.Set(x,y);
- var myObject = world.CreateBody(boxBd)
- myObject.m_shapeList.visibility = 'hidden';
- console.log(myObject);
- return myObject
-
- },
- createBigBall:function (world, x, y) {
- var fixDef = new Box2D.Dynamics.b2FixtureDef;
- fixDef.density = 1000000.0;
- fixDef.friction = 0.5;
- fixDef.restitution = 0.2;
- fixDef.shape = new Box2D.Collision.Shapes.b2CircleShape(20/30);
-
- var bodyDef = new Box2D.Dynamics.b2BodyDef;
- bodyDef.type = Box2D.Dynamics.b2Body.b2_dynamicBody;
- bodyDef.position.x = x;
- bodyDef.position.y = y;
- var myobj = world.CreateBody(bodyDef).CreateFixture(fixDef)
- //console.log(myobj)
- return myobj;
- },
-
- /*
- 286
- Create standard boxes of given height , width at x,y
- 287
- */
-
- createPieBox:function (world, x, y, width, height,rotation,color, options){
-
- //default setting
-
- options = $.extend(true, {
- 'density':10000000.0 ,
- 'friction':1.0 ,
- 'restitution':0.2 ,
- 'linearDamping':0.0 ,
- 'angularDamping':0.0 ,
- 'gravityScale':0.0 ,
- 'type':b2Body.b2_dynamicBody
- }, options);
-
-
- var body_def = new b2BodyDef();
- var fix_def = new b2FixtureDef;
- fix_def.density = options.density;
- fix_def.friction = options.friction;
- fix_def.restitution = options.restitution;
- fix_def.shape = new b2PolygonShape();
- fix_def.shape.SetAsBox( width/scale , height/scale );
- body_def.position.Set(x/scale , y/scale);
- body_def.linearDamping = options.linearDamping;
- body_def.angularDamping = options.angularDamping;
- body_def.angle = rotation;
-
- body_def.type = options.type;
- var b = world.CreateBody( body_def );
- var f = b.CreateFixture(fix_def);
- f.m_userData = {type:"box",familyID:null,fillColor:color}
-
- return b;
-
- },
-
- createDataBallTarget:function (world,targetX,targetY, x, y,size,family) {
- //console.log("DBT")
- var xPos = x/scale+(Math.random()*0.1);
- var yPos = y/scale+(Math.random()*0.1);
-
- // CREATE BALL
- var fixDef = new Box2D.Dynamics.b2FixtureDef;
- fixDef.density = 0.1;
- fixDef.friction = 0.0;
- fixDef.restitution = 0.0;
- fixDef.shape = new Box2D.Collision.Shapes.b2CircleShape(size/scale);
- var bodyDef = new Box2D.Dynamics.b2BodyDef;
- bodyDef.type = Box2D.Dynamics.b2Body.b2_dynamicBody;
- bodyDef.position.x = xPos;
- bodyDef.position.y = yPos;
- var myobj = world.CreateBody(bodyDef).CreateFixture(fixDef);
-
- //CREATE JOIN MOUVEMENT TO TARGET
- var md = new b2MouseJointDef();
- md.bodyA = world.GetGroundBody();
- md.bodyB = myobj.GetBody();
- md.target.Set(xPos,yPos);
- md.collideConnected = true;
- md.maxForce = 50* myobj.GetBody().GetMass();
- mouseJoint = world.CreateJoint(md);
- mouseJoint.SetTarget(new b2Vec2(targetX/scale, targetY/scale));
-
- // ADD INFO IN OBJECT
- myobj.m_userData = {type:"PieBall",familyID:family,fillColor:colorScale(family)}
- categorys[family].value+=1;
- //setTimeout(function(){mouseJoint.SetTarget(chart.position.x/scale, chart.position.y/scale)},1000);
- categorys[family].joins.push(mouseJoint);
-
- return myobj;
- },
-
- createDataBallPie:function (world,target, x, y,size,family) {
- console.log(target)
- var xPos = categorys[family].incomingPoint.x/scale+(Math.random()*2/scale);
- var yPos = categorys[family].incomingPoint.y/scale;
-
- // CREATE BALL
- var fixDef = new Box2D.Dynamics.b2FixtureDef;
- fixDef.density = 0.1;
- fixDef.friction = 0.0;
- fixDef.restitution = 0.0;
- fixDef.shape = new Box2D.Collision.Shapes.b2CircleShape(size/scale);
-
- var bodyDef = new Box2D.Dynamics.b2BodyDef;
- bodyDef.type = Box2D.Dynamics.b2Body.b2_dynamicBody;
-
- bodyDef.position.x = xPos;
- bodyDef.position.y = yPos;
-
- // I need a distinct list with bodies (and not fixtures)
- var myo = world.CreateBody(bodyDef);
- myo.m_userData={type:"PieBall",familyID:family,fillColor:categorys[family].color}
-
- listBodies.push(myo);
- var myobj = myo.CreateFixture(fixDef);
-
- //CREATE JOIN MOUVEMENT TO TARGET
- var md = new b2MouseJointDef();
- md.bodyA = world.GetGroundBody();
- md.bodyB = myobj.GetBody();
- md.target.Set(xPos,yPos);
-
- md.collideConnected = true;
- md.maxForce = 100* myobj.GetBody().GetMass();
- mouseJoint = world.CreateJoint(md);
- mouseJoint.SetTarget(new b2Vec2(target.position.x/scale, target.position.y/scale));
-
- // ADD INFO IN OBJECT
- myobj.m_userData={type:"PieBall",familyID:family,fillColor:colorScale(family)}
- categorys[family].value+=1;
- //setTimeout(function(){mouseJoint.SetTarget(chart.position.x/scale, chart.position.y/scale)},1000);
-
- return myobj;
- },
-
- createDataBall:function (_this, x, y,size) {
- var fixDef = new Box2D.Dynamics.b2FixtureDef;
- fixDef.density = 1.0;
- fixDef.friction = 0.5;
- fixDef.restitution = 0.2;
- fixDef.shape = new Box2D.Collision.Shapes.b2CircleShape(size/_this.settings.options.scale);
-
- var bodyDef = new Box2D.Dynamics.b2BodyDef;
- bodyDef.type = Box2D.Dynamics.b2Body.b2_dynamicBody;
- bodyDef.position.x = x;//+(Math.random())
- bodyDef.position.y = y;
-
- var myobj = _this.world.CreateBody(bodyDef).CreateFixture(fixDef)
- myobj.m_userData={type:"PieBall",
- familyID:'family',// add family ///
- fillColor:"rgb(200,0,0)"}// add color
-
- //console.log(myobj)
- return myobj;
- },
-
-}
-
-})(jQuery);
--- a/integ/js/vs/lib/Box2DWeb/Box2DWeb-2.1.a.3.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10866 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
-*
-* This software is provided 'as-is', without any express or implied
-* warranty. In no event will the authors be held liable for any damages
-* arising from the use of this software.
-* Permission is granted to anyone to use this software for any purpose,
-* including commercial applications, and to alter it and redistribute it
-* freely, subject to the following restrictions:
-* 1. The origin of this software must not be misrepresented; you must not
-* claim that you wrote the original software. If you use this software
-* in a product, an acknowledgment in the product documentation would be
-* appreciated but is not required.
-* 2. Altered source versions must be plainly marked as such, and must not be
-* misrepresented as being the original software.
-* 3. This notice may not be removed or altered from any source distribution.
-*/
-var Box2D = {};
-
-(function (a2j, undefined) {
-
- if(!(Object.prototype.defineProperty instanceof Function)
- && Object.prototype.__defineGetter__ instanceof Function
- && Object.prototype.__defineSetter__ instanceof Function)
- {
- Object.defineProperty = function(obj, p, cfg) {
- if(cfg.get instanceof Function)
- obj.__defineGetter__(p, cfg.get);
- if(cfg.set instanceof Function)
- obj.__defineSetter__(p, cfg.set);
- }
- }
-
- function emptyFn() {};
- a2j.inherit = function(cls, base) {
- var tmpCtr = cls;
- emptyFn.prototype = base.prototype;
- cls.prototype = new emptyFn;
- cls.prototype.constructor = tmpCtr;
- };
-
- a2j.generateCallback = function generateCallback(context, cb) {
- return function () {
- cb.apply(context, arguments);
- };
- };
-
- a2j.NVector = function NVector(length) {
- if (length === undefined) length = 0;
- var tmp = new Array(length || 0);
- for (var i = 0; i < length; ++i)
- tmp[i] = 0;
- return tmp;
- };
-
- a2j.is = function is(o1, o2) {
- if (o1 === null) return false;
- if ((o2 instanceof Function) && (o1 instanceof o2)) return true;
- if ((o1.constructor.__implements != undefined) && (o1.constructor.__implements[o2])) return true;
- return false;
- };
-
- a2j.parseUInt = function(v) {
- return Math.abs(parseInt(v));
- }
-
-})(Box2D);
-
-//#TODO remove assignments from global namespace
-var Vector = Array;
-var Vector_a2j_Number = Box2D.NVector;
-//package structure
-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 = {};
-//pre-definitions
-(function () {
- Box2D.Collision.IBroadPhase = 'Box2D.Collision.IBroadPhase';
-
- function b2AABB() {
- b2AABB.b2AABB.apply(this, arguments);
- };
- Box2D.Collision.b2AABB = b2AABB;
-
- function b2Bound() {
- b2Bound.b2Bound.apply(this, arguments);
- };
- Box2D.Collision.b2Bound = b2Bound;
-
- function b2BoundValues() {
- b2BoundValues.b2BoundValues.apply(this, arguments);
- if (this.constructor === b2BoundValues) this.b2BoundValues.apply(this, arguments);
- };
- Box2D.Collision.b2BoundValues = b2BoundValues;
-
- function b2Collision() {
- b2Collision.b2Collision.apply(this, arguments);
- };
- Box2D.Collision.b2Collision = b2Collision;
-
- function b2ContactID() {
- b2ContactID.b2ContactID.apply(this, arguments);
- if (this.constructor === b2ContactID) this.b2ContactID.apply(this, arguments);
- };
- Box2D.Collision.b2ContactID = b2ContactID;
-
- function b2ContactPoint() {
- b2ContactPoint.b2ContactPoint.apply(this, arguments);
- };
- Box2D.Collision.b2ContactPoint = b2ContactPoint;
-
- function b2Distance() {
- b2Distance.b2Distance.apply(this, arguments);
- };
- Box2D.Collision.b2Distance = b2Distance;
-
- function b2DistanceInput() {
- b2DistanceInput.b2DistanceInput.apply(this, arguments);
- };
- Box2D.Collision.b2DistanceInput = b2DistanceInput;
-
- function b2DistanceOutput() {
- b2DistanceOutput.b2DistanceOutput.apply(this, arguments);
- };
- Box2D.Collision.b2DistanceOutput = b2DistanceOutput;
-
- function b2DistanceProxy() {
- b2DistanceProxy.b2DistanceProxy.apply(this, arguments);
- };
- Box2D.Collision.b2DistanceProxy = b2DistanceProxy;
-
- function b2DynamicTree() {
- b2DynamicTree.b2DynamicTree.apply(this, arguments);
- if (this.constructor === b2DynamicTree) this.b2DynamicTree.apply(this, arguments);
- };
- Box2D.Collision.b2DynamicTree = b2DynamicTree;
-
- function b2DynamicTreeBroadPhase() {
- b2DynamicTreeBroadPhase.b2DynamicTreeBroadPhase.apply(this, arguments);
- };
- Box2D.Collision.b2DynamicTreeBroadPhase = b2DynamicTreeBroadPhase;
-
- function b2DynamicTreeNode() {
- b2DynamicTreeNode.b2DynamicTreeNode.apply(this, arguments);
- };
- Box2D.Collision.b2DynamicTreeNode = b2DynamicTreeNode;
-
- function b2DynamicTreePair() {
- b2DynamicTreePair.b2DynamicTreePair.apply(this, arguments);
- };
- Box2D.Collision.b2DynamicTreePair = b2DynamicTreePair;
-
- function b2Manifold() {
- b2Manifold.b2Manifold.apply(this, arguments);
- if (this.constructor === b2Manifold) this.b2Manifold.apply(this, arguments);
- };
- Box2D.Collision.b2Manifold = b2Manifold;
-
- function b2ManifoldPoint() {
- b2ManifoldPoint.b2ManifoldPoint.apply(this, arguments);
- if (this.constructor === b2ManifoldPoint) this.b2ManifoldPoint.apply(this, arguments);
- };
- Box2D.Collision.b2ManifoldPoint = b2ManifoldPoint;
-
- function b2Point() {
- b2Point.b2Point.apply(this, arguments);
- };
- Box2D.Collision.b2Point = b2Point;
-
- function b2RayCastInput() {
- b2RayCastInput.b2RayCastInput.apply(this, arguments);
- if (this.constructor === b2RayCastInput) this.b2RayCastInput.apply(this, arguments);
- };
- Box2D.Collision.b2RayCastInput = b2RayCastInput;
-
- function b2RayCastOutput() {
- b2RayCastOutput.b2RayCastOutput.apply(this, arguments);
- };
- Box2D.Collision.b2RayCastOutput = b2RayCastOutput;
-
- function b2Segment() {
- b2Segment.b2Segment.apply(this, arguments);
- };
- Box2D.Collision.b2Segment = b2Segment;
-
- function b2SeparationFunction() {
- b2SeparationFunction.b2SeparationFunction.apply(this, arguments);
- };
- Box2D.Collision.b2SeparationFunction = b2SeparationFunction;
-
- function b2Simplex() {
- b2Simplex.b2Simplex.apply(this, arguments);
- if (this.constructor === b2Simplex) this.b2Simplex.apply(this, arguments);
- };
- Box2D.Collision.b2Simplex = b2Simplex;
-
- function b2SimplexCache() {
- b2SimplexCache.b2SimplexCache.apply(this, arguments);
- };
- Box2D.Collision.b2SimplexCache = b2SimplexCache;
-
- function b2SimplexVertex() {
- b2SimplexVertex.b2SimplexVertex.apply(this, arguments);
- };
- Box2D.Collision.b2SimplexVertex = b2SimplexVertex;
-
- function b2TimeOfImpact() {
- b2TimeOfImpact.b2TimeOfImpact.apply(this, arguments);
- };
- Box2D.Collision.b2TimeOfImpact = b2TimeOfImpact;
-
- function b2TOIInput() {
- b2TOIInput.b2TOIInput.apply(this, arguments);
- };
- Box2D.Collision.b2TOIInput = b2TOIInput;
-
- function b2WorldManifold() {
- b2WorldManifold.b2WorldManifold.apply(this, arguments);
- if (this.constructor === b2WorldManifold) this.b2WorldManifold.apply(this, arguments);
- };
- Box2D.Collision.b2WorldManifold = b2WorldManifold;
-
- function ClipVertex() {
- ClipVertex.ClipVertex.apply(this, arguments);
- };
- Box2D.Collision.ClipVertex = ClipVertex;
-
- function Features() {
- Features.Features.apply(this, arguments);
- };
- Box2D.Collision.Features = Features;
-
- function b2CircleShape() {
- b2CircleShape.b2CircleShape.apply(this, arguments);
- if (this.constructor === b2CircleShape) this.b2CircleShape.apply(this, arguments);
- };
- Box2D.Collision.Shapes.b2CircleShape = b2CircleShape;
-
- function b2EdgeChainDef() {
- b2EdgeChainDef.b2EdgeChainDef.apply(this, arguments);
- if (this.constructor === b2EdgeChainDef) this.b2EdgeChainDef.apply(this, arguments);
- };
- Box2D.Collision.Shapes.b2EdgeChainDef = b2EdgeChainDef;
-
- function b2EdgeShape() {
- b2EdgeShape.b2EdgeShape.apply(this, arguments);
- if (this.constructor === b2EdgeShape) this.b2EdgeShape.apply(this, arguments);
- };
- Box2D.Collision.Shapes.b2EdgeShape = b2EdgeShape;
-
- function b2MassData() {
- b2MassData.b2MassData.apply(this, arguments);
- };
- Box2D.Collision.Shapes.b2MassData = b2MassData;
-
- function b2PolygonShape() {
- b2PolygonShape.b2PolygonShape.apply(this, arguments);
- if (this.constructor === b2PolygonShape) this.b2PolygonShape.apply(this, arguments);
- };
- Box2D.Collision.Shapes.b2PolygonShape = b2PolygonShape;
-
- function b2Shape() {
- b2Shape.b2Shape.apply(this, arguments);
- if (this.constructor === b2Shape) this.b2Shape.apply(this, arguments);
- };
- Box2D.Collision.Shapes.b2Shape = b2Shape;
- Box2D.Common.b2internal = 'Box2D.Common.b2internal';
-
- function b2Color() {
- b2Color.b2Color.apply(this, arguments);
- if (this.constructor === b2Color) this.b2Color.apply(this, arguments);
- };
- Box2D.Common.b2Color = b2Color;
-
- function b2Settings() {
- b2Settings.b2Settings.apply(this, arguments);
- };
- Box2D.Common.b2Settings = b2Settings;
-
- function b2Mat22() {
- b2Mat22.b2Mat22.apply(this, arguments);
- if (this.constructor === b2Mat22) this.b2Mat22.apply(this, arguments);
- };
- Box2D.Common.Math.b2Mat22 = b2Mat22;
-
- function b2Mat33() {
- b2Mat33.b2Mat33.apply(this, arguments);
- if (this.constructor === b2Mat33) this.b2Mat33.apply(this, arguments);
- };
- Box2D.Common.Math.b2Mat33 = b2Mat33;
-
- function b2Math() {
- b2Math.b2Math.apply(this, arguments);
- };
- Box2D.Common.Math.b2Math = b2Math;
-
- function b2Sweep() {
- b2Sweep.b2Sweep.apply(this, arguments);
- };
- Box2D.Common.Math.b2Sweep = b2Sweep;
-
- function b2Transform() {
- b2Transform.b2Transform.apply(this, arguments);
- if (this.constructor === b2Transform) this.b2Transform.apply(this, arguments);
- };
- Box2D.Common.Math.b2Transform = b2Transform;
-
- function b2Vec2() {
- b2Vec2.b2Vec2.apply(this, arguments);
- if (this.constructor === b2Vec2) this.b2Vec2.apply(this, arguments);
- };
- Box2D.Common.Math.b2Vec2 = b2Vec2;
-
- function b2Vec3() {
- b2Vec3.b2Vec3.apply(this, arguments);
- if (this.constructor === b2Vec3) this.b2Vec3.apply(this, arguments);
- };
- Box2D.Common.Math.b2Vec3 = b2Vec3;
-
- function b2Body() {
- b2Body.b2Body.apply(this, arguments);
- if (this.constructor === b2Body) this.b2Body.apply(this, arguments);
- };
- Box2D.Dynamics.b2Body = b2Body;
-
- function b2BodyDef() {
- b2BodyDef.b2BodyDef.apply(this, arguments);
- if (this.constructor === b2BodyDef) this.b2BodyDef.apply(this, arguments);
- };
- Box2D.Dynamics.b2BodyDef = b2BodyDef;
-
- function b2ContactFilter() {
- b2ContactFilter.b2ContactFilter.apply(this, arguments);
- };
- Box2D.Dynamics.b2ContactFilter = b2ContactFilter;
-
- function b2ContactImpulse() {
- b2ContactImpulse.b2ContactImpulse.apply(this, arguments);
- };
- Box2D.Dynamics.b2ContactImpulse = b2ContactImpulse;
-
- function b2ContactListener() {
- b2ContactListener.b2ContactListener.apply(this, arguments);
- };
- Box2D.Dynamics.b2ContactListener = b2ContactListener;
-
- function b2ContactManager() {
- b2ContactManager.b2ContactManager.apply(this, arguments);
- if (this.constructor === b2ContactManager) this.b2ContactManager.apply(this, arguments);
- };
- Box2D.Dynamics.b2ContactManager = b2ContactManager;
-
- function b2DebugDraw() {
- b2DebugDraw.b2DebugDraw.apply(this, arguments);
- if (this.constructor === b2DebugDraw) this.b2DebugDraw.apply(this, arguments);
- };
- Box2D.Dynamics.b2DebugDraw = b2DebugDraw;
-
- function b2DestructionListener() {
- b2DestructionListener.b2DestructionListener.apply(this, arguments);
- };
- Box2D.Dynamics.b2DestructionListener = b2DestructionListener;
-
- function b2FilterData() {
- b2FilterData.b2FilterData.apply(this, arguments);
- };
- Box2D.Dynamics.b2FilterData = b2FilterData;
-
- function b2Fixture() {
- b2Fixture.b2Fixture.apply(this, arguments);
- if (this.constructor === b2Fixture) this.b2Fixture.apply(this, arguments);
- };
- Box2D.Dynamics.b2Fixture = b2Fixture;
-
- function b2FixtureDef() {
- b2FixtureDef.b2FixtureDef.apply(this, arguments);
- if (this.constructor === b2FixtureDef) this.b2FixtureDef.apply(this, arguments);
- };
- Box2D.Dynamics.b2FixtureDef = b2FixtureDef;
-
- function b2Island() {
- b2Island.b2Island.apply(this, arguments);
- if (this.constructor === b2Island) this.b2Island.apply(this, arguments);
- };
- Box2D.Dynamics.b2Island = b2Island;
-
- function b2TimeStep() {
- b2TimeStep.b2TimeStep.apply(this, arguments);
- };
- Box2D.Dynamics.b2TimeStep = b2TimeStep;
-
- function b2World() {
- b2World.b2World.apply(this, arguments);
- if (this.constructor === b2World) this.b2World.apply(this, arguments);
- };
- Box2D.Dynamics.b2World = b2World;
-
- function b2CircleContact() {
- b2CircleContact.b2CircleContact.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2CircleContact = b2CircleContact;
-
- function b2Contact() {
- b2Contact.b2Contact.apply(this, arguments);
- if (this.constructor === b2Contact) this.b2Contact.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2Contact = b2Contact;
-
- function b2ContactConstraint() {
- b2ContactConstraint.b2ContactConstraint.apply(this, arguments);
- if (this.constructor === b2ContactConstraint) this.b2ContactConstraint.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2ContactConstraint = b2ContactConstraint;
-
- function b2ContactConstraintPoint() {
- b2ContactConstraintPoint.b2ContactConstraintPoint.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2ContactConstraintPoint = b2ContactConstraintPoint;
-
- function b2ContactEdge() {
- b2ContactEdge.b2ContactEdge.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2ContactEdge = b2ContactEdge;
-
- function b2ContactFactory() {
- b2ContactFactory.b2ContactFactory.apply(this, arguments);
- if (this.constructor === b2ContactFactory) this.b2ContactFactory.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2ContactFactory = b2ContactFactory;
-
- function b2ContactRegister() {
- b2ContactRegister.b2ContactRegister.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2ContactRegister = b2ContactRegister;
-
- function b2ContactResult() {
- b2ContactResult.b2ContactResult.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2ContactResult = b2ContactResult;
-
- function b2ContactSolver() {
- b2ContactSolver.b2ContactSolver.apply(this, arguments);
- if (this.constructor === b2ContactSolver) this.b2ContactSolver.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2ContactSolver = b2ContactSolver;
-
- function b2EdgeAndCircleContact() {
- b2EdgeAndCircleContact.b2EdgeAndCircleContact.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2EdgeAndCircleContact = b2EdgeAndCircleContact;
-
- function b2NullContact() {
- b2NullContact.b2NullContact.apply(this, arguments);
- if (this.constructor === b2NullContact) this.b2NullContact.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2NullContact = b2NullContact;
-
- function b2PolyAndCircleContact() {
- b2PolyAndCircleContact.b2PolyAndCircleContact.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2PolyAndCircleContact = b2PolyAndCircleContact;
-
- function b2PolyAndEdgeContact() {
- b2PolyAndEdgeContact.b2PolyAndEdgeContact.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2PolyAndEdgeContact = b2PolyAndEdgeContact;
-
- function b2PolygonContact() {
- b2PolygonContact.b2PolygonContact.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2PolygonContact = b2PolygonContact;
-
- function b2PositionSolverManifold() {
- b2PositionSolverManifold.b2PositionSolverManifold.apply(this, arguments);
- if (this.constructor === b2PositionSolverManifold) this.b2PositionSolverManifold.apply(this, arguments);
- };
- Box2D.Dynamics.Contacts.b2PositionSolverManifold = b2PositionSolverManifold;
-
- function b2BuoyancyController() {
- b2BuoyancyController.b2BuoyancyController.apply(this, arguments);
- };
- Box2D.Dynamics.Controllers.b2BuoyancyController = b2BuoyancyController;
-
- function b2ConstantAccelController() {
- b2ConstantAccelController.b2ConstantAccelController.apply(this, arguments);
- };
- Box2D.Dynamics.Controllers.b2ConstantAccelController = b2ConstantAccelController;
-
- function b2ConstantForceController() {
- b2ConstantForceController.b2ConstantForceController.apply(this, arguments);
- };
- Box2D.Dynamics.Controllers.b2ConstantForceController = b2ConstantForceController;
-
- function b2Controller() {
- b2Controller.b2Controller.apply(this, arguments);
- };
- Box2D.Dynamics.Controllers.b2Controller = b2Controller;
-
- function b2ControllerEdge() {
- b2ControllerEdge.b2ControllerEdge.apply(this, arguments);
- };
- Box2D.Dynamics.Controllers.b2ControllerEdge = b2ControllerEdge;
-
- function b2GravityController() {
- b2GravityController.b2GravityController.apply(this, arguments);
- };
- Box2D.Dynamics.Controllers.b2GravityController = b2GravityController;
-
- function b2TensorDampingController() {
- b2TensorDampingController.b2TensorDampingController.apply(this, arguments);
- };
- Box2D.Dynamics.Controllers.b2TensorDampingController = b2TensorDampingController;
-
- function b2DistanceJoint() {
- b2DistanceJoint.b2DistanceJoint.apply(this, arguments);
- if (this.constructor === b2DistanceJoint) this.b2DistanceJoint.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2DistanceJoint = b2DistanceJoint;
-
- function b2DistanceJointDef() {
- b2DistanceJointDef.b2DistanceJointDef.apply(this, arguments);
- if (this.constructor === b2DistanceJointDef) this.b2DistanceJointDef.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2DistanceJointDef = b2DistanceJointDef;
-
- function b2FrictionJoint() {
- b2FrictionJoint.b2FrictionJoint.apply(this, arguments);
- if (this.constructor === b2FrictionJoint) this.b2FrictionJoint.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2FrictionJoint = b2FrictionJoint;
-
- function b2FrictionJointDef() {
- b2FrictionJointDef.b2FrictionJointDef.apply(this, arguments);
- if (this.constructor === b2FrictionJointDef) this.b2FrictionJointDef.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2FrictionJointDef = b2FrictionJointDef;
-
- function b2GearJoint() {
- b2GearJoint.b2GearJoint.apply(this, arguments);
- if (this.constructor === b2GearJoint) this.b2GearJoint.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2GearJoint = b2GearJoint;
-
- function b2GearJointDef() {
- b2GearJointDef.b2GearJointDef.apply(this, arguments);
- if (this.constructor === b2GearJointDef) this.b2GearJointDef.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2GearJointDef = b2GearJointDef;
-
- function b2Jacobian() {
- b2Jacobian.b2Jacobian.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2Jacobian = b2Jacobian;
-
- function b2Joint() {
- b2Joint.b2Joint.apply(this, arguments);
- if (this.constructor === b2Joint) this.b2Joint.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2Joint = b2Joint;
-
- function b2JointDef() {
- b2JointDef.b2JointDef.apply(this, arguments);
- if (this.constructor === b2JointDef) this.b2JointDef.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2JointDef = b2JointDef;
-
- function b2JointEdge() {
- b2JointEdge.b2JointEdge.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2JointEdge = b2JointEdge;
-
- function b2LineJoint() {
- b2LineJoint.b2LineJoint.apply(this, arguments);
- if (this.constructor === b2LineJoint) this.b2LineJoint.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2LineJoint = b2LineJoint;
-
- function b2LineJointDef() {
- b2LineJointDef.b2LineJointDef.apply(this, arguments);
- if (this.constructor === b2LineJointDef) this.b2LineJointDef.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2LineJointDef = b2LineJointDef;
-
- function b2MouseJoint() {
- b2MouseJoint.b2MouseJoint.apply(this, arguments);
- if (this.constructor === b2MouseJoint) this.b2MouseJoint.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2MouseJoint = b2MouseJoint;
-
- function b2MouseJointDef() {
- b2MouseJointDef.b2MouseJointDef.apply(this, arguments);
- if (this.constructor === b2MouseJointDef) this.b2MouseJointDef.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2MouseJointDef = b2MouseJointDef;
-
- function b2PrismaticJoint() {
- b2PrismaticJoint.b2PrismaticJoint.apply(this, arguments);
- if (this.constructor === b2PrismaticJoint) this.b2PrismaticJoint.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2PrismaticJoint = b2PrismaticJoint;
-
- function b2PrismaticJointDef() {
- b2PrismaticJointDef.b2PrismaticJointDef.apply(this, arguments);
- if (this.constructor === b2PrismaticJointDef) this.b2PrismaticJointDef.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2PrismaticJointDef = b2PrismaticJointDef;
-
- function b2PulleyJoint() {
- b2PulleyJoint.b2PulleyJoint.apply(this, arguments);
- if (this.constructor === b2PulleyJoint) this.b2PulleyJoint.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2PulleyJoint = b2PulleyJoint;
-
- function b2PulleyJointDef() {
- b2PulleyJointDef.b2PulleyJointDef.apply(this, arguments);
- if (this.constructor === b2PulleyJointDef) this.b2PulleyJointDef.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2PulleyJointDef = b2PulleyJointDef;
-
- function b2RevoluteJoint() {
- b2RevoluteJoint.b2RevoluteJoint.apply(this, arguments);
- if (this.constructor === b2RevoluteJoint) this.b2RevoluteJoint.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2RevoluteJoint = b2RevoluteJoint;
-
- function b2RevoluteJointDef() {
- b2RevoluteJointDef.b2RevoluteJointDef.apply(this, arguments);
- if (this.constructor === b2RevoluteJointDef) this.b2RevoluteJointDef.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2RevoluteJointDef = b2RevoluteJointDef;
-
- function b2WeldJoint() {
- b2WeldJoint.b2WeldJoint.apply(this, arguments);
- if (this.constructor === b2WeldJoint) this.b2WeldJoint.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2WeldJoint = b2WeldJoint;
-
- function b2WeldJointDef() {
- b2WeldJointDef.b2WeldJointDef.apply(this, arguments);
- if (this.constructor === b2WeldJointDef) this.b2WeldJointDef.apply(this, arguments);
- };
- Box2D.Dynamics.Joints.b2WeldJointDef = b2WeldJointDef;
-})(); //definitions
-Box2D.postDefs = [];
-(function () {
- var b2CircleShape = Box2D.Collision.Shapes.b2CircleShape,
- b2EdgeChainDef = Box2D.Collision.Shapes.b2EdgeChainDef,
- b2EdgeShape = Box2D.Collision.Shapes.b2EdgeShape,
- b2MassData = Box2D.Collision.Shapes.b2MassData,
- b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape,
- b2Shape = Box2D.Collision.Shapes.b2Shape,
- b2Color = Box2D.Common.b2Color,
- b2internal = Box2D.Common.b2internal,
- b2Settings = Box2D.Common.b2Settings,
- b2Mat22 = Box2D.Common.Math.b2Mat22,
- b2Mat33 = Box2D.Common.Math.b2Mat33,
- b2Math = Box2D.Common.Math.b2Math,
- b2Sweep = Box2D.Common.Math.b2Sweep,
- b2Transform = Box2D.Common.Math.b2Transform,
- b2Vec2 = Box2D.Common.Math.b2Vec2,
- b2Vec3 = Box2D.Common.Math.b2Vec3,
- b2AABB = Box2D.Collision.b2AABB,
- b2Bound = Box2D.Collision.b2Bound,
- b2BoundValues = Box2D.Collision.b2BoundValues,
- b2Collision = Box2D.Collision.b2Collision,
- b2ContactID = Box2D.Collision.b2ContactID,
- b2ContactPoint = Box2D.Collision.b2ContactPoint,
- b2Distance = Box2D.Collision.b2Distance,
- b2DistanceInput = Box2D.Collision.b2DistanceInput,
- b2DistanceOutput = Box2D.Collision.b2DistanceOutput,
- b2DistanceProxy = Box2D.Collision.b2DistanceProxy,
- b2DynamicTree = Box2D.Collision.b2DynamicTree,
- b2DynamicTreeBroadPhase = Box2D.Collision.b2DynamicTreeBroadPhase,
- b2DynamicTreeNode = Box2D.Collision.b2DynamicTreeNode,
- b2DynamicTreePair = Box2D.Collision.b2DynamicTreePair,
- b2Manifold = Box2D.Collision.b2Manifold,
- b2ManifoldPoint = Box2D.Collision.b2ManifoldPoint,
- b2Point = Box2D.Collision.b2Point,
- b2RayCastInput = Box2D.Collision.b2RayCastInput,
- b2RayCastOutput = Box2D.Collision.b2RayCastOutput,
- b2Segment = Box2D.Collision.b2Segment,
- b2SeparationFunction = Box2D.Collision.b2SeparationFunction,
- b2Simplex = Box2D.Collision.b2Simplex,
- b2SimplexCache = Box2D.Collision.b2SimplexCache,
- b2SimplexVertex = Box2D.Collision.b2SimplexVertex,
- b2TimeOfImpact = Box2D.Collision.b2TimeOfImpact,
- b2TOIInput = Box2D.Collision.b2TOIInput,
- b2WorldManifold = Box2D.Collision.b2WorldManifold,
- ClipVertex = Box2D.Collision.ClipVertex,
- Features = Box2D.Collision.Features,
- IBroadPhase = Box2D.Collision.IBroadPhase;
-
- b2AABB.b2AABB = function () {
- this.lowerBound = new b2Vec2();
- this.upperBound = new b2Vec2();
- };
- b2AABB.prototype.IsValid = function () {
- var dX = this.upperBound.x - this.lowerBound.x;
- var dY = this.upperBound.y - this.lowerBound.y;
- var valid = dX >= 0.0 && dY >= 0.0;
- valid = valid && this.lowerBound.IsValid() && this.upperBound.IsValid();
- return valid;
- }
- b2AABB.prototype.GetCenter = function () {
- return new b2Vec2((this.lowerBound.x + this.upperBound.x) / 2, (this.lowerBound.y + this.upperBound.y) / 2);
- }
- b2AABB.prototype.GetExtents = function () {
- return new b2Vec2((this.upperBound.x - this.lowerBound.x) / 2, (this.upperBound.y - this.lowerBound.y) / 2);
- }
- b2AABB.prototype.Contains = function (aabb) {
- var result = true;
- result = result && this.lowerBound.x <= aabb.lowerBound.x;
- result = result && this.lowerBound.y <= aabb.lowerBound.y;
- result = result && aabb.upperBound.x <= this.upperBound.x;
- result = result && aabb.upperBound.y <= this.upperBound.y;
- return result;
- }
- b2AABB.prototype.RayCast = function (output, input) {
- var tmin = (-Number.MAX_VALUE);
- var tmax = Number.MAX_VALUE;
- var pX = input.p1.x;
- var pY = input.p1.y;
- var dX = input.p2.x - input.p1.x;
- var dY = input.p2.y - input.p1.y;
- var absDX = Math.abs(dX);
- var absDY = Math.abs(dY);
- var normal = output.normal;
- var inv_d = 0;
- var t1 = 0;
- var t2 = 0;
- var t3 = 0;
- var s = 0; {
- if (absDX < Number.MIN_VALUE) {
- if (pX < this.lowerBound.x || this.upperBound.x < pX) return false;
- }
- else {
- inv_d = 1.0 / dX;
- t1 = (this.lowerBound.x - pX) * inv_d;
- t2 = (this.upperBound.x - pX) * inv_d;
- s = (-1.0);
- if (t1 > t2) {
- t3 = t1;
- t1 = t2;
- t2 = t3;
- s = 1.0;
- }
- if (t1 > tmin) {
- normal.x = s;
- normal.y = 0;
- tmin = t1;
- }
- tmax = Math.min(tmax, t2);
- if (tmin > tmax) return false;
- }
- } {
- if (absDY < Number.MIN_VALUE) {
- if (pY < this.lowerBound.y || this.upperBound.y < pY) return false;
- }
- else {
- inv_d = 1.0 / dY;
- t1 = (this.lowerBound.y - pY) * inv_d;
- t2 = (this.upperBound.y - pY) * inv_d;
- s = (-1.0);
- if (t1 > t2) {
- t3 = t1;
- t1 = t2;
- t2 = t3;
- s = 1.0;
- }
- if (t1 > tmin) {
- normal.y = s;
- normal.x = 0;
- tmin = t1;
- }
- tmax = Math.min(tmax, t2);
- if (tmin > tmax) return false;
- }
- }
- output.fraction = tmin;
- return true;
- }
- b2AABB.prototype.TestOverlap = function (other) {
- var d1X = other.lowerBound.x - this.upperBound.x;
- var d1Y = other.lowerBound.y - this.upperBound.y;
- var d2X = this.lowerBound.x - other.upperBound.x;
- var d2Y = this.lowerBound.y - other.upperBound.y;
- if (d1X > 0.0 || d1Y > 0.0) return false;
- if (d2X > 0.0 || d2Y > 0.0) return false;
- return true;
- }
- b2AABB.Combine = function (aabb1, aabb2) {
- var aabb = new b2AABB();
- aabb.Combine(aabb1, aabb2);
- return aabb;
- }
- b2AABB.prototype.Combine = function (aabb1, aabb2) {
- this.lowerBound.x = Math.min(aabb1.lowerBound.x, aabb2.lowerBound.x);
- this.lowerBound.y = Math.min(aabb1.lowerBound.y, aabb2.lowerBound.y);
- this.upperBound.x = Math.max(aabb1.upperBound.x, aabb2.upperBound.x);
- this.upperBound.y = Math.max(aabb1.upperBound.y, aabb2.upperBound.y);
- }
- b2Bound.b2Bound = function () {};
- b2Bound.prototype.IsLower = function () {
- return (this.value & 1) == 0;
- }
- b2Bound.prototype.IsUpper = function () {
- return (this.value & 1) == 1;
- }
- b2Bound.prototype.Swap = function (b) {
- var tempValue = this.value;
- var tempProxy = this.proxy;
- var tempStabbingCount = this.stabbingCount;
- this.value = b.value;
- this.proxy = b.proxy;
- this.stabbingCount = b.stabbingCount;
- b.value = tempValue;
- b.proxy = tempProxy;
- b.stabbingCount = tempStabbingCount;
- }
- b2BoundValues.b2BoundValues = function () {};
- b2BoundValues.prototype.b2BoundValues = function () {
- this.lowerValues = new Vector_a2j_Number();
- this.lowerValues[0] = 0.0;
- this.lowerValues[1] = 0.0;
- this.upperValues = new Vector_a2j_Number();
- this.upperValues[0] = 0.0;
- this.upperValues[1] = 0.0;
- }
- b2Collision.b2Collision = function () {};
- b2Collision.ClipSegmentToLine = function (vOut, vIn, normal, offset) {
- if (offset === undefined) offset = 0;
- var cv;
- var numOut = 0;
- cv = vIn[0];
- var vIn0 = cv.v;
- cv = vIn[1];
- var vIn1 = cv.v;
- var distance0 = normal.x * vIn0.x + normal.y * vIn0.y - offset;
- var distance1 = normal.x * vIn1.x + normal.y * vIn1.y - offset;
- if (distance0 <= 0.0) vOut[numOut++].Set(vIn[0]);
- if (distance1 <= 0.0) vOut[numOut++].Set(vIn[1]);
- if (distance0 * distance1 < 0.0) {
- var interp = distance0 / (distance0 - distance1);
- cv = vOut[numOut];
- var tVec = cv.v;
- tVec.x = vIn0.x + interp * (vIn1.x - vIn0.x);
- tVec.y = vIn0.y + interp * (vIn1.y - vIn0.y);
- cv = vOut[numOut];
- var cv2;
- if (distance0 > 0.0) {
- cv2 = vIn[0];
- cv.id = cv2.id;
- }
- else {
- cv2 = vIn[1];
- cv.id = cv2.id;
- }++numOut;
- }
- return numOut;
- }
- b2Collision.EdgeSeparation = function (poly1, xf1, edge1, poly2, xf2) {
- if (edge1 === undefined) edge1 = 0;
- var count1 = parseInt(poly1.m_vertexCount);
- var vertices1 = poly1.m_vertices;
- var normals1 = poly1.m_normals;
- var count2 = parseInt(poly2.m_vertexCount);
- var vertices2 = poly2.m_vertices;
- var tMat;
- var tVec;
- tMat = xf1.R;
- tVec = normals1[edge1];
- var normal1WorldX = (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var normal1WorldY = (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tMat = xf2.R;
- var normal1X = (tMat.col1.x * normal1WorldX + tMat.col1.y * normal1WorldY);
- var normal1Y = (tMat.col2.x * normal1WorldX + tMat.col2.y * normal1WorldY);
- var index = 0;
- var minDot = Number.MAX_VALUE;
- for (var i = 0; i < count2; ++i) {
- tVec = vertices2[i];
- var dot = tVec.x * normal1X + tVec.y * normal1Y;
- if (dot < minDot) {
- minDot = dot;
- index = i;
- }
- }
- tVec = vertices1[edge1];
- tMat = xf1.R;
- var v1X = xf1.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var v1Y = xf1.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tVec = vertices2[index];
- tMat = xf2.R;
- var v2X = xf2.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var v2Y = xf2.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- v2X -= v1X;
- v2Y -= v1Y;
- var separation = v2X * normal1WorldX + v2Y * normal1WorldY;
- return separation;
- }
- b2Collision.FindMaxSeparation = function (edgeIndex, poly1, xf1, poly2, xf2) {
- var count1 = parseInt(poly1.m_vertexCount);
- var normals1 = poly1.m_normals;
- var tVec;
- var tMat;
- tMat = xf2.R;
- tVec = poly2.m_centroid;
- var dX = xf2.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var dY = xf2.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tMat = xf1.R;
- tVec = poly1.m_centroid;
- dX -= xf1.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- dY -= xf1.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- var dLocal1X = (dX * xf1.R.col1.x + dY * xf1.R.col1.y);
- var dLocal1Y = (dX * xf1.R.col2.x + dY * xf1.R.col2.y);
- var edge = 0;
- var maxDot = (-Number.MAX_VALUE);
- for (var i = 0; i < count1; ++i) {
- tVec = normals1[i];
- var dot = (tVec.x * dLocal1X + tVec.y * dLocal1Y);
- if (dot > maxDot) {
- maxDot = dot;
- edge = i;
- }
- }
- var s = b2Collision.EdgeSeparation(poly1, xf1, edge, poly2, xf2);
- var prevEdge = parseInt(edge - 1 >= 0 ? edge - 1 : count1 - 1);
- var sPrev = b2Collision.EdgeSeparation(poly1, xf1, prevEdge, poly2, xf2);
- var nextEdge = parseInt(edge + 1 < count1 ? edge + 1 : 0);
- var sNext = b2Collision.EdgeSeparation(poly1, xf1, nextEdge, poly2, xf2);
- var bestEdge = 0;
- var bestSeparation = 0;
- var increment = 0;
- if (sPrev > s && sPrev > sNext) {
- increment = (-1);
- bestEdge = prevEdge;
- bestSeparation = sPrev;
- }
- else if (sNext > s) {
- increment = 1;
- bestEdge = nextEdge;
- bestSeparation = sNext;
- }
- else {
- edgeIndex[0] = edge;
- return s;
- }
- while (true) {
- if (increment == (-1)) edge = bestEdge - 1 >= 0 ? bestEdge - 1 : count1 - 1;
- else edge = bestEdge + 1 < count1 ? bestEdge + 1 : 0;s = b2Collision.EdgeSeparation(poly1, xf1, edge, poly2, xf2);
- if (s > bestSeparation) {
- bestEdge = edge;
- bestSeparation = s;
- }
- else {
- break;
- }
- }
- edgeIndex[0] = bestEdge;
- return bestSeparation;
- }
- b2Collision.FindIncidentEdge = function (c, poly1, xf1, edge1, poly2, xf2) {
- if (edge1 === undefined) edge1 = 0;
- var count1 = parseInt(poly1.m_vertexCount);
- var normals1 = poly1.m_normals;
- var count2 = parseInt(poly2.m_vertexCount);
- var vertices2 = poly2.m_vertices;
- var normals2 = poly2.m_normals;
- var tMat;
- var tVec;
- tMat = xf1.R;
- tVec = normals1[edge1];
- var normal1X = (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var normal1Y = (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tMat = xf2.R;
- var tX = (tMat.col1.x * normal1X + tMat.col1.y * normal1Y);
- normal1Y = (tMat.col2.x * normal1X + tMat.col2.y * normal1Y);
- normal1X = tX;
- var index = 0;
- var minDot = Number.MAX_VALUE;
- for (var i = 0; i < count2; ++i) {
- tVec = normals2[i];
- var dot = (normal1X * tVec.x + normal1Y * tVec.y);
- if (dot < minDot) {
- minDot = dot;
- index = i;
- }
- }
- var tClip;
- var i1 = parseInt(index);
- var i2 = parseInt(i1 + 1 < count2 ? i1 + 1 : 0);
- tClip = c[0];
- tVec = vertices2[i1];
- tMat = xf2.R;
- tClip.v.x = xf2.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- tClip.v.y = xf2.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tClip.id.features.referenceEdge = edge1;
- tClip.id.features.incidentEdge = i1;
- tClip.id.features.incidentVertex = 0;
- tClip = c[1];
- tVec = vertices2[i2];
- tMat = xf2.R;
- tClip.v.x = xf2.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- tClip.v.y = xf2.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tClip.id.features.referenceEdge = edge1;
- tClip.id.features.incidentEdge = i2;
- tClip.id.features.incidentVertex = 1;
- }
- b2Collision.MakeClipPointVector = function () {
- var r = new Vector(2);
- r[0] = new ClipVertex();
- r[1] = new ClipVertex();
- return r;
- }
- b2Collision.CollidePolygons = function (manifold, polyA, xfA, polyB, xfB) {
- var cv;
- manifold.m_pointCount = 0;
- var totalRadius = polyA.m_radius + polyB.m_radius;
- var edgeA = 0;
- b2Collision.s_edgeAO[0] = edgeA;
- var separationA = b2Collision.FindMaxSeparation(b2Collision.s_edgeAO, polyA, xfA, polyB, xfB);
- edgeA = b2Collision.s_edgeAO[0];
- if (separationA > totalRadius) return;
- var edgeB = 0;
- b2Collision.s_edgeBO[0] = edgeB;
- var separationB = b2Collision.FindMaxSeparation(b2Collision.s_edgeBO, polyB, xfB, polyA, xfA);
- edgeB = b2Collision.s_edgeBO[0];
- if (separationB > totalRadius) return;
- var poly1;
- var poly2;
- var xf1;
- var xf2;
- var edge1 = 0;
- var flip = 0;
- var k_relativeTol = 0.98;
- var k_absoluteTol = 0.001;
- var tMat;
- if (separationB > k_relativeTol * separationA + k_absoluteTol) {
- poly1 = polyB;
- poly2 = polyA;
- xf1 = xfB;
- xf2 = xfA;
- edge1 = edgeB;
- manifold.m_type = b2Manifold.e_faceB;
- flip = 1;
- }
- else {
- poly1 = polyA;
- poly2 = polyB;
- xf1 = xfA;
- xf2 = xfB;
- edge1 = edgeA;
- manifold.m_type = b2Manifold.e_faceA;
- flip = 0;
- }
- var incidentEdge = b2Collision.s_incidentEdge;
- b2Collision.FindIncidentEdge(incidentEdge, poly1, xf1, edge1, poly2, xf2);
- var count1 = parseInt(poly1.m_vertexCount);
- var vertices1 = poly1.m_vertices;
- var local_v11 = vertices1[edge1];
- var local_v12;
- if (edge1 + 1 < count1) {
- local_v12 = vertices1[parseInt(edge1 + 1)];
- }
- else {
- local_v12 = vertices1[0];
- }
- var localTangent = b2Collision.s_localTangent;
- localTangent.Set(local_v12.x - local_v11.x, local_v12.y - local_v11.y);
- localTangent.Normalize();
- var localNormal = b2Collision.s_localNormal;
- localNormal.x = localTangent.y;
- localNormal.y = (-localTangent.x);
- var planePoint = b2Collision.s_planePoint;
- planePoint.Set(0.5 * (local_v11.x + local_v12.x), 0.5 * (local_v11.y + local_v12.y));
- var tangent = b2Collision.s_tangent;
- tMat = xf1.R;
- tangent.x = (tMat.col1.x * localTangent.x + tMat.col2.x * localTangent.y);
- tangent.y = (tMat.col1.y * localTangent.x + tMat.col2.y * localTangent.y);
- var tangent2 = b2Collision.s_tangent2;
- tangent2.x = (-tangent.x);
- tangent2.y = (-tangent.y);
- var normal = b2Collision.s_normal;
- normal.x = tangent.y;
- normal.y = (-tangent.x);
- var v11 = b2Collision.s_v11;
- var v12 = b2Collision.s_v12;
- v11.x = xf1.position.x + (tMat.col1.x * local_v11.x + tMat.col2.x * local_v11.y);
- v11.y = xf1.position.y + (tMat.col1.y * local_v11.x + tMat.col2.y * local_v11.y);
- v12.x = xf1.position.x + (tMat.col1.x * local_v12.x + tMat.col2.x * local_v12.y);
- v12.y = xf1.position.y + (tMat.col1.y * local_v12.x + tMat.col2.y * local_v12.y);
- var frontOffset = normal.x * v11.x + normal.y * v11.y;
- var sideOffset1 = (-tangent.x * v11.x) - tangent.y * v11.y + totalRadius;
- var sideOffset2 = tangent.x * v12.x + tangent.y * v12.y + totalRadius;
- var clipPoints1 = b2Collision.s_clipPoints1;
- var clipPoints2 = b2Collision.s_clipPoints2;
- var np = 0;
- np = b2Collision.ClipSegmentToLine(clipPoints1, incidentEdge, tangent2, sideOffset1);
- if (np < 2) return;
- np = b2Collision.ClipSegmentToLine(clipPoints2, clipPoints1, tangent, sideOffset2);
- if (np < 2) return;
- manifold.m_localPlaneNormal.SetV(localNormal);
- manifold.m_localPoint.SetV(planePoint);
- var pointCount = 0;
- for (var i = 0; i < b2Settings.b2_maxManifoldPoints; ++i) {
- cv = clipPoints2[i];
- var separation = normal.x * cv.v.x + normal.y * cv.v.y - frontOffset;
- if (separation <= totalRadius) {
- var cp = manifold.m_points[pointCount];
- tMat = xf2.R;
- var tX = cv.v.x - xf2.position.x;
- var tY = cv.v.y - xf2.position.y;
- cp.m_localPoint.x = (tX * tMat.col1.x + tY * tMat.col1.y);
- cp.m_localPoint.y = (tX * tMat.col2.x + tY * tMat.col2.y);
- cp.m_id.Set(cv.id);
- cp.m_id.features.flip = flip;
- ++pointCount;
- }
- }
- manifold.m_pointCount = pointCount;
- }
- b2Collision.CollideCircles = function (manifold, circle1, xf1, circle2, xf2) {
- manifold.m_pointCount = 0;
- var tMat;
- var tVec;
- tMat = xf1.R;
- tVec = circle1.m_p;
- var p1X = xf1.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var p1Y = xf1.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tMat = xf2.R;
- tVec = circle2.m_p;
- var p2X = xf2.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var p2Y = xf2.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- var dX = p2X - p1X;
- var dY = p2Y - p1Y;
- var distSqr = dX * dX + dY * dY;
- var radius = circle1.m_radius + circle2.m_radius;
- if (distSqr > radius * radius) {
- return;
- }
- manifold.m_type = b2Manifold.e_circles;
- manifold.m_localPoint.SetV(circle1.m_p);
- manifold.m_localPlaneNormal.SetZero();
- manifold.m_pointCount = 1;
- manifold.m_points[0].m_localPoint.SetV(circle2.m_p);
- manifold.m_points[0].m_id.key = 0;
- }
- b2Collision.CollidePolygonAndCircle = function (manifold, polygon, xf1, circle, xf2) {
- manifold.m_pointCount = 0;
- var tPoint;
- var dX = 0;
- var dY = 0;
- var positionX = 0;
- var positionY = 0;
- var tVec;
- var tMat;
- tMat = xf2.R;
- tVec = circle.m_p;
- var cX = xf2.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var cY = xf2.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- dX = cX - xf1.position.x;
- dY = cY - xf1.position.y;
- tMat = xf1.R;
- var cLocalX = (dX * tMat.col1.x + dY * tMat.col1.y);
- var cLocalY = (dX * tMat.col2.x + dY * tMat.col2.y);
- var dist = 0;
- var normalIndex = 0;
- var separation = (-Number.MAX_VALUE);
- var radius = polygon.m_radius + circle.m_radius;
- var vertexCount = parseInt(polygon.m_vertexCount);
- var vertices = polygon.m_vertices;
- var normals = polygon.m_normals;
- for (var i = 0; i < vertexCount; ++i) {
- tVec = vertices[i];
- dX = cLocalX - tVec.x;
- dY = cLocalY - tVec.y;
- tVec = normals[i];
- var s = tVec.x * dX + tVec.y * dY;
- if (s > radius) {
- return;
- }
- if (s > separation) {
- separation = s;
- normalIndex = i;
- }
- }
- var vertIndex1 = parseInt(normalIndex);
- var vertIndex2 = parseInt(vertIndex1 + 1 < vertexCount ? vertIndex1 + 1 : 0);
- var v1 = vertices[vertIndex1];
- var v2 = vertices[vertIndex2];
- if (separation < Number.MIN_VALUE) {
- manifold.m_pointCount = 1;
- manifold.m_type = b2Manifold.e_faceA;
- manifold.m_localPlaneNormal.SetV(normals[normalIndex]);
- manifold.m_localPoint.x = 0.5 * (v1.x + v2.x);
- manifold.m_localPoint.y = 0.5 * (v1.y + v2.y);
- manifold.m_points[0].m_localPoint.SetV(circle.m_p);
- manifold.m_points[0].m_id.key = 0;
- return;
- }
- var u1 = (cLocalX - v1.x) * (v2.x - v1.x) + (cLocalY - v1.y) * (v2.y - v1.y);
- var u2 = (cLocalX - v2.x) * (v1.x - v2.x) + (cLocalY - v2.y) * (v1.y - v2.y);
- if (u1 <= 0.0) {
- if ((cLocalX - v1.x) * (cLocalX - v1.x) + (cLocalY - v1.y) * (cLocalY - v1.y) > radius * radius) return;
- manifold.m_pointCount = 1;
- manifold.m_type = b2Manifold.e_faceA;
- manifold.m_localPlaneNormal.x = cLocalX - v1.x;
- manifold.m_localPlaneNormal.y = cLocalY - v1.y;
- manifold.m_localPlaneNormal.Normalize();
- manifold.m_localPoint.SetV(v1);
- manifold.m_points[0].m_localPoint.SetV(circle.m_p);
- manifold.m_points[0].m_id.key = 0;
- }
- else if (u2 <= 0) {
- if ((cLocalX - v2.x) * (cLocalX - v2.x) + (cLocalY - v2.y) * (cLocalY - v2.y) > radius * radius) return;
- manifold.m_pointCount = 1;
- manifold.m_type = b2Manifold.e_faceA;
- manifold.m_localPlaneNormal.x = cLocalX - v2.x;
- manifold.m_localPlaneNormal.y = cLocalY - v2.y;
- manifold.m_localPlaneNormal.Normalize();
- manifold.m_localPoint.SetV(v2);
- manifold.m_points[0].m_localPoint.SetV(circle.m_p);
- manifold.m_points[0].m_id.key = 0;
- }
- else {
- var faceCenterX = 0.5 * (v1.x + v2.x);
- var faceCenterY = 0.5 * (v1.y + v2.y);
- separation = (cLocalX - faceCenterX) * normals[vertIndex1].x + (cLocalY - faceCenterY) * normals[vertIndex1].y;
- if (separation > radius) return;
- manifold.m_pointCount = 1;
- manifold.m_type = b2Manifold.e_faceA;
- manifold.m_localPlaneNormal.x = normals[vertIndex1].x;
- manifold.m_localPlaneNormal.y = normals[vertIndex1].y;
- manifold.m_localPlaneNormal.Normalize();
- manifold.m_localPoint.Set(faceCenterX, faceCenterY);
- manifold.m_points[0].m_localPoint.SetV(circle.m_p);
- manifold.m_points[0].m_id.key = 0;
- }
- }
- b2Collision.TestOverlap = function (a, b) {
- var t1 = b.lowerBound;
- var t2 = a.upperBound;
- var d1X = t1.x - t2.x;
- var d1Y = t1.y - t2.y;
- t1 = a.lowerBound;
- t2 = b.upperBound;
- var d2X = t1.x - t2.x;
- var d2Y = t1.y - t2.y;
- if (d1X > 0.0 || d1Y > 0.0) return false;
- if (d2X > 0.0 || d2Y > 0.0) return false;
- return true;
- }
- Box2D.postDefs.push(function () {
- Box2D.Collision.b2Collision.s_incidentEdge = b2Collision.MakeClipPointVector();
- Box2D.Collision.b2Collision.s_clipPoints1 = b2Collision.MakeClipPointVector();
- Box2D.Collision.b2Collision.s_clipPoints2 = b2Collision.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 b2Vec2();
- Box2D.Collision.b2Collision.s_localNormal = new b2Vec2();
- Box2D.Collision.b2Collision.s_planePoint = new b2Vec2();
- Box2D.Collision.b2Collision.s_normal = new b2Vec2();
- Box2D.Collision.b2Collision.s_tangent = new b2Vec2();
- Box2D.Collision.b2Collision.s_tangent2 = new b2Vec2();
- Box2D.Collision.b2Collision.s_v11 = new b2Vec2();
- Box2D.Collision.b2Collision.s_v12 = new b2Vec2();
- Box2D.Collision.b2Collision.b2CollidePolyTempVec = new b2Vec2();
- Box2D.Collision.b2Collision.b2_nullFeature = 0x000000ff;
- });
- b2ContactID.b2ContactID = function () {
- this.features = new Features();
- };
- b2ContactID.prototype.b2ContactID = function () {
- this.features._m_id = this;
- }
- b2ContactID.prototype.Set = function (id) {
- this.key = id._key;
- }
- b2ContactID.prototype.Copy = function () {
- var id = new b2ContactID();
- id.key = this.key;
- return id;
- }
- Object.defineProperty(b2ContactID.prototype, 'key', {
- enumerable: false,
- configurable: true,
- get: function () {
- return this._key;
- }
- });
- Object.defineProperty(b2ContactID.prototype, 'key', {
- enumerable: false,
- configurable: true,
- set: function (value) {
- if (value === undefined) value = 0;
- this._key = value;
- this.features._referenceEdge = this._key & 0x000000ff;
- this.features._incidentEdge = ((this._key & 0x0000ff00) >> 8) & 0x000000ff;
- this.features._incidentVertex = ((this._key & 0x00ff0000) >> 16) & 0x000000ff;
- this.features._flip = ((this._key & 0xff000000) >> 24) & 0x000000ff;
- }
- });
- b2ContactPoint.b2ContactPoint = function () {
- this.position = new b2Vec2();
- this.velocity = new b2Vec2();
- this.normal = new b2Vec2();
- this.id = new b2ContactID();
- };
- b2Distance.b2Distance = function () {};
- b2Distance.Distance = function (output, cache, input) {
- ++b2Distance.b2_gjkCalls;
- var proxyA = input.proxyA;
- var proxyB = input.proxyB;
- var transformA = input.transformA;
- var transformB = input.transformB;
- var simplex = b2Distance.s_simplex;
- simplex.ReadCache(cache, proxyA, transformA, proxyB, transformB);
- var vertices = simplex.m_vertices;
- var k_maxIters = 20;
- var saveA = b2Distance.s_saveA;
- var saveB = b2Distance.s_saveB;
- var saveCount = 0;
- var closestPoint = simplex.GetClosestPoint();
- var distanceSqr1 = closestPoint.LengthSquared();
- var distanceSqr2 = distanceSqr1;
- var i = 0;
- var p;
- var iter = 0;
- while (iter < k_maxIters) {
- saveCount = simplex.m_count;
- for (i = 0;
- i < saveCount; i++) {
- saveA[i] = vertices[i].indexA;
- saveB[i] = vertices[i].indexB;
- }
- switch (simplex.m_count) {
- case 1:
- break;
- case 2:
- simplex.Solve2();
- break;
- case 3:
- simplex.Solve3();
- break;
- default:
- b2Settings.b2Assert(false);
- }
- if (simplex.m_count == 3) {
- break;
- }
- p = simplex.GetClosestPoint();
- distanceSqr2 = p.LengthSquared();
- if (distanceSqr2 > distanceSqr1) {}
- distanceSqr1 = distanceSqr2;
- var d = simplex.GetSearchDirection();
- if (d.LengthSquared() < Number.MIN_VALUE * Number.MIN_VALUE) {
- break;
- }
- var vertex = vertices[simplex.m_count];
- vertex.indexA = proxyA.GetSupport(b2Math.MulTMV(transformA.R, d.GetNegative()));
- vertex.wA = b2Math.MulX(transformA, proxyA.GetVertex(vertex.indexA));
- vertex.indexB = proxyB.GetSupport(b2Math.MulTMV(transformB.R, d));
- vertex.wB = b2Math.MulX(transformB, proxyB.GetVertex(vertex.indexB));
- vertex.w = b2Math.SubtractVV(vertex.wB, vertex.wA);
- ++iter;
- ++b2Distance.b2_gjkIters;
- var duplicate = false;
- for (i = 0;
- i < saveCount; i++) {
- if (vertex.indexA == saveA[i] && vertex.indexB == saveB[i]) {
- duplicate = true;
- break;
- }
- }
- if (duplicate) {
- break;
- }++simplex.m_count;
- }
- b2Distance.b2_gjkMaxIters = b2Math.Max(b2Distance.b2_gjkMaxIters, iter);
- simplex.GetWitnessPoints(output.pointA, output.pointB);
- output.distance = b2Math.SubtractVV(output.pointA, output.pointB).Length();
- output.iterations = iter;
- simplex.WriteCache(cache);
- if (input.useRadii) {
- var rA = proxyA.m_radius;
- var rB = proxyB.m_radius;
- if (output.distance > rA + rB && output.distance > Number.MIN_VALUE) {
- output.distance -= rA + rB;
- var normal = b2Math.SubtractVV(output.pointB, output.pointA);
- normal.Normalize();
- output.pointA.x += rA * normal.x;
- output.pointA.y += rA * normal.y;
- output.pointB.x -= rB * normal.x;
- output.pointB.y -= rB * normal.y;
- }
- else {
- p = new b2Vec2();
- p.x = .5 * (output.pointA.x + output.pointB.x);
- p.y = .5 * (output.pointA.y + output.pointB.y);
- output.pointA.x = output.pointB.x = p.x;
- output.pointA.y = output.pointB.y = p.y;
- output.distance = 0.0;
- }
- }
- }
- Box2D.postDefs.push(function () {
- Box2D.Collision.b2Distance.s_simplex = new b2Simplex();
- Box2D.Collision.b2Distance.s_saveA = new Vector_a2j_Number(3);
- Box2D.Collision.b2Distance.s_saveB = new Vector_a2j_Number(3);
- });
- b2DistanceInput.b2DistanceInput = function () {};
- b2DistanceOutput.b2DistanceOutput = function () {
- this.pointA = new b2Vec2();
- this.pointB = new b2Vec2();
- };
- b2DistanceProxy.b2DistanceProxy = function () {};
- b2DistanceProxy.prototype.Set = function (shape) {
- switch (shape.GetType()) {
- case b2Shape.e_circleShape:
- {
- var circle = (shape instanceof b2CircleShape ? shape : null);
- this.m_vertices = new Vector(1, true);
- this.m_vertices[0] = circle.m_p;
- this.m_count = 1;
- this.m_radius = circle.m_radius;
- }
- break;
- case b2Shape.e_polygonShape:
- {
- var polygon = (shape instanceof b2PolygonShape ? shape : null);
- this.m_vertices = polygon.m_vertices;
- this.m_count = polygon.m_vertexCount;
- this.m_radius = polygon.m_radius;
- }
- break;
- default:
- b2Settings.b2Assert(false);
- }
- }
- b2DistanceProxy.prototype.GetSupport = function (d) {
- var bestIndex = 0;
- var bestValue = this.m_vertices[0].x * d.x + this.m_vertices[0].y * d.y;
- for (var i = 1; i < this.m_count; ++i) {
- var value = this.m_vertices[i].x * d.x + this.m_vertices[i].y * d.y;
- if (value > bestValue) {
- bestIndex = i;
- bestValue = value;
- }
- }
- return bestIndex;
- }
- b2DistanceProxy.prototype.GetSupportVertex = function (d) {
- var bestIndex = 0;
- var bestValue = this.m_vertices[0].x * d.x + this.m_vertices[0].y * d.y;
- for (var i = 1; i < this.m_count; ++i) {
- var value = this.m_vertices[i].x * d.x + this.m_vertices[i].y * d.y;
- if (value > bestValue) {
- bestIndex = i;
- bestValue = value;
- }
- }
- return this.m_vertices[bestIndex];
- }
- b2DistanceProxy.prototype.GetVertexCount = function () {
- return this.m_count;
- }
- b2DistanceProxy.prototype.GetVertex = function (index) {
- if (index === undefined) index = 0;
- b2Settings.b2Assert(0 <= index && index < this.m_count);
- return this.m_vertices[index];
- }
- b2DynamicTree.b2DynamicTree = function () {};
- b2DynamicTree.prototype.b2DynamicTree = function () {
- this.m_root = null;
- this.m_freeList = null;
- this.m_path = 0;
- this.m_insertionCount = 0;
- }
- b2DynamicTree.prototype.CreateProxy = function (aabb, userData) {
- var node = this.AllocateNode();
- var extendX = b2Settings.b2_aabbExtension;
- var extendY = b2Settings.b2_aabbExtension;
- node.aabb.lowerBound.x = aabb.lowerBound.x - extendX;
- node.aabb.lowerBound.y = aabb.lowerBound.y - extendY;
- node.aabb.upperBound.x = aabb.upperBound.x + extendX;
- node.aabb.upperBound.y = aabb.upperBound.y + extendY;
- node.userData = userData;
- this.InsertLeaf(node);
- return node;
- }
- b2DynamicTree.prototype.DestroyProxy = function (proxy) {
- this.RemoveLeaf(proxy);
- this.FreeNode(proxy);
- }
- b2DynamicTree.prototype.MoveProxy = function (proxy, aabb, displacement) {
- b2Settings.b2Assert(proxy.IsLeaf());
- if (proxy.aabb.Contains(aabb)) {
- return false;
- }
- this.RemoveLeaf(proxy);
- var extendX = b2Settings.b2_aabbExtension + b2Settings.b2_aabbMultiplier * (displacement.x > 0 ? displacement.x : (-displacement.x));
- var extendY = b2Settings.b2_aabbExtension + b2Settings.b2_aabbMultiplier * (displacement.y > 0 ? displacement.y : (-displacement.y));
- proxy.aabb.lowerBound.x = aabb.lowerBound.x - extendX;
- proxy.aabb.lowerBound.y = aabb.lowerBound.y - extendY;
- proxy.aabb.upperBound.x = aabb.upperBound.x + extendX;
- proxy.aabb.upperBound.y = aabb.upperBound.y + extendY;
- this.InsertLeaf(proxy);
- return true;
- }
- b2DynamicTree.prototype.Rebalance = function (iterations) {
- if (iterations === undefined) iterations = 0;
- if (this.m_root == null) return;
- for (var i = 0; i < iterations; i++) {
- var node = this.m_root;
- var bit = 0;
- while (node.IsLeaf() == false) {
- node = (this.m_path >> bit) & 1 ? node.child2 : node.child1;
- bit = (bit + 1) & 31;
- }++this.m_path;
- this.RemoveLeaf(node);
- this.InsertLeaf(node);
- }
- }
- b2DynamicTree.prototype.GetFatAABB = function (proxy) {
- return proxy.aabb;
- }
- b2DynamicTree.prototype.GetUserData = function (proxy) {
- return proxy.userData;
- }
- b2DynamicTree.prototype.Query = function (callback, aabb) {
- if (this.m_root == null) return;
- var stack = new Vector();
- var count = 0;
- stack[count++] = this.m_root;
- while (count > 0) {
- var node = stack[--count];
- if (node.aabb.TestOverlap(aabb)) {
- if (node.IsLeaf()) {
- var proceed = callback(node);
- if (!proceed) return;
- }
- else {
- stack[count++] = node.child1;
- stack[count++] = node.child2;
- }
- }
- }
- }
- b2DynamicTree.prototype.RayCast = function (callback, input) {
- if (this.m_root == null) return;
- var p1 = input.p1;
- var p2 = input.p2;
- var r = b2Math.SubtractVV(p1, p2);
- r.Normalize();
- var v = b2Math.CrossFV(1.0, r);
- var abs_v = b2Math.AbsV(v);
- var maxFraction = input.maxFraction;
- var segmentAABB = new b2AABB();
- var tX = 0;
- var tY = 0; {
- tX = p1.x + maxFraction * (p2.x - p1.x);
- tY = p1.y + maxFraction * (p2.y - p1.y);
- segmentAABB.lowerBound.x = Math.min(p1.x, tX);
- segmentAABB.lowerBound.y = Math.min(p1.y, tY);
- segmentAABB.upperBound.x = Math.max(p1.x, tX);
- segmentAABB.upperBound.y = Math.max(p1.y, tY);
- }
- var stack = new Vector();
- var count = 0;
- stack[count++] = this.m_root;
- while (count > 0) {
- var node = stack[--count];
- if (node.aabb.TestOverlap(segmentAABB) == false) {
- continue;
- }
- var c = node.aabb.GetCenter();
- var h = node.aabb.GetExtents();
- var separation = Math.abs(v.x * (p1.x - c.x) + v.y * (p1.y - c.y)) - abs_v.x * h.x - abs_v.y * h.y;
- if (separation > 0.0) continue;
- if (node.IsLeaf()) {
- var subInput = new b2RayCastInput();
- subInput.p1 = input.p1;
- subInput.p2 = input.p2;
- subInput.maxFraction = input.maxFraction;
- maxFraction = callback(subInput, node);
- if (maxFraction == 0.0) return;
- if (maxFraction > 0.0) {
- tX = p1.x + maxFraction * (p2.x - p1.x);
- tY = p1.y + maxFraction * (p2.y - p1.y);
- segmentAABB.lowerBound.x = Math.min(p1.x, tX);
- segmentAABB.lowerBound.y = Math.min(p1.y, tY);
- segmentAABB.upperBound.x = Math.max(p1.x, tX);
- segmentAABB.upperBound.y = Math.max(p1.y, tY);
- }
- }
- else {
- stack[count++] = node.child1;
- stack[count++] = node.child2;
- }
- }
- }
- b2DynamicTree.prototype.AllocateNode = function () {
- if (this.m_freeList) {
- var node = this.m_freeList;
- this.m_freeList = node.parent;
- node.parent = null;
- node.child1 = null;
- node.child2 = null;
- return node;
- }
- return new b2DynamicTreeNode();
- }
- b2DynamicTree.prototype.FreeNode = function (node) {
- node.parent = this.m_freeList;
- this.m_freeList = node;
- }
- b2DynamicTree.prototype.InsertLeaf = function (leaf) {
- ++this.m_insertionCount;
- if (this.m_root == null) {
- this.m_root = leaf;
- this.m_root.parent = null;
- return;
- }
- var center = leaf.aabb.GetCenter();
- var sibling = this.m_root;
- if (sibling.IsLeaf() == false) {
- do {
- var child1 = sibling.child1;
- var child2 = sibling.child2;
- var norm1 = Math.abs((child1.aabb.lowerBound.x + child1.aabb.upperBound.x) / 2 - center.x) + Math.abs((child1.aabb.lowerBound.y + child1.aabb.upperBound.y) / 2 - center.y);
- var norm2 = Math.abs((child2.aabb.lowerBound.x + child2.aabb.upperBound.x) / 2 - center.x) + Math.abs((child2.aabb.lowerBound.y + child2.aabb.upperBound.y) / 2 - center.y);
- if (norm1 < norm2) {
- sibling = child1;
- }
- else {
- sibling = child2;
- }
- }
- while (sibling.IsLeaf() == false)
- }
- var node1 = sibling.parent;
- var node2 = this.AllocateNode();
- node2.parent = node1;
- node2.userData = null;
- node2.aabb.Combine(leaf.aabb, sibling.aabb);
- if (node1) {
- if (sibling.parent.child1 == sibling) {
- node1.child1 = node2;
- }
- else {
- node1.child2 = node2;
- }
- node2.child1 = sibling;
- node2.child2 = leaf;
- sibling.parent = node2;
- leaf.parent = node2;
- do {
- if (node1.aabb.Contains(node2.aabb)) break;
- node1.aabb.Combine(node1.child1.aabb, node1.child2.aabb);
- node2 = node1;
- node1 = node1.parent;
- }
- while (node1)
- }
- else {
- node2.child1 = sibling;
- node2.child2 = leaf;
- sibling.parent = node2;
- leaf.parent = node2;
- this.m_root = node2;
- }
- }
- b2DynamicTree.prototype.RemoveLeaf = function (leaf) {
- if (leaf == this.m_root) {
- this.m_root = null;
- return;
- }
- var node2 = leaf.parent;
- var node1 = node2.parent;
- var sibling;
- if (node2.child1 == leaf) {
- sibling = node2.child2;
- }
- else {
- sibling = node2.child1;
- }
- if (node1) {
- if (node1.child1 == node2) {
- node1.child1 = sibling;
- }
- else {
- node1.child2 = sibling;
- }
- sibling.parent = node1;
- this.FreeNode(node2);
- while (node1) {
- var oldAABB = node1.aabb;
- node1.aabb = b2AABB.Combine(node1.child1.aabb, node1.child2.aabb);
- if (oldAABB.Contains(node1.aabb)) break;
- node1 = node1.parent;
- }
- }
- else {
- this.m_root = sibling;
- sibling.parent = null;
- this.FreeNode(node2);
- }
- }
- b2DynamicTreeBroadPhase.b2DynamicTreeBroadPhase = function () {
- this.m_tree = new b2DynamicTree();
- this.m_moveBuffer = new Vector();
- this.m_pairBuffer = new Vector();
- this.m_pairCount = 0;
- };
- b2DynamicTreeBroadPhase.prototype.CreateProxy = function (aabb, userData) {
- var proxy = this.m_tree.CreateProxy(aabb, userData);
- ++this.m_proxyCount;
- this.BufferMove(proxy);
- return proxy;
- }
- b2DynamicTreeBroadPhase.prototype.DestroyProxy = function (proxy) {
- this.UnBufferMove(proxy);
- --this.m_proxyCount;
- this.m_tree.DestroyProxy(proxy);
- }
- b2DynamicTreeBroadPhase.prototype.MoveProxy = function (proxy, aabb, displacement) {
- var buffer = this.m_tree.MoveProxy(proxy, aabb, displacement);
- if (buffer) {
- this.BufferMove(proxy);
- }
- }
- b2DynamicTreeBroadPhase.prototype.TestOverlap = function (proxyA, proxyB) {
- var aabbA = this.m_tree.GetFatAABB(proxyA);
- var aabbB = this.m_tree.GetFatAABB(proxyB);
- return aabbA.TestOverlap(aabbB);
- }
- b2DynamicTreeBroadPhase.prototype.GetUserData = function (proxy) {
- return this.m_tree.GetUserData(proxy);
- }
- b2DynamicTreeBroadPhase.prototype.GetFatAABB = function (proxy) {
- return this.m_tree.GetFatAABB(proxy);
- }
- b2DynamicTreeBroadPhase.prototype.GetProxyCount = function () {
- return this.m_proxyCount;
- }
- b2DynamicTreeBroadPhase.prototype.UpdatePairs = function (callback) {
- var __this = this;
- __this.m_pairCount = 0;
- var i = 0,
- queryProxy;
- for (i = 0;
- i < __this.m_moveBuffer.length; ++i) {
- queryProxy = __this.m_moveBuffer[i];
-
- function QueryCallback(proxy) {
- if (proxy == queryProxy) return true;
- if (__this.m_pairCount == __this.m_pairBuffer.length) {
- __this.m_pairBuffer[__this.m_pairCount] = new b2DynamicTreePair();
- }
- var pair = __this.m_pairBuffer[__this.m_pairCount];
- pair.proxyA = proxy < queryProxy ? proxy : queryProxy;
- pair.proxyB = proxy >= queryProxy ? proxy : queryProxy;++__this.m_pairCount;
- return true;
- };
- var fatAABB = __this.m_tree.GetFatAABB(queryProxy);
- __this.m_tree.Query(QueryCallback, fatAABB);
- }
- __this.m_moveBuffer.length = 0;
- for (var i = 0; i < __this.m_pairCount;) {
- var primaryPair = __this.m_pairBuffer[i];
- var userDataA = __this.m_tree.GetUserData(primaryPair.proxyA);
- var userDataB = __this.m_tree.GetUserData(primaryPair.proxyB);
- callback(userDataA, userDataB);
- ++i;
- while (i < __this.m_pairCount) {
- var pair = __this.m_pairBuffer[i];
- if (pair.proxyA != primaryPair.proxyA || pair.proxyB != primaryPair.proxyB) {
- break;
- }++i;
- }
- }
- }
- b2DynamicTreeBroadPhase.prototype.Query = function (callback, aabb) {
- this.m_tree.Query(callback, aabb);
- }
- b2DynamicTreeBroadPhase.prototype.RayCast = function (callback, input) {
- this.m_tree.RayCast(callback, input);
- }
- b2DynamicTreeBroadPhase.prototype.Validate = function () {}
- b2DynamicTreeBroadPhase.prototype.Rebalance = function (iterations) {
- if (iterations === undefined) iterations = 0;
- this.m_tree.Rebalance(iterations);
- }
- b2DynamicTreeBroadPhase.prototype.BufferMove = function (proxy) {
- this.m_moveBuffer[this.m_moveBuffer.length] = proxy;
- }
- b2DynamicTreeBroadPhase.prototype.UnBufferMove = function (proxy) {
- var i = parseInt(this.m_moveBuffer.indexOf(proxy));
- this.m_moveBuffer.splice(i, 1);
- }
- b2DynamicTreeBroadPhase.prototype.ComparePairs = function (pair1, pair2) {
- return 0;
- }
- b2DynamicTreeBroadPhase.__implements = {};
- b2DynamicTreeBroadPhase.__implements[IBroadPhase] = true;
- b2DynamicTreeNode.b2DynamicTreeNode = function () {
- this.aabb = new b2AABB();
- };
- b2DynamicTreeNode.prototype.IsLeaf = function () {
- return this.child1 == null;
- }
- b2DynamicTreePair.b2DynamicTreePair = function () {};
- b2Manifold.b2Manifold = function () {
- this.m_pointCount = 0;
- };
- b2Manifold.prototype.b2Manifold = function () {
- this.m_points = new Vector(b2Settings.b2_maxManifoldPoints);
- for (var i = 0; i < b2Settings.b2_maxManifoldPoints; i++) {
- this.m_points[i] = new b2ManifoldPoint();
- }
- this.m_localPlaneNormal = new b2Vec2();
- this.m_localPoint = new b2Vec2();
- }
- b2Manifold.prototype.Reset = function () {
- for (var i = 0; i < b2Settings.b2_maxManifoldPoints; i++) {
- ((this.m_points[i] instanceof b2ManifoldPoint ? this.m_points[i] : null)).Reset();
- }
- this.m_localPlaneNormal.SetZero();
- this.m_localPoint.SetZero();
- this.m_type = 0;
- this.m_pointCount = 0;
- }
- b2Manifold.prototype.Set = function (m) {
- this.m_pointCount = m.m_pointCount;
- for (var i = 0; i < b2Settings.b2_maxManifoldPoints; i++) {
- ((this.m_points[i] instanceof b2ManifoldPoint ? this.m_points[i] : null)).Set(m.m_points[i]);
- }
- this.m_localPlaneNormal.SetV(m.m_localPlaneNormal);
- this.m_localPoint.SetV(m.m_localPoint);
- this.m_type = m.m_type;
- }
- b2Manifold.prototype.Copy = function () {
- var copy = new b2Manifold();
- copy.Set(this);
- return copy;
- }
- Box2D.postDefs.push(function () {
- Box2D.Collision.b2Manifold.e_circles = 0x0001;
- Box2D.Collision.b2Manifold.e_faceA = 0x0002;
- Box2D.Collision.b2Manifold.e_faceB = 0x0004;
- });
- b2ManifoldPoint.b2ManifoldPoint = function () {
- this.m_localPoint = new b2Vec2();
- this.m_id = new b2ContactID();
- };
- b2ManifoldPoint.prototype.b2ManifoldPoint = function () {
- this.Reset();
- }
- b2ManifoldPoint.prototype.Reset = function () {
- this.m_localPoint.SetZero();
- this.m_normalImpulse = 0.0;
- this.m_tangentImpulse = 0.0;
- this.m_id.key = 0;
- }
- b2ManifoldPoint.prototype.Set = function (m) {
- this.m_localPoint.SetV(m.m_localPoint);
- this.m_normalImpulse = m.m_normalImpulse;
- this.m_tangentImpulse = m.m_tangentImpulse;
- this.m_id.Set(m.m_id);
- }
- b2Point.b2Point = function () {
- this.p = new b2Vec2();
- };
- b2Point.prototype.Support = function (xf, vX, vY) {
- if (vX === undefined) vX = 0;
- if (vY === undefined) vY = 0;
- return this.p;
- }
- b2Point.prototype.GetFirstVertex = function (xf) {
- return this.p;
- }
- b2RayCastInput.b2RayCastInput = function () {
- this.p1 = new b2Vec2();
- this.p2 = new b2Vec2();
- };
- b2RayCastInput.prototype.b2RayCastInput = function (p1, p2, maxFraction) {
- if (p1 === undefined) p1 = null;
- if (p2 === undefined) p2 = null;
- if (maxFraction === undefined) maxFraction = 1;
- if (p1) this.p1.SetV(p1);
- if (p2) this.p2.SetV(p2);
- this.maxFraction = maxFraction;
- }
- b2RayCastOutput.b2RayCastOutput = function () {
- this.normal = new b2Vec2();
- };
- b2Segment.b2Segment = function () {
- this.p1 = new b2Vec2();
- this.p2 = new b2Vec2();
- };
- b2Segment.prototype.TestSegment = function (lambda, normal, segment, maxLambda) {
- if (maxLambda === undefined) maxLambda = 0;
- var s = segment.p1;
- var rX = segment.p2.x - s.x;
- var rY = segment.p2.y - s.y;
- var dX = this.p2.x - this.p1.x;
- var dY = this.p2.y - this.p1.y;
- var nX = dY;
- var nY = (-dX);
- var k_slop = 100.0 * Number.MIN_VALUE;
- var denom = (-(rX * nX + rY * nY));
- if (denom > k_slop) {
- var bX = s.x - this.p1.x;
- var bY = s.y - this.p1.y;
- var a = (bX * nX + bY * nY);
- if (0.0 <= a && a <= maxLambda * denom) {
- var mu2 = (-rX * bY) + rY * bX;
- if ((-k_slop * denom) <= mu2 && mu2 <= denom * (1.0 + k_slop)) {
- a /= denom;
- var nLen = Math.sqrt(nX * nX + nY * nY);
- nX /= nLen;
- nY /= nLen;
- lambda[0] = a;
- normal.Set(nX, nY);
- return true;
- }
- }
- }
- return false;
- }
- b2Segment.prototype.Extend = function (aabb) {
- this.ExtendForward(aabb);
- this.ExtendBackward(aabb);
- }
- b2Segment.prototype.ExtendForward = function (aabb) {
- var dX = this.p2.x - this.p1.x;
- var dY = this.p2.y - this.p1.y;
- var lambda = Math.min(dX > 0 ? (aabb.upperBound.x - this.p1.x) / dX : dX < 0 ? (aabb.lowerBound.x - this.p1.x) / dX : Number.POSITIVE_INFINITY,
- dY > 0 ? (aabb.upperBound.y - this.p1.y) / dY : dY < 0 ? (aabb.lowerBound.y - this.p1.y) / dY : Number.POSITIVE_INFINITY);
- this.p2.x = this.p1.x + dX * lambda;
- this.p2.y = this.p1.y + dY * lambda;
- }
- b2Segment.prototype.ExtendBackward = function (aabb) {
- var dX = (-this.p2.x) + this.p1.x;
- var dY = (-this.p2.y) + this.p1.y;
- var lambda = Math.min(dX > 0 ? (aabb.upperBound.x - this.p2.x) / dX : dX < 0 ? (aabb.lowerBound.x - this.p2.x) / dX : Number.POSITIVE_INFINITY,
- dY > 0 ? (aabb.upperBound.y - this.p2.y) / dY : dY < 0 ? (aabb.lowerBound.y - this.p2.y) / dY : Number.POSITIVE_INFINITY);
- this.p1.x = this.p2.x + dX * lambda;
- this.p1.y = this.p2.y + dY * lambda;
- }
- b2SeparationFunction.b2SeparationFunction = function () {
- this.m_localPoint = new b2Vec2();
- this.m_axis = new b2Vec2();
- };
- b2SeparationFunction.prototype.Initialize = function (cache, proxyA, transformA, proxyB, transformB) {
- this.m_proxyA = proxyA;
- this.m_proxyB = proxyB;
- var count = parseInt(cache.count);
- b2Settings.b2Assert(0 < count && count < 3);
- var localPointA;
- var localPointA1;
- var localPointA2;
- var localPointB;
- var localPointB1;
- var localPointB2;
- var pointAX = 0;
- var pointAY = 0;
- var pointBX = 0;
- var pointBY = 0;
- var normalX = 0;
- var normalY = 0;
- var tMat;
- var tVec;
- var s = 0;
- var sgn = 0;
- if (count == 1) {
- this.m_type = b2SeparationFunction.e_points;
- localPointA = this.m_proxyA.GetVertex(cache.indexA[0]);
- localPointB = this.m_proxyB.GetVertex(cache.indexB[0]);
- tVec = localPointA;
- tMat = transformA.R;
- pointAX = transformA.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- pointAY = transformA.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tVec = localPointB;
- tMat = transformB.R;
- pointBX = transformB.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- pointBY = transformB.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- this.m_axis.x = pointBX - pointAX;
- this.m_axis.y = pointBY - pointAY;
- this.m_axis.Normalize();
- }
- else if (cache.indexB[0] == cache.indexB[1]) {
- this.m_type = b2SeparationFunction.e_faceA;
- localPointA1 = this.m_proxyA.GetVertex(cache.indexA[0]);
- localPointA2 = this.m_proxyA.GetVertex(cache.indexA[1]);
- localPointB = this.m_proxyB.GetVertex(cache.indexB[0]);
- this.m_localPoint.x = 0.5 * (localPointA1.x + localPointA2.x);
- this.m_localPoint.y = 0.5 * (localPointA1.y + localPointA2.y);
- this.m_axis = b2Math.CrossVF(b2Math.SubtractVV(localPointA2, localPointA1), 1.0);
- this.m_axis.Normalize();
- tVec = this.m_axis;
- tMat = transformA.R;
- normalX = tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- normalY = tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tVec = this.m_localPoint;
- tMat = transformA.R;
- pointAX = transformA.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- pointAY = transformA.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tVec = localPointB;
- tMat = transformB.R;
- pointBX = transformB.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- pointBY = transformB.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- s = (pointBX - pointAX) * normalX + (pointBY - pointAY) * normalY;
- if (s < 0.0) {
- this.m_axis.NegativeSelf();
- }
- }
- else if (cache.indexA[0] == cache.indexA[0]) {
- this.m_type = b2SeparationFunction.e_faceB;
- localPointB1 = this.m_proxyB.GetVertex(cache.indexB[0]);
- localPointB2 = this.m_proxyB.GetVertex(cache.indexB[1]);
- localPointA = this.m_proxyA.GetVertex(cache.indexA[0]);
- this.m_localPoint.x = 0.5 * (localPointB1.x + localPointB2.x);
- this.m_localPoint.y = 0.5 * (localPointB1.y + localPointB2.y);
- this.m_axis = b2Math.CrossVF(b2Math.SubtractVV(localPointB2, localPointB1), 1.0);
- this.m_axis.Normalize();
- tVec = this.m_axis;
- tMat = transformB.R;
- normalX = tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- normalY = tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tVec = this.m_localPoint;
- tMat = transformB.R;
- pointBX = transformB.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- pointBY = transformB.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tVec = localPointA;
- tMat = transformA.R;
- pointAX = transformA.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- pointAY = transformA.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- s = (pointAX - pointBX) * normalX + (pointAY - pointBY) * normalY;
- if (s < 0.0) {
- this.m_axis.NegativeSelf();
- }
- }
- else {
- localPointA1 = this.m_proxyA.GetVertex(cache.indexA[0]);
- localPointA2 = this.m_proxyA.GetVertex(cache.indexA[1]);
- localPointB1 = this.m_proxyB.GetVertex(cache.indexB[0]);
- localPointB2 = this.m_proxyB.GetVertex(cache.indexB[1]);
- var pA = b2Math.MulX(transformA, localPointA);
- var dA = b2Math.MulMV(transformA.R, b2Math.SubtractVV(localPointA2, localPointA1));
- var pB = b2Math.MulX(transformB, localPointB);
- var dB = b2Math.MulMV(transformB.R, b2Math.SubtractVV(localPointB2, localPointB1));
- var a = dA.x * dA.x + dA.y * dA.y;
- var e = dB.x * dB.x + dB.y * dB.y;
- var r = b2Math.SubtractVV(dB, dA);
- var c = dA.x * r.x + dA.y * r.y;
- var f = dB.x * r.x + dB.y * r.y;
- var b = dA.x * dB.x + dA.y * dB.y;
- var denom = a * e - b * b;
- s = 0.0;
- if (denom != 0.0) {
- s = b2Math.Clamp((b * f - c * e) / denom, 0.0, 1.0);
- }
- var t = (b * s + f) / e;
- if (t < 0.0) {
- t = 0.0;
- s = b2Math.Clamp((b - c) / a, 0.0, 1.0);
- }
- localPointA = new b2Vec2();
- localPointA.x = localPointA1.x + s * (localPointA2.x - localPointA1.x);
- localPointA.y = localPointA1.y + s * (localPointA2.y - localPointA1.y);
- localPointB = new b2Vec2();
- localPointB.x = localPointB1.x + s * (localPointB2.x - localPointB1.x);
- localPointB.y = localPointB1.y + s * (localPointB2.y - localPointB1.y);
- if (s == 0.0 || s == 1.0) {
- this.m_type = b2SeparationFunction.e_faceB;
- this.m_axis = b2Math.CrossVF(b2Math.SubtractVV(localPointB2, localPointB1), 1.0);
- this.m_axis.Normalize();
- this.m_localPoint = localPointB;
- tVec = this.m_axis;
- tMat = transformB.R;
- normalX = tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- normalY = tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tVec = this.m_localPoint;
- tMat = transformB.R;
- pointBX = transformB.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- pointBY = transformB.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tVec = localPointA;
- tMat = transformA.R;
- pointAX = transformA.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- pointAY = transformA.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- sgn = (pointAX - pointBX) * normalX + (pointAY - pointBY) * normalY;
- if (s < 0.0) {
- this.m_axis.NegativeSelf();
- }
- }
- else {
- this.m_type = b2SeparationFunction.e_faceA;
- this.m_axis = b2Math.CrossVF(b2Math.SubtractVV(localPointA2, localPointA1), 1.0);
- this.m_localPoint = localPointA;
- tVec = this.m_axis;
- tMat = transformA.R;
- normalX = tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- normalY = tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tVec = this.m_localPoint;
- tMat = transformA.R;
- pointAX = transformA.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- pointAY = transformA.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tVec = localPointB;
- tMat = transformB.R;
- pointBX = transformB.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- pointBY = transformB.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- sgn = (pointBX - pointAX) * normalX + (pointBY - pointAY) * normalY;
- if (s < 0.0) {
- this.m_axis.NegativeSelf();
- }
- }
- }
- }
- b2SeparationFunction.prototype.Evaluate = function (transformA, transformB) {
- var axisA;
- var axisB;
- var localPointA;
- var localPointB;
- var pointA;
- var pointB;
- var seperation = 0;
- var normal;
- switch (this.m_type) {
- case b2SeparationFunction.e_points:
- {
- axisA = b2Math.MulTMV(transformA.R, this.m_axis);
- axisB = b2Math.MulTMV(transformB.R, this.m_axis.GetNegative());
- localPointA = this.m_proxyA.GetSupportVertex(axisA);
- localPointB = this.m_proxyB.GetSupportVertex(axisB);
- pointA = b2Math.MulX(transformA, localPointA);
- pointB = b2Math.MulX(transformB, localPointB);
- seperation = (pointB.x - pointA.x) * this.m_axis.x + (pointB.y - pointA.y) * this.m_axis.y;
- return seperation;
- }
- case b2SeparationFunction.e_faceA:
- {
- normal = b2Math.MulMV(transformA.R, this.m_axis);
- pointA = b2Math.MulX(transformA, this.m_localPoint);
- axisB = b2Math.MulTMV(transformB.R, normal.GetNegative());
- localPointB = this.m_proxyB.GetSupportVertex(axisB);
- pointB = b2Math.MulX(transformB, localPointB);
- seperation = (pointB.x - pointA.x) * normal.x + (pointB.y - pointA.y) * normal.y;
- return seperation;
- }
- case b2SeparationFunction.e_faceB:
- {
- normal = b2Math.MulMV(transformB.R, this.m_axis);
- pointB = b2Math.MulX(transformB, this.m_localPoint);
- axisA = b2Math.MulTMV(transformA.R, normal.GetNegative());
- localPointA = this.m_proxyA.GetSupportVertex(axisA);
- pointA = b2Math.MulX(transformA, localPointA);
- seperation = (pointA.x - pointB.x) * normal.x + (pointA.y - pointB.y) * normal.y;
- return seperation;
- }
- default:
- b2Settings.b2Assert(false);
- return 0.0;
- }
- }
- Box2D.postDefs.push(function () {
- Box2D.Collision.b2SeparationFunction.e_points = 0x01;
- Box2D.Collision.b2SeparationFunction.e_faceA = 0x02;
- Box2D.Collision.b2SeparationFunction.e_faceB = 0x04;
- });
- b2Simplex.b2Simplex = function () {
- this.m_v1 = new b2SimplexVertex();
- this.m_v2 = new b2SimplexVertex();
- this.m_v3 = new b2SimplexVertex();
- this.m_vertices = new Vector(3);
- };
- b2Simplex.prototype.b2Simplex = function () {
- this.m_vertices[0] = this.m_v1;
- this.m_vertices[1] = this.m_v2;
- this.m_vertices[2] = this.m_v3;
- }
- b2Simplex.prototype.ReadCache = function (cache, proxyA, transformA, proxyB, transformB) {
- b2Settings.b2Assert(0 <= cache.count && cache.count <= 3);
- var wALocal;
- var wBLocal;
- this.m_count = cache.count;
- var vertices = this.m_vertices;
- for (var i = 0; i < this.m_count; i++) {
- var v = vertices[i];
- v.indexA = cache.indexA[i];
- v.indexB = cache.indexB[i];
- wALocal = proxyA.GetVertex(v.indexA);
- wBLocal = proxyB.GetVertex(v.indexB);
- v.wA = b2Math.MulX(transformA, wALocal);
- v.wB = b2Math.MulX(transformB, wBLocal);
- v.w = b2Math.SubtractVV(v.wB, v.wA);
- v.a = 0;
- }
- if (this.m_count > 1) {
- var metric1 = cache.metric;
- var metric2 = this.GetMetric();
- if (metric2 < .5 * metric1 || 2.0 * metric1 < metric2 || metric2 < Number.MIN_VALUE) {
- this.m_count = 0;
- }
- }
- if (this.m_count == 0) {
- v = vertices[0];
- v.indexA = 0;
- v.indexB = 0;
- wALocal = proxyA.GetVertex(0);
- wBLocal = proxyB.GetVertex(0);
- v.wA = b2Math.MulX(transformA, wALocal);
- v.wB = b2Math.MulX(transformB, wBLocal);
- v.w = b2Math.SubtractVV(v.wB, v.wA);
- this.m_count = 1;
- }
- }
- b2Simplex.prototype.WriteCache = function (cache) {
- cache.metric = this.GetMetric();
- cache.count = Box2D.parseUInt(this.m_count);
- var vertices = this.m_vertices;
- for (var i = 0; i < this.m_count; i++) {
- cache.indexA[i] = Box2D.parseUInt(vertices[i].indexA);
- cache.indexB[i] = Box2D.parseUInt(vertices[i].indexB);
- }
- }
- b2Simplex.prototype.GetSearchDirection = function () {
- switch (this.m_count) {
- case 1:
- return this.m_v1.w.GetNegative();
- case 2:
- {
- var e12 = b2Math.SubtractVV(this.m_v2.w, this.m_v1.w);
- var sgn = b2Math.CrossVV(e12, this.m_v1.w.GetNegative());
- if (sgn > 0.0) {
- return b2Math.CrossFV(1.0, e12);
- }
- else {
- return b2Math.CrossVF(e12, 1.0);
- }
- }
- default:
- b2Settings.b2Assert(false);
- return new b2Vec2();
- }
- }
- b2Simplex.prototype.GetClosestPoint = function () {
- switch (this.m_count) {
- case 0:
- b2Settings.b2Assert(false);
- return new b2Vec2();
- case 1:
- return this.m_v1.w;
- case 2:
- return new b2Vec2(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:
- b2Settings.b2Assert(false);
- return new b2Vec2();
- }
- }
- b2Simplex.prototype.GetWitnessPoints = function (pA, pB) {
- switch (this.m_count) {
- case 0:
- b2Settings.b2Assert(false);
- break;
- case 1:
- pA.SetV(this.m_v1.wA);
- pB.SetV(this.m_v1.wB);
- break;
- case 2:
- pA.x = this.m_v1.a * this.m_v1.wA.x + this.m_v2.a * this.m_v2.wA.x;
- pA.y = this.m_v1.a * this.m_v1.wA.y + this.m_v2.a * this.m_v2.wA.y;
- pB.x = this.m_v1.a * this.m_v1.wB.x + this.m_v2.a * this.m_v2.wB.x;
- pB.y = this.m_v1.a * this.m_v1.wB.y + this.m_v2.a * this.m_v2.wB.y;
- break;
- case 3:
- pB.x = pA.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;
- pB.y = pA.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:
- b2Settings.b2Assert(false);
- break;
- }
- }
- b2Simplex.prototype.GetMetric = function () {
- switch (this.m_count) {
- case 0:
- b2Settings.b2Assert(false);
- return 0.0;
- case 1:
- return 0.0;
- case 2:
- return b2Math.SubtractVV(this.m_v1.w, this.m_v2.w).Length();
- case 3:
- return b2Math.CrossVV(b2Math.SubtractVV(this.m_v2.w, this.m_v1.w), b2Math.SubtractVV(this.m_v3.w, this.m_v1.w));
- default:
- b2Settings.b2Assert(false);
- return 0.0;
- }
- }
- b2Simplex.prototype.Solve2 = function () {
- var w1 = this.m_v1.w;
- var w2 = this.m_v2.w;
- var e12 = b2Math.SubtractVV(w2, w1);
- var d12_2 = (-(w1.x * e12.x + w1.y * e12.y));
- if (d12_2 <= 0.0) {
- this.m_v1.a = 1.0;
- this.m_count = 1;
- return;
- }
- var d12_1 = (w2.x * e12.x + w2.y * e12.y);
- if (d12_1 <= 0.0) {
- this.m_v2.a = 1.0;
- this.m_count = 1;
- this.m_v1.Set(this.m_v2);
- return;
- }
- var inv_d12 = 1.0 / (d12_1 + d12_2);
- this.m_v1.a = d12_1 * inv_d12;
- this.m_v2.a = d12_2 * inv_d12;
- this.m_count = 2;
- }
- b2Simplex.prototype.Solve3 = function () {
- var w1 = this.m_v1.w;
- var w2 = this.m_v2.w;
- var w3 = this.m_v3.w;
- var e12 = b2Math.SubtractVV(w2, w1);
- var w1e12 = b2Math.Dot(w1, e12);
- var w2e12 = b2Math.Dot(w2, e12);
- var d12_1 = w2e12;
- var d12_2 = (-w1e12);
- var e13 = b2Math.SubtractVV(w3, w1);
- var w1e13 = b2Math.Dot(w1, e13);
- var w3e13 = b2Math.Dot(w3, e13);
- var d13_1 = w3e13;
- var d13_2 = (-w1e13);
- var e23 = b2Math.SubtractVV(w3, w2);
- var w2e23 = b2Math.Dot(w2, e23);
- var w3e23 = b2Math.Dot(w3, e23);
- var d23_1 = w3e23;
- var d23_2 = (-w2e23);
- var n123 = b2Math.CrossVV(e12, e13);
- var d123_1 = n123 * b2Math.CrossVV(w2, w3);
- var d123_2 = n123 * b2Math.CrossVV(w3, w1);
- var d123_3 = n123 * b2Math.CrossVV(w1, w2);
- if (d12_2 <= 0.0 && d13_2 <= 0.0) {
- this.m_v1.a = 1.0;
- this.m_count = 1;
- return;
- }
- if (d12_1 > 0.0 && d12_2 > 0.0 && d123_3 <= 0.0) {
- var inv_d12 = 1.0 / (d12_1 + d12_2);
- this.m_v1.a = d12_1 * inv_d12;
- this.m_v2.a = d12_2 * inv_d12;
- this.m_count = 2;
- return;
- }
- if (d13_1 > 0.0 && d13_2 > 0.0 && d123_2 <= 0.0) {
- var inv_d13 = 1.0 / (d13_1 + d13_2);
- this.m_v1.a = d13_1 * inv_d13;
- this.m_v3.a = d13_2 * inv_d13;
- this.m_count = 2;
- this.m_v2.Set(this.m_v3);
- return;
- }
- if (d12_1 <= 0.0 && d23_2 <= 0.0) {
- this.m_v2.a = 1.0;
- this.m_count = 1;
- this.m_v1.Set(this.m_v2);
- return;
- }
- if (d13_1 <= 0.0 && d23_1 <= 0.0) {
- this.m_v3.a = 1.0;
- this.m_count = 1;
- this.m_v1.Set(this.m_v3);
- return;
- }
- if (d23_1 > 0.0 && d23_2 > 0.0 && d123_1 <= 0.0) {
- var inv_d23 = 1.0 / (d23_1 + d23_2);
- this.m_v2.a = d23_1 * inv_d23;
- this.m_v3.a = d23_2 * inv_d23;
- this.m_count = 2;
- this.m_v1.Set(this.m_v3);
- return;
- }
- var inv_d123 = 1.0 / (d123_1 + d123_2 + d123_3);
- this.m_v1.a = d123_1 * inv_d123;
- this.m_v2.a = d123_2 * inv_d123;
- this.m_v3.a = d123_3 * inv_d123;
- this.m_count = 3;
- }
- b2SimplexCache.b2SimplexCache = function () {
- this.indexA = new Vector_a2j_Number(3);
- this.indexB = new Vector_a2j_Number(3);
- };
- b2SimplexVertex.b2SimplexVertex = function () {};
- b2SimplexVertex.prototype.Set = function (other) {
- this.wA.SetV(other.wA);
- this.wB.SetV(other.wB);
- this.w.SetV(other.w);
- this.a = other.a;
- this.indexA = other.indexA;
- this.indexB = other.indexB;
- }
- b2TimeOfImpact.b2TimeOfImpact = function () {};
- b2TimeOfImpact.TimeOfImpact = function (input) {
- ++b2TimeOfImpact.b2_toiCalls;
- var proxyA = input.proxyA;
- var proxyB = input.proxyB;
- var sweepA = input.sweepA;
- var sweepB = input.sweepB;
- b2Settings.b2Assert(sweepA.t0 == sweepB.t0);
- b2Settings.b2Assert(1.0 - sweepA.t0 > Number.MIN_VALUE);
- var radius = proxyA.m_radius + proxyB.m_radius;
- var tolerance = input.tolerance;
- var alpha = 0.0;
- var k_maxIterations = 1000;
- var iter = 0;
- var target = 0.0;
- b2TimeOfImpact.s_cache.count = 0;
- b2TimeOfImpact.s_distanceInput.useRadii = false;
- for (;;) {
- sweepA.GetTransform(b2TimeOfImpact.s_xfA, alpha);
- sweepB.GetTransform(b2TimeOfImpact.s_xfB, alpha);
- b2TimeOfImpact.s_distanceInput.proxyA = proxyA;
- b2TimeOfImpact.s_distanceInput.proxyB = proxyB;
- b2TimeOfImpact.s_distanceInput.transformA = b2TimeOfImpact.s_xfA;
- b2TimeOfImpact.s_distanceInput.transformB = b2TimeOfImpact.s_xfB;
- b2Distance.Distance(b2TimeOfImpact.s_distanceOutput, b2TimeOfImpact.s_cache, b2TimeOfImpact.s_distanceInput);
- if (b2TimeOfImpact.s_distanceOutput.distance <= 0.0) {
- alpha = 1.0;
- break;
- }
- b2TimeOfImpact.s_fcn.Initialize(b2TimeOfImpact.s_cache, proxyA, b2TimeOfImpact.s_xfA, proxyB, b2TimeOfImpact.s_xfB);
- var separation = b2TimeOfImpact.s_fcn.Evaluate(b2TimeOfImpact.s_xfA, b2TimeOfImpact.s_xfB);
- if (separation <= 0.0) {
- alpha = 1.0;
- break;
- }
- if (iter == 0) {
- if (separation > radius) {
- target = b2Math.Max(radius - tolerance, 0.75 * radius);
- }
- else {
- target = b2Math.Max(separation - tolerance, 0.02 * radius);
- }
- }
- if (separation - target < 0.5 * tolerance) {
- if (iter == 0) {
- alpha = 1.0;
- break;
- }
- break;
- }
- var newAlpha = alpha; {
- var x1 = alpha;
- var x2 = 1.0;
- var f1 = separation;
- sweepA.GetTransform(b2TimeOfImpact.s_xfA, x2);
- sweepB.GetTransform(b2TimeOfImpact.s_xfB, x2);
- var f2 = b2TimeOfImpact.s_fcn.Evaluate(b2TimeOfImpact.s_xfA, b2TimeOfImpact.s_xfB);
- if (f2 >= target) {
- alpha = 1.0;
- break;
- }
- var rootIterCount = 0;
- for (;;) {
- var x = 0;
- if (rootIterCount & 1) {
- x = x1 + (target - f1) * (x2 - x1) / (f2 - f1);
- }
- else {
- x = 0.5 * (x1 + x2);
- }
- sweepA.GetTransform(b2TimeOfImpact.s_xfA, x);
- sweepB.GetTransform(b2TimeOfImpact.s_xfB, x);
- var f = b2TimeOfImpact.s_fcn.Evaluate(b2TimeOfImpact.s_xfA, b2TimeOfImpact.s_xfB);
- if (b2Math.Abs(f - target) < 0.025 * tolerance) {
- newAlpha = x;
- break;
- }
- if (f > target) {
- x1 = x;
- f1 = f;
- }
- else {
- x2 = x;
- f2 = f;
- }++rootIterCount;
- ++b2TimeOfImpact.b2_toiRootIters;
- if (rootIterCount == 50) {
- break;
- }
- }
- b2TimeOfImpact.b2_toiMaxRootIters = b2Math.Max(b2TimeOfImpact.b2_toiMaxRootIters, rootIterCount);
- }
- if (newAlpha < (1.0 + 100.0 * Number.MIN_VALUE) * alpha) {
- break;
- }
- alpha = newAlpha;
- iter++;
- ++b2TimeOfImpact.b2_toiIters;
- if (iter == k_maxIterations) {
- break;
- }
- }
- b2TimeOfImpact.b2_toiMaxIters = b2Math.Max(b2TimeOfImpact.b2_toiMaxIters, iter);
- return alpha;
- }
- 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 b2SimplexCache();
- Box2D.Collision.b2TimeOfImpact.s_distanceInput = new b2DistanceInput();
- Box2D.Collision.b2TimeOfImpact.s_xfA = new b2Transform();
- Box2D.Collision.b2TimeOfImpact.s_xfB = new b2Transform();
- Box2D.Collision.b2TimeOfImpact.s_fcn = new b2SeparationFunction();
- Box2D.Collision.b2TimeOfImpact.s_distanceOutput = new b2DistanceOutput();
- });
- b2TOIInput.b2TOIInput = function () {
- this.proxyA = new b2DistanceProxy();
- this.proxyB = new b2DistanceProxy();
- this.sweepA = new b2Sweep();
- this.sweepB = new b2Sweep();
- };
- b2WorldManifold.b2WorldManifold = function () {
- this.m_normal = new b2Vec2();
- };
- b2WorldManifold.prototype.b2WorldManifold = function () {
- this.m_points = new Vector(b2Settings.b2_maxManifoldPoints);
- for (var i = 0; i < b2Settings.b2_maxManifoldPoints; i++) {
- this.m_points[i] = new b2Vec2();
- }
- }
- b2WorldManifold.prototype.Initialize = function (manifold, xfA, radiusA, xfB, radiusB) {
- if (radiusA === undefined) radiusA = 0;
- if (radiusB === undefined) radiusB = 0;
- if (manifold.m_pointCount == 0) {
- return;
- }
- var i = 0;
- var tVec;
- var tMat;
- var normalX = 0;
- var normalY = 0;
- var planePointX = 0;
- var planePointY = 0;
- var clipPointX = 0;
- var clipPointY = 0;
- switch (manifold.m_type) {
- case b2Manifold.e_circles:
- {
- tMat = xfA.R;
- tVec = manifold.m_localPoint;
- var pointAX = xfA.position.x + tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- var pointAY = xfA.position.y + tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tMat = xfB.R;
- tVec = manifold.m_points[0].m_localPoint;
- var pointBX = xfB.position.x + tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- var pointBY = xfB.position.y + tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- var dX = pointBX - pointAX;
- var dY = pointBY - pointAY;
- var d2 = dX * dX + dY * dY;
- if (d2 > Number.MIN_VALUE * Number.MIN_VALUE) {
- var d = Math.sqrt(d2);
- this.m_normal.x = dX / d;
- this.m_normal.y = dY / d;
- }
- else {
- this.m_normal.x = 1;
- this.m_normal.y = 0;
- }
- var cAX = pointAX + radiusA * this.m_normal.x;
- var cAY = pointAY + radiusA * this.m_normal.y;
- var cBX = pointBX - radiusB * this.m_normal.x;
- var cBY = pointBY - radiusB * this.m_normal.y;
- this.m_points[0].x = 0.5 * (cAX + cBX);
- this.m_points[0].y = 0.5 * (cAY + cBY);
- }
- break;
- case b2Manifold.e_faceA:
- {
- tMat = xfA.R;
- tVec = manifold.m_localPlaneNormal;
- normalX = tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- normalY = tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tMat = xfA.R;
- tVec = manifold.m_localPoint;
- planePointX = xfA.position.x + tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- planePointY = xfA.position.y + tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- this.m_normal.x = normalX;
- this.m_normal.y = normalY;
- for (i = 0;
- i < manifold.m_pointCount; i++) {
- tMat = xfB.R;
- tVec = manifold.m_points[i].m_localPoint;
- clipPointX = xfB.position.x + tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- clipPointY = xfB.position.y + tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- this.m_points[i].x = clipPointX + 0.5 * (radiusA - (clipPointX - planePointX) * normalX - (clipPointY - planePointY) * normalY - radiusB) * normalX;
- this.m_points[i].y = clipPointY + 0.5 * (radiusA - (clipPointX - planePointX) * normalX - (clipPointY - planePointY) * normalY - radiusB) * normalY;
- }
- }
- break;
- case b2Manifold.e_faceB:
- {
- tMat = xfB.R;
- tVec = manifold.m_localPlaneNormal;
- normalX = tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- normalY = tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tMat = xfB.R;
- tVec = manifold.m_localPoint;
- planePointX = xfB.position.x + tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- planePointY = xfB.position.y + tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- this.m_normal.x = (-normalX);
- this.m_normal.y = (-normalY);
- for (i = 0;
- i < manifold.m_pointCount; i++) {
- tMat = xfA.R;
- tVec = manifold.m_points[i].m_localPoint;
- clipPointX = xfA.position.x + tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- clipPointY = xfA.position.y + tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- this.m_points[i].x = clipPointX + 0.5 * (radiusB - (clipPointX - planePointX) * normalX - (clipPointY - planePointY) * normalY - radiusA) * normalX;
- this.m_points[i].y = clipPointY + 0.5 * (radiusB - (clipPointX - planePointX) * normalX - (clipPointY - planePointY) * normalY - radiusA) * normalY;
- }
- }
- break;
- }
- }
- ClipVertex.ClipVertex = function () {
- this.v = new b2Vec2();
- this.id = new b2ContactID();
- };
- ClipVertex.prototype.Set = function (other) {
- this.v.SetV(other.v);
- this.id.Set(other.id);
- }
- Features.Features = function () {};
- Object.defineProperty(Features.prototype, 'referenceEdge', {
- enumerable: false,
- configurable: true,
- get: function () {
- return this._referenceEdge;
- }
- });
- Object.defineProperty(Features.prototype, 'referenceEdge', {
- enumerable: false,
- configurable: true,
- set: function (value) {
- if (value === undefined) value = 0;
- this._referenceEdge = value;
- this._m_id._key = (this._m_id._key & 0xffffff00) | (this._referenceEdge & 0x000000ff);
- }
- });
- Object.defineProperty(Features.prototype, 'incidentEdge', {
- enumerable: false,
- configurable: true,
- get: function () {
- return this._incidentEdge;
- }
- });
- Object.defineProperty(Features.prototype, 'incidentEdge', {
- enumerable: false,
- configurable: true,
- set: function (value) {
- if (value === undefined) value = 0;
- this._incidentEdge = value;
- this._m_id._key = (this._m_id._key & 0xffff00ff) | ((this._incidentEdge << 8) & 0x0000ff00);
- }
- });
- Object.defineProperty(Features.prototype, 'incidentVertex', {
- enumerable: false,
- configurable: true,
- get: function () {
- return this._incidentVertex;
- }
- });
- Object.defineProperty(Features.prototype, 'incidentVertex', {
- enumerable: false,
- configurable: true,
- set: function (value) {
- if (value === undefined) value = 0;
- this._incidentVertex = value;
- this._m_id._key = (this._m_id._key & 0xff00ffff) | ((this._incidentVertex << 16) & 0x00ff0000);
- }
- });
- Object.defineProperty(Features.prototype, 'flip', {
- enumerable: false,
- configurable: true,
- get: function () {
- return this._flip;
- }
- });
- Object.defineProperty(Features.prototype, 'flip', {
- enumerable: false,
- configurable: true,
- set: function (value) {
- if (value === undefined) value = 0;
- this._flip = value;
- this._m_id._key = (this._m_id._key & 0x00ffffff) | ((this._flip << 24) & 0xff000000);
- }
- });
-})();
-(function () {
- var b2Color = Box2D.Common.b2Color,
- b2internal = Box2D.Common.b2internal,
- b2Settings = Box2D.Common.b2Settings,
- b2CircleShape = Box2D.Collision.Shapes.b2CircleShape,
- b2EdgeChainDef = Box2D.Collision.Shapes.b2EdgeChainDef,
- b2EdgeShape = Box2D.Collision.Shapes.b2EdgeShape,
- b2MassData = Box2D.Collision.Shapes.b2MassData,
- b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape,
- b2Shape = Box2D.Collision.Shapes.b2Shape,
- b2Mat22 = Box2D.Common.Math.b2Mat22,
- b2Mat33 = Box2D.Common.Math.b2Mat33,
- b2Math = Box2D.Common.Math.b2Math,
- b2Sweep = Box2D.Common.Math.b2Sweep,
- b2Transform = Box2D.Common.Math.b2Transform,
- b2Vec2 = Box2D.Common.Math.b2Vec2,
- b2Vec3 = Box2D.Common.Math.b2Vec3,
- b2Body = Box2D.Dynamics.b2Body,
- b2BodyDef = Box2D.Dynamics.b2BodyDef,
- b2ContactFilter = Box2D.Dynamics.b2ContactFilter,
- b2ContactImpulse = Box2D.Dynamics.b2ContactImpulse,
- b2ContactListener = Box2D.Dynamics.b2ContactListener,
- b2ContactManager = Box2D.Dynamics.b2ContactManager,
- b2DebugDraw = Box2D.Dynamics.b2DebugDraw,
- b2DestructionListener = Box2D.Dynamics.b2DestructionListener,
- b2FilterData = Box2D.Dynamics.b2FilterData,
- b2Fixture = Box2D.Dynamics.b2Fixture,
- b2FixtureDef = Box2D.Dynamics.b2FixtureDef,
- b2Island = Box2D.Dynamics.b2Island,
- b2TimeStep = Box2D.Dynamics.b2TimeStep,
- b2World = Box2D.Dynamics.b2World,
- b2AABB = Box2D.Collision.b2AABB,
- b2Bound = Box2D.Collision.b2Bound,
- b2BoundValues = Box2D.Collision.b2BoundValues,
- b2Collision = Box2D.Collision.b2Collision,
- b2ContactID = Box2D.Collision.b2ContactID,
- b2ContactPoint = Box2D.Collision.b2ContactPoint,
- b2Distance = Box2D.Collision.b2Distance,
- b2DistanceInput = Box2D.Collision.b2DistanceInput,
- b2DistanceOutput = Box2D.Collision.b2DistanceOutput,
- b2DistanceProxy = Box2D.Collision.b2DistanceProxy,
- b2DynamicTree = Box2D.Collision.b2DynamicTree,
- b2DynamicTreeBroadPhase = Box2D.Collision.b2DynamicTreeBroadPhase,
- b2DynamicTreeNode = Box2D.Collision.b2DynamicTreeNode,
- b2DynamicTreePair = Box2D.Collision.b2DynamicTreePair,
- b2Manifold = Box2D.Collision.b2Manifold,
- b2ManifoldPoint = Box2D.Collision.b2ManifoldPoint,
- b2Point = Box2D.Collision.b2Point,
- b2RayCastInput = Box2D.Collision.b2RayCastInput,
- b2RayCastOutput = Box2D.Collision.b2RayCastOutput,
- b2Segment = Box2D.Collision.b2Segment,
- b2SeparationFunction = Box2D.Collision.b2SeparationFunction,
- b2Simplex = Box2D.Collision.b2Simplex,
- b2SimplexCache = Box2D.Collision.b2SimplexCache,
- b2SimplexVertex = Box2D.Collision.b2SimplexVertex,
- b2TimeOfImpact = Box2D.Collision.b2TimeOfImpact,
- b2TOIInput = Box2D.Collision.b2TOIInput,
- b2WorldManifold = Box2D.Collision.b2WorldManifold,
- ClipVertex = Box2D.Collision.ClipVertex,
- Features = Box2D.Collision.Features,
- IBroadPhase = Box2D.Collision.IBroadPhase;
-
- Box2D.inherit(b2CircleShape, Box2D.Collision.Shapes.b2Shape);
- b2CircleShape.prototype.__super = Box2D.Collision.Shapes.b2Shape.prototype;
- b2CircleShape.b2CircleShape = function () {
- Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this, arguments);
- this.m_p = new b2Vec2();
- };
- b2CircleShape.prototype.Copy = function () {
- var s = new b2CircleShape();
- s.Set(this);
- return s;
- }
- b2CircleShape.prototype.Set = function (other) {
- this.__super.Set.call(this, other);
- if (Box2D.is(other, b2CircleShape)) {
- var other2 = (other instanceof b2CircleShape ? other : null);
- this.m_p.SetV(other2.m_p);
- }
- }
- b2CircleShape.prototype.TestPoint = function (transform, p) {
- var tMat = transform.R;
- var dX = transform.position.x + (tMat.col1.x * this.m_p.x + tMat.col2.x * this.m_p.y);
- var dY = transform.position.y + (tMat.col1.y * this.m_p.x + tMat.col2.y * this.m_p.y);
- dX = p.x - dX;
- dY = p.y - dY;
- return (dX * dX + dY * dY) <= this.m_radius * this.m_radius;
- }
- b2CircleShape.prototype.RayCast = function (output, input, transform) {
- var tMat = transform.R;
- var positionX = transform.position.x + (tMat.col1.x * this.m_p.x + tMat.col2.x * this.m_p.y);
- var positionY = transform.position.y + (tMat.col1.y * this.m_p.x + tMat.col2.y * this.m_p.y);
- var sX = input.p1.x - positionX;
- var sY = input.p1.y - positionY;
- var b = (sX * sX + sY * sY) - this.m_radius * this.m_radius;
- var rX = input.p2.x - input.p1.x;
- var rY = input.p2.y - input.p1.y;
- var c = (sX * rX + sY * rY);
- var rr = (rX * rX + rY * rY);
- var sigma = c * c - rr * b;
- if (sigma < 0.0 || rr < Number.MIN_VALUE) {
- return false;
- }
- var a = (-(c + Math.sqrt(sigma)));
- if (0.0 <= a && a <= input.maxFraction * rr) {
- a /= rr;
- output.fraction = a;
- output.normal.x = sX + a * rX;
- output.normal.y = sY + a * rY;
- output.normal.Normalize();
- return true;
- }
- return false;
- }
- b2CircleShape.prototype.ComputeAABB = function (aabb, transform) {
- var tMat = transform.R;
- var pX = transform.position.x + (tMat.col1.x * this.m_p.x + tMat.col2.x * this.m_p.y);
- var pY = transform.position.y + (tMat.col1.y * this.m_p.x + tMat.col2.y * this.m_p.y);
- aabb.lowerBound.Set(pX - this.m_radius, pY - this.m_radius);
- aabb.upperBound.Set(pX + this.m_radius, pY + this.m_radius);
- }
- b2CircleShape.prototype.ComputeMass = function (massData, density) {
- if (density === undefined) density = 0;
- massData.mass = density * b2Settings.b2_pi * this.m_radius * this.m_radius;
- massData.center.SetV(this.m_p);
- massData.I = massData.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));
- }
- b2CircleShape.prototype.ComputeSubmergedArea = function (normal, offset, xf, c) {
- if (offset === undefined) offset = 0;
- var p = b2Math.MulX(xf, this.m_p);
- var l = (-(b2Math.Dot(normal, p) - offset));
- if (l < (-this.m_radius) + Number.MIN_VALUE) {
- return 0;
- }
- if (l > this.m_radius) {
- c.SetV(p);
- return Math.PI * this.m_radius * this.m_radius;
- }
- var r2 = this.m_radius * this.m_radius;
- var l2 = l * l;
- var area = r2 * (Math.asin(l / this.m_radius) + Math.PI / 2) + l * Math.sqrt(r2 - l2);
- var com = (-2 / 3 * Math.pow(r2 - l2, 1.5) / area);
- c.x = p.x + normal.x * com;
- c.y = p.y + normal.y * com;
- return area;
- }
- b2CircleShape.prototype.GetLocalPosition = function () {
- return this.m_p;
- }
- b2CircleShape.prototype.SetLocalPosition = function (position) {
- this.m_p.SetV(position);
- }
- b2CircleShape.prototype.GetRadius = function () {
- return this.m_radius;
- }
- b2CircleShape.prototype.SetRadius = function (radius) {
- if (radius === undefined) radius = 0;
- this.m_radius = radius;
- }
- b2CircleShape.prototype.b2CircleShape = function (radius) {
- if (radius === undefined) radius = 0;
- this.__super.b2Shape.call(this);
- this.m_type = b2Shape.e_circleShape;
- this.m_radius = radius;
- }
- b2EdgeChainDef.b2EdgeChainDef = function () {};
- b2EdgeChainDef.prototype.b2EdgeChainDef = function () {
- this.vertexCount = 0;
- this.isALoop = true;
- this.vertices = [];
- }
- Box2D.inherit(b2EdgeShape, Box2D.Collision.Shapes.b2Shape);
- b2EdgeShape.prototype.__super = Box2D.Collision.Shapes.b2Shape.prototype;
- b2EdgeShape.b2EdgeShape = function () {
- Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this, arguments);
- this.s_supportVec = new b2Vec2();
- this.m_v1 = new b2Vec2();
- this.m_v2 = new b2Vec2();
- this.m_coreV1 = new b2Vec2();
- this.m_coreV2 = new b2Vec2();
- this.m_normal = new b2Vec2();
- this.m_direction = new b2Vec2();
- this.m_cornerDir1 = new b2Vec2();
- this.m_cornerDir2 = new b2Vec2();
- };
- b2EdgeShape.prototype.TestPoint = function (transform, p) {
- return false;
- }
- b2EdgeShape.prototype.RayCast = function (output, input, transform) {
- var tMat;
- var rX = input.p2.x - input.p1.x;
- var rY = input.p2.y - input.p1.y;
- tMat = transform.R;
- var v1X = transform.position.x + (tMat.col1.x * this.m_v1.x + tMat.col2.x * this.m_v1.y);
- var v1Y = transform.position.y + (tMat.col1.y * this.m_v1.x + tMat.col2.y * this.m_v1.y);
- var nX = transform.position.y + (tMat.col1.y * this.m_v2.x + tMat.col2.y * this.m_v2.y) - v1Y;
- var nY = (-(transform.position.x + (tMat.col1.x * this.m_v2.x + tMat.col2.x * this.m_v2.y) - v1X));
- var k_slop = 100.0 * Number.MIN_VALUE;
- var denom = (-(rX * nX + rY * nY));
- if (denom > k_slop) {
- var bX = input.p1.x - v1X;
- var bY = input.p1.y - v1Y;
- var a = (bX * nX + bY * nY);
- if (0.0 <= a && a <= input.maxFraction * denom) {
- var mu2 = (-rX * bY) + rY * bX;
- if ((-k_slop * denom) <= mu2 && mu2 <= denom * (1.0 + k_slop)) {
- a /= denom;
- output.fraction = a;
- var nLen = Math.sqrt(nX * nX + nY * nY);
- output.normal.x = nX / nLen;
- output.normal.y = nY / nLen;
- return true;
- }
- }
- }
- return false;
- }
- b2EdgeShape.prototype.ComputeAABB = function (aabb, transform) {
- var tMat = transform.R;
- var v1X = transform.position.x + (tMat.col1.x * this.m_v1.x + tMat.col2.x * this.m_v1.y);
- var v1Y = transform.position.y + (tMat.col1.y * this.m_v1.x + tMat.col2.y * this.m_v1.y);
- var v2X = transform.position.x + (tMat.col1.x * this.m_v2.x + tMat.col2.x * this.m_v2.y);
- var v2Y = transform.position.y + (tMat.col1.y * this.m_v2.x + tMat.col2.y * this.m_v2.y);
- if (v1X < v2X) {
- aabb.lowerBound.x = v1X;
- aabb.upperBound.x = v2X;
- }
- else {
- aabb.lowerBound.x = v2X;
- aabb.upperBound.x = v1X;
- }
- if (v1Y < v2Y) {
- aabb.lowerBound.y = v1Y;
- aabb.upperBound.y = v2Y;
- }
- else {
- aabb.lowerBound.y = v2Y;
- aabb.upperBound.y = v1Y;
- }
- }
- b2EdgeShape.prototype.ComputeMass = function (massData, density) {
- if (density === undefined) density = 0;
- massData.mass = 0;
- massData.center.SetV(this.m_v1);
- massData.I = 0;
- }
- b2EdgeShape.prototype.ComputeSubmergedArea = function (normal, offset, xf, c) {
- if (offset === undefined) offset = 0;
- var v0 = new b2Vec2(normal.x * offset, normal.y * offset);
- var v1 = b2Math.MulX(xf, this.m_v1);
- var v2 = b2Math.MulX(xf, this.m_v2);
- var d1 = b2Math.Dot(normal, v1) - offset;
- var d2 = b2Math.Dot(normal, v2) - offset;
- if (d1 > 0) {
- if (d2 > 0) {
- return 0;
- }
- else {
- v1.x = (-d2 / (d1 - d2) * v1.x) + d1 / (d1 - d2) * v2.x;
- v1.y = (-d2 / (d1 - d2) * v1.y) + d1 / (d1 - d2) * v2.y;
- }
- }
- else {
- if (d2 > 0) {
- v2.x = (-d2 / (d1 - d2) * v1.x) + d1 / (d1 - d2) * v2.x;
- v2.y = (-d2 / (d1 - d2) * v1.y) + d1 / (d1 - d2) * v2.y;
- }
- else {}
- }
- c.x = (v0.x + v1.x + v2.x) / 3;
- c.y = (v0.y + v1.y + v2.y) / 3;
- return 0.5 * ((v1.x - v0.x) * (v2.y - v0.y) - (v1.y - v0.y) * (v2.x - v0.x));
- }
- b2EdgeShape.prototype.GetLength = function () {
- return this.m_length;
- }
- b2EdgeShape.prototype.GetVertex1 = function () {
- return this.m_v1;
- }
- b2EdgeShape.prototype.GetVertex2 = function () {
- return this.m_v2;
- }
- b2EdgeShape.prototype.GetCoreVertex1 = function () {
- return this.m_coreV1;
- }
- b2EdgeShape.prototype.GetCoreVertex2 = function () {
- return this.m_coreV2;
- }
- b2EdgeShape.prototype.GetNormalVector = function () {
- return this.m_normal;
- }
- b2EdgeShape.prototype.GetDirectionVector = function () {
- return this.m_direction;
- }
- b2EdgeShape.prototype.GetCorner1Vector = function () {
- return this.m_cornerDir1;
- }
- b2EdgeShape.prototype.GetCorner2Vector = function () {
- return this.m_cornerDir2;
- }
- b2EdgeShape.prototype.Corner1IsConvex = function () {
- return this.m_cornerConvex1;
- }
- b2EdgeShape.prototype.Corner2IsConvex = function () {
- return this.m_cornerConvex2;
- }
- b2EdgeShape.prototype.GetFirstVertex = function (xf) {
- var tMat = xf.R;
- return new b2Vec2(xf.position.x + (tMat.col1.x * this.m_coreV1.x + tMat.col2.x * this.m_coreV1.y), xf.position.y + (tMat.col1.y * this.m_coreV1.x + tMat.col2.y * this.m_coreV1.y));
- }
- b2EdgeShape.prototype.GetNextEdge = function () {
- return this.m_nextEdge;
- }
- b2EdgeShape.prototype.GetPrevEdge = function () {
- return this.m_prevEdge;
- }
- b2EdgeShape.prototype.Support = function (xf, dX, dY) {
- if (dX === undefined) dX = 0;
- if (dY === undefined) dY = 0;
- var tMat = xf.R;
- var v1X = xf.position.x + (tMat.col1.x * this.m_coreV1.x + tMat.col2.x * this.m_coreV1.y);
- var v1Y = xf.position.y + (tMat.col1.y * this.m_coreV1.x + tMat.col2.y * this.m_coreV1.y);
- var v2X = xf.position.x + (tMat.col1.x * this.m_coreV2.x + tMat.col2.x * this.m_coreV2.y);
- var v2Y = xf.position.y + (tMat.col1.y * this.m_coreV2.x + tMat.col2.y * this.m_coreV2.y);
- if ((v1X * dX + v1Y * dY) > (v2X * dX + v2Y * dY)) {
- this.s_supportVec.x = v1X;
- this.s_supportVec.y = v1Y;
- }
- else {
- this.s_supportVec.x = v2X;
- this.s_supportVec.y = v2Y;
- }
- return this.s_supportVec;
- }
- b2EdgeShape.prototype.b2EdgeShape = function (v1, v2) {
- this.__super.b2Shape.call(this);
- this.m_type = b2Shape.e_edgeShape;
- this.m_prevEdge = null;
- this.m_nextEdge = null;
- this.m_v1 = v1;
- this.m_v2 = v2;
- 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((-b2Settings.b2_toiSlop * (this.m_normal.x - this.m_direction.x)) + this.m_v1.x, (-b2Settings.b2_toiSlop * (this.m_normal.y - this.m_direction.y)) + this.m_v1.y);
- this.m_coreV2.Set((-b2Settings.b2_toiSlop * (this.m_normal.x + this.m_direction.x)) + this.m_v2.x, (-b2Settings.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));
- }
- b2EdgeShape.prototype.SetPrevEdge = function (edge, core, cornerDir, convex) {
- this.m_prevEdge = edge;
- this.m_coreV1 = core;
- this.m_cornerDir1 = cornerDir;
- this.m_cornerConvex1 = convex;
- }
- b2EdgeShape.prototype.SetNextEdge = function (edge, core, cornerDir, convex) {
- this.m_nextEdge = edge;
- this.m_coreV2 = core;
- this.m_cornerDir2 = cornerDir;
- this.m_cornerConvex2 = convex;
- }
- b2MassData.b2MassData = function () {
- this.mass = 0.0;
- this.center = new b2Vec2(0, 0);
- this.I = 0.0;
- };
- Box2D.inherit(b2PolygonShape, Box2D.Collision.Shapes.b2Shape);
- b2PolygonShape.prototype.__super = Box2D.Collision.Shapes.b2Shape.prototype;
- b2PolygonShape.b2PolygonShape = function () {
- Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this, arguments);
- };
- b2PolygonShape.prototype.Copy = function () {
- var s = new b2PolygonShape();
- s.Set(this);
- return s;
- }
- b2PolygonShape.prototype.Set = function (other) {
- this.__super.Set.call(this, other);
- if (Box2D.is(other, b2PolygonShape)) {
- var other2 = (other instanceof b2PolygonShape ? other : null);
- this.m_centroid.SetV(other2.m_centroid);
- this.m_vertexCount = other2.m_vertexCount;
- this.Reserve(this.m_vertexCount);
- for (var i = 0; i < this.m_vertexCount; i++) {
- this.m_vertices[i].SetV(other2.m_vertices[i]);
- this.m_normals[i].SetV(other2.m_normals[i]);
- }
- }
- }
- b2PolygonShape.prototype.SetAsArray = function (vertices, vertexCount) {
- if (vertexCount === undefined) vertexCount = 0;
- var v = new Vector();
- var i = 0,
- tVec;
- for (i = 0;
- i < vertices.length; ++i) {
- tVec = vertices[i];
- v.push(tVec);
- }
- this.SetAsVector(v, vertexCount);
- }
- b2PolygonShape.AsArray = function (vertices, vertexCount) {
- if (vertexCount === undefined) vertexCount = 0;
- var polygonShape = new b2PolygonShape();
- polygonShape.SetAsArray(vertices, vertexCount);
- return polygonShape;
- }
- b2PolygonShape.prototype.SetAsVector = function (vertices, vertexCount) {
- if (vertexCount === undefined) vertexCount = 0;
- if (vertexCount == 0) vertexCount = vertices.length;
- b2Settings.b2Assert(2 <= vertexCount);
- this.m_vertexCount = vertexCount;
- this.Reserve(vertexCount);
- var i = 0;
- for (i = 0;
- i < this.m_vertexCount; i++) {
- this.m_vertices[i].SetV(vertices[i]);
- }
- for (i = 0;
- i < this.m_vertexCount; ++i) {
- var i1 = parseInt(i);
- var i2 = parseInt(i + 1 < this.m_vertexCount ? i + 1 : 0);
- var edge = b2Math.SubtractVV(this.m_vertices[i2], this.m_vertices[i1]);
- b2Settings.b2Assert(edge.LengthSquared() > Number.MIN_VALUE);
- this.m_normals[i].SetV(b2Math.CrossVF(edge, 1.0));
- this.m_normals[i].Normalize();
- }
- this.m_centroid = b2PolygonShape.ComputeCentroid(this.m_vertices, this.m_vertexCount);
- }
- b2PolygonShape.AsVector = function (vertices, vertexCount) {
- if (vertexCount === undefined) vertexCount = 0;
- var polygonShape = new b2PolygonShape();
- polygonShape.SetAsVector(vertices, vertexCount);
- return polygonShape;
- }
- b2PolygonShape.prototype.SetAsBox = function (hx, hy) {
- if (hx === undefined) hx = 0;
- if (hy === undefined) hy = 0;
- this.m_vertexCount = 4;
- this.Reserve(4);
- this.m_vertices[0].Set((-hx), (-hy));
- this.m_vertices[1].Set(hx, (-hy));
- this.m_vertices[2].Set(hx, hy);
- this.m_vertices[3].Set((-hx), hy);
- this.m_normals[0].Set(0.0, (-1.0));
- this.m_normals[1].Set(1.0, 0.0);
- this.m_normals[2].Set(0.0, 1.0);
- this.m_normals[3].Set((-1.0), 0.0);
- this.m_centroid.SetZero();
- }
- b2PolygonShape.AsBox = function (hx, hy) {
- if (hx === undefined) hx = 0;
- if (hy === undefined) hy = 0;
- var polygonShape = new b2PolygonShape();
- polygonShape.SetAsBox(hx, hy);
- return polygonShape;
- }
- b2PolygonShape.prototype.SetAsOrientedBox = function (hx, hy, center, angle) {
- if (hx === undefined) hx = 0;
- if (hy === undefined) hy = 0;
- if (center === undefined) center = null;
- if (angle === undefined) angle = 0.0;
- this.m_vertexCount = 4;
- this.Reserve(4);
- this.m_vertices[0].Set((-hx), (-hy));
- this.m_vertices[1].Set(hx, (-hy));
- this.m_vertices[2].Set(hx, hy);
- this.m_vertices[3].Set((-hx), hy);
- this.m_normals[0].Set(0.0, (-1.0));
- this.m_normals[1].Set(1.0, 0.0);
- this.m_normals[2].Set(0.0, 1.0);
- this.m_normals[3].Set((-1.0), 0.0);
- this.m_centroid = center;
- var xf = new b2Transform();
- xf.position = center;
- xf.R.Set(angle);
- for (var i = 0; i < this.m_vertexCount; ++i) {
- this.m_vertices[i] = b2Math.MulX(xf, this.m_vertices[i]);
- this.m_normals[i] = b2Math.MulMV(xf.R, this.m_normals[i]);
- }
- }
- b2PolygonShape.AsOrientedBox = function (hx, hy, center, angle) {
- if (hx === undefined) hx = 0;
- if (hy === undefined) hy = 0;
- if (center === undefined) center = null;
- if (angle === undefined) angle = 0.0;
- var polygonShape = new b2PolygonShape();
- polygonShape.SetAsOrientedBox(hx, hy, center, angle);
- return polygonShape;
- }
- b2PolygonShape.prototype.SetAsEdge = function (v1, v2) {
- this.m_vertexCount = 2;
- this.Reserve(2);
- this.m_vertices[0].SetV(v1);
- this.m_vertices[1].SetV(v2);
- this.m_centroid.x = 0.5 * (v1.x + v2.x);
- this.m_centroid.y = 0.5 * (v1.y + v2.y);
- this.m_normals[0] = b2Math.CrossVF(b2Math.SubtractVV(v2, v1), 1.0);
- 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);
- }
- b2PolygonShape.AsEdge = function (v1, v2) {
- var polygonShape = new b2PolygonShape();
- polygonShape.SetAsEdge(v1, v2);
- return polygonShape;
- }
- b2PolygonShape.prototype.TestPoint = function (xf, p) {
- var tVec;
- var tMat = xf.R;
- var tX = p.x - xf.position.x;
- var tY = p.y - xf.position.y;
- var pLocalX = (tX * tMat.col1.x + tY * tMat.col1.y);
- var pLocalY = (tX * tMat.col2.x + tY * tMat.col2.y);
- for (var i = 0; i < this.m_vertexCount; ++i) {
- tVec = this.m_vertices[i];
- tX = pLocalX - tVec.x;
- tY = pLocalY - tVec.y;
- tVec = this.m_normals[i];
- var dot = (tVec.x * tX + tVec.y * tY);
- if (dot > 0.0) {
- return false;
- }
- }
- return true;
- }
- b2PolygonShape.prototype.RayCast = function (output, input, transform) {
- var lower = 0.0;
- var upper = input.maxFraction;
- var tX = 0;
- var tY = 0;
- var tMat;
- var tVec;
- tX = input.p1.x - transform.position.x;
- tY = input.p1.y - transform.position.y;
- tMat = transform.R;
- var p1X = (tX * tMat.col1.x + tY * tMat.col1.y);
- var p1Y = (tX * tMat.col2.x + tY * tMat.col2.y);
- tX = input.p2.x - transform.position.x;
- tY = input.p2.y - transform.position.y;
- tMat = transform.R;
- var p2X = (tX * tMat.col1.x + tY * tMat.col1.y);
- var p2Y = (tX * tMat.col2.x + tY * tMat.col2.y);
- var dX = p2X - p1X;
- var dY = p2Y - p1Y;
- var index = parseInt((-1));
- for (var i = 0; i < this.m_vertexCount; ++i) {
- tVec = this.m_vertices[i];
- tX = tVec.x - p1X;
- tY = tVec.y - p1Y;
- tVec = this.m_normals[i];
- var numerator = (tVec.x * tX + tVec.y * tY);
- var denominator = (tVec.x * dX + tVec.y * dY);
- if (denominator == 0.0) {
- if (numerator < 0.0) {
- return false;
- }
- }
- else {
- if (denominator < 0.0 && numerator < lower * denominator) {
- lower = numerator / denominator;
- index = i;
- }
- else if (denominator > 0.0 && numerator < upper * denominator) {
- upper = numerator / denominator;
- }
- }
- if (upper < lower - Number.MIN_VALUE) {
- return false;
- }
- }
- if (index >= 0) {
- output.fraction = lower;
- tMat = transform.R;
- tVec = this.m_normals[index];
- output.normal.x = (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- output.normal.y = (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- return true;
- }
- return false;
- }
- b2PolygonShape.prototype.ComputeAABB = function (aabb, xf) {
- var tMat = xf.R;
- var tVec = this.m_vertices[0];
- var lowerX = xf.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var lowerY = xf.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- var upperX = lowerX;
- var upperY = lowerY;
- for (var i = 1; i < this.m_vertexCount; ++i) {
- tVec = this.m_vertices[i];
- var vX = xf.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var vY = xf.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- lowerX = lowerX < vX ? lowerX : vX;
- lowerY = lowerY < vY ? lowerY : vY;
- upperX = upperX > vX ? upperX : vX;
- upperY = upperY > vY ? upperY : vY;
- }
- aabb.lowerBound.x = lowerX - this.m_radius;
- aabb.lowerBound.y = lowerY - this.m_radius;
- aabb.upperBound.x = upperX + this.m_radius;
- aabb.upperBound.y = upperY + this.m_radius;
- }
- b2PolygonShape.prototype.ComputeMass = function (massData, density) {
- if (density === undefined) density = 0;
- if (this.m_vertexCount == 2) {
- massData.center.x = 0.5 * (this.m_vertices[0].x + this.m_vertices[1].x);
- massData.center.y = 0.5 * (this.m_vertices[0].y + this.m_vertices[1].y);
- massData.mass = 0.0;
- massData.I = 0.0;
- return;
- }
- var centerX = 0.0;
- var centerY = 0.0;
- var area = 0.0;
- var I = 0.0;
- var p1X = 0.0;
- var p1Y = 0.0;
- var k_inv3 = 1.0 / 3.0;
- for (var i = 0; i < this.m_vertexCount; ++i) {
- var p2 = this.m_vertices[i];
- var p3 = i + 1 < this.m_vertexCount ? this.m_vertices[parseInt(i + 1)] : this.m_vertices[0];
- var e1X = p2.x - p1X;
- var e1Y = p2.y - p1Y;
- var e2X = p3.x - p1X;
- var e2Y = p3.y - p1Y;
- var D = e1X * e2Y - e1Y * e2X;
- var triangleArea = 0.5 * D;area += triangleArea;
- centerX += triangleArea * k_inv3 * (p1X + p2.x + p3.x);
- centerY += triangleArea * k_inv3 * (p1Y + p2.y + p3.y);
- var px = p1X;
- var py = p1Y;
- var ex1 = e1X;
- var ey1 = e1Y;
- var ex2 = e2X;
- var ey2 = e2Y;
- var intx2 = k_inv3 * (0.25 * (ex1 * ex1 + ex2 * ex1 + ex2 * ex2) + (px * ex1 + px * ex2)) + 0.5 * px * px;
- var inty2 = k_inv3 * (0.25 * (ey1 * ey1 + ey2 * ey1 + ey2 * ey2) + (py * ey1 + py * ey2)) + 0.5 * py * py;I += D * (intx2 + inty2);
- }
- massData.mass = density * area;
- centerX *= 1.0 / area;
- centerY *= 1.0 / area;
- massData.center.Set(centerX, centerY);
- massData.I = density * I;
- }
- b2PolygonShape.prototype.ComputeSubmergedArea = function (normal, offset, xf, c) {
- if (offset === undefined) offset = 0;
- var normalL = b2Math.MulTMV(xf.R, normal);
- var offsetL = offset - b2Math.Dot(normal, xf.position);
- var depths = new Vector_a2j_Number();
- var diveCount = 0;
- var intoIndex = parseInt((-1));
- var outoIndex = parseInt((-1));
- var lastSubmerged = false;
- var i = 0;
- for (i = 0;
- i < this.m_vertexCount; ++i) {
- depths[i] = b2Math.Dot(normalL, this.m_vertices[i]) - offsetL;
- var isSubmerged = depths[i] < (-Number.MIN_VALUE);
- if (i > 0) {
- if (isSubmerged) {
- if (!lastSubmerged) {
- intoIndex = i - 1;
- diveCount++;
- }
- }
- else {
- if (lastSubmerged) {
- outoIndex = i - 1;
- diveCount++;
- }
- }
- }
- lastSubmerged = isSubmerged;
- }
- switch (diveCount) {
- case 0:
- if (lastSubmerged) {
- var md = new b2MassData();
- this.ComputeMass(md, 1);
- c.SetV(b2Math.MulX(xf, md.center));
- return md.mass;
- }
- else {
- return 0;
- }
- break;
- case 1:
- if (intoIndex == (-1)) {
- intoIndex = this.m_vertexCount - 1;
- }
- else {
- outoIndex = this.m_vertexCount - 1;
- }
- break;
- }
- var intoIndex2 = parseInt((intoIndex + 1) % this.m_vertexCount);
- var outoIndex2 = parseInt((outoIndex + 1) % this.m_vertexCount);
- var intoLamdda = (0 - depths[intoIndex]) / (depths[intoIndex2] - depths[intoIndex]);
- var outoLamdda = (0 - depths[outoIndex]) / (depths[outoIndex2] - depths[outoIndex]);
- var intoVec = new b2Vec2(this.m_vertices[intoIndex].x * (1 - intoLamdda) + this.m_vertices[intoIndex2].x * intoLamdda, this.m_vertices[intoIndex].y * (1 - intoLamdda) + this.m_vertices[intoIndex2].y * intoLamdda);
- var outoVec = new b2Vec2(this.m_vertices[outoIndex].x * (1 - outoLamdda) + this.m_vertices[outoIndex2].x * outoLamdda, this.m_vertices[outoIndex].y * (1 - outoLamdda) + this.m_vertices[outoIndex2].y * outoLamdda);
- var area = 0;
- var center = new b2Vec2();
- var p2 = this.m_vertices[intoIndex2];
- var p3;
- i = intoIndex2;
- while (i != outoIndex2) {
- i = (i + 1) % this.m_vertexCount;
- if (i == outoIndex2) p3 = outoVec;
- else p3 = this.m_vertices[i];
- var triangleArea = 0.5 * ((p2.x - intoVec.x) * (p3.y - intoVec.y) - (p2.y - intoVec.y) * (p3.x - intoVec.x));
- area += triangleArea;
- center.x += triangleArea * (intoVec.x + p2.x + p3.x) / 3;
- center.y += triangleArea * (intoVec.y + p2.y + p3.y) / 3;
- p2 = p3;
- }
- center.Multiply(1 / area);
- c.SetV(b2Math.MulX(xf, center));
- return area;
- }
- b2PolygonShape.prototype.GetVertexCount = function () {
- return this.m_vertexCount;
- }
- b2PolygonShape.prototype.GetVertices = function () {
- return this.m_vertices;
- }
- b2PolygonShape.prototype.GetNormals = function () {
- return this.m_normals;
- }
- b2PolygonShape.prototype.GetSupport = function (d) {
- var bestIndex = 0;
- var bestValue = this.m_vertices[0].x * d.x + this.m_vertices[0].y * d.y;
- for (var i = 1; i < this.m_vertexCount; ++i) {
- var value = this.m_vertices[i].x * d.x + this.m_vertices[i].y * d.y;
- if (value > bestValue) {
- bestIndex = i;
- bestValue = value;
- }
- }
- return bestIndex;
- }
- b2PolygonShape.prototype.GetSupportVertex = function (d) {
- var bestIndex = 0;
- var bestValue = this.m_vertices[0].x * d.x + this.m_vertices[0].y * d.y;
- for (var i = 1; i < this.m_vertexCount; ++i) {
- var value = this.m_vertices[i].x * d.x + this.m_vertices[i].y * d.y;
- if (value > bestValue) {
- bestIndex = i;
- bestValue = value;
- }
- }
- return this.m_vertices[bestIndex];
- }
- b2PolygonShape.prototype.Validate = function () {
- return false;
- }
- b2PolygonShape.prototype.b2PolygonShape = function () {
- this.__super.b2Shape.call(this);
- this.m_type = b2Shape.e_polygonShape;
- this.m_centroid = new b2Vec2();
- this.m_vertices = new Vector();
- this.m_normals = new Vector();
- }
- b2PolygonShape.prototype.Reserve = function (count) {
- if (count === undefined) count = 0;
- for (var i = parseInt(this.m_vertices.length); i < count; i++) {
- this.m_vertices[i] = new b2Vec2();
- this.m_normals[i] = new b2Vec2();
- }
- }
- b2PolygonShape.ComputeCentroid = function (vs, count) {
- if (count === undefined) count = 0;
- var c = new b2Vec2();
- var area = 0.0;
- var p1X = 0.0;
- var p1Y = 0.0;
- var inv3 = 1.0 / 3.0;
- for (var i = 0; i < count; ++i) {
- var p2 = vs[i];
- var p3 = i + 1 < count ? vs[parseInt(i + 1)] : vs[0];
- var e1X = p2.x - p1X;
- var e1Y = p2.y - p1Y;
- var e2X = p3.x - p1X;
- var e2Y = p3.y - p1Y;
- var D = (e1X * e2Y - e1Y * e2X);
- var triangleArea = 0.5 * D;area += triangleArea;
- c.x += triangleArea * inv3 * (p1X + p2.x + p3.x);
- c.y += triangleArea * inv3 * (p1Y + p2.y + p3.y);
- }
- c.x *= 1.0 / area;
- c.y *= 1.0 / area;
- return c;
- }
- b2PolygonShape.ComputeOBB = function (obb, vs, count) {
- if (count === undefined) count = 0;
- var i = 0;
- var p = new Vector(count + 1);
- for (i = 0;
- i < count; ++i) {
- p[i] = vs[i];
- }
- p[count] = p[0];
- var minArea = Number.MAX_VALUE;
- for (i = 1;
- i <= count; ++i) {
- var root = p[parseInt(i - 1)];
- var uxX = p[i].x - root.x;
- var uxY = p[i].y - root.y;
- var length = Math.sqrt(uxX * uxX + uxY * uxY);
- uxX /= length;
- uxY /= length;
- var uyX = (-uxY);
- var uyY = uxX;
- var lowerX = Number.MAX_VALUE;
- var lowerY = Number.MAX_VALUE;
- var upperX = (-Number.MAX_VALUE);
- var upperY = (-Number.MAX_VALUE);
- for (var j = 0; j < count; ++j) {
- var dX = p[j].x - root.x;
- var dY = p[j].y - root.y;
- var rX = (uxX * dX + uxY * dY);
- var rY = (uyX * dX + uyY * dY);
- if (rX < lowerX) lowerX = rX;
- if (rY < lowerY) lowerY = rY;
- if (rX > upperX) upperX = rX;
- if (rY > upperY) upperY = rY;
- }
- var area = (upperX - lowerX) * (upperY - lowerY);
- if (area < 0.95 * minArea) {
- minArea = area;
- obb.R.col1.x = uxX;
- obb.R.col1.y = uxY;
- obb.R.col2.x = uyX;
- obb.R.col2.y = uyY;
- var centerX = 0.5 * (lowerX + upperX);
- var centerY = 0.5 * (lowerY + upperY);
- var tMat = obb.R;
- obb.center.x = root.x + (tMat.col1.x * centerX + tMat.col2.x * centerY);
- obb.center.y = root.y + (tMat.col1.y * centerX + tMat.col2.y * centerY);
- obb.extents.x = 0.5 * (upperX - lowerX);
- obb.extents.y = 0.5 * (upperY - lowerY);
- }
- }
- }
- Box2D.postDefs.push(function () {
- Box2D.Collision.Shapes.b2PolygonShape.s_mat = new b2Mat22();
- });
- b2Shape.b2Shape = function () {};
- b2Shape.prototype.Copy = function () {
- return null;
- }
- b2Shape.prototype.Set = function (other) {
- this.m_radius = other.m_radius;
- }
- b2Shape.prototype.GetType = function () {
- return this.m_type;
- }
- b2Shape.prototype.TestPoint = function (xf, p) {
- return false;
- }
- b2Shape.prototype.RayCast = function (output, input, transform) {
- return false;
- }
- b2Shape.prototype.ComputeAABB = function (aabb, xf) {}
- b2Shape.prototype.ComputeMass = function (massData, density) {
- if (density === undefined) density = 0;
- }
- b2Shape.prototype.ComputeSubmergedArea = function (normal, offset, xf, c) {
- if (offset === undefined) offset = 0;
- return 0;
- }
- b2Shape.TestOverlap = function (shape1, transform1, shape2, transform2) {
- var input = new b2DistanceInput();
- input.proxyA = new b2DistanceProxy();
- input.proxyA.Set(shape1);
- input.proxyB = new b2DistanceProxy();
- input.proxyB.Set(shape2);
- input.transformA = transform1;
- input.transformB = transform2;
- input.useRadii = true;
- var simplexCache = new b2SimplexCache();
- simplexCache.count = 0;
- var output = new b2DistanceOutput();
- b2Distance.Distance(output, simplexCache, input);
- return output.distance < 10.0 * Number.MIN_VALUE;
- }
- b2Shape.prototype.b2Shape = function () {
- this.m_type = b2Shape.e_unknownShape;
- this.m_radius = b2Settings.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 b2Color = Box2D.Common.b2Color,
- b2internal = Box2D.Common.b2internal,
- b2Settings = Box2D.Common.b2Settings,
- b2Mat22 = Box2D.Common.Math.b2Mat22,
- b2Mat33 = Box2D.Common.Math.b2Mat33,
- b2Math = Box2D.Common.Math.b2Math,
- b2Sweep = Box2D.Common.Math.b2Sweep,
- b2Transform = Box2D.Common.Math.b2Transform,
- b2Vec2 = Box2D.Common.Math.b2Vec2,
- b2Vec3 = Box2D.Common.Math.b2Vec3;
-
- b2Color.b2Color = function () {
- this._r = 0;
- this._g = 0;
- this._b = 0;
- };
- b2Color.prototype.b2Color = function (rr, gg, bb) {
- if (rr === undefined) rr = 0;
- if (gg === undefined) gg = 0;
- if (bb === undefined) bb = 0;
- this._r = Box2D.parseUInt(255 * b2Math.Clamp(rr, 0.0, 1.0));
- this._g = Box2D.parseUInt(255 * b2Math.Clamp(gg, 0.0, 1.0));
- this._b = Box2D.parseUInt(255 * b2Math.Clamp(bb, 0.0, 1.0));
- }
- b2Color.prototype.Set = function (rr, gg, bb) {
- if (rr === undefined) rr = 0;
- if (gg === undefined) gg = 0;
- if (bb === undefined) bb = 0;
- this._r = Box2D.parseUInt(255 * b2Math.Clamp(rr, 0.0, 1.0));
- this._g = Box2D.parseUInt(255 * b2Math.Clamp(gg, 0.0, 1.0));
- this._b = Box2D.parseUInt(255 * b2Math.Clamp(bb, 0.0, 1.0));
- }
- Object.defineProperty(b2Color.prototype, 'r', {
- enumerable: false,
- configurable: true,
- set: function (rr) {
- if (rr === undefined) rr = 0;
- this._r = Box2D.parseUInt(255 * b2Math.Clamp(rr, 0.0, 1.0));
- }
- });
- Object.defineProperty(b2Color.prototype, 'g', {
- enumerable: false,
- configurable: true,
- set: function (gg) {
- if (gg === undefined) gg = 0;
- this._g = Box2D.parseUInt(255 * b2Math.Clamp(gg, 0.0, 1.0));
- }
- });
- Object.defineProperty(b2Color.prototype, 'b', {
- enumerable: false,
- configurable: true,
- set: function (bb) {
- if (bb === undefined) bb = 0;
- this._b = Box2D.parseUInt(255 * b2Math.Clamp(bb, 0.0, 1.0));
- }
- });
- Object.defineProperty(b2Color.prototype, 'color', {
- enumerable: false,
- configurable: true,
- get: function () {
- return (this._r << 16) | (this._g << 8) | (this._b);
- }
- });
- b2Settings.b2Settings = function () {};
- b2Settings.b2MixFriction = function (friction1, friction2) {
- if (friction1 === undefined) friction1 = 0;
- if (friction2 === undefined) friction2 = 0;
- return Math.sqrt(friction1 * friction2);
- }
- b2Settings.b2MixRestitution = function (restitution1, restitution2) {
- if (restitution1 === undefined) restitution1 = 0;
- if (restitution2 === undefined) restitution2 = 0;
- return restitution1 > restitution2 ? restitution1 : restitution2;
- }
- b2Settings.b2Assert = function (a) {
- if (!a) {
- throw "Assertion Failed";
- }
- }
- Box2D.postDefs.push(function () {
- Box2D.Common.b2Settings.VERSION = "2.1alpha";
- Box2D.Common.b2Settings.USHRT_MAX = 0x0000ffff;
- 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.0;
- Box2D.Common.b2Settings.b2_polygonRadius = 2.0 * b2Settings.b2_linearSlop;
- Box2D.Common.b2Settings.b2_linearSlop = 0.005;
- Box2D.Common.b2Settings.b2_angularSlop = 2.0 / 180.0 * b2Settings.b2_pi;
- Box2D.Common.b2Settings.b2_toiSlop = 8.0 * b2Settings.b2_linearSlop;
- Box2D.Common.b2Settings.b2_maxTOIContactsPerIsland = 32;
- Box2D.Common.b2Settings.b2_maxTOIJointsPerIsland = 32;
- Box2D.Common.b2Settings.b2_velocityThreshold = 1.0;
- Box2D.Common.b2Settings.b2_maxLinearCorrection = 0.2;
- Box2D.Common.b2Settings.b2_maxAngularCorrection = 8.0 / 180.0 * b2Settings.b2_pi;
- Box2D.Common.b2Settings.b2_maxTranslation = 2.0;
- Box2D.Common.b2Settings.b2_maxTranslationSquared = b2Settings.b2_maxTranslation * b2Settings.b2_maxTranslation;
- Box2D.Common.b2Settings.b2_maxRotation = 0.5 * b2Settings.b2_pi;
- Box2D.Common.b2Settings.b2_maxRotationSquared = b2Settings.b2_maxRotation * b2Settings.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.0 / 180.0 * b2Settings.b2_pi;
- });
-})();
-(function () {
- var b2AABB = Box2D.Collision.b2AABB,
- b2Color = Box2D.Common.b2Color,
- b2internal = Box2D.Common.b2internal,
- b2Settings = Box2D.Common.b2Settings,
- b2Mat22 = Box2D.Common.Math.b2Mat22,
- b2Mat33 = Box2D.Common.Math.b2Mat33,
- b2Math = Box2D.Common.Math.b2Math,
- b2Sweep = Box2D.Common.Math.b2Sweep,
- b2Transform = Box2D.Common.Math.b2Transform,
- b2Vec2 = Box2D.Common.Math.b2Vec2,
- b2Vec3 = Box2D.Common.Math.b2Vec3;
-
- b2Mat22.b2Mat22 = function () {
- this.col1 = new b2Vec2();
- this.col2 = new b2Vec2();
- };
- b2Mat22.prototype.b2Mat22 = function () {
- this.SetIdentity();
- }
- b2Mat22.FromAngle = function (angle) {
- if (angle === undefined) angle = 0;
- var mat = new b2Mat22();
- mat.Set(angle);
- return mat;
- }
- b2Mat22.FromVV = function (c1, c2) {
- var mat = new b2Mat22();
- mat.SetVV(c1, c2);
- return mat;
- }
- b2Mat22.prototype.Set = function (angle) {
- if (angle === undefined) angle = 0;
- var c = Math.cos(angle);
- var s = Math.sin(angle);
- this.col1.x = c;
- this.col2.x = (-s);
- this.col1.y = s;
- this.col2.y = c;
- }
- b2Mat22.prototype.SetVV = function (c1, c2) {
- this.col1.SetV(c1);
- this.col2.SetV(c2);
- }
- b2Mat22.prototype.Copy = function () {
- var mat = new b2Mat22();
- mat.SetM(this);
- return mat;
- }
- b2Mat22.prototype.SetM = function (m) {
- this.col1.SetV(m.col1);
- this.col2.SetV(m.col2);
- }
- b2Mat22.prototype.AddM = function (m) {
- this.col1.x += m.col1.x;
- this.col1.y += m.col1.y;
- this.col2.x += m.col2.x;
- this.col2.y += m.col2.y;
- }
- b2Mat22.prototype.SetIdentity = function () {
- this.col1.x = 1.0;
- this.col2.x = 0.0;
- this.col1.y = 0.0;
- this.col2.y = 1.0;
- }
- b2Mat22.prototype.SetZero = function () {
- this.col1.x = 0.0;
- this.col2.x = 0.0;
- this.col1.y = 0.0;
- this.col2.y = 0.0;
- }
- b2Mat22.prototype.GetAngle = function () {
- return Math.atan2(this.col1.y, this.col1.x);
- }
- b2Mat22.prototype.GetInverse = function (out) {
- var a = this.col1.x;
- var b = this.col2.x;
- var c = this.col1.y;
- var d = this.col2.y;
- var det = a * d - b * c;
- if (det != 0.0) {
- det = 1.0 / det;
- }
- out.col1.x = det * d;
- out.col2.x = (-det * b);
- out.col1.y = (-det * c);
- out.col2.y = det * a;
- return out;
- }
- b2Mat22.prototype.Solve = function (out, bX, bY) {
- if (bX === undefined) bX = 0;
- if (bY === undefined) bY = 0;
- var a11 = this.col1.x;
- var a12 = this.col2.x;
- var a21 = this.col1.y;
- var a22 = this.col2.y;
- var det = a11 * a22 - a12 * a21;
- if (det != 0.0) {
- det = 1.0 / det;
- }
- out.x = det * (a22 * bX - a12 * bY);
- out.y = det * (a11 * bY - a21 * bX);
- return out;
- }
- b2Mat22.prototype.Abs = function () {
- this.col1.Abs();
- this.col2.Abs();
- }
- b2Mat33.b2Mat33 = function () {
- this.col1 = new b2Vec3();
- this.col2 = new b2Vec3();
- this.col3 = new b2Vec3();
- };
- b2Mat33.prototype.b2Mat33 = function (c1, c2, c3) {
- if (c1 === undefined) c1 = null;
- if (c2 === undefined) c2 = null;
- if (c3 === undefined) c3 = null;
- if (!c1 && !c2 && !c3) {
- this.col1.SetZero();
- this.col2.SetZero();
- this.col3.SetZero();
- }
- else {
- this.col1.SetV(c1);
- this.col2.SetV(c2);
- this.col3.SetV(c3);
- }
- }
- b2Mat33.prototype.SetVVV = function (c1, c2, c3) {
- this.col1.SetV(c1);
- this.col2.SetV(c2);
- this.col3.SetV(c3);
- }
- b2Mat33.prototype.Copy = function () {
- return new b2Mat33(this.col1, this.col2, this.col3);
- }
- b2Mat33.prototype.SetM = function (m) {
- this.col1.SetV(m.col1);
- this.col2.SetV(m.col2);
- this.col3.SetV(m.col3);
- }
- b2Mat33.prototype.AddM = function (m) {
- this.col1.x += m.col1.x;
- this.col1.y += m.col1.y;
- this.col1.z += m.col1.z;
- this.col2.x += m.col2.x;
- this.col2.y += m.col2.y;
- this.col2.z += m.col2.z;
- this.col3.x += m.col3.x;
- this.col3.y += m.col3.y;
- this.col3.z += m.col3.z;
- }
- b2Mat33.prototype.SetIdentity = function () {
- this.col1.x = 1.0;
- this.col2.x = 0.0;
- this.col3.x = 0.0;
- this.col1.y = 0.0;
- this.col2.y = 1.0;
- this.col3.y = 0.0;
- this.col1.z = 0.0;
- this.col2.z = 0.0;
- this.col3.z = 1.0;
- }
- b2Mat33.prototype.SetZero = function () {
- this.col1.x = 0.0;
- this.col2.x = 0.0;
- this.col3.x = 0.0;
- this.col1.y = 0.0;
- this.col2.y = 0.0;
- this.col3.y = 0.0;
- this.col1.z = 0.0;
- this.col2.z = 0.0;
- this.col3.z = 0.0;
- }
- b2Mat33.prototype.Solve22 = function (out, bX, bY) {
- if (bX === undefined) bX = 0;
- if (bY === undefined) bY = 0;
- var a11 = this.col1.x;
- var a12 = this.col2.x;
- var a21 = this.col1.y;
- var a22 = this.col2.y;
- var det = a11 * a22 - a12 * a21;
- if (det != 0.0) {
- det = 1.0 / det;
- }
- out.x = det * (a22 * bX - a12 * bY);
- out.y = det * (a11 * bY - a21 * bX);
- return out;
- }
- b2Mat33.prototype.Solve33 = function (out, bX, bY, bZ) {
- if (bX === undefined) bX = 0;
- if (bY === undefined) bY = 0;
- if (bZ === undefined) bZ = 0;
- var a11 = this.col1.x;
- var a21 = this.col1.y;
- var a31 = this.col1.z;
- var a12 = this.col2.x;
- var a22 = this.col2.y;
- var a32 = this.col2.z;
- var a13 = this.col3.x;
- var a23 = this.col3.y;
- var a33 = this.col3.z;
- var det = a11 * (a22 * a33 - a32 * a23) + a21 * (a32 * a13 - a12 * a33) + a31 * (a12 * a23 - a22 * a13);
- if (det != 0.0) {
- det = 1.0 / det;
- }
- out.x = det * (bX * (a22 * a33 - a32 * a23) + bY * (a32 * a13 - a12 * a33) + bZ * (a12 * a23 - a22 * a13));
- out.y = det * (a11 * (bY * a33 - bZ * a23) + a21 * (bZ * a13 - bX * a33) + a31 * (bX * a23 - bY * a13));
- out.z = det * (a11 * (a22 * bZ - a32 * bY) + a21 * (a32 * bX - a12 * bZ) + a31 * (a12 * bY - a22 * bX));
- return out;
- }
- b2Math.b2Math = function () {};
- b2Math.IsValid = function (x) {
- if (x === undefined) x = 0;
- return isFinite(x);
- }
- b2Math.Dot = function (a, b) {
- return a.x * b.x + a.y * b.y;
- }
- b2Math.CrossVV = function (a, b) {
- return a.x * b.y - a.y * b.x;
- }
- b2Math.CrossVF = function (a, s) {
- if (s === undefined) s = 0;
- var v = new b2Vec2(s * a.y, (-s * a.x));
- return v;
- }
- b2Math.CrossFV = function (s, a) {
- if (s === undefined) s = 0;
- var v = new b2Vec2((-s * a.y), s * a.x);
- return v;
- }
- b2Math.MulMV = function (A, v) {
- var u = new b2Vec2(A.col1.x * v.x + A.col2.x * v.y, A.col1.y * v.x + A.col2.y * v.y);
- return u;
- }
- b2Math.MulTMV = function (A, v) {
- var u = new b2Vec2(b2Math.Dot(v, A.col1), b2Math.Dot(v, A.col2));
- return u;
- }
- b2Math.MulX = function (T, v) {
- var a = b2Math.MulMV(T.R, v);
- a.x += T.position.x;
- a.y += T.position.y;
- return a;
- }
- b2Math.MulXT = function (T, v) {
- var a = b2Math.SubtractVV(v, T.position);
- var tX = (a.x * T.R.col1.x + a.y * T.R.col1.y);
- a.y = (a.x * T.R.col2.x + a.y * T.R.col2.y);
- a.x = tX;
- return a;
- }
- b2Math.AddVV = function (a, b) {
- var v = new b2Vec2(a.x + b.x, a.y + b.y);
- return v;
- }
- b2Math.SubtractVV = function (a, b) {
- var v = new b2Vec2(a.x - b.x, a.y - b.y);
- return v;
- }
- b2Math.Distance = function (a, b) {
- var cX = a.x - b.x;
- var cY = a.y - b.y;
- return Math.sqrt(cX * cX + cY * cY);
- }
- b2Math.DistanceSquared = function (a, b) {
- var cX = a.x - b.x;
- var cY = a.y - b.y;
- return (cX * cX + cY * cY);
- }
- b2Math.MulFV = function (s, a) {
- if (s === undefined) s = 0;
- var v = new b2Vec2(s * a.x, s * a.y);
- return v;
- }
- b2Math.AddMM = function (A, B) {
- var C = b2Mat22.FromVV(b2Math.AddVV(A.col1, B.col1), b2Math.AddVV(A.col2, B.col2));
- return C;
- }
- b2Math.MulMM = function (A, B) {
- var C = b2Mat22.FromVV(b2Math.MulMV(A, B.col1), b2Math.MulMV(A, B.col2));
- return C;
- }
- b2Math.MulTMM = function (A, B) {
- var c1 = new b2Vec2(b2Math.Dot(A.col1, B.col1), b2Math.Dot(A.col2, B.col1));
- var c2 = new b2Vec2(b2Math.Dot(A.col1, B.col2), b2Math.Dot(A.col2, B.col2));
- var C = b2Mat22.FromVV(c1, c2);
- return C;
- }
- b2Math.Abs = function (a) {
- if (a === undefined) a = 0;
- return a > 0.0 ? a : (-a);
- }
- b2Math.AbsV = function (a) {
- var b = new b2Vec2(b2Math.Abs(a.x), b2Math.Abs(a.y));
- return b;
- }
- b2Math.AbsM = function (A) {
- var B = b2Mat22.FromVV(b2Math.AbsV(A.col1), b2Math.AbsV(A.col2));
- return B;
- }
- b2Math.Min = function (a, b) {
- if (a === undefined) a = 0;
- if (b === undefined) b = 0;
- return a < b ? a : b;
- }
- b2Math.MinV = function (a, b) {
- var c = new b2Vec2(b2Math.Min(a.x, b.x), b2Math.Min(a.y, b.y));
- return c;
- }
- b2Math.Max = function (a, b) {
- if (a === undefined) a = 0;
- if (b === undefined) b = 0;
- return a > b ? a : b;
- }
- b2Math.MaxV = function (a, b) {
- var c = new b2Vec2(b2Math.Max(a.x, b.x), b2Math.Max(a.y, b.y));
- return c;
- }
- b2Math.Clamp = function (a, low, high) {
- if (a === undefined) a = 0;
- if (low === undefined) low = 0;
- if (high === undefined) high = 0;
- return a < low ? low : a > high ? high : a;
- }
- b2Math.ClampV = function (a, low, high) {
- return b2Math.MaxV(low, b2Math.MinV(a, high));
- }
- b2Math.Swap = function (a, b) {
- var tmp = a[0];
- a[0] = b[0];
- b[0] = tmp;
- }
- b2Math.Random = function () {
- return Math.random() * 2 - 1;
- }
- b2Math.RandomRange = function (lo, hi) {
- if (lo === undefined) lo = 0;
- if (hi === undefined) hi = 0;
- var r = Math.random();
- r = (hi - lo) * r + lo;
- return r;
- }
- b2Math.NextPowerOfTwo = function (x) {
- if (x === undefined) x = 0;
- x |= (x >> 1) & 0x7FFFFFFF;
- x |= (x >> 2) & 0x3FFFFFFF;
- x |= (x >> 4) & 0x0FFFFFFF;
- x |= (x >> 8) & 0x00FFFFFF;
- x |= (x >> 16) & 0x0000FFFF;
- return x + 1;
- }
- b2Math.IsPowerOfTwo = function (x) {
- if (x === undefined) x = 0;
- var result = x > 0 && (x & (x - 1)) == 0;
- return result;
- }
- Box2D.postDefs.push(function () {
- Box2D.Common.Math.b2Math.b2Vec2_zero = new b2Vec2(0.0, 0.0);
- Box2D.Common.Math.b2Math.b2Mat22_identity = b2Mat22.FromVV(new b2Vec2(1.0, 0.0), new b2Vec2(0.0, 1.0));
- Box2D.Common.Math.b2Math.b2Transform_identity = new b2Transform(b2Math.b2Vec2_zero, b2Math.b2Mat22_identity);
- });
- b2Sweep.b2Sweep = function () {
- this.localCenter = new b2Vec2();
- this.c0 = new b2Vec2;
- this.c = new b2Vec2();
- };
- b2Sweep.prototype.Set = function (other) {
- this.localCenter.SetV(other.localCenter);
- this.c0.SetV(other.c0);
- this.c.SetV(other.c);
- this.a0 = other.a0;
- this.a = other.a;
- this.t0 = other.t0;
- }
- b2Sweep.prototype.Copy = function () {
- var copy = new b2Sweep();
- copy.localCenter.SetV(this.localCenter);
- copy.c0.SetV(this.c0);
- copy.c.SetV(this.c);
- copy.a0 = this.a0;
- copy.a = this.a;
- copy.t0 = this.t0;
- return copy;
- }
- b2Sweep.prototype.GetTransform = function (xf, alpha) {
- if (alpha === undefined) alpha = 0;
- xf.position.x = (1.0 - alpha) * this.c0.x + alpha * this.c.x;
- xf.position.y = (1.0 - alpha) * this.c0.y + alpha * this.c.y;
- var angle = (1.0 - alpha) * this.a0 + alpha * this.a;
- xf.R.Set(angle);
- var tMat = xf.R;
- xf.position.x -= (tMat.col1.x * this.localCenter.x + tMat.col2.x * this.localCenter.y);
- xf.position.y -= (tMat.col1.y * this.localCenter.x + tMat.col2.y * this.localCenter.y);
- }
- b2Sweep.prototype.Advance = function (t) {
- if (t === undefined) t = 0;
- if (this.t0 < t && 1.0 - this.t0 > Number.MIN_VALUE) {
- var alpha = (t - this.t0) / (1.0 - this.t0);
- this.c0.x = (1.0 - alpha) * this.c0.x + alpha * this.c.x;
- this.c0.y = (1.0 - alpha) * this.c0.y + alpha * this.c.y;
- this.a0 = (1.0 - alpha) * this.a0 + alpha * this.a;
- this.t0 = t;
- }
- }
- b2Transform.b2Transform = function () {
- this.position = new b2Vec2;
- this.R = new b2Mat22();
- };
- b2Transform.prototype.b2Transform = function (pos, r) {
- if (pos === undefined) pos = null;
- if (r === undefined) r = null;
- if (pos) {
- this.position.SetV(pos);
- this.R.SetM(r);
- }
- }
- b2Transform.prototype.Initialize = function (pos, r) {
- this.position.SetV(pos);
- this.R.SetM(r);
- }
- b2Transform.prototype.SetIdentity = function () {
- this.position.SetZero();
- this.R.SetIdentity();
- }
- b2Transform.prototype.Set = function (x) {
- this.position.SetV(x.position);
- this.R.SetM(x.R);
- }
- b2Transform.prototype.GetAngle = function () {
- return Math.atan2(this.R.col1.y, this.R.col1.x);
- }
- b2Vec2.b2Vec2 = function () {};
- b2Vec2.prototype.b2Vec2 = function (x_, y_) {
- if (x_ === undefined) x_ = 0;
- if (y_ === undefined) y_ = 0;
- this.x = x_;
- this.y = y_;
- }
- b2Vec2.prototype.SetZero = function () {
- this.x = 0.0;
- this.y = 0.0;
- }
- b2Vec2.prototype.Set = function (x_, y_) {
- if (x_ === undefined) x_ = 0;
- if (y_ === undefined) y_ = 0;
- this.x = x_;
- this.y = y_;
- }
- b2Vec2.prototype.SetV = function (v) {
- this.x = v.x;
- this.y = v.y;
- }
- b2Vec2.prototype.GetNegative = function () {
- return new b2Vec2((-this.x), (-this.y));
- }
- b2Vec2.prototype.NegativeSelf = function () {
- this.x = (-this.x);
- this.y = (-this.y);
- }
- b2Vec2.Make = function (x_, y_) {
- if (x_ === undefined) x_ = 0;
- if (y_ === undefined) y_ = 0;
- return new b2Vec2(x_, y_);
- }
- b2Vec2.prototype.Copy = function () {
- return new b2Vec2(this.x, this.y);
- }
- b2Vec2.prototype.Add = function (v) {
- this.x += v.x;
- this.y += v.y;
- }
- b2Vec2.prototype.Subtract = function (v) {
- this.x -= v.x;
- this.y -= v.y;
- }
- b2Vec2.prototype.Multiply = function (a) {
- if (a === undefined) a = 0;
- this.x *= a;
- this.y *= a;
- }
- b2Vec2.prototype.MulM = function (A) {
- var tX = this.x;
- this.x = A.col1.x * tX + A.col2.x * this.y;
- this.y = A.col1.y * tX + A.col2.y * this.y;
- }
- b2Vec2.prototype.MulTM = function (A) {
- var tX = b2Math.Dot(this, A.col1);
- this.y = b2Math.Dot(this, A.col2);
- this.x = tX;
- }
- b2Vec2.prototype.CrossVF = function (s) {
- if (s === undefined) s = 0;
- var tX = this.x;
- this.x = s * this.y;
- this.y = (-s * tX);
- }
- b2Vec2.prototype.CrossFV = function (s) {
- if (s === undefined) s = 0;
- var tX = this.x;
- this.x = (-s * this.y);
- this.y = s * tX;
- }
- b2Vec2.prototype.MinV = function (b) {
- this.x = this.x < b.x ? this.x : b.x;
- this.y = this.y < b.y ? this.y : b.y;
- }
- b2Vec2.prototype.MaxV = function (b) {
- this.x = this.x > b.x ? this.x : b.x;
- this.y = this.y > b.y ? this.y : b.y;
- }
- b2Vec2.prototype.Abs = function () {
- if (this.x < 0) this.x = (-this.x);
- if (this.y < 0) this.y = (-this.y);
- }
- b2Vec2.prototype.Length = function () {
- return Math.sqrt(this.x * this.x + this.y * this.y);
- }
- b2Vec2.prototype.LengthSquared = function () {
- return (this.x * this.x + this.y * this.y);
- }
- b2Vec2.prototype.Normalize = function () {
- var length = Math.sqrt(this.x * this.x + this.y * this.y);
- if (length < Number.MIN_VALUE) {
- return 0.0;
- }
- var invLength = 1.0 / length;
- this.x *= invLength;
- this.y *= invLength;
- return length;
- }
- b2Vec2.prototype.IsValid = function () {
- return b2Math.IsValid(this.x) && b2Math.IsValid(this.y);
- }
- b2Vec3.b2Vec3 = function () {};
- b2Vec3.prototype.b2Vec3 = function (x, y, z) {
- if (x === undefined) x = 0;
- if (y === undefined) y = 0;
- if (z === undefined) z = 0;
- this.x = x;
- this.y = y;
- this.z = z;
- }
- b2Vec3.prototype.SetZero = function () {
- this.x = this.y = this.z = 0.0;
- }
- b2Vec3.prototype.Set = function (x, y, z) {
- if (x === undefined) x = 0;
- if (y === undefined) y = 0;
- if (z === undefined) z = 0;
- this.x = x;
- this.y = y;
- this.z = z;
- }
- b2Vec3.prototype.SetV = function (v) {
- this.x = v.x;
- this.y = v.y;
- this.z = v.z;
- }
- b2Vec3.prototype.GetNegative = function () {
- return new b2Vec3((-this.x), (-this.y), (-this.z));
- }
- b2Vec3.prototype.NegativeSelf = function () {
- this.x = (-this.x);
- this.y = (-this.y);
- this.z = (-this.z);
- }
- b2Vec3.prototype.Copy = function () {
- return new b2Vec3(this.x, this.y, this.z);
- }
- b2Vec3.prototype.Add = function (v) {
- this.x += v.x;
- this.y += v.y;
- this.z += v.z;
- }
- b2Vec3.prototype.Subtract = function (v) {
- this.x -= v.x;
- this.y -= v.y;
- this.z -= v.z;
- }
- b2Vec3.prototype.Multiply = function (a) {
- if (a === undefined) a = 0;
- this.x *= a;
- this.y *= a;
- this.z *= a;
- }
-})();
-(function () {
- var b2ControllerEdge = Box2D.Dynamics.Controllers.b2ControllerEdge,
- b2Mat22 = Box2D.Common.Math.b2Mat22,
- b2Mat33 = Box2D.Common.Math.b2Mat33,
- b2Math = Box2D.Common.Math.b2Math,
- b2Sweep = Box2D.Common.Math.b2Sweep,
- b2Transform = Box2D.Common.Math.b2Transform,
- b2Vec2 = Box2D.Common.Math.b2Vec2,
- b2Vec3 = Box2D.Common.Math.b2Vec3,
- b2Color = Box2D.Common.b2Color,
- b2internal = Box2D.Common.b2internal,
- b2Settings = Box2D.Common.b2Settings,
- b2AABB = Box2D.Collision.b2AABB,
- b2Bound = Box2D.Collision.b2Bound,
- b2BoundValues = Box2D.Collision.b2BoundValues,
- b2Collision = Box2D.Collision.b2Collision,
- b2ContactID = Box2D.Collision.b2ContactID,
- b2ContactPoint = Box2D.Collision.b2ContactPoint,
- b2Distance = Box2D.Collision.b2Distance,
- b2DistanceInput = Box2D.Collision.b2DistanceInput,
- b2DistanceOutput = Box2D.Collision.b2DistanceOutput,
- b2DistanceProxy = Box2D.Collision.b2DistanceProxy,
- b2DynamicTree = Box2D.Collision.b2DynamicTree,
- b2DynamicTreeBroadPhase = Box2D.Collision.b2DynamicTreeBroadPhase,
- b2DynamicTreeNode = Box2D.Collision.b2DynamicTreeNode,
- b2DynamicTreePair = Box2D.Collision.b2DynamicTreePair,
- b2Manifold = Box2D.Collision.b2Manifold,
- b2ManifoldPoint = Box2D.Collision.b2ManifoldPoint,
- b2Point = Box2D.Collision.b2Point,
- b2RayCastInput = Box2D.Collision.b2RayCastInput,
- b2RayCastOutput = Box2D.Collision.b2RayCastOutput,
- b2Segment = Box2D.Collision.b2Segment,
- b2SeparationFunction = Box2D.Collision.b2SeparationFunction,
- b2Simplex = Box2D.Collision.b2Simplex,
- b2SimplexCache = Box2D.Collision.b2SimplexCache,
- b2SimplexVertex = Box2D.Collision.b2SimplexVertex,
- b2TimeOfImpact = Box2D.Collision.b2TimeOfImpact,
- b2TOIInput = Box2D.Collision.b2TOIInput,
- b2WorldManifold = Box2D.Collision.b2WorldManifold,
- ClipVertex = Box2D.Collision.ClipVertex,
- Features = Box2D.Collision.Features,
- IBroadPhase = Box2D.Collision.IBroadPhase,
- b2CircleShape = Box2D.Collision.Shapes.b2CircleShape,
- b2EdgeChainDef = Box2D.Collision.Shapes.b2EdgeChainDef,
- b2EdgeShape = Box2D.Collision.Shapes.b2EdgeShape,
- b2MassData = Box2D.Collision.Shapes.b2MassData,
- b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape,
- b2Shape = Box2D.Collision.Shapes.b2Shape,
- b2Body = Box2D.Dynamics.b2Body,
- b2BodyDef = Box2D.Dynamics.b2BodyDef,
- b2ContactFilter = Box2D.Dynamics.b2ContactFilter,
- b2ContactImpulse = Box2D.Dynamics.b2ContactImpulse,
- b2ContactListener = Box2D.Dynamics.b2ContactListener,
- b2ContactManager = Box2D.Dynamics.b2ContactManager,
- b2DebugDraw = Box2D.Dynamics.b2DebugDraw,
- b2DestructionListener = Box2D.Dynamics.b2DestructionListener,
- b2FilterData = Box2D.Dynamics.b2FilterData,
- b2Fixture = Box2D.Dynamics.b2Fixture,
- b2FixtureDef = Box2D.Dynamics.b2FixtureDef,
- b2Island = Box2D.Dynamics.b2Island,
- b2TimeStep = Box2D.Dynamics.b2TimeStep,
- b2World = Box2D.Dynamics.b2World,
- b2CircleContact = Box2D.Dynamics.Contacts.b2CircleContact,
- b2Contact = Box2D.Dynamics.Contacts.b2Contact,
- b2ContactConstraint = Box2D.Dynamics.Contacts.b2ContactConstraint,
- b2ContactConstraintPoint = Box2D.Dynamics.Contacts.b2ContactConstraintPoint,
- b2ContactEdge = Box2D.Dynamics.Contacts.b2ContactEdge,
- b2ContactFactory = Box2D.Dynamics.Contacts.b2ContactFactory,
- b2ContactRegister = Box2D.Dynamics.Contacts.b2ContactRegister,
- b2ContactResult = Box2D.Dynamics.Contacts.b2ContactResult,
- b2ContactSolver = Box2D.Dynamics.Contacts.b2ContactSolver,
- b2EdgeAndCircleContact = Box2D.Dynamics.Contacts.b2EdgeAndCircleContact,
- b2NullContact = Box2D.Dynamics.Contacts.b2NullContact,
- b2PolyAndCircleContact = Box2D.Dynamics.Contacts.b2PolyAndCircleContact,
- b2PolyAndEdgeContact = Box2D.Dynamics.Contacts.b2PolyAndEdgeContact,
- b2PolygonContact = Box2D.Dynamics.Contacts.b2PolygonContact,
- b2PositionSolverManifold = Box2D.Dynamics.Contacts.b2PositionSolverManifold,
- b2Controller = Box2D.Dynamics.Controllers.b2Controller,
- b2DistanceJoint = Box2D.Dynamics.Joints.b2DistanceJoint,
- b2DistanceJointDef = Box2D.Dynamics.Joints.b2DistanceJointDef,
- b2FrictionJoint = Box2D.Dynamics.Joints.b2FrictionJoint,
- b2FrictionJointDef = Box2D.Dynamics.Joints.b2FrictionJointDef,
- b2GearJoint = Box2D.Dynamics.Joints.b2GearJoint,
- b2GearJointDef = Box2D.Dynamics.Joints.b2GearJointDef,
- b2Jacobian = Box2D.Dynamics.Joints.b2Jacobian,
- b2Joint = Box2D.Dynamics.Joints.b2Joint,
- b2JointDef = Box2D.Dynamics.Joints.b2JointDef,
- b2JointEdge = Box2D.Dynamics.Joints.b2JointEdge,
- b2LineJoint = Box2D.Dynamics.Joints.b2LineJoint,
- b2LineJointDef = Box2D.Dynamics.Joints.b2LineJointDef,
- b2MouseJoint = Box2D.Dynamics.Joints.b2MouseJoint,
- b2MouseJointDef = Box2D.Dynamics.Joints.b2MouseJointDef,
- b2PrismaticJoint = Box2D.Dynamics.Joints.b2PrismaticJoint,
- b2PrismaticJointDef = Box2D.Dynamics.Joints.b2PrismaticJointDef,
- b2PulleyJoint = Box2D.Dynamics.Joints.b2PulleyJoint,
- b2PulleyJointDef = Box2D.Dynamics.Joints.b2PulleyJointDef,
- b2RevoluteJoint = Box2D.Dynamics.Joints.b2RevoluteJoint,
- b2RevoluteJointDef = Box2D.Dynamics.Joints.b2RevoluteJointDef,
- b2WeldJoint = Box2D.Dynamics.Joints.b2WeldJoint,
- b2WeldJointDef = Box2D.Dynamics.Joints.b2WeldJointDef;
-
- b2Body.b2Body = function () {
- this.m_xf = new b2Transform();
- this.m_sweep = new b2Sweep();
- this.m_linearVelocity = new b2Vec2();
- this.m_force = new b2Vec2();
- };
- b2Body.prototype.connectEdges = function (s1, s2, angle1) {
- if (angle1 === undefined) angle1 = 0;
- var angle2 = Math.atan2(s2.GetDirectionVector().y, s2.GetDirectionVector().x);
- var coreOffset = Math.tan((angle2 - angle1) * 0.5);
- var core = b2Math.MulFV(coreOffset, s2.GetDirectionVector());
- core = b2Math.SubtractVV(core, s2.GetNormalVector());
- core = b2Math.MulFV(b2Settings.b2_toiSlop, core);
- core = b2Math.AddVV(core, s2.GetVertex1());
- var cornerDir = b2Math.AddVV(s1.GetDirectionVector(), s2.GetDirectionVector());
- cornerDir.Normalize();
- var convex = b2Math.Dot(s1.GetDirectionVector(), s2.GetNormalVector()) > 0.0;
- s1.SetNextEdge(s2, core, cornerDir, convex);
- s2.SetPrevEdge(s1, core, cornerDir, convex);
- return angle2;
- }
- b2Body.prototype.CreateFixture = function (def) {
- if (this.m_world.IsLocked() == true) {
- return null;
- }
- var fixture = new b2Fixture();
- fixture.Create(this, this.m_xf, def);
- if (this.m_flags & b2Body.e_activeFlag) {
- var broadPhase = this.m_world.m_contactManager.m_broadPhase;
- fixture.CreateProxy(broadPhase, this.m_xf);
- }
- fixture.m_next = this.m_fixtureList;
- this.m_fixtureList = fixture;
- ++this.m_fixtureCount;
- fixture.m_body = this;
- if (fixture.m_density > 0.0) {
- this.ResetMassData();
- }
- this.m_world.m_flags |= b2World.e_newFixture;
- return fixture;
- }
- b2Body.prototype.CreateFixture2 = function (shape, density) {
- if (density === undefined) density = 0.0;
- var def = new b2FixtureDef();
- def.shape = shape;
- def.density = density;
- return this.CreateFixture(def);
- }
- b2Body.prototype.DestroyFixture = function (fixture) {
- if (this.m_world.IsLocked() == true) {
- return;
- }
- var node = this.m_fixtureList;
- var ppF = null;
- var found = false;
- while (node != null) {
- if (node == fixture) {
- if (ppF) ppF.m_next = fixture.m_next;
- else this.m_fixtureList = fixture.m_next;
- found = true;
- break;
- }
- ppF = node;
- node = node.m_next;
- }
- var edge = this.m_contactList;
- while (edge) {
- var c = edge.contact;
- edge = edge.next;
- var fixtureA = c.GetFixtureA();
- var fixtureB = c.GetFixtureB();
- if (fixture == fixtureA || fixture == fixtureB) {
- this.m_world.m_contactManager.Destroy(c);
- }
- }
- if (this.m_flags & b2Body.e_activeFlag) {
- var broadPhase = this.m_world.m_contactManager.m_broadPhase;
- fixture.DestroyProxy(broadPhase);
- }
- else {}
- fixture.Destroy();
- fixture.m_body = null;
- fixture.m_next = null;
- --this.m_fixtureCount;
- this.ResetMassData();
- }
- b2Body.prototype.SetPositionAndAngle = function (position, angle) {
- if (angle === undefined) angle = 0;
- var f;
- if (this.m_world.IsLocked() == true) {
- return;
- }
- this.m_xf.R.Set(angle);
- this.m_xf.position.SetV(position);
- var tMat = this.m_xf.R;
- var tVec = this.m_sweep.localCenter;
- this.m_sweep.c.x = (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- this.m_sweep.c.y = (tMat.col1.y * tVec.x + tMat.col2.y * tVec.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 = angle;
- var broadPhase = this.m_world.m_contactManager.m_broadPhase;
- for (f = this.m_fixtureList;
- f; f = f.m_next) {
- f.Synchronize(broadPhase, this.m_xf, this.m_xf);
- }
- this.m_world.m_contactManager.FindNewContacts();
- }
- b2Body.prototype.SetTransform = function (xf) {
- this.SetPositionAndAngle(xf.position, xf.GetAngle());
- }
- b2Body.prototype.GetTransform = function () {
- return this.m_xf;
- }
- b2Body.prototype.GetPosition = function () {
- return this.m_xf.position;
- }
- b2Body.prototype.SetPosition = function (position) {
- this.SetPositionAndAngle(position, this.GetAngle());
- }
- b2Body.prototype.GetAngle = function () {
- return this.m_sweep.a;
- }
- b2Body.prototype.SetAngle = function (angle) {
- if (angle === undefined) angle = 0;
- this.SetPositionAndAngle(this.GetPosition(), angle);
- }
- b2Body.prototype.GetWorldCenter = function () {
- return this.m_sweep.c;
- }
- b2Body.prototype.GetLocalCenter = function () {
- return this.m_sweep.localCenter;
- }
- b2Body.prototype.SetLinearVelocity = function (v) {
- if (this.m_type == b2Body.b2_staticBody) {
- return;
- }
- this.m_linearVelocity.SetV(v);
- }
- b2Body.prototype.GetLinearVelocity = function () {
- return this.m_linearVelocity;
- }
- b2Body.prototype.SetAngularVelocity = function (omega) {
- if (omega === undefined) omega = 0;
- if (this.m_type == b2Body.b2_staticBody) {
- return;
- }
- this.m_angularVelocity = omega;
- }
- b2Body.prototype.GetAngularVelocity = function () {
- return this.m_angularVelocity;
- }
- b2Body.prototype.GetDefinition = function () {
- var bd = new b2BodyDef();
- bd.type = this.GetType();
- bd.allowSleep = (this.m_flags & b2Body.e_allowSleepFlag) == b2Body.e_allowSleepFlag;
- bd.angle = this.GetAngle();
- bd.angularDamping = this.m_angularDamping;
- bd.angularVelocity = this.m_angularVelocity;
- bd.fixedRotation = (this.m_flags & b2Body.e_fixedRotationFlag) == b2Body.e_fixedRotationFlag;
- bd.bullet = (this.m_flags & b2Body.e_bulletFlag) == b2Body.e_bulletFlag;
- bd.awake = (this.m_flags & b2Body.e_awakeFlag) == b2Body.e_awakeFlag;
- bd.linearDamping = this.m_linearDamping;
- bd.linearVelocity.SetV(this.GetLinearVelocity());
- bd.position = this.GetPosition();
- bd.userData = this.GetUserData();
- return bd;
- }
- b2Body.prototype.ApplyForce = function (force, point) {
- if (this.m_type != b2Body.b2_dynamicBody) {
- return;
- }
- if (this.IsAwake() == false) {
- this.SetAwake(true);
- }
- this.m_force.x += force.x;
- this.m_force.y += force.y;
- this.m_torque += ((point.x - this.m_sweep.c.x) * force.y - (point.y - this.m_sweep.c.y) * force.x);
- }
- b2Body.prototype.ApplyTorque = function (torque) {
- if (torque === undefined) torque = 0;
- if (this.m_type != b2Body.b2_dynamicBody) {
- return;
- }
- if (this.IsAwake() == false) {
- this.SetAwake(true);
- }
- this.m_torque += torque;
- }
- b2Body.prototype.ApplyImpulse = function (impulse, point) {
- if (this.m_type != b2Body.b2_dynamicBody) {
- return;
- }
- if (this.IsAwake() == false) {
- this.SetAwake(true);
- }
- this.m_linearVelocity.x += this.m_invMass * impulse.x;
- this.m_linearVelocity.y += this.m_invMass * impulse.y;
- this.m_angularVelocity += this.m_invI * ((point.x - this.m_sweep.c.x) * impulse.y - (point.y - this.m_sweep.c.y) * impulse.x);
- }
- b2Body.prototype.Split = function (callback) {
- var linearVelocity = this.GetLinearVelocity().Copy();
- var angularVelocity = this.GetAngularVelocity();
- var center = this.GetWorldCenter();
- var body1 = this;
- var body2 = this.m_world.CreateBody(this.GetDefinition());
- var prev;
- for (var f = body1.m_fixtureList; f;) {
- if (callback(f)) {
- var next = f.m_next;
- if (prev) {
- prev.m_next = next;
- }
- else {
- body1.m_fixtureList = next;
- }
- body1.m_fixtureCount--;
- f.m_next = body2.m_fixtureList;
- body2.m_fixtureList = f;
- body2.m_fixtureCount++;
- f.m_body = body2;
- f = next;
- }
- else {
- prev = f;
- f = f.m_next;
- }
- }
- body1.ResetMassData();
- body2.ResetMassData();
- var center1 = body1.GetWorldCenter();
- var center2 = body2.GetWorldCenter();
- var velocity1 = b2Math.AddVV(linearVelocity, b2Math.CrossFV(angularVelocity, b2Math.SubtractVV(center1, center)));
- var velocity2 = b2Math.AddVV(linearVelocity, b2Math.CrossFV(angularVelocity, b2Math.SubtractVV(center2, center)));
- body1.SetLinearVelocity(velocity1);
- body2.SetLinearVelocity(velocity2);
- body1.SetAngularVelocity(angularVelocity);
- body2.SetAngularVelocity(angularVelocity);
- body1.SynchronizeFixtures();
- body2.SynchronizeFixtures();
- return body2;
- }
- b2Body.prototype.Merge = function (other) {
- var f;
- for (f = other.m_fixtureList;
- f;) {
- var next = f.m_next;
- other.m_fixtureCount--;
- f.m_next = this.m_fixtureList;
- this.m_fixtureList = f;
- this.m_fixtureCount++;
- f.m_body = body2;
- f = next;
- }
- body1.m_fixtureCount = 0;
- var body1 = this;
- var body2 = other;
- var center1 = body1.GetWorldCenter();
- var center2 = body2.GetWorldCenter();
- var velocity1 = body1.GetLinearVelocity().Copy();
- var velocity2 = body2.GetLinearVelocity().Copy();
- var angular1 = body1.GetAngularVelocity();
- var angular = body2.GetAngularVelocity();
- body1.ResetMassData();
- this.SynchronizeFixtures();
- }
- b2Body.prototype.GetMass = function () {
- return this.m_mass;
- }
- b2Body.prototype.GetInertia = function () {
- return this.m_I;
- }
- b2Body.prototype.GetMassData = function (data) {
- data.mass = this.m_mass;
- data.I = this.m_I;
- data.center.SetV(this.m_sweep.localCenter);
- }
- b2Body.prototype.SetMassData = function (massData) {
- b2Settings.b2Assert(this.m_world.IsLocked() == false);
- if (this.m_world.IsLocked() == true) {
- return;
- }
- if (this.m_type != b2Body.b2_dynamicBody) {
- return;
- }
- this.m_invMass = 0.0;
- this.m_I = 0.0;
- this.m_invI = 0.0;
- this.m_mass = massData.mass;
- if (this.m_mass <= 0.0) {
- this.m_mass = 1.0;
- }
- this.m_invMass = 1.0 / this.m_mass;
- if (massData.I > 0.0 && (this.m_flags & b2Body.e_fixedRotationFlag) == 0) {
- this.m_I = massData.I - this.m_mass * (massData.center.x * massData.center.x + massData.center.y * massData.center.y);
- this.m_invI = 1.0 / this.m_I;
- }
- var oldCenter = this.m_sweep.c.Copy();
- this.m_sweep.localCenter.SetV(massData.center);
- this.m_sweep.c0.SetV(b2Math.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 - oldCenter.y));
- this.m_linearVelocity.y += this.m_angularVelocity * (+(this.m_sweep.c.x - oldCenter.x));
- }
- b2Body.prototype.ResetMassData = function () {
- this.m_mass = 0.0;
- this.m_invMass = 0.0;
- this.m_I = 0.0;
- this.m_invI = 0.0;
- this.m_sweep.localCenter.SetZero();
- if (this.m_type == b2Body.b2_staticBody || this.m_type == b2Body.b2_kinematicBody) {
- return;
- }
- var center = b2Vec2.Make(0, 0);
- for (var f = this.m_fixtureList; f; f = f.m_next) {
- if (f.m_density == 0.0) {
- continue;
- }
- var massData = f.GetMassData();
- this.m_mass += massData.mass;
- center.x += massData.center.x * massData.mass;
- center.y += massData.center.y * massData.mass;
- this.m_I += massData.I;
- }
- if (this.m_mass > 0.0) {
- this.m_invMass = 1.0 / this.m_mass;
- center.x *= this.m_invMass;
- center.y *= this.m_invMass;
- }
- else {
- this.m_mass = 1.0;
- this.m_invMass = 1.0;
- }
- if (this.m_I > 0.0 && (this.m_flags & b2Body.e_fixedRotationFlag) == 0) {
- this.m_I -= this.m_mass * (center.x * center.x + center.y * center.y);
- this.m_I *= this.m_inertiaScale;
- b2Settings.b2Assert(this.m_I > 0);
- this.m_invI = 1.0 / this.m_I;
- }
- else {
- this.m_I = 0.0;
- this.m_invI = 0.0;
- }
- var oldCenter = this.m_sweep.c.Copy();
- this.m_sweep.localCenter.SetV(center);
- this.m_sweep.c0.SetV(b2Math.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 - oldCenter.y));
- this.m_linearVelocity.y += this.m_angularVelocity * (+(this.m_sweep.c.x - oldCenter.x));
- }
- b2Body.prototype.GetWorldPoint = function (localPoint) {
- var A = this.m_xf.R;
- var u = new b2Vec2(A.col1.x * localPoint.x + A.col2.x * localPoint.y, A.col1.y * localPoint.x + A.col2.y * localPoint.y);
- u.x += this.m_xf.position.x;
- u.y += this.m_xf.position.y;
- return u;
- }
- b2Body.prototype.GetWorldVector = function (localVector) {
- return b2Math.MulMV(this.m_xf.R, localVector);
- }
- b2Body.prototype.GetLocalPoint = function (worldPoint) {
- return b2Math.MulXT(this.m_xf, worldPoint);
- }
- b2Body.prototype.GetLocalVector = function (worldVector) {
- return b2Math.MulTMV(this.m_xf.R, worldVector);
- }
- b2Body.prototype.GetLinearVelocityFromWorldPoint = function (worldPoint) {
- return new b2Vec2(this.m_linearVelocity.x - this.m_angularVelocity * (worldPoint.y - this.m_sweep.c.y), this.m_linearVelocity.y + this.m_angularVelocity * (worldPoint.x - this.m_sweep.c.x));
- }
- b2Body.prototype.GetLinearVelocityFromLocalPoint = function (localPoint) {
- var A = this.m_xf.R;
- var worldPoint = new b2Vec2(A.col1.x * localPoint.x + A.col2.x * localPoint.y, A.col1.y * localPoint.x + A.col2.y * localPoint.y);
- worldPoint.x += this.m_xf.position.x;
- worldPoint.y += this.m_xf.position.y;
- return new b2Vec2(this.m_linearVelocity.x - this.m_angularVelocity * (worldPoint.y - this.m_sweep.c.y), this.m_linearVelocity.y + this.m_angularVelocity * (worldPoint.x - this.m_sweep.c.x));
- }
- b2Body.prototype.GetLinearDamping = function () {
- return this.m_linearDamping;
- }
- b2Body.prototype.SetLinearDamping = function (linearDamping) {
- if (linearDamping === undefined) linearDamping = 0;
- this.m_linearDamping = linearDamping;
- }
- b2Body.prototype.GetAngularDamping = function () {
- return this.m_angularDamping;
- }
- b2Body.prototype.SetAngularDamping = function (angularDamping) {
- if (angularDamping === undefined) angularDamping = 0;
- this.m_angularDamping = angularDamping;
- }
- b2Body.prototype.SetType = function (type) {
- if (type === undefined) type = 0;
- if (this.m_type == type) {
- return;
- }
- this.m_type = type;
- this.ResetMassData();
- if (this.m_type == b2Body.b2_staticBody) {
- this.m_linearVelocity.SetZero();
- this.m_angularVelocity = 0.0;
- }
- this.SetAwake(true);
- this.m_force.SetZero();
- this.m_torque = 0.0;
- for (var ce = this.m_contactList; ce; ce = ce.next) {
- ce.contact.FlagForFiltering();
- }
- }
- b2Body.prototype.GetType = function () {
- return this.m_type;
- }
- b2Body.prototype.SetBullet = function (flag) {
- if (flag) {
- this.m_flags |= b2Body.e_bulletFlag;
- }
- else {
- this.m_flags &= ~b2Body.e_bulletFlag;
- }
- }
- b2Body.prototype.IsBullet = function () {
- return (this.m_flags & b2Body.e_bulletFlag) == b2Body.e_bulletFlag;
- }
- b2Body.prototype.SetSleepingAllowed = function (flag) {
- if (flag) {
- this.m_flags |= b2Body.e_allowSleepFlag;
- }
- else {
- this.m_flags &= ~b2Body.e_allowSleepFlag;
- this.SetAwake(true);
- }
- }
- b2Body.prototype.SetAwake = function (flag) {
- if (flag) {
- this.m_flags |= b2Body.e_awakeFlag;
- this.m_sleepTime = 0.0;
- }
- else {
- this.m_flags &= ~b2Body.e_awakeFlag;
- this.m_sleepTime = 0.0;
- this.m_linearVelocity.SetZero();
- this.m_angularVelocity = 0.0;
- this.m_force.SetZero();
- this.m_torque = 0.0;
- }
- }
- b2Body.prototype.IsAwake = function () {
- return (this.m_flags & b2Body.e_awakeFlag) == b2Body.e_awakeFlag;
- }
- b2Body.prototype.SetFixedRotation = function (fixed) {
- if (fixed) {
- this.m_flags |= b2Body.e_fixedRotationFlag;
- }
- else {
- this.m_flags &= ~b2Body.e_fixedRotationFlag;
- }
- this.ResetMassData();
- }
- b2Body.prototype.IsFixedRotation = function () {
- return (this.m_flags & b2Body.e_fixedRotationFlag) == b2Body.e_fixedRotationFlag;
- }
- b2Body.prototype.SetActive = function (flag) {
- if (flag == this.IsActive()) {
- return;
- }
- var broadPhase;
- var f;
- if (flag) {
- this.m_flags |= b2Body.e_activeFlag;
- broadPhase = this.m_world.m_contactManager.m_broadPhase;
- for (f = this.m_fixtureList;
- f; f = f.m_next) {
- f.CreateProxy(broadPhase, this.m_xf);
- }
- }
- else {
- this.m_flags &= ~b2Body.e_activeFlag;
- broadPhase = this.m_world.m_contactManager.m_broadPhase;
- for (f = this.m_fixtureList;
- f; f = f.m_next) {
- f.DestroyProxy(broadPhase);
- }
- var ce = this.m_contactList;
- while (ce) {
- var ce0 = ce;
- ce = ce.next;
- this.m_world.m_contactManager.Destroy(ce0.contact);
- }
- this.m_contactList = null;
- }
- }
- b2Body.prototype.IsActive = function () {
- return (this.m_flags & b2Body.e_activeFlag) == b2Body.e_activeFlag;
- }
- b2Body.prototype.IsSleepingAllowed = function () {
- return (this.m_flags & b2Body.e_allowSleepFlag) == b2Body.e_allowSleepFlag;
- }
- b2Body.prototype.GetFixtureList = function () {
- return this.m_fixtureList;
- }
- b2Body.prototype.GetJointList = function () {
- return this.m_jointList;
- }
- b2Body.prototype.GetControllerList = function () {
- return this.m_controllerList;
- }
- b2Body.prototype.GetContactList = function () {
- return this.m_contactList;
- }
- b2Body.prototype.GetNext = function () {
- return this.m_next;
- }
- b2Body.prototype.GetUserData = function () {
- return this.m_userData;
- }
- b2Body.prototype.SetUserData = function (data) {
- this.m_userData = data;
- }
- b2Body.prototype.GetWorld = function () {
- return this.m_world;
- }
- b2Body.prototype.b2Body = function (bd, world) {
- this.m_flags = 0;
- if (bd.bullet) {
- this.m_flags |= b2Body.e_bulletFlag;
- }
- if (bd.fixedRotation) {
- this.m_flags |= b2Body.e_fixedRotationFlag;
- }
- if (bd.allowSleep) {
- this.m_flags |= b2Body.e_allowSleepFlag;
- }
- if (bd.awake) {
- this.m_flags |= b2Body.e_awakeFlag;
- }
- if (bd.active) {
- this.m_flags |= b2Body.e_activeFlag;
- }
- this.m_world = world;
- this.m_xf.position.SetV(bd.position);
- this.m_xf.R.Set(bd.angle);
- this.m_sweep.localCenter.SetZero();
- this.m_sweep.t0 = 1.0;
- this.m_sweep.a0 = this.m_sweep.a = bd.angle;
- var tMat = this.m_xf.R;
- var tVec = this.m_sweep.localCenter;
- this.m_sweep.c.x = (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- this.m_sweep.c.y = (tMat.col1.y * tVec.x + tMat.col2.y * tVec.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_jointList = null;
- this.m_controllerList = null;
- this.m_contactList = null;
- this.m_controllerCount = 0;
- this.m_prev = null;
- this.m_next = null;
- this.m_linearVelocity.SetV(bd.linearVelocity);
- this.m_angularVelocity = bd.angularVelocity;
- this.m_linearDamping = bd.linearDamping;
- this.m_angularDamping = bd.angularDamping;
- this.m_force.Set(0.0, 0.0);
- this.m_torque = 0.0;
- this.m_sleepTime = 0.0;
- this.m_type = bd.type;
- if (this.m_type == b2Body.b2_dynamicBody) {
- this.m_mass = 1.0;
- this.m_invMass = 1.0;
- }
- else {
- this.m_mass = 0.0;
- this.m_invMass = 0.0;
- }
- this.m_I = 0.0;
- this.m_invI = 0.0;
- this.m_inertiaScale = bd.inertiaScale;
- this.m_userData = bd.userData;
- this.m_fixtureList = null;
- this.m_fixtureCount = 0;
- }
- b2Body.prototype.SynchronizeFixtures = function () {
- var xf1 = b2Body.s_xf1;
- xf1.R.Set(this.m_sweep.a0);
- var tMat = xf1.R;
- var tVec = this.m_sweep.localCenter;
- xf1.position.x = this.m_sweep.c0.x - (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- xf1.position.y = this.m_sweep.c0.y - (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- var f;
- var broadPhase = this.m_world.m_contactManager.m_broadPhase;
- for (f = this.m_fixtureList;
- f; f = f.m_next) {
- f.Synchronize(broadPhase, xf1, this.m_xf);
- }
- }
- b2Body.prototype.SynchronizeTransform = function () {
- this.m_xf.R.Set(this.m_sweep.a);
- var tMat = this.m_xf.R;
- var tVec = this.m_sweep.localCenter;
- this.m_xf.position.x = this.m_sweep.c.x - (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- this.m_xf.position.y = this.m_sweep.c.y - (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- }
- b2Body.prototype.ShouldCollide = function (other) {
- if (this.m_type != b2Body.b2_dynamicBody && other.m_type != b2Body.b2_dynamicBody) {
- return false;
- }
- for (var jn = this.m_jointList; jn; jn = jn.next) {
- if (jn.other == other) if (jn.joint.m_collideConnected == false) {
- return false;
- }
- }
- return true;
- }
- b2Body.prototype.Advance = function (t) {
- if (t === undefined) t = 0;
- this.m_sweep.Advance(t);
- 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 b2Transform();
- Box2D.Dynamics.b2Body.e_islandFlag = 0x0001;
- Box2D.Dynamics.b2Body.e_awakeFlag = 0x0002;
- Box2D.Dynamics.b2Body.e_allowSleepFlag = 0x0004;
- Box2D.Dynamics.b2Body.e_bulletFlag = 0x0008;
- Box2D.Dynamics.b2Body.e_fixedRotationFlag = 0x0010;
- Box2D.Dynamics.b2Body.e_activeFlag = 0x0020;
- Box2D.Dynamics.b2Body.b2_staticBody = 0;
- Box2D.Dynamics.b2Body.b2_kinematicBody = 1;
- Box2D.Dynamics.b2Body.b2_dynamicBody = 2;
- });
- b2BodyDef.b2BodyDef = function () {
- this.position = new b2Vec2();
- this.linearVelocity = new b2Vec2();
- };
- b2BodyDef.prototype.b2BodyDef = function () {
- this.userData = null;
- this.position.Set(0.0, 0.0);
- this.angle = 0.0;
- this.linearVelocity.Set(0, 0);
- this.angularVelocity = 0.0;
- this.linearDamping = 0.0;
- this.angularDamping = 0.0;
- this.allowSleep = true;
- this.awake = true;
- this.fixedRotation = false;
- this.bullet = false;
- this.type = b2Body.b2_staticBody;
- this.active = true;
- this.inertiaScale = 1.0;
- }
- b2ContactFilter.b2ContactFilter = function () {};
- b2ContactFilter.prototype.ShouldCollide = function (fixtureA, fixtureB) {
- var filter1 = fixtureA.GetFilterData();
- var filter2 = fixtureB.GetFilterData();
- if (filter1.groupIndex == filter2.groupIndex && filter1.groupIndex != 0) {
- return filter1.groupIndex > 0;
- }
- var collide = (filter1.maskBits & filter2.categoryBits) != 0 && (filter1.categoryBits & filter2.maskBits) != 0;
- return collide;
- }
- b2ContactFilter.prototype.RayCollide = function (userData, fixture) {
- if (!userData) return true;
- return this.ShouldCollide((userData instanceof b2Fixture ? userData : null), fixture);
- }
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.b2ContactFilter.b2_defaultFilter = new b2ContactFilter();
- });
- b2ContactImpulse.b2ContactImpulse = function () {
- this.normalImpulses = new Vector_a2j_Number(b2Settings.b2_maxManifoldPoints);
- this.tangentImpulses = new Vector_a2j_Number(b2Settings.b2_maxManifoldPoints);
- };
- b2ContactListener.b2ContactListener = function () {};
- b2ContactListener.prototype.BeginContact = function (contact) {}
- b2ContactListener.prototype.EndContact = function (contact) {}
- b2ContactListener.prototype.PreSolve = function (contact, oldManifold) {}
- b2ContactListener.prototype.PostSolve = function (contact, impulse) {}
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.b2ContactListener.b2_defaultListener = new b2ContactListener();
- });
- b2ContactManager.b2ContactManager = function () {};
- b2ContactManager.prototype.b2ContactManager = function () {
- this.m_world = null;
- this.m_contactCount = 0;
- this.m_contactFilter = b2ContactFilter.b2_defaultFilter;
- this.m_contactListener = b2ContactListener.b2_defaultListener;
- this.m_contactFactory = new b2ContactFactory(this.m_allocator);
- this.m_broadPhase = new b2DynamicTreeBroadPhase();
- }
- b2ContactManager.prototype.AddPair = function (proxyUserDataA, proxyUserDataB) {
- var fixtureA = (proxyUserDataA instanceof b2Fixture ? proxyUserDataA : null);
- var fixtureB = (proxyUserDataB instanceof b2Fixture ? proxyUserDataB : null);
- var bodyA = fixtureA.GetBody();
- var bodyB = fixtureB.GetBody();
- if (bodyA == bodyB) return;
- var edge = bodyB.GetContactList();
- while (edge) {
- if (edge.other == bodyA) {
- var fA = edge.contact.GetFixtureA();
- var fB = edge.contact.GetFixtureB();
- if (fA == fixtureA && fB == fixtureB) return;
- if (fA == fixtureB && fB == fixtureA) return;
- }
- edge = edge.next;
- }
- if (bodyB.ShouldCollide(bodyA) == false) {
- return;
- }
- if (this.m_contactFilter.ShouldCollide(fixtureA, fixtureB) == false) {
- return;
- }
- var c = this.m_contactFactory.Create(fixtureA, fixtureB);
- fixtureA = c.GetFixtureA();
- fixtureB = c.GetFixtureB();
- bodyA = fixtureA.m_body;
- bodyB = fixtureB.m_body;
- c.m_prev = null;
- c.m_next = this.m_world.m_contactList;
- if (this.m_world.m_contactList != null) {
- this.m_world.m_contactList.m_prev = c;
- }
- this.m_world.m_contactList = c;
- c.m_nodeA.contact = c;
- c.m_nodeA.other = bodyB;
- c.m_nodeA.prev = null;
- c.m_nodeA.next = bodyA.m_contactList;
- if (bodyA.m_contactList != null) {
- bodyA.m_contactList.prev = c.m_nodeA;
- }
- bodyA.m_contactList = c.m_nodeA;
- c.m_nodeB.contact = c;
- c.m_nodeB.other = bodyA;
- c.m_nodeB.prev = null;
- c.m_nodeB.next = bodyB.m_contactList;
- if (bodyB.m_contactList != null) {
- bodyB.m_contactList.prev = c.m_nodeB;
- }
- bodyB.m_contactList = c.m_nodeB;
- ++this.m_world.m_contactCount;
- return;
- }
- b2ContactManager.prototype.FindNewContacts = function () {
- this.m_broadPhase.UpdatePairs(Box2D.generateCallback(this, this.AddPair));
- }
- b2ContactManager.prototype.Destroy = function (c) {
- var fixtureA = c.GetFixtureA();
- var fixtureB = c.GetFixtureB();
- var bodyA = fixtureA.GetBody();
- var bodyB = fixtureB.GetBody();
- if (c.IsTouching()) {
- this.m_contactListener.EndContact(c);
- }
- if (c.m_prev) {
- c.m_prev.m_next = c.m_next;
- }
- if (c.m_next) {
- c.m_next.m_prev = c.m_prev;
- }
- if (c == this.m_world.m_contactList) {
- this.m_world.m_contactList = c.m_next;
- }
- if (c.m_nodeA.prev) {
- c.m_nodeA.prev.next = c.m_nodeA.next;
- }
- if (c.m_nodeA.next) {
- c.m_nodeA.next.prev = c.m_nodeA.prev;
- }
- if (c.m_nodeA == bodyA.m_contactList) {
- bodyA.m_contactList = c.m_nodeA.next;
- }
- if (c.m_nodeB.prev) {
- c.m_nodeB.prev.next = c.m_nodeB.next;
- }
- if (c.m_nodeB.next) {
- c.m_nodeB.next.prev = c.m_nodeB.prev;
- }
- if (c.m_nodeB == bodyB.m_contactList) {
- bodyB.m_contactList = c.m_nodeB.next;
- }
- this.m_contactFactory.Destroy(c);
- --this.m_contactCount;
- }
- b2ContactManager.prototype.Collide = function () {
- var c = this.m_world.m_contactList;
- while (c) {
- var fixtureA = c.GetFixtureA();
- var fixtureB = c.GetFixtureB();
- var bodyA = fixtureA.GetBody();
- var bodyB = fixtureB.GetBody();
- if (bodyA.IsAwake() == false && bodyB.IsAwake() == false) {
- c = c.GetNext();
- continue;
- }
- if (c.m_flags & b2Contact.e_filterFlag) {
- if (bodyB.ShouldCollide(bodyA) == false) {
- var cNuke = c;
- c = cNuke.GetNext();
- this.Destroy(cNuke);
- continue;
- }
- if (this.m_contactFilter.ShouldCollide(fixtureA, fixtureB) == false) {
- cNuke = c;
- c = cNuke.GetNext();
- this.Destroy(cNuke);
- continue;
- }
- c.m_flags &= ~b2Contact.e_filterFlag;
- }
- var proxyA = fixtureA.m_proxy;
- var proxyB = fixtureB.m_proxy;
- var overlap = this.m_broadPhase.TestOverlap(proxyA, proxyB);
- if (overlap == false) {
- cNuke = c;
- c = cNuke.GetNext();
- this.Destroy(cNuke);
- continue;
- }
- c.Update(this.m_contactListener);
- c = c.GetNext();
- }
- }
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.b2ContactManager.s_evalCP = new b2ContactPoint();
- });
- b2DebugDraw.b2DebugDraw = function () {};
- b2DebugDraw.prototype.b2DebugDraw = function () {}
- b2DebugDraw.prototype.SetFlags = function (flags) {
- if (flags === undefined) flags = 0;
- }
- b2DebugDraw.prototype.GetFlags = function () {}
- b2DebugDraw.prototype.AppendFlags = function (flags) {
- if (flags === undefined) flags = 0;
- }
- b2DebugDraw.prototype.ClearFlags = function (flags) {
- if (flags === undefined) flags = 0;
- }
- b2DebugDraw.prototype.SetSprite = function (sprite) {}
- b2DebugDraw.prototype.GetSprite = function () {}
- b2DebugDraw.prototype.SetDrawScale = function (drawScale) {
- if (drawScale === undefined) drawScale = 0;
- }
- b2DebugDraw.prototype.GetDrawScale = function () {}
- b2DebugDraw.prototype.SetLineThickness = function (lineThickness) {
- if (lineThickness === undefined) lineThickness = 0;
- }
- b2DebugDraw.prototype.GetLineThickness = function () {}
- b2DebugDraw.prototype.SetAlpha = function (alpha) {
- if (alpha === undefined) alpha = 0;
- }
- b2DebugDraw.prototype.GetAlpha = function () {}
- b2DebugDraw.prototype.SetFillAlpha = function (alpha) {
- if (alpha === undefined) alpha = 0;
- }
- b2DebugDraw.prototype.GetFillAlpha = function () {}
- b2DebugDraw.prototype.SetXFormScale = function (xformScale) {
- if (xformScale === undefined) xformScale = 0;
- }
- b2DebugDraw.prototype.GetXFormScale = function () {}
- b2DebugDraw.prototype.DrawPolygon = function (vertices, vertexCount, color) {
- if (vertexCount === undefined) vertexCount = 0;
- }
- b2DebugDraw.prototype.DrawSolidPolygon = function (vertices, vertexCount, color) {
- if (vertexCount === undefined) vertexCount = 0;
- }
- b2DebugDraw.prototype.DrawCircle = function (center, radius, color) {
- if (radius === undefined) radius = 0;
- }
- b2DebugDraw.prototype.DrawSolidCircle = function (center, radius, axis, color) {
- if (radius === undefined) radius = 0;
- }
- b2DebugDraw.prototype.DrawSegment = function (p1, p2, color) {}
- b2DebugDraw.prototype.DrawTransform = function (xf) {}
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.b2DebugDraw.e_shapeBit = 0x0001;
- Box2D.Dynamics.b2DebugDraw.e_jointBit = 0x0002;
- Box2D.Dynamics.b2DebugDraw.e_aabbBit = 0x0004;
- Box2D.Dynamics.b2DebugDraw.e_pairBit = 0x0008;
- Box2D.Dynamics.b2DebugDraw.e_centerOfMassBit = 0x0010;
- Box2D.Dynamics.b2DebugDraw.e_controllerBit = 0x0020;
- });
- b2DestructionListener.b2DestructionListener = function () {};
- b2DestructionListener.prototype.SayGoodbyeJoint = function (joint) {}
- b2DestructionListener.prototype.SayGoodbyeFixture = function (fixture) {}
- b2FilterData.b2FilterData = function () {
- this.categoryBits = 0x0001;
- this.maskBits = 0xFFFF;
- this.groupIndex = 0;
- };
- b2FilterData.prototype.Copy = function () {
- var copy = new b2FilterData();
- copy.categoryBits = this.categoryBits;
- copy.maskBits = this.maskBits;
- copy.groupIndex = this.groupIndex;
- return copy;
- }
- b2Fixture.b2Fixture = function () {
- this.m_filter = new b2FilterData();
- };
- b2Fixture.prototype.GetType = function () {
- return this.m_shape.GetType();
- }
- b2Fixture.prototype.GetShape = function () {
- return this.m_shape;
- }
- b2Fixture.prototype.SetSensor = function (sensor) {
- if (this.m_isSensor == sensor) return;
- this.m_isSensor = sensor;
- if (this.m_body == null) return;
- var edge = this.m_body.GetContactList();
- while (edge) {
- var contact = edge.contact;
- var fixtureA = contact.GetFixtureA();
- var fixtureB = contact.GetFixtureB();
- if (fixtureA == this || fixtureB == this) contact.SetSensor(fixtureA.IsSensor() || fixtureB.IsSensor());
- edge = edge.next;
- }
- }
- b2Fixture.prototype.IsSensor = function () {
- return this.m_isSensor;
- }
- b2Fixture.prototype.SetFilterData = function (filter) {
- this.m_filter = filter.Copy();
- if (this.m_body) return;
- var edge = this.m_body.GetContactList();
- while (edge) {
- var contact = edge.contact;
- var fixtureA = contact.GetFixtureA();
- var fixtureB = contact.GetFixtureB();
- if (fixtureA == this || fixtureB == this) contact.FlagForFiltering();
- edge = edge.next;
- }
- }
- b2Fixture.prototype.GetFilterData = function () {
- return this.m_filter.Copy();
- }
- b2Fixture.prototype.GetBody = function () {
- return this.m_body;
- }
- b2Fixture.prototype.GetNext = function () {
- return this.m_next;
- }
- b2Fixture.prototype.GetUserData = function () {
- return this.m_userData;
- }
- b2Fixture.prototype.SetUserData = function (data) {
- this.m_userData = data;
- }
- b2Fixture.prototype.TestPoint = function (p) {
- return this.m_shape.TestPoint(this.m_body.GetTransform(), p);
- }
- b2Fixture.prototype.RayCast = function (output, input) {
- return this.m_shape.RayCast(output, input, this.m_body.GetTransform());
- }
- b2Fixture.prototype.GetMassData = function (massData) {
- if (massData === undefined) massData = null;
- if (massData == null) {
- massData = new b2MassData();
- }
- this.m_shape.ComputeMass(massData, this.m_density);
- return massData;
- }
- b2Fixture.prototype.SetDensity = function (density) {
- if (density === undefined) density = 0;
- this.m_density = density;
- }
- b2Fixture.prototype.GetDensity = function () {
- return this.m_density;
- }
- b2Fixture.prototype.GetFriction = function () {
- return this.m_friction;
- }
- b2Fixture.prototype.SetFriction = function (friction) {
- if (friction === undefined) friction = 0;
- this.m_friction = friction;
- }
- b2Fixture.prototype.GetRestitution = function () {
- return this.m_restitution;
- }
- b2Fixture.prototype.SetRestitution = function (restitution) {
- if (restitution === undefined) restitution = 0;
- this.m_restitution = restitution;
- }
- b2Fixture.prototype.GetAABB = function () {
- return this.m_aabb;
- }
- b2Fixture.prototype.b2Fixture = function () {
- this.m_aabb = new b2AABB();
- this.m_userData = null;
- this.m_body = null;
- this.m_next = null;
- this.m_shape = null;
- this.m_density = 0.0;
- this.m_friction = 0.0;
- this.m_restitution = 0.0;
- }
- b2Fixture.prototype.Create = function (body, xf, def) {
- this.m_userData = def.userData;
- this.m_friction = def.friction;
- this.m_restitution = def.restitution;
- this.m_body = body;
- this.m_next = null;
- this.m_filter = def.filter.Copy();
- this.m_isSensor = def.isSensor;
- this.m_shape = def.shape.Copy();
- this.m_density = def.density;
- }
- b2Fixture.prototype.Destroy = function () {
- this.m_shape = null;
- }
- b2Fixture.prototype.CreateProxy = function (broadPhase, xf) {
- this.m_shape.ComputeAABB(this.m_aabb, xf);
- this.m_proxy = broadPhase.CreateProxy(this.m_aabb, this);
- }
- b2Fixture.prototype.DestroyProxy = function (broadPhase) {
- if (this.m_proxy == null) {
- return;
- }
- broadPhase.DestroyProxy(this.m_proxy);
- this.m_proxy = null;
- }
- b2Fixture.prototype.Synchronize = function (broadPhase, transform1, transform2) {
- if (!this.m_proxy) return;
- var aabb1 = new b2AABB();
- var aabb2 = new b2AABB();
- this.m_shape.ComputeAABB(aabb1, transform1);
- this.m_shape.ComputeAABB(aabb2, transform2);
- this.m_aabb.Combine(aabb1, aabb2);
- var displacement = b2Math.SubtractVV(transform2.position, transform1.position);
- broadPhase.MoveProxy(this.m_proxy, this.m_aabb, displacement);
- }
- b2FixtureDef.b2FixtureDef = function () {
- this.filter = new b2FilterData();
- };
- b2FixtureDef.prototype.b2FixtureDef = function () {
- this.shape = null;
- this.userData = null;
- this.friction = 0.2;
- this.restitution = 0.0;
- this.density = 0.0;
- this.filter.categoryBits = 0x0001;
- this.filter.maskBits = 0xFFFF;
- this.filter.groupIndex = 0;
- this.isSensor = false;
- }
- b2Island.b2Island = function () {};
- b2Island.prototype.b2Island = function () {
- this.m_bodies = new Vector();
- this.m_contacts = new Vector();
- this.m_joints = new Vector();
- }
- b2Island.prototype.Initialize = function (bodyCapacity, contactCapacity, jointCapacity, allocator, listener, contactSolver) {
- if (bodyCapacity === undefined) bodyCapacity = 0;
- if (contactCapacity === undefined) contactCapacity = 0;
- if (jointCapacity === undefined) jointCapacity = 0;
- var i = 0;
- this.m_bodyCapacity = bodyCapacity;
- this.m_contactCapacity = contactCapacity;
- this.m_jointCapacity = jointCapacity;
- this.m_bodyCount = 0;
- this.m_contactCount = 0;
- this.m_jointCount = 0;
- this.m_allocator = allocator;
- this.m_listener = listener;
- this.m_contactSolver = contactSolver;
- for (i = this.m_bodies.length;
- i < bodyCapacity; i++)
- this.m_bodies[i] = null;
- for (i = this.m_contacts.length;
- i < contactCapacity; i++)
- this.m_contacts[i] = null;
- for (i = this.m_joints.length;
- i < jointCapacity; i++)
- this.m_joints[i] = null;
- }
- b2Island.prototype.Clear = function () {
- this.m_bodyCount = 0;
- this.m_contactCount = 0;
- this.m_jointCount = 0;
- }
- b2Island.prototype.Solve = function (step, gravity, allowSleep) {
- var i = 0;
- var j = 0;
- var b;
- var joint;
- for (i = 0;
- i < this.m_bodyCount; ++i) {
- b = this.m_bodies[i];
- if (b.GetType() != b2Body.b2_dynamicBody) continue;
- b.m_linearVelocity.x += step.dt * (gravity.x + b.m_invMass * b.m_force.x);
- b.m_linearVelocity.y += step.dt * (gravity.y + b.m_invMass * b.m_force.y);
- b.m_angularVelocity += step.dt * b.m_invI * b.m_torque;
- b.m_linearVelocity.Multiply(b2Math.Clamp(1.0 - step.dt * b.m_linearDamping, 0.0, 1.0));
- b.m_angularVelocity *= b2Math.Clamp(1.0 - step.dt * b.m_angularDamping, 0.0, 1.0);
- }
- this.m_contactSolver.Initialize(step, this.m_contacts, this.m_contactCount, this.m_allocator);
- var contactSolver = this.m_contactSolver;
- contactSolver.InitVelocityConstraints(step);
- for (i = 0;
- i < this.m_jointCount; ++i) {
- joint = this.m_joints[i];
- joint.InitVelocityConstraints(step);
- }
- for (i = 0;
- i < step.velocityIterations; ++i) {
- for (j = 0;
- j < this.m_jointCount; ++j) {
- joint = this.m_joints[j];
- joint.SolveVelocityConstraints(step);
- }
- contactSolver.SolveVelocityConstraints();
- }
- for (i = 0;
- i < this.m_jointCount; ++i) {
- joint = this.m_joints[i];
- joint.FinalizeVelocityConstraints();
- }
- contactSolver.FinalizeVelocityConstraints();
- for (i = 0;
- i < this.m_bodyCount; ++i) {
- b = this.m_bodies[i];
- if (b.GetType() == b2Body.b2_staticBody) continue;
- var translationX = step.dt * b.m_linearVelocity.x;
- var translationY = step.dt * b.m_linearVelocity.y;
- if ((translationX * translationX + translationY * translationY) > b2Settings.b2_maxTranslationSquared) {
- b.m_linearVelocity.Normalize();
- b.m_linearVelocity.x *= b2Settings.b2_maxTranslation * step.inv_dt;
- b.m_linearVelocity.y *= b2Settings.b2_maxTranslation * step.inv_dt;
- }
- var rotation = step.dt * b.m_angularVelocity;
- if (rotation * rotation > b2Settings.b2_maxRotationSquared) {
- if (b.m_angularVelocity < 0.0) {
- b.m_angularVelocity = (-b2Settings.b2_maxRotation * step.inv_dt);
- }
- else {
- b.m_angularVelocity = b2Settings.b2_maxRotation * step.inv_dt;
- }
- }
- b.m_sweep.c0.SetV(b.m_sweep.c);
- b.m_sweep.a0 = b.m_sweep.a;
- b.m_sweep.c.x += step.dt * b.m_linearVelocity.x;
- b.m_sweep.c.y += step.dt * b.m_linearVelocity.y;
- b.m_sweep.a += step.dt * b.m_angularVelocity;
- b.SynchronizeTransform();
- }
- for (i = 0;
- i < step.positionIterations; ++i) {
- var contactsOkay = contactSolver.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
- var jointsOkay = true;
- for (j = 0;
- j < this.m_jointCount; ++j) {
- joint = this.m_joints[j];
- var jointOkay = joint.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
- jointsOkay = jointsOkay && jointOkay;
- }
- if (contactsOkay && jointsOkay) {
- break;
- }
- }
- this.Report(contactSolver.m_constraints);
- if (allowSleep) {
- var minSleepTime = Number.MAX_VALUE;
- var linTolSqr = b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance;
- var angTolSqr = b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance;
- for (i = 0;
- i < this.m_bodyCount; ++i) {
- b = this.m_bodies[i];
- if (b.GetType() == b2Body.b2_staticBody) {
- continue;
- }
- if ((b.m_flags & b2Body.e_allowSleepFlag) == 0) {
- b.m_sleepTime = 0.0;
- minSleepTime = 0.0;
- }
- if ((b.m_flags & b2Body.e_allowSleepFlag) == 0 || b.m_angularVelocity * b.m_angularVelocity > angTolSqr || b2Math.Dot(b.m_linearVelocity, b.m_linearVelocity) > linTolSqr) {
- b.m_sleepTime = 0.0;
- minSleepTime = 0.0;
- }
- else {
- b.m_sleepTime += step.dt;
- minSleepTime = b2Math.Min(minSleepTime, b.m_sleepTime);
- }
- }
- if (minSleepTime >= b2Settings.b2_timeToSleep) {
- for (i = 0;
- i < this.m_bodyCount; ++i) {
- b = this.m_bodies[i];
- b.SetAwake(false);
- }
- }
- }
- }
- b2Island.prototype.SolveTOI = function (subStep) {
- var i = 0;
- var j = 0;
- this.m_contactSolver.Initialize(subStep, this.m_contacts, this.m_contactCount, this.m_allocator);
- var contactSolver = this.m_contactSolver;
- for (i = 0;
- i < this.m_jointCount; ++i) {
- this.m_joints[i].InitVelocityConstraints(subStep);
- }
- for (i = 0;
- i < subStep.velocityIterations; ++i) {
- contactSolver.SolveVelocityConstraints();
- for (j = 0;
- j < this.m_jointCount; ++j) {
- this.m_joints[j].SolveVelocityConstraints(subStep);
- }
- }
- for (i = 0;
- i < this.m_bodyCount; ++i) {
- var b = this.m_bodies[i];
- if (b.GetType() == b2Body.b2_staticBody) continue;
- var translationX = subStep.dt * b.m_linearVelocity.x;
- var translationY = subStep.dt * b.m_linearVelocity.y;
- if ((translationX * translationX + translationY * translationY) > b2Settings.b2_maxTranslationSquared) {
- b.m_linearVelocity.Normalize();
- b.m_linearVelocity.x *= b2Settings.b2_maxTranslation * subStep.inv_dt;
- b.m_linearVelocity.y *= b2Settings.b2_maxTranslation * subStep.inv_dt;
- }
- var rotation = subStep.dt * b.m_angularVelocity;
- if (rotation * rotation > b2Settings.b2_maxRotationSquared) {
- if (b.m_angularVelocity < 0.0) {
- b.m_angularVelocity = (-b2Settings.b2_maxRotation * subStep.inv_dt);
- }
- else {
- b.m_angularVelocity = b2Settings.b2_maxRotation * subStep.inv_dt;
- }
- }
- b.m_sweep.c0.SetV(b.m_sweep.c);
- b.m_sweep.a0 = b.m_sweep.a;
- b.m_sweep.c.x += subStep.dt * b.m_linearVelocity.x;
- b.m_sweep.c.y += subStep.dt * b.m_linearVelocity.y;
- b.m_sweep.a += subStep.dt * b.m_angularVelocity;
- b.SynchronizeTransform();
- }
- var k_toiBaumgarte = 0.75;
- for (i = 0;
- i < subStep.positionIterations; ++i) {
- var contactsOkay = contactSolver.SolvePositionConstraints(k_toiBaumgarte);
- var jointsOkay = true;
- for (j = 0;
- j < this.m_jointCount; ++j) {
- var jointOkay = this.m_joints[j].SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
- jointsOkay = jointsOkay && jointOkay;
- }
- if (contactsOkay && jointsOkay) {
- break;
- }
- }
- this.Report(contactSolver.m_constraints);
- }
- b2Island.prototype.Report = function (constraints) {
- if (this.m_listener == null) {
- return;
- }
- for (var i = 0; i < this.m_contactCount; ++i) {
- var c = this.m_contacts[i];
- var cc = constraints[i];
- for (var j = 0; j < cc.pointCount; ++j) {
- b2Island.s_impulse.normalImpulses[j] = cc.points[j].normalImpulse;
- b2Island.s_impulse.tangentImpulses[j] = cc.points[j].tangentImpulse;
- }
- this.m_listener.PostSolve(c, b2Island.s_impulse);
- }
- }
- b2Island.prototype.AddBody = function (body) {
- body.m_islandIndex = this.m_bodyCount;
- this.m_bodies[this.m_bodyCount++] = body;
- }
- b2Island.prototype.AddContact = function (contact) {
- this.m_contacts[this.m_contactCount++] = contact;
- }
- b2Island.prototype.AddJoint = function (joint) {
- this.m_joints[this.m_jointCount++] = joint;
- }
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.b2Island.s_impulse = new b2ContactImpulse();
- });
- b2TimeStep.b2TimeStep = function () {};
- b2TimeStep.prototype.Set = function (step) {
- this.dt = step.dt;
- this.inv_dt = step.inv_dt;
- this.positionIterations = step.positionIterations;
- this.velocityIterations = step.velocityIterations;
- this.warmStarting = step.warmStarting;
- }
- b2World.b2World = function () {
- this.s_stack = new Vector();
- this.m_contactManager = new b2ContactManager();
- this.m_contactSolver = new b2ContactSolver();
- this.m_island = new b2Island();
- };
- b2World.prototype.b2World = function (gravity, doSleep) {
- this.m_destructionListener = null;
- this.m_debugDraw = null;
- this.m_bodyList = null;
- this.m_contactList = null;
- this.m_jointList = null;
- this.m_controllerList = null;
- this.m_bodyCount = 0;
- this.m_contactCount = 0;
- this.m_jointCount = 0;
- this.m_controllerCount = 0;
- b2World.m_warmStarting = true;
- b2World.m_continuousPhysics = true;
- this.m_allowSleep = doSleep;
- this.m_gravity = gravity;
- this.m_inv_dt0 = 0.0;
- this.m_contactManager.m_world = this;
- var bd = new b2BodyDef();
- this.m_groundBody = this.CreateBody(bd);
- }
- b2World.prototype.SetDestructionListener = function (listener) {
- this.m_destructionListener = listener;
- }
- b2World.prototype.SetContactFilter = function (filter) {
- this.m_contactManager.m_contactFilter = filter;
- }
- b2World.prototype.SetContactListener = function (listener) {
- this.m_contactManager.m_contactListener = listener;
- }
- b2World.prototype.SetDebugDraw = function (debugDraw) {
- this.m_debugDraw = debugDraw;
- }
- b2World.prototype.SetBroadPhase = function (broadPhase) {
- var oldBroadPhase = this.m_contactManager.m_broadPhase;
- this.m_contactManager.m_broadPhase = broadPhase;
- for (var b = this.m_bodyList; b; b = b.m_next) {
- for (var f = b.m_fixtureList; f; f = f.m_next) {
- f.m_proxy = broadPhase.CreateProxy(oldBroadPhase.GetFatAABB(f.m_proxy), f);
- }
- }
- }
- b2World.prototype.Validate = function () {
- this.m_contactManager.m_broadPhase.Validate();
- }
- b2World.prototype.GetProxyCount = function () {
- return this.m_contactManager.m_broadPhase.GetProxyCount();
- }
- b2World.prototype.CreateBody = function (def) {
- if (this.IsLocked() == true) {
- return null;
- }
- var b = new b2Body(def, this);
- b.m_prev = null;
- b.m_next = this.m_bodyList;
- if (this.m_bodyList) {
- this.m_bodyList.m_prev = b;
- }
- this.m_bodyList = b;
- ++this.m_bodyCount;
- return b;
- }
- b2World.prototype.DestroyBody = function (b) {
- if (this.IsLocked() == true) {
- return;
- }
- var jn = b.m_jointList;
- while (jn) {
- var jn0 = jn;
- jn = jn.next;
- if (this.m_destructionListener) {
- this.m_destructionListener.SayGoodbyeJoint(jn0.joint);
- }
- this.DestroyJoint(jn0.joint);
- }
- var coe = b.m_controllerList;
- while (coe) {
- var coe0 = coe;
- coe = coe.nextController;
- coe0.controller.RemoveBody(b);
- }
- var ce = b.m_contactList;
- while (ce) {
- var ce0 = ce;
- ce = ce.next;
- this.m_contactManager.Destroy(ce0.contact);
- }
- b.m_contactList = null;
- var f = b.m_fixtureList;
- while (f) {
- var f0 = f;
- f = f.m_next;
- if (this.m_destructionListener) {
- this.m_destructionListener.SayGoodbyeFixture(f0);
- }
- f0.DestroyProxy(this.m_contactManager.m_broadPhase);
- f0.Destroy();
- }
- b.m_fixtureList = null;
- b.m_fixtureCount = 0;
- 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_bodyList) {
- this.m_bodyList = b.m_next;
- }--this.m_bodyCount;
- }
- b2World.prototype.CreateJoint = function (def) {
- var j = b2Joint.Create(def, null);
- j.m_prev = null;
- j.m_next = this.m_jointList;
- if (this.m_jointList) {
- this.m_jointList.m_prev = j;
- }
- this.m_jointList = j;
- ++this.m_jointCount;
- j.m_edgeA.joint = j;
- j.m_edgeA.other = j.m_bodyB;
- j.m_edgeA.prev = null;
- j.m_edgeA.next = j.m_bodyA.m_jointList;
- if (j.m_bodyA.m_jointList) j.m_bodyA.m_jointList.prev = j.m_edgeA;
- j.m_bodyA.m_jointList = j.m_edgeA;
- j.m_edgeB.joint = j;
- j.m_edgeB.other = j.m_bodyA;
- j.m_edgeB.prev = null;
- j.m_edgeB.next = j.m_bodyB.m_jointList;
- if (j.m_bodyB.m_jointList) j.m_bodyB.m_jointList.prev = j.m_edgeB;
- j.m_bodyB.m_jointList = j.m_edgeB;
- var bodyA = def.bodyA;
- var bodyB = def.bodyB;
- if (def.collideConnected == false) {
- var edge = bodyB.GetContactList();
- while (edge) {
- if (edge.other == bodyA) {
- edge.contact.FlagForFiltering();
- }
- edge = edge.next;
- }
- }
- return j;
- }
- b2World.prototype.DestroyJoint = function (j) {
- var collideConnected = j.m_collideConnected;
- if (j.m_prev) {
- j.m_prev.m_next = j.m_next;
- }
- if (j.m_next) {
- j.m_next.m_prev = j.m_prev;
- }
- if (j == this.m_jointList) {
- this.m_jointList = j.m_next;
- }
- var bodyA = j.m_bodyA;
- var bodyB = j.m_bodyB;
- bodyA.SetAwake(true);
- bodyB.SetAwake(true);
- if (j.m_edgeA.prev) {
- j.m_edgeA.prev.next = j.m_edgeA.next;
- }
- if (j.m_edgeA.next) {
- j.m_edgeA.next.prev = j.m_edgeA.prev;
- }
- if (j.m_edgeA == bodyA.m_jointList) {
- bodyA.m_jointList = j.m_edgeA.next;
- }
- j.m_edgeA.prev = null;
- j.m_edgeA.next = null;
- if (j.m_edgeB.prev) {
- j.m_edgeB.prev.next = j.m_edgeB.next;
- }
- if (j.m_edgeB.next) {
- j.m_edgeB.next.prev = j.m_edgeB.prev;
- }
- if (j.m_edgeB == bodyB.m_jointList) {
- bodyB.m_jointList = j.m_edgeB.next;
- }
- j.m_edgeB.prev = null;
- j.m_edgeB.next = null;
- b2Joint.Destroy(j, null);
- --this.m_jointCount;
- if (collideConnected == false) {
- var edge = bodyB.GetContactList();
- while (edge) {
- if (edge.other == bodyA) {
- edge.contact.FlagForFiltering();
- }
- edge = edge.next;
- }
- }
- }
- b2World.prototype.AddController = function (c) {
- c.m_next = this.m_controllerList;
- c.m_prev = null;
- this.m_controllerList = c;
- c.m_world = this;
- this.m_controllerCount++;
- return c;
- }
- b2World.prototype.RemoveController = function (c) {
- if (c.m_prev) c.m_prev.m_next = c.m_next;
- if (c.m_next) c.m_next.m_prev = c.m_prev;
- if (this.m_controllerList == c) this.m_controllerList = c.m_next;
- this.m_controllerCount--;
- }
- b2World.prototype.CreateController = function (controller) {
- if (controller.m_world != this) throw new Error("Controller can only be a member of one world");
- controller.m_next = this.m_controllerList;
- controller.m_prev = null;
- if (this.m_controllerList) this.m_controllerList.m_prev = controller;
- this.m_controllerList = controller;
- ++this.m_controllerCount;
- controller.m_world = this;
- return controller;
- }
- b2World.prototype.DestroyController = function (controller) {
- controller.Clear();
- if (controller.m_next) controller.m_next.m_prev = controller.m_prev;
- if (controller.m_prev) controller.m_prev.m_next = controller.m_next;
- if (controller == this.m_controllerList) this.m_controllerList = controller.m_next;
- --this.m_controllerCount;
- }
- b2World.prototype.SetWarmStarting = function (flag) {
- b2World.m_warmStarting = flag;
- }
- b2World.prototype.SetContinuousPhysics = function (flag) {
- b2World.m_continuousPhysics = flag;
- }
- b2World.prototype.GetBodyCount = function () {
- return this.m_bodyCount;
- }
- b2World.prototype.GetJointCount = function () {
- return this.m_jointCount;
- }
- b2World.prototype.GetContactCount = function () {
- return this.m_contactCount;
- }
- b2World.prototype.SetGravity = function (gravity) {
- this.m_gravity = gravity;
- }
- b2World.prototype.GetGravity = function () {
- return this.m_gravity;
- }
- b2World.prototype.GetGroundBody = function () {
- return this.m_groundBody;
- }
- b2World.prototype.Step = function (dt, velocityIterations, positionIterations) {
- if (dt === undefined) dt = 0;
- if (velocityIterations === undefined) velocityIterations = 0;
- if (positionIterations === undefined) positionIterations = 0;
- if (this.m_flags & b2World.e_newFixture) {
- this.m_contactManager.FindNewContacts();
- this.m_flags &= ~b2World.e_newFixture;
- }
- this.m_flags |= b2World.e_locked;
- var step = b2World.s_timestep2;
- step.dt = dt;
- step.velocityIterations = velocityIterations;
- step.positionIterations = positionIterations;
- if (dt > 0.0) {
- step.inv_dt = 1.0 / dt;
- }
- else {
- step.inv_dt = 0.0;
- }
- step.dtRatio = this.m_inv_dt0 * dt;
- step.warmStarting = b2World.m_warmStarting;
- this.m_contactManager.Collide();
- if (step.dt > 0.0) {
- this.Solve(step);
- }
- if (b2World.m_continuousPhysics && step.dt > 0.0) {
- this.SolveTOI(step);
- }
- if (step.dt > 0.0) {
- this.m_inv_dt0 = step.inv_dt;
- }
- this.m_flags &= ~b2World.e_locked;
- }
- b2World.prototype.ClearForces = function () {
- for (var body = this.m_bodyList; body; body = body.m_next) {
- body.m_force.SetZero();
- body.m_torque = 0.0;
- }
- }
- b2World.prototype.DrawDebugData = function () {
- if (this.m_debugDraw == null) {
- return;
- }
- this.m_debugDraw.m_sprite.graphics.clear();
- var flags = this.m_debugDraw.GetFlags();
- var i = 0;
- var b;
- var f;
- var s;
- var j;
- var bp;
- var invQ = new b2Vec2;
- var x1 = new b2Vec2;
- var x2 = new b2Vec2;
- var xf;
- var b1 = new b2AABB();
- var b2 = new b2AABB();
- var vs = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
- var color = new b2Color(0, 0, 0);
- if (flags & b2DebugDraw.e_shapeBit) {
- for (b = this.m_bodyList;
- b; b = b.m_next) {
- xf = b.m_xf;
- for (f = b.GetFixtureList();
- f; f = f.m_next) {
- s = f.GetShape();
- if (b.IsActive() == false) {
- color.Set(0.5, 0.5, 0.3);
- this.DrawShape(s, xf, color);
- }
- else if (b.GetType() == b2Body.b2_staticBody) {
- color.Set(0.5, 0.9, 0.5);
- this.DrawShape(s, xf, color);
- }
- else if (b.GetType() == b2Body.b2_kinematicBody) {
- color.Set(0.5, 0.5, 0.9);
- this.DrawShape(s, xf, color);
- }
- else if (b.IsAwake() == false) {
- color.Set(0.6, 0.6, 0.6);
- this.DrawShape(s, xf, color);
- }
- else {
- color.Set(0.9, 0.7, 0.7);
- this.DrawShape(s, xf, color);
- }
- }
- }
- }
- if (flags & b2DebugDraw.e_jointBit) {
- for (j = this.m_jointList;
- j; j = j.m_next) {
- this.DrawJoint(j);
- }
- }
- if (flags & b2DebugDraw.e_controllerBit) {
- for (var c = this.m_controllerList; c; c = c.m_next) {
- c.Draw(this.m_debugDraw);
- }
- }
- if (flags & b2DebugDraw.e_pairBit) {
- color.Set(0.3, 0.9, 0.9);
- for (var contact = this.m_contactManager.m_contactList; contact; contact = contact.GetNext()) {
- var fixtureA = contact.GetFixtureA();
- var fixtureB = contact.GetFixtureB();
- var cA = fixtureA.GetAABB().GetCenter();
- var cB = fixtureB.GetAABB().GetCenter();
- this.m_debugDraw.DrawSegment(cA, cB, color);
- }
- }
- if (flags & b2DebugDraw.e_aabbBit) {
- bp = this.m_contactManager.m_broadPhase;
- vs = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
- for (b = this.m_bodyList;
- b; b = b.GetNext()) {
- if (b.IsActive() == false) {
- continue;
- }
- for (f = b.GetFixtureList();
- f; f = f.GetNext()) {
- var aabb = bp.GetFatAABB(f.m_proxy);
- vs[0].Set(aabb.lowerBound.x, aabb.lowerBound.y);
- vs[1].Set(aabb.upperBound.x, aabb.lowerBound.y);
- vs[2].Set(aabb.upperBound.x, aabb.upperBound.y);
- vs[3].Set(aabb.lowerBound.x, aabb.upperBound.y);
- this.m_debugDraw.DrawPolygon(vs, 4, color);
- }
- }
- }
- if (flags & b2DebugDraw.e_centerOfMassBit) {
- for (b = this.m_bodyList;
- b; b = b.m_next) {
- xf = b2World.s_xf;
- xf.R = b.m_xf.R;
- xf.position = b.GetWorldCenter();
- this.m_debugDraw.DrawTransform(xf);
- }
- }
- }
- b2World.prototype.QueryAABB = function (callback, aabb) {
- var __this = this;
- var broadPhase = __this.m_contactManager.m_broadPhase;
-
- function WorldQueryWrapper(proxy) {
- return callback(broadPhase.GetUserData(proxy));
- };
- broadPhase.Query(WorldQueryWrapper, aabb);
- }
- b2World.prototype.QueryShape = function (callback, shape, transform) {
- var __this = this;
- if (transform === undefined) transform = null;
- if (transform == null) {
- transform = new b2Transform();
- transform.SetIdentity();
- }
- var broadPhase = __this.m_contactManager.m_broadPhase;
-
- function WorldQueryWrapper(proxy) {
- var fixture = (broadPhase.GetUserData(proxy) instanceof b2Fixture ? broadPhase.GetUserData(proxy) : null);
- if (b2Shape.TestOverlap(shape, transform, fixture.GetShape(), fixture.GetBody().GetTransform())) return callback(fixture);
- return true;
- };
- var aabb = new b2AABB();
- shape.ComputeAABB(aabb, transform);
- broadPhase.Query(WorldQueryWrapper, aabb);
- }
- b2World.prototype.QueryPoint = function (callback, p) {
- var __this = this;
- var broadPhase = __this.m_contactManager.m_broadPhase;
-
- function WorldQueryWrapper(proxy) {
- var fixture = (broadPhase.GetUserData(proxy) instanceof b2Fixture ? broadPhase.GetUserData(proxy) : null);
- if (fixture.TestPoint(p)) return callback(fixture);
- return true;
- };
- var aabb = new b2AABB();
- aabb.lowerBound.Set(p.x - b2Settings.b2_linearSlop, p.y - b2Settings.b2_linearSlop);
- aabb.upperBound.Set(p.x + b2Settings.b2_linearSlop, p.y + b2Settings.b2_linearSlop);
- broadPhase.Query(WorldQueryWrapper, aabb);
- }
- b2World.prototype.RayCast = function (callback, point1, point2) {
- var __this = this;
- var broadPhase = __this.m_contactManager.m_broadPhase;
- var output = new b2RayCastOutput;
-
- function RayCastWrapper(input, proxy) {
- var userData = broadPhase.GetUserData(proxy);
- var fixture = (userData instanceof b2Fixture ? userData : null);
- var hit = fixture.RayCast(output, input);
- if (hit) {
- var fraction = output.fraction;
- var point = new b2Vec2((1.0 - fraction) * point1.x + fraction * point2.x, (1.0 - fraction) * point1.y + fraction * point2.y);
- return callback(fixture, point, output.normal, fraction);
- }
- return input.maxFraction;
- };
- var input = new b2RayCastInput(point1, point2);
- broadPhase.RayCast(RayCastWrapper, input);
- }
- b2World.prototype.RayCastOne = function (point1, point2) {
- var __this = this;
- var result;
-
- function RayCastOneWrapper(fixture, point, normal, fraction) {
- if (fraction === undefined) fraction = 0;
- result = fixture;
- return fraction;
- };
- __this.RayCast(RayCastOneWrapper, point1, point2);
- return result;
- }
- b2World.prototype.RayCastAll = function (point1, point2) {
- var __this = this;
- var result = new Vector();
-
- function RayCastAllWrapper(fixture, point, normal, fraction) {
- if (fraction === undefined) fraction = 0;
- result[result.length] = fixture;
- return 1;
- };
- __this.RayCast(RayCastAllWrapper, point1, point2);
- return result;
- }
- b2World.prototype.GetBodyList = function () {
- return this.m_bodyList;
- }
- b2World.prototype.GetJointList = function () {
- return this.m_jointList;
- }
- b2World.prototype.GetContactList = function () {
- return this.m_contactList;
- }
- b2World.prototype.IsLocked = function () {
- return (this.m_flags & b2World.e_locked) > 0;
- }
- b2World.prototype.Solve = function (step) {
- var b;
- for (var controller = this.m_controllerList; controller; controller = controller.m_next) {
- controller.Step(step);
- }
- var island = this.m_island;
- island.Initialize(this.m_bodyCount, this.m_contactCount, this.m_jointCount, null, this.m_contactManager.m_contactListener, this.m_contactSolver);
- for (b = this.m_bodyList;
- b; b = b.m_next) {
- b.m_flags &= ~b2Body.e_islandFlag;
- }
- for (var c = this.m_contactList; c; c = c.m_next) {
- c.m_flags &= ~b2Contact.e_islandFlag;
- }
- for (var j = this.m_jointList; j; j = j.m_next) {
- j.m_islandFlag = false;
- }
- var stackSize = parseInt(this.m_bodyCount);
- var stack = this.s_stack;
- for (var seed = this.m_bodyList; seed; seed = seed.m_next) {
- if (seed.m_flags & b2Body.e_islandFlag) {
- continue;
- }
- if (seed.IsAwake() == false || seed.IsActive() == false) {
- continue;
- }
- if (seed.GetType() == b2Body.b2_staticBody) {
- continue;
- }
- island.Clear();
- var stackCount = 0;
- stack[stackCount++] = seed;
- seed.m_flags |= b2Body.e_islandFlag;
- while (stackCount > 0) {
- b = stack[--stackCount];
- island.AddBody(b);
- if (b.IsAwake() == false) {
- b.SetAwake(true);
- }
- if (b.GetType() == b2Body.b2_staticBody) {
- continue;
- }
- var other;
- for (var ce = b.m_contactList; ce; ce = ce.next) {
- if (ce.contact.m_flags & b2Contact.e_islandFlag) {
- continue;
- }
- if (ce.contact.IsSensor() == true || ce.contact.IsEnabled() == false || ce.contact.IsTouching() == false) {
- continue;
- }
- island.AddContact(ce.contact);
- ce.contact.m_flags |= b2Contact.e_islandFlag;
- other = ce.other;
- if (other.m_flags & b2Body.e_islandFlag) {
- continue;
- }
- stack[stackCount++] = other;
- other.m_flags |= b2Body.e_islandFlag;
- }
- for (var jn = b.m_jointList; jn; jn = jn.next) {
- if (jn.joint.m_islandFlag == true) {
- continue;
- }
- other = jn.other;
- if (other.IsActive() == false) {
- continue;
- }
- island.AddJoint(jn.joint);
- jn.joint.m_islandFlag = true;
- if (other.m_flags & b2Body.e_islandFlag) {
- continue;
- }
- stack[stackCount++] = other;
- other.m_flags |= b2Body.e_islandFlag;
- }
- }
- island.Solve(step, this.m_gravity, this.m_allowSleep);
- for (var i = 0; i < island.m_bodyCount; ++i) {
- b = island.m_bodies[i];
- if (b.GetType() == b2Body.b2_staticBody) {
- b.m_flags &= ~b2Body.e_islandFlag;
- }
- }
- }
- for (i = 0;
- i < stack.length; ++i) {
- if (!stack[i]) break;
- stack[i] = null;
- }
- for (b = this.m_bodyList;
- b; b = b.m_next) {
- if (b.IsAwake() == false || b.IsActive() == false) {
- continue;
- }
- if (b.GetType() == b2Body.b2_staticBody) {
- continue;
- }
- b.SynchronizeFixtures();
- }
- this.m_contactManager.FindNewContacts();
- }
- b2World.prototype.SolveTOI = function (step) {
- var b;
- var fA;
- var fB;
- var bA;
- var bB;
- var cEdge;
- var j;
- var island = this.m_island;
- island.Initialize(this.m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, b2Settings.b2_maxTOIJointsPerIsland, null, this.m_contactManager.m_contactListener, this.m_contactSolver);
- var queue = b2World.s_queue;
- for (b = this.m_bodyList;
- b; b = b.m_next) {
- b.m_flags &= ~b2Body.e_islandFlag;
- b.m_sweep.t0 = 0.0;
- }
- var c;
- for (c = this.m_contactList;
- c; c = c.m_next) {
- c.m_flags &= ~ (b2Contact.e_toiFlag | b2Contact.e_islandFlag);
- }
- for (j = this.m_jointList;
- j; j = j.m_next) {
- j.m_islandFlag = false;
- }
- for (;;) {
- var minContact = null;
- var minTOI = 1.0;
- for (c = this.m_contactList;
- c; c = c.m_next) {
- if (c.IsSensor() == true || c.IsEnabled() == false || c.IsContinuous() == false) {
- continue;
- }
- var toi = 1.0;
- if (c.m_flags & b2Contact.e_toiFlag) {
- toi = c.m_toi;
- }
- else {
- fA = c.m_fixtureA;
- fB = c.m_fixtureB;
- bA = fA.m_body;
- bB = fB.m_body;
- if ((bA.GetType() != b2Body.b2_dynamicBody || bA.IsAwake() == false) && (bB.GetType() != b2Body.b2_dynamicBody || bB.IsAwake() == false)) {
- continue;
- }
- var t0 = bA.m_sweep.t0;
- if (bA.m_sweep.t0 < bB.m_sweep.t0) {
- t0 = bB.m_sweep.t0;
- bA.m_sweep.Advance(t0);
- }
- else if (bB.m_sweep.t0 < bA.m_sweep.t0) {
- t0 = bA.m_sweep.t0;
- bB.m_sweep.Advance(t0);
- }
- toi = c.ComputeTOI(bA.m_sweep, bB.m_sweep);
- b2Settings.b2Assert(0.0 <= toi && toi <= 1.0);
- if (toi > 0.0 && toi < 1.0) {
- toi = (1.0 - toi) * t0 + toi;
- if (toi > 1) toi = 1;
- }
- c.m_toi = toi;
- c.m_flags |= b2Contact.e_toiFlag;
- }
- if (Number.MIN_VALUE < toi && toi < minTOI) {
- minContact = c;
- minTOI = toi;
- }
- }
- if (minContact == null || 1.0 - 100.0 * Number.MIN_VALUE < minTOI) {
- break;
- }
- fA = minContact.m_fixtureA;
- fB = minContact.m_fixtureB;
- bA = fA.m_body;
- bB = fB.m_body;
- b2World.s_backupA.Set(bA.m_sweep);
- b2World.s_backupB.Set(bB.m_sweep);
- bA.Advance(minTOI);
- bB.Advance(minTOI);
- minContact.Update(this.m_contactManager.m_contactListener);
- minContact.m_flags &= ~b2Contact.e_toiFlag;
- if (minContact.IsSensor() == true || minContact.IsEnabled() == false) {
- bA.m_sweep.Set(b2World.s_backupA);
- bB.m_sweep.Set(b2World.s_backupB);
- bA.SynchronizeTransform();
- bB.SynchronizeTransform();
- continue;
- }
- if (minContact.IsTouching() == false) {
- continue;
- }
- var seed = bA;
- if (seed.GetType() != b2Body.b2_dynamicBody) {
- seed = bB;
- }
- island.Clear();
- var queueStart = 0;
- var queueSize = 0;
- queue[queueStart + queueSize++] = seed;
- seed.m_flags |= b2Body.e_islandFlag;
- while (queueSize > 0) {
- b = queue[queueStart++];
- --queueSize;
- island.AddBody(b);
- if (b.IsAwake() == false) {
- b.SetAwake(true);
- }
- if (b.GetType() != b2Body.b2_dynamicBody) {
- continue;
- }
- for (cEdge = b.m_contactList;
- cEdge; cEdge = cEdge.next) {
- if (island.m_contactCount == island.m_contactCapacity) {
- break;
- }
- if (cEdge.contact.m_flags & b2Contact.e_islandFlag) {
- continue;
- }
- if (cEdge.contact.IsSensor() == true || cEdge.contact.IsEnabled() == false || cEdge.contact.IsTouching() == false) {
- continue;
- }
- island.AddContact(cEdge.contact);
- cEdge.contact.m_flags |= b2Contact.e_islandFlag;
- var other = cEdge.other;
- if (other.m_flags & b2Body.e_islandFlag) {
- continue;
- }
- if (other.GetType() != b2Body.b2_staticBody) {
- other.Advance(minTOI);
- other.SetAwake(true);
- }
- queue[queueStart + queueSize] = other;
- ++queueSize;
- other.m_flags |= b2Body.e_islandFlag;
- }
- for (var jEdge = b.m_jointList; jEdge; jEdge = jEdge.next) {
- if (island.m_jointCount == island.m_jointCapacity) continue;
- if (jEdge.joint.m_islandFlag == true) continue;
- other = jEdge.other;
- if (other.IsActive() == false) {
- continue;
- }
- island.AddJoint(jEdge.joint);
- jEdge.joint.m_islandFlag = true;
- if (other.m_flags & b2Body.e_islandFlag) continue;
- if (other.GetType() != b2Body.b2_staticBody) {
- other.Advance(minTOI);
- other.SetAwake(true);
- }
- queue[queueStart + queueSize] = other;
- ++queueSize;
- other.m_flags |= b2Body.e_islandFlag;
- }
- }
- var subStep = b2World.s_timestep;
- subStep.warmStarting = false;
- subStep.dt = (1.0 - minTOI) * step.dt;
- subStep.inv_dt = 1.0 / subStep.dt;
- subStep.dtRatio = 0.0;
- subStep.velocityIterations = step.velocityIterations;
- subStep.positionIterations = step.positionIterations;
- island.SolveTOI(subStep);
- var i = 0;
- for (i = 0;
- i < island.m_bodyCount; ++i) {
- b = island.m_bodies[i];
- b.m_flags &= ~b2Body.e_islandFlag;
- if (b.IsAwake() == false) {
- continue;
- }
- if (b.GetType() != b2Body.b2_dynamicBody) {
- continue;
- }
- b.SynchronizeFixtures();
- for (cEdge = b.m_contactList;
- cEdge; cEdge = cEdge.next) {
- cEdge.contact.m_flags &= ~b2Contact.e_toiFlag;
- }
- }
- for (i = 0;
- i < island.m_contactCount; ++i) {
- c = island.m_contacts[i];
- c.m_flags &= ~ (b2Contact.e_toiFlag | b2Contact.e_islandFlag);
- }
- for (i = 0;
- i < island.m_jointCount; ++i) {
- j = island.m_joints[i];
- j.m_islandFlag = false;
- }
- this.m_contactManager.FindNewContacts();
- }
- }
- b2World.prototype.DrawJoint = function (joint) {
- var b1 = joint.GetBodyA();
- var b2 = joint.GetBodyB();
- var xf1 = b1.m_xf;
- var xf2 = b2.m_xf;
- var x1 = xf1.position;
- var x2 = xf2.position;
- var p1 = joint.GetAnchorA();
- var p2 = joint.GetAnchorB();
- var color = b2World.s_jointColor;
- switch (joint.m_type) {
- case b2Joint.e_distanceJoint:
- this.m_debugDraw.DrawSegment(p1, p2, color);
- break;
- case b2Joint.e_pulleyJoint:
- {
- var pulley = ((joint instanceof b2PulleyJoint ? joint : null));
- var s1 = pulley.GetGroundAnchorA();
- var s2 = pulley.GetGroundAnchorB();
- this.m_debugDraw.DrawSegment(s1, p1, color);
- this.m_debugDraw.DrawSegment(s2, p2, color);
- this.m_debugDraw.DrawSegment(s1, s2, color);
- }
- break;
- case b2Joint.e_mouseJoint:
- this.m_debugDraw.DrawSegment(p1, p2, color);
- break;
- default:
- if (b1 != this.m_groundBody) this.m_debugDraw.DrawSegment(x1, p1, color);
- this.m_debugDraw.DrawSegment(p1, p2, color);
- if (b2 != this.m_groundBody) this.m_debugDraw.DrawSegment(x2, p2, color);
- }
- }
- b2World.prototype.DrawShape = function (shape, xf, color) {
- switch (shape.m_type) {
- case b2Shape.e_circleShape:
- {
- var circle = ((shape instanceof b2CircleShape ? shape : null));
- var center = b2Math.MulX(xf, circle.m_p);
- var radius = circle.m_radius;
- var axis = xf.R.col1;
- this.m_debugDraw.DrawSolidCircle(center, radius, axis, color);
- }
- break;
- case b2Shape.e_polygonShape:
- {
- var i = 0;
- var poly = ((shape instanceof b2PolygonShape ? shape : null));
- var vertexCount = parseInt(poly.GetVertexCount());
- var localVertices = poly.GetVertices();
- var vertices = new Vector(vertexCount);
- for (i = 0;
- i < vertexCount; ++i) {
- vertices[i] = b2Math.MulX(xf, localVertices[i]);
- }
- this.m_debugDraw.DrawSolidPolygon(vertices, vertexCount, color);
- }
- break;
- case b2Shape.e_edgeShape:
- {
- var edge = (shape instanceof b2EdgeShape ? shape : null);
- this.m_debugDraw.DrawSegment(b2Math.MulX(xf, edge.GetVertex1()), b2Math.MulX(xf, edge.GetVertex2()), color);
- }
- break;
- }
- }
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.b2World.s_timestep2 = new b2TimeStep();
- Box2D.Dynamics.b2World.s_xf = new b2Transform();
- Box2D.Dynamics.b2World.s_backupA = new b2Sweep();
- Box2D.Dynamics.b2World.s_backupB = new b2Sweep();
- Box2D.Dynamics.b2World.s_timestep = new b2TimeStep();
- Box2D.Dynamics.b2World.s_queue = new Vector();
- Box2D.Dynamics.b2World.s_jointColor = new b2Color(0.5, 0.8, 0.8);
- Box2D.Dynamics.b2World.e_newFixture = 0x0001;
- Box2D.Dynamics.b2World.e_locked = 0x0002;
- });
-})();
-(function () {
- var b2CircleShape = Box2D.Collision.Shapes.b2CircleShape,
- b2EdgeChainDef = Box2D.Collision.Shapes.b2EdgeChainDef,
- b2EdgeShape = Box2D.Collision.Shapes.b2EdgeShape,
- b2MassData = Box2D.Collision.Shapes.b2MassData,
- b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape,
- b2Shape = Box2D.Collision.Shapes.b2Shape,
- b2CircleContact = Box2D.Dynamics.Contacts.b2CircleContact,
- b2Contact = Box2D.Dynamics.Contacts.b2Contact,
- b2ContactConstraint = Box2D.Dynamics.Contacts.b2ContactConstraint,
- b2ContactConstraintPoint = Box2D.Dynamics.Contacts.b2ContactConstraintPoint,
- b2ContactEdge = Box2D.Dynamics.Contacts.b2ContactEdge,
- b2ContactFactory = Box2D.Dynamics.Contacts.b2ContactFactory,
- b2ContactRegister = Box2D.Dynamics.Contacts.b2ContactRegister,
- b2ContactResult = Box2D.Dynamics.Contacts.b2ContactResult,
- b2ContactSolver = Box2D.Dynamics.Contacts.b2ContactSolver,
- b2EdgeAndCircleContact = Box2D.Dynamics.Contacts.b2EdgeAndCircleContact,
- b2NullContact = Box2D.Dynamics.Contacts.b2NullContact,
- b2PolyAndCircleContact = Box2D.Dynamics.Contacts.b2PolyAndCircleContact,
- b2PolyAndEdgeContact = Box2D.Dynamics.Contacts.b2PolyAndEdgeContact,
- b2PolygonContact = Box2D.Dynamics.Contacts.b2PolygonContact,
- b2PositionSolverManifold = Box2D.Dynamics.Contacts.b2PositionSolverManifold,
- b2Body = Box2D.Dynamics.b2Body,
- b2BodyDef = Box2D.Dynamics.b2BodyDef,
- b2ContactFilter = Box2D.Dynamics.b2ContactFilter,
- b2ContactImpulse = Box2D.Dynamics.b2ContactImpulse,
- b2ContactListener = Box2D.Dynamics.b2ContactListener,
- b2ContactManager = Box2D.Dynamics.b2ContactManager,
- b2DebugDraw = Box2D.Dynamics.b2DebugDraw,
- b2DestructionListener = Box2D.Dynamics.b2DestructionListener,
- b2FilterData = Box2D.Dynamics.b2FilterData,
- b2Fixture = Box2D.Dynamics.b2Fixture,
- b2FixtureDef = Box2D.Dynamics.b2FixtureDef,
- b2Island = Box2D.Dynamics.b2Island,
- b2TimeStep = Box2D.Dynamics.b2TimeStep,
- b2World = Box2D.Dynamics.b2World,
- b2Color = Box2D.Common.b2Color,
- b2internal = Box2D.Common.b2internal,
- b2Settings = Box2D.Common.b2Settings,
- b2Mat22 = Box2D.Common.Math.b2Mat22,
- b2Mat33 = Box2D.Common.Math.b2Mat33,
- b2Math = Box2D.Common.Math.b2Math,
- b2Sweep = Box2D.Common.Math.b2Sweep,
- b2Transform = Box2D.Common.Math.b2Transform,
- b2Vec2 = Box2D.Common.Math.b2Vec2,
- b2Vec3 = Box2D.Common.Math.b2Vec3,
- b2AABB = Box2D.Collision.b2AABB,
- b2Bound = Box2D.Collision.b2Bound,
- b2BoundValues = Box2D.Collision.b2BoundValues,
- b2Collision = Box2D.Collision.b2Collision,
- b2ContactID = Box2D.Collision.b2ContactID,
- b2ContactPoint = Box2D.Collision.b2ContactPoint,
- b2Distance = Box2D.Collision.b2Distance,
- b2DistanceInput = Box2D.Collision.b2DistanceInput,
- b2DistanceOutput = Box2D.Collision.b2DistanceOutput,
- b2DistanceProxy = Box2D.Collision.b2DistanceProxy,
- b2DynamicTree = Box2D.Collision.b2DynamicTree,
- b2DynamicTreeBroadPhase = Box2D.Collision.b2DynamicTreeBroadPhase,
- b2DynamicTreeNode = Box2D.Collision.b2DynamicTreeNode,
- b2DynamicTreePair = Box2D.Collision.b2DynamicTreePair,
- b2Manifold = Box2D.Collision.b2Manifold,
- b2ManifoldPoint = Box2D.Collision.b2ManifoldPoint,
- b2Point = Box2D.Collision.b2Point,
- b2RayCastInput = Box2D.Collision.b2RayCastInput,
- b2RayCastOutput = Box2D.Collision.b2RayCastOutput,
- b2Segment = Box2D.Collision.b2Segment,
- b2SeparationFunction = Box2D.Collision.b2SeparationFunction,
- b2Simplex = Box2D.Collision.b2Simplex,
- b2SimplexCache = Box2D.Collision.b2SimplexCache,
- b2SimplexVertex = Box2D.Collision.b2SimplexVertex,
- b2TimeOfImpact = Box2D.Collision.b2TimeOfImpact,
- b2TOIInput = Box2D.Collision.b2TOIInput,
- b2WorldManifold = Box2D.Collision.b2WorldManifold,
- ClipVertex = Box2D.Collision.ClipVertex,
- Features = Box2D.Collision.Features,
- IBroadPhase = Box2D.Collision.IBroadPhase;
-
- Box2D.inherit(b2CircleContact, Box2D.Dynamics.Contacts.b2Contact);
- b2CircleContact.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype;
- b2CircleContact.b2CircleContact = function () {
- Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
- };
- b2CircleContact.Create = function (allocator) {
- return new b2CircleContact();
- }
- b2CircleContact.Destroy = function (contact, allocator) {}
- b2CircleContact.prototype.Reset = function (fixtureA, fixtureB) {
- this.__super.Reset.call(this, fixtureA, fixtureB);
- }
- b2CircleContact.prototype.Evaluate = function () {
- var bA = this.m_fixtureA.GetBody();
- var bB = this.m_fixtureB.GetBody();
- b2Collision.CollideCircles(this.m_manifold, (this.m_fixtureA.GetShape() instanceof b2CircleShape ? this.m_fixtureA.GetShape() : null), bA.m_xf, (this.m_fixtureB.GetShape() instanceof b2CircleShape ? this.m_fixtureB.GetShape() : null), bB.m_xf);
- }
- b2Contact.b2Contact = function () {
- this.m_nodeA = new b2ContactEdge();
- this.m_nodeB = new b2ContactEdge();
- this.m_manifold = new b2Manifold();
- this.m_oldManifold = new b2Manifold();
- };
- b2Contact.prototype.GetManifold = function () {
- return this.m_manifold;
- }
- b2Contact.prototype.GetWorldManifold = function (worldManifold) {
- var bodyA = this.m_fixtureA.GetBody();
- var bodyB = this.m_fixtureB.GetBody();
- var shapeA = this.m_fixtureA.GetShape();
- var shapeB = this.m_fixtureB.GetShape();
- worldManifold.Initialize(this.m_manifold, bodyA.GetTransform(), shapeA.m_radius, bodyB.GetTransform(), shapeB.m_radius);
- }
- b2Contact.prototype.IsTouching = function () {
- return (this.m_flags & b2Contact.e_touchingFlag) == b2Contact.e_touchingFlag;
- }
- b2Contact.prototype.IsContinuous = function () {
- return (this.m_flags & b2Contact.e_continuousFlag) == b2Contact.e_continuousFlag;
- }
- b2Contact.prototype.SetSensor = function (sensor) {
- if (sensor) {
- this.m_flags |= b2Contact.e_sensorFlag;
- }
- else {
- this.m_flags &= ~b2Contact.e_sensorFlag;
- }
- }
- b2Contact.prototype.IsSensor = function () {
- return (this.m_flags & b2Contact.e_sensorFlag) == b2Contact.e_sensorFlag;
- }
- b2Contact.prototype.SetEnabled = function (flag) {
- if (flag) {
- this.m_flags |= b2Contact.e_enabledFlag;
- }
- else {
- this.m_flags &= ~b2Contact.e_enabledFlag;
- }
- }
- b2Contact.prototype.IsEnabled = function () {
- return (this.m_flags & b2Contact.e_enabledFlag) == b2Contact.e_enabledFlag;
- }
- b2Contact.prototype.GetNext = function () {
- return this.m_next;
- }
- b2Contact.prototype.GetFixtureA = function () {
- return this.m_fixtureA;
- }
- b2Contact.prototype.GetFixtureB = function () {
- return this.m_fixtureB;
- }
- b2Contact.prototype.FlagForFiltering = function () {
- this.m_flags |= b2Contact.e_filterFlag;
- }
- b2Contact.prototype.b2Contact = function () {}
- b2Contact.prototype.Reset = function (fixtureA, fixtureB) {
- if (fixtureA === undefined) fixtureA = null;
- if (fixtureB === undefined) fixtureB = null;
- this.m_flags = b2Contact.e_enabledFlag;
- if (!fixtureA || !fixtureB) {
- this.m_fixtureA = null;
- this.m_fixtureB = null;
- return;
- }
- if (fixtureA.IsSensor() || fixtureB.IsSensor()) {
- this.m_flags |= b2Contact.e_sensorFlag;
- }
- var bodyA = fixtureA.GetBody();
- var bodyB = fixtureB.GetBody();
- if (bodyA.GetType() != b2Body.b2_dynamicBody || bodyA.IsBullet() || bodyB.GetType() != b2Body.b2_dynamicBody || bodyB.IsBullet()) {
- this.m_flags |= b2Contact.e_continuousFlag;
- }
- this.m_fixtureA = fixtureA;
- this.m_fixtureB = fixtureB;
- this.m_manifold.m_pointCount = 0;
- this.m_prev = null;
- this.m_next = 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;
- }
- b2Contact.prototype.Update = function (listener) {
- var tManifold = this.m_oldManifold;
- this.m_oldManifold = this.m_manifold;
- this.m_manifold = tManifold;
- this.m_flags |= b2Contact.e_enabledFlag;
- var touching = false;
- var wasTouching = (this.m_flags & b2Contact.e_touchingFlag) == b2Contact.e_touchingFlag;
- var bodyA = this.m_fixtureA.m_body;
- var bodyB = this.m_fixtureB.m_body;
- var aabbOverlap = this.m_fixtureA.m_aabb.TestOverlap(this.m_fixtureB.m_aabb);
- if (this.m_flags & b2Contact.e_sensorFlag) {
- if (aabbOverlap) {
- var shapeA = this.m_fixtureA.GetShape();
- var shapeB = this.m_fixtureB.GetShape();
- var xfA = bodyA.GetTransform();
- var xfB = bodyB.GetTransform();
- touching = b2Shape.TestOverlap(shapeA, xfA, shapeB, xfB);
- }
- this.m_manifold.m_pointCount = 0;
- }
- else {
- if (bodyA.GetType() != b2Body.b2_dynamicBody || bodyA.IsBullet() || bodyB.GetType() != b2Body.b2_dynamicBody || bodyB.IsBullet()) {
- this.m_flags |= b2Contact.e_continuousFlag;
- }
- else {
- this.m_flags &= ~b2Contact.e_continuousFlag;
- }
- if (aabbOverlap) {
- this.Evaluate();
- touching = this.m_manifold.m_pointCount > 0;
- for (var i = 0; i < this.m_manifold.m_pointCount; ++i) {
- var mp2 = this.m_manifold.m_points[i];
- mp2.m_normalImpulse = 0.0;
- mp2.m_tangentImpulse = 0.0;
- var id2 = mp2.m_id;
- for (var j = 0; j < this.m_oldManifold.m_pointCount; ++j) {
- var mp1 = this.m_oldManifold.m_points[j];
- if (mp1.m_id.key == id2.key) {
- mp2.m_normalImpulse = mp1.m_normalImpulse;
- mp2.m_tangentImpulse = mp1.m_tangentImpulse;
- break;
- }
- }
- }
- }
- else {
- this.m_manifold.m_pointCount = 0;
- }
- if (touching != wasTouching) {
- bodyA.SetAwake(true);
- bodyB.SetAwake(true);
- }
- }
- if (touching) {
- this.m_flags |= b2Contact.e_touchingFlag;
- }
- else {
- this.m_flags &= ~b2Contact.e_touchingFlag;
- }
- if (wasTouching == false && touching == true) {
- listener.BeginContact(this);
- }
- if (wasTouching == true && touching == false) {
- listener.EndContact(this);
- }
- if ((this.m_flags & b2Contact.e_sensorFlag) == 0) {
- listener.PreSolve(this, this.m_oldManifold);
- }
- }
- b2Contact.prototype.Evaluate = function () {}
- b2Contact.prototype.ComputeTOI = function (sweepA, sweepB) {
- b2Contact.s_input.proxyA.Set(this.m_fixtureA.GetShape());
- b2Contact.s_input.proxyB.Set(this.m_fixtureB.GetShape());
- b2Contact.s_input.sweepA = sweepA;
- b2Contact.s_input.sweepB = sweepB;
- b2Contact.s_input.tolerance = b2Settings.b2_linearSlop;
- return b2TimeOfImpact.TimeOfImpact(b2Contact.s_input);
- }
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.Contacts.b2Contact.e_sensorFlag = 0x0001;
- Box2D.Dynamics.Contacts.b2Contact.e_continuousFlag = 0x0002;
- Box2D.Dynamics.Contacts.b2Contact.e_islandFlag = 0x0004;
- Box2D.Dynamics.Contacts.b2Contact.e_toiFlag = 0x0008;
- Box2D.Dynamics.Contacts.b2Contact.e_touchingFlag = 0x0010;
- Box2D.Dynamics.Contacts.b2Contact.e_enabledFlag = 0x0020;
- Box2D.Dynamics.Contacts.b2Contact.e_filterFlag = 0x0040;
- Box2D.Dynamics.Contacts.b2Contact.s_input = new b2TOIInput();
- });
- b2ContactConstraint.b2ContactConstraint = function () {
- this.localPlaneNormal = new b2Vec2();
- this.localPoint = new b2Vec2();
- this.normal = new b2Vec2();
- this.normalMass = new b2Mat22();
- this.K = new b2Mat22();
- };
- b2ContactConstraint.prototype.b2ContactConstraint = function () {
- this.points = new Vector(b2Settings.b2_maxManifoldPoints);
- for (var i = 0; i < b2Settings.b2_maxManifoldPoints; i++) {
- this.points[i] = new b2ContactConstraintPoint();
- }
- }
- b2ContactConstraintPoint.b2ContactConstraintPoint = function () {
- this.localPoint = new b2Vec2();
- this.rA = new b2Vec2();
- this.rB = new b2Vec2();
- };
- b2ContactEdge.b2ContactEdge = function () {};
- b2ContactFactory.b2ContactFactory = function () {};
- b2ContactFactory.prototype.b2ContactFactory = function (allocator) {
- this.m_allocator = allocator;
- this.InitializeRegisters();
- }
- b2ContactFactory.prototype.AddType = function (createFcn, destroyFcn, type1, type2) {
- if (type1 === undefined) type1 = 0;
- if (type2 === undefined) type2 = 0;
- this.m_registers[type1][type2].createFcn = createFcn;
- this.m_registers[type1][type2].destroyFcn = destroyFcn;
- this.m_registers[type1][type2].primary = true;
- if (type1 != type2) {
- this.m_registers[type2][type1].createFcn = createFcn;
- this.m_registers[type2][type1].destroyFcn = destroyFcn;
- this.m_registers[type2][type1].primary = false;
- }
- }
- b2ContactFactory.prototype.InitializeRegisters = function () {
- this.m_registers = new Vector(b2Shape.e_shapeTypeCount);
- for (var i = 0; i < b2Shape.e_shapeTypeCount; i++) {
- this.m_registers[i] = new Vector(b2Shape.e_shapeTypeCount);
- for (var j = 0; j < b2Shape.e_shapeTypeCount; j++) {
- this.m_registers[i][j] = new b2ContactRegister();
- }
- }
- this.AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
- this.AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape);
- this.AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape);
- this.AddType(b2EdgeAndCircleContact.Create, b2EdgeAndCircleContact.Destroy, b2Shape.e_edgeShape, b2Shape.e_circleShape);
- this.AddType(b2PolyAndEdgeContact.Create, b2PolyAndEdgeContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_edgeShape);
- }
- b2ContactFactory.prototype.Create = function (fixtureA, fixtureB) {
- var type1 = parseInt(fixtureA.GetType());
- var type2 = parseInt(fixtureB.GetType());
- var reg = this.m_registers[type1][type2];
- var c;
- if (reg.pool) {
- c = reg.pool;
- reg.pool = c.m_next;
- reg.poolCount--;
- c.Reset(fixtureA, fixtureB);
- return c;
- }
- var createFcn = reg.createFcn;
- if (createFcn != null) {
- if (reg.primary) {
- c = createFcn(this.m_allocator);
- c.Reset(fixtureA, fixtureB);
- return c;
- }
- else {
- c = createFcn(this.m_allocator);
- c.Reset(fixtureB, fixtureA);
- return c;
- }
- }
- else {
- return null;
- }
- }
- b2ContactFactory.prototype.Destroy = function (contact) {
- if (contact.m_manifold.m_pointCount > 0) {
- contact.m_fixtureA.m_body.SetAwake(true);
- contact.m_fixtureB.m_body.SetAwake(true);
- }
- var type1 = parseInt(contact.m_fixtureA.GetType());
- var type2 = parseInt(contact.m_fixtureB.GetType());
- var reg = this.m_registers[type1][type2];
- if (true) {
- reg.poolCount++;
- contact.m_next = reg.pool;
- reg.pool = contact;
- }
- var destroyFcn = reg.destroyFcn;
- destroyFcn(contact, this.m_allocator);
- }
- b2ContactRegister.b2ContactRegister = function () {};
- b2ContactResult.b2ContactResult = function () {
- this.position = new b2Vec2();
- this.normal = new b2Vec2();
- this.id = new b2ContactID();
- };
- b2ContactSolver.b2ContactSolver = function () {
- this.m_step = new b2TimeStep();
- this.m_constraints = new Vector();
- };
- b2ContactSolver.prototype.b2ContactSolver = function () {}
- b2ContactSolver.prototype.Initialize = function (step, contacts, contactCount, allocator) {
- if (contactCount === undefined) contactCount = 0;
- var contact;
- this.m_step.Set(step);
- this.m_allocator = allocator;
- var i = 0;
- var tVec;
- var tMat;
- this.m_constraintCount = contactCount;
- while (this.m_constraints.length < this.m_constraintCount) {
- this.m_constraints[this.m_constraints.length] = new b2ContactConstraint();
- }
- for (i = 0;
- i < contactCount; ++i) {
- contact = contacts[i];
- var fixtureA = contact.m_fixtureA;
- var fixtureB = contact.m_fixtureB;
- var shapeA = fixtureA.m_shape;
- var shapeB = fixtureB.m_shape;
- var radiusA = shapeA.m_radius;
- var radiusB = shapeB.m_radius;
- var bodyA = fixtureA.m_body;
- var bodyB = fixtureB.m_body;
- var manifold = contact.GetManifold();
- var friction = b2Settings.b2MixFriction(fixtureA.GetFriction(), fixtureB.GetFriction());
- var restitution = b2Settings.b2MixRestitution(fixtureA.GetRestitution(), fixtureB.GetRestitution());
- var vAX = bodyA.m_linearVelocity.x;
- var vAY = bodyA.m_linearVelocity.y;
- var vBX = bodyB.m_linearVelocity.x;
- var vBY = bodyB.m_linearVelocity.y;
- var wA = bodyA.m_angularVelocity;
- var wB = bodyB.m_angularVelocity;
- b2Settings.b2Assert(manifold.m_pointCount > 0);
- b2ContactSolver.s_worldManifold.Initialize(manifold, bodyA.m_xf, radiusA, bodyB.m_xf, radiusB);
- var normalX = b2ContactSolver.s_worldManifold.m_normal.x;
- var normalY = b2ContactSolver.s_worldManifold.m_normal.y;
- var cc = this.m_constraints[i];
- cc.bodyA = bodyA;
- cc.bodyB = bodyB;
- cc.manifold = manifold;
- cc.normal.x = normalX;
- cc.normal.y = normalY;
- cc.pointCount = manifold.m_pointCount;
- cc.friction = friction;
- cc.restitution = restitution;
- cc.localPlaneNormal.x = manifold.m_localPlaneNormal.x;
- cc.localPlaneNormal.y = manifold.m_localPlaneNormal.y;
- cc.localPoint.x = manifold.m_localPoint.x;
- cc.localPoint.y = manifold.m_localPoint.y;
- cc.radius = radiusA + radiusB;
- cc.type = manifold.m_type;
- for (var k = 0; k < cc.pointCount; ++k) {
- var cp = manifold.m_points[k];
- var ccp = cc.points[k];
- ccp.normalImpulse = cp.m_normalImpulse;
- ccp.tangentImpulse = cp.m_tangentImpulse;
- ccp.localPoint.SetV(cp.m_localPoint);
- var rAX = ccp.rA.x = b2ContactSolver.s_worldManifold.m_points[k].x - bodyA.m_sweep.c.x;
- var rAY = ccp.rA.y = b2ContactSolver.s_worldManifold.m_points[k].y - bodyA.m_sweep.c.y;
- var rBX = ccp.rB.x = b2ContactSolver.s_worldManifold.m_points[k].x - bodyB.m_sweep.c.x;
- var rBY = ccp.rB.y = b2ContactSolver.s_worldManifold.m_points[k].y - bodyB.m_sweep.c.y;
- var rnA = rAX * normalY - rAY * normalX;
- var rnB = rBX * normalY - rBY * normalX;
- rnA *= rnA;
- rnB *= rnB;
- var kNormal = bodyA.m_invMass + bodyB.m_invMass + bodyA.m_invI * rnA + bodyB.m_invI * rnB;
- ccp.normalMass = 1.0 / kNormal;
- var kEqualized = bodyA.m_mass * bodyA.m_invMass + bodyB.m_mass * bodyB.m_invMass;
- kEqualized += bodyA.m_mass * bodyA.m_invI * rnA + bodyB.m_mass * bodyB.m_invI * rnB;
- ccp.equalizedMass = 1.0 / kEqualized;
- var tangentX = normalY;
- var tangentY = (-normalX);
- var rtA = rAX * tangentY - rAY * tangentX;
- var rtB = rBX * tangentY - rBY * tangentX;
- rtA *= rtA;
- rtB *= rtB;
- var kTangent = bodyA.m_invMass + bodyB.m_invMass + bodyA.m_invI * rtA + bodyB.m_invI * rtB;
- ccp.tangentMass = 1.0 / kTangent;
- ccp.velocityBias = 0.0;
- var tX = vBX + ((-wB * rBY)) - vAX - ((-wA * rAY));
- var tY = vBY + (wB * rBX) - vAY - (wA * rAX);
- var vRel = cc.normal.x * tX + cc.normal.y * tY;
- if (vRel < (-b2Settings.b2_velocityThreshold)) {
- ccp.velocityBias += (-cc.restitution * vRel);
- }
- }
- if (cc.pointCount == 2) {
- var ccp1 = cc.points[0];
- var ccp2 = cc.points[1];
- var invMassA = bodyA.m_invMass;
- var invIA = bodyA.m_invI;
- var invMassB = bodyB.m_invMass;
- var invIB = bodyB.m_invI;
- var rn1A = ccp1.rA.x * normalY - ccp1.rA.y * normalX;
- var rn1B = ccp1.rB.x * normalY - ccp1.rB.y * normalX;
- var rn2A = ccp2.rA.x * normalY - ccp2.rA.y * normalX;
- var rn2B = ccp2.rB.x * normalY - ccp2.rB.y * normalX;
- var k11 = invMassA + invMassB + invIA * rn1A * rn1A + invIB * rn1B * rn1B;
- var k22 = invMassA + invMassB + invIA * rn2A * rn2A + invIB * rn2B * rn2B;
- var k12 = invMassA + invMassB + invIA * rn1A * rn2A + invIB * rn1B * rn2B;
- var k_maxConditionNumber = 100.0;
- if (k11 * k11 < k_maxConditionNumber * (k11 * k22 - k12 * k12)) {
- cc.K.col1.Set(k11, k12);
- cc.K.col2.Set(k12, k22);
- cc.K.GetInverse(cc.normalMass);
- }
- else {
- cc.pointCount = 1;
- }
- }
- }
- }
- b2ContactSolver.prototype.InitVelocityConstraints = function (step) {
- var tVec;
- var tVec2;
- var tMat;
- for (var i = 0; i < this.m_constraintCount; ++i) {
- var c = this.m_constraints[i];
- var bodyA = c.bodyA;
- var bodyB = c.bodyB;
- var invMassA = bodyA.m_invMass;
- var invIA = bodyA.m_invI;
- var invMassB = bodyB.m_invMass;
- var invIB = bodyB.m_invI;
- var normalX = c.normal.x;
- var normalY = c.normal.y;
- var tangentX = normalY;
- var tangentY = (-normalX);
- var tX = 0;
- var j = 0;
- var tCount = 0;
- if (step.warmStarting) {
- tCount = c.pointCount;
- for (j = 0;
- j < tCount; ++j) {
- var ccp = c.points[j];
- ccp.normalImpulse *= step.dtRatio;
- ccp.tangentImpulse *= step.dtRatio;
- var PX = ccp.normalImpulse * normalX + ccp.tangentImpulse * tangentX;
- var PY = ccp.normalImpulse * normalY + ccp.tangentImpulse * tangentY;
- bodyA.m_angularVelocity -= invIA * (ccp.rA.x * PY - ccp.rA.y * PX);
- bodyA.m_linearVelocity.x -= invMassA * PX;
- bodyA.m_linearVelocity.y -= invMassA * PY;
- bodyB.m_angularVelocity += invIB * (ccp.rB.x * PY - ccp.rB.y * PX);
- bodyB.m_linearVelocity.x += invMassB * PX;
- bodyB.m_linearVelocity.y += invMassB * PY;
- }
- }
- else {
- tCount = c.pointCount;
- for (j = 0;
- j < tCount; ++j) {
- var ccp2 = c.points[j];
- ccp2.normalImpulse = 0.0;
- ccp2.tangentImpulse = 0.0;
- }
- }
- }
- }
- b2ContactSolver.prototype.SolveVelocityConstraints = function () {
- var j = 0;
- var ccp;
- var rAX = 0;
- var rAY = 0;
- var rBX = 0;
- var rBY = 0;
- var dvX = 0;
- var dvY = 0;
- var vn = 0;
- var vt = 0;
- var lambda = 0;
- var maxFriction = 0;
- var newImpulse = 0;
- var PX = 0;
- var PY = 0;
- var dX = 0;
- var dY = 0;
- var P1X = 0;
- var P1Y = 0;
- var P2X = 0;
- var P2Y = 0;
- var tMat;
- var tVec;
- for (var i = 0; i < this.m_constraintCount; ++i) {
- var c = this.m_constraints[i];
- var bodyA = c.bodyA;
- var bodyB = c.bodyB;
- var wA = bodyA.m_angularVelocity;
- var wB = bodyB.m_angularVelocity;
- var vA = bodyA.m_linearVelocity;
- var vB = bodyB.m_linearVelocity;
- var invMassA = bodyA.m_invMass;
- var invIA = bodyA.m_invI;
- var invMassB = bodyB.m_invMass;
- var invIB = bodyB.m_invI;
- var normalX = c.normal.x;
- var normalY = c.normal.y;
- var tangentX = normalY;
- var tangentY = (-normalX);
- var friction = c.friction;
- var tX = 0;
- for (j = 0;
- j < c.pointCount; j++) {
- ccp = c.points[j];
- dvX = vB.x - wB * ccp.rB.y - vA.x + wA * ccp.rA.y;
- dvY = vB.y + wB * ccp.rB.x - vA.y - wA * ccp.rA.x;
- vt = dvX * tangentX + dvY * tangentY;
- lambda = ccp.tangentMass * (-vt);
- maxFriction = friction * ccp.normalImpulse;
- newImpulse = b2Math.Clamp(ccp.tangentImpulse + lambda, (-maxFriction), maxFriction);
- lambda = newImpulse - ccp.tangentImpulse;
- PX = lambda * tangentX;
- PY = lambda * tangentY;
- vA.x -= invMassA * PX;
- vA.y -= invMassA * PY;
- wA -= invIA * (ccp.rA.x * PY - ccp.rA.y * PX);
- vB.x += invMassB * PX;
- vB.y += invMassB * PY;
- wB += invIB * (ccp.rB.x * PY - ccp.rB.y * PX);
- ccp.tangentImpulse = newImpulse;
- }
- var tCount = parseInt(c.pointCount);
- if (c.pointCount == 1) {
- ccp = c.points[0];
- dvX = vB.x + ((-wB * ccp.rB.y)) - vA.x - ((-wA * ccp.rA.y));
- dvY = vB.y + (wB * ccp.rB.x) - vA.y - (wA * ccp.rA.x);
- vn = dvX * normalX + dvY * normalY;
- lambda = (-ccp.normalMass * (vn - ccp.velocityBias));
- newImpulse = ccp.normalImpulse + lambda;
- newImpulse = newImpulse > 0 ? newImpulse : 0.0;
- lambda = newImpulse - ccp.normalImpulse;
- PX = lambda * normalX;
- PY = lambda * normalY;
- vA.x -= invMassA * PX;
- vA.y -= invMassA * PY;
- wA -= invIA * (ccp.rA.x * PY - ccp.rA.y * PX);
- vB.x += invMassB * PX;
- vB.y += invMassB * PY;
- wB += invIB * (ccp.rB.x * PY - ccp.rB.y * PX);
- ccp.normalImpulse = newImpulse;
- }
- else {
- var cp1 = c.points[0];
- var cp2 = c.points[1];
- var aX = cp1.normalImpulse;
- var aY = cp2.normalImpulse;
- var dv1X = vB.x - wB * cp1.rB.y - vA.x + wA * cp1.rA.y;
- var dv1Y = vB.y + wB * cp1.rB.x - vA.y - wA * cp1.rA.x;
- var dv2X = vB.x - wB * cp2.rB.y - vA.x + wA * cp2.rA.y;
- var dv2Y = vB.y + wB * cp2.rB.x - vA.y - wA * cp2.rA.x;
- var vn1 = dv1X * normalX + dv1Y * normalY;
- var vn2 = dv2X * normalX + dv2Y * normalY;
- var bX = vn1 - cp1.velocityBias;
- var bY = vn2 - cp2.velocityBias;
- tMat = c.K;
- bX -= tMat.col1.x * aX + tMat.col2.x * aY;
- bY -= tMat.col1.y * aX + tMat.col2.y * aY;
- var k_errorTol = 0.001;
- for (;;) {
- tMat = c.normalMass;
- var xX = (-(tMat.col1.x * bX + tMat.col2.x * bY));
- var xY = (-(tMat.col1.y * bX + tMat.col2.y * bY));
- if (xX >= 0.0 && xY >= 0.0) {
- dX = xX - aX;
- dY = xY - aY;
- P1X = dX * normalX;
- P1Y = dX * normalY;
- P2X = dY * normalX;
- P2Y = dY * normalY;
- vA.x -= invMassA * (P1X + P2X);
- vA.y -= invMassA * (P1Y + P2Y);
- wA -= invIA * (cp1.rA.x * P1Y - cp1.rA.y * P1X + cp2.rA.x * P2Y - cp2.rA.y * P2X);
- vB.x += invMassB * (P1X + P2X);
- vB.y += invMassB * (P1Y + P2Y);
- wB += invIB * (cp1.rB.x * P1Y - cp1.rB.y * P1X + cp2.rB.x * P2Y - cp2.rB.y * P2X);
- cp1.normalImpulse = xX;
- cp2.normalImpulse = xY;
- break;
- }
- xX = (-cp1.normalMass * bX);
- xY = 0.0;
- vn1 = 0.0;
- vn2 = c.K.col1.y * xX + bY;
- if (xX >= 0.0 && vn2 >= 0.0) {
- dX = xX - aX;
- dY = xY - aY;
- P1X = dX * normalX;
- P1Y = dX * normalY;
- P2X = dY * normalX;
- P2Y = dY * normalY;
- vA.x -= invMassA * (P1X + P2X);
- vA.y -= invMassA * (P1Y + P2Y);
- wA -= invIA * (cp1.rA.x * P1Y - cp1.rA.y * P1X + cp2.rA.x * P2Y - cp2.rA.y * P2X);
- vB.x += invMassB * (P1X + P2X);
- vB.y += invMassB * (P1Y + P2Y);
- wB += invIB * (cp1.rB.x * P1Y - cp1.rB.y * P1X + cp2.rB.x * P2Y - cp2.rB.y * P2X);
- cp1.normalImpulse = xX;
- cp2.normalImpulse = xY;
- break;
- }
- xX = 0.0;
- xY = (-cp2.normalMass * bY);
- vn1 = c.K.col2.x * xY + bX;
- vn2 = 0.0;
- if (xY >= 0.0 && vn1 >= 0.0) {
- dX = xX - aX;
- dY = xY - aY;
- P1X = dX * normalX;
- P1Y = dX * normalY;
- P2X = dY * normalX;
- P2Y = dY * normalY;
- vA.x -= invMassA * (P1X + P2X);
- vA.y -= invMassA * (P1Y + P2Y);
- wA -= invIA * (cp1.rA.x * P1Y - cp1.rA.y * P1X + cp2.rA.x * P2Y - cp2.rA.y * P2X);
- vB.x += invMassB * (P1X + P2X);
- vB.y += invMassB * (P1Y + P2Y);
- wB += invIB * (cp1.rB.x * P1Y - cp1.rB.y * P1X + cp2.rB.x * P2Y - cp2.rB.y * P2X);
- cp1.normalImpulse = xX;
- cp2.normalImpulse = xY;
- break;
- }
- xX = 0.0;
- xY = 0.0;
- vn1 = bX;
- vn2 = bY;
- if (vn1 >= 0.0 && vn2 >= 0.0) {
- dX = xX - aX;
- dY = xY - aY;
- P1X = dX * normalX;
- P1Y = dX * normalY;
- P2X = dY * normalX;
- P2Y = dY * normalY;
- vA.x -= invMassA * (P1X + P2X);
- vA.y -= invMassA * (P1Y + P2Y);
- wA -= invIA * (cp1.rA.x * P1Y - cp1.rA.y * P1X + cp2.rA.x * P2Y - cp2.rA.y * P2X);
- vB.x += invMassB * (P1X + P2X);
- vB.y += invMassB * (P1Y + P2Y);
- wB += invIB * (cp1.rB.x * P1Y - cp1.rB.y * P1X + cp2.rB.x * P2Y - cp2.rB.y * P2X);
- cp1.normalImpulse = xX;
- cp2.normalImpulse = xY;
- break;
- }
- break;
- }
- }
- bodyA.m_angularVelocity = wA;
- bodyB.m_angularVelocity = wB;
- }
- }
- b2ContactSolver.prototype.FinalizeVelocityConstraints = function () {
- for (var i = 0; i < this.m_constraintCount; ++i) {
- var c = this.m_constraints[i];
- var m = c.manifold;
- for (var j = 0; j < c.pointCount; ++j) {
- var point1 = m.m_points[j];
- var point2 = c.points[j];
- point1.m_normalImpulse = point2.normalImpulse;
- point1.m_tangentImpulse = point2.tangentImpulse;
- }
- }
- }
- b2ContactSolver.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- var minSeparation = 0.0;
- for (var i = 0; i < this.m_constraintCount; i++) {
- var c = this.m_constraints[i];
- var bodyA = c.bodyA;
- var bodyB = c.bodyB;
- var invMassA = bodyA.m_mass * bodyA.m_invMass;
- var invIA = bodyA.m_mass * bodyA.m_invI;
- var invMassB = bodyB.m_mass * bodyB.m_invMass;
- var invIB = bodyB.m_mass * bodyB.m_invI;
- b2ContactSolver.s_psm.Initialize(c);
- var normal = b2ContactSolver.s_psm.m_normal;
- for (var j = 0; j < c.pointCount; j++) {
- var ccp = c.points[j];
- var point = b2ContactSolver.s_psm.m_points[j];
- var separation = b2ContactSolver.s_psm.m_separations[j];
- var rAX = point.x - bodyA.m_sweep.c.x;
- var rAY = point.y - bodyA.m_sweep.c.y;
- var rBX = point.x - bodyB.m_sweep.c.x;
- var rBY = point.y - bodyB.m_sweep.c.y;
- minSeparation = minSeparation < separation ? minSeparation : separation;
- var C = b2Math.Clamp(baumgarte * (separation + b2Settings.b2_linearSlop), (-b2Settings.b2_maxLinearCorrection), 0.0);
- var impulse = (-ccp.equalizedMass * C);
- var PX = impulse * normal.x;
- var PY = impulse * normal.y;bodyA.m_sweep.c.x -= invMassA * PX;
- bodyA.m_sweep.c.y -= invMassA * PY;
- bodyA.m_sweep.a -= invIA * (rAX * PY - rAY * PX);
- bodyA.SynchronizeTransform();
- bodyB.m_sweep.c.x += invMassB * PX;
- bodyB.m_sweep.c.y += invMassB * PY;
- bodyB.m_sweep.a += invIB * (rBX * PY - rBY * PX);
- bodyB.SynchronizeTransform();
- }
- }
- return minSeparation > (-1.5 * b2Settings.b2_linearSlop);
- }
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.Contacts.b2ContactSolver.s_worldManifold = new b2WorldManifold();
- Box2D.Dynamics.Contacts.b2ContactSolver.s_psm = new b2PositionSolverManifold();
- });
- Box2D.inherit(b2EdgeAndCircleContact, Box2D.Dynamics.Contacts.b2Contact);
- b2EdgeAndCircleContact.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype;
- b2EdgeAndCircleContact.b2EdgeAndCircleContact = function () {
- Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
- };
- b2EdgeAndCircleContact.Create = function (allocator) {
- return new b2EdgeAndCircleContact();
- }
- b2EdgeAndCircleContact.Destroy = function (contact, allocator) {}
- b2EdgeAndCircleContact.prototype.Reset = function (fixtureA, fixtureB) {
- this.__super.Reset.call(this, fixtureA, fixtureB);
- }
- b2EdgeAndCircleContact.prototype.Evaluate = function () {
- var bA = this.m_fixtureA.GetBody();
- var bB = this.m_fixtureB.GetBody();
- this.b2CollideEdgeAndCircle(this.m_manifold, (this.m_fixtureA.GetShape() instanceof b2EdgeShape ? this.m_fixtureA.GetShape() : null), bA.m_xf, (this.m_fixtureB.GetShape() instanceof b2CircleShape ? this.m_fixtureB.GetShape() : null), bB.m_xf);
- }
- b2EdgeAndCircleContact.prototype.b2CollideEdgeAndCircle = function (manifold, edge, xf1, circle, xf2) {}
- Box2D.inherit(b2NullContact, Box2D.Dynamics.Contacts.b2Contact);
- b2NullContact.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype;
- b2NullContact.b2NullContact = function () {
- Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
- };
- b2NullContact.prototype.b2NullContact = function () {
- this.__super.b2Contact.call(this);
- }
- b2NullContact.prototype.Evaluate = function () {}
- Box2D.inherit(b2PolyAndCircleContact, Box2D.Dynamics.Contacts.b2Contact);
- b2PolyAndCircleContact.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype;
- b2PolyAndCircleContact.b2PolyAndCircleContact = function () {
- Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
- };
- b2PolyAndCircleContact.Create = function (allocator) {
- return new b2PolyAndCircleContact();
- }
- b2PolyAndCircleContact.Destroy = function (contact, allocator) {}
- b2PolyAndCircleContact.prototype.Reset = function (fixtureA, fixtureB) {
- this.__super.Reset.call(this, fixtureA, fixtureB);
- b2Settings.b2Assert(fixtureA.GetType() == b2Shape.e_polygonShape);
- b2Settings.b2Assert(fixtureB.GetType() == b2Shape.e_circleShape);
- }
- b2PolyAndCircleContact.prototype.Evaluate = function () {
- var bA = this.m_fixtureA.m_body;
- var bB = this.m_fixtureB.m_body;
- b2Collision.CollidePolygonAndCircle(this.m_manifold, (this.m_fixtureA.GetShape() instanceof b2PolygonShape ? this.m_fixtureA.GetShape() : null), bA.m_xf, (this.m_fixtureB.GetShape() instanceof b2CircleShape ? this.m_fixtureB.GetShape() : null), bB.m_xf);
- }
- Box2D.inherit(b2PolyAndEdgeContact, Box2D.Dynamics.Contacts.b2Contact);
- b2PolyAndEdgeContact.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype;
- b2PolyAndEdgeContact.b2PolyAndEdgeContact = function () {
- Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
- };
- b2PolyAndEdgeContact.Create = function (allocator) {
- return new b2PolyAndEdgeContact();
- }
- b2PolyAndEdgeContact.Destroy = function (contact, allocator) {}
- b2PolyAndEdgeContact.prototype.Reset = function (fixtureA, fixtureB) {
- this.__super.Reset.call(this, fixtureA, fixtureB);
- b2Settings.b2Assert(fixtureA.GetType() == b2Shape.e_polygonShape);
- b2Settings.b2Assert(fixtureB.GetType() == b2Shape.e_edgeShape);
- }
- b2PolyAndEdgeContact.prototype.Evaluate = function () {
- var bA = this.m_fixtureA.GetBody();
- var bB = this.m_fixtureB.GetBody();
- this.b2CollidePolyAndEdge(this.m_manifold, (this.m_fixtureA.GetShape() instanceof b2PolygonShape ? this.m_fixtureA.GetShape() : null), bA.m_xf, (this.m_fixtureB.GetShape() instanceof b2EdgeShape ? this.m_fixtureB.GetShape() : null), bB.m_xf);
- }
- b2PolyAndEdgeContact.prototype.b2CollidePolyAndEdge = function (manifold, polygon, xf1, edge, xf2) {}
- Box2D.inherit(b2PolygonContact, Box2D.Dynamics.Contacts.b2Contact);
- b2PolygonContact.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype;
- b2PolygonContact.b2PolygonContact = function () {
- Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
- };
- b2PolygonContact.Create = function (allocator) {
- return new b2PolygonContact();
- }
- b2PolygonContact.Destroy = function (contact, allocator) {}
- b2PolygonContact.prototype.Reset = function (fixtureA, fixtureB) {
- this.__super.Reset.call(this, fixtureA, fixtureB);
- }
- b2PolygonContact.prototype.Evaluate = function () {
- var bA = this.m_fixtureA.GetBody();
- var bB = this.m_fixtureB.GetBody();
- b2Collision.CollidePolygons(this.m_manifold, (this.m_fixtureA.GetShape() instanceof b2PolygonShape ? this.m_fixtureA.GetShape() : null), bA.m_xf, (this.m_fixtureB.GetShape() instanceof b2PolygonShape ? this.m_fixtureB.GetShape() : null), bB.m_xf);
- }
- b2PositionSolverManifold.b2PositionSolverManifold = function () {};
- b2PositionSolverManifold.prototype.b2PositionSolverManifold = function () {
- this.m_normal = new b2Vec2();
- this.m_separations = new Vector_a2j_Number(b2Settings.b2_maxManifoldPoints);
- this.m_points = new Vector(b2Settings.b2_maxManifoldPoints);
- for (var i = 0; i < b2Settings.b2_maxManifoldPoints; i++) {
- this.m_points[i] = new b2Vec2();
- }
- }
- b2PositionSolverManifold.prototype.Initialize = function (cc) {
- b2Settings.b2Assert(cc.pointCount > 0);
- var i = 0;
- var clipPointX = 0;
- var clipPointY = 0;
- var tMat;
- var tVec;
- var planePointX = 0;
- var planePointY = 0;
- switch (cc.type) {
- case b2Manifold.e_circles:
- {
- tMat = cc.bodyA.m_xf.R;
- tVec = cc.localPoint;
- var pointAX = cc.bodyA.m_xf.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var pointAY = cc.bodyA.m_xf.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tMat = cc.bodyB.m_xf.R;
- tVec = cc.points[0].localPoint;
- var pointBX = cc.bodyB.m_xf.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- var pointBY = cc.bodyB.m_xf.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- var dX = pointBX - pointAX;
- var dY = pointBY - pointAY;
- var d2 = dX * dX + dY * dY;
- if (d2 > Number.MIN_VALUE * Number.MIN_VALUE) {
- var d = Math.sqrt(d2);
- this.m_normal.x = dX / d;
- this.m_normal.y = dY / d;
- }
- else {
- this.m_normal.x = 1.0;
- this.m_normal.y = 0.0;
- }
- this.m_points[0].x = 0.5 * (pointAX + pointBX);
- this.m_points[0].y = 0.5 * (pointAY + pointBY);
- this.m_separations[0] = dX * this.m_normal.x + dY * this.m_normal.y - cc.radius;
- }
- break;
- case b2Manifold.e_faceA:
- {
- tMat = cc.bodyA.m_xf.R;
- tVec = cc.localPlaneNormal;
- this.m_normal.x = tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- this.m_normal.y = tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tMat = cc.bodyA.m_xf.R;
- tVec = cc.localPoint;
- planePointX = cc.bodyA.m_xf.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- planePointY = cc.bodyA.m_xf.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tMat = cc.bodyB.m_xf.R;
- for (i = 0;
- i < cc.pointCount; ++i) {
- tVec = cc.points[i].localPoint;
- clipPointX = cc.bodyB.m_xf.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- clipPointY = cc.bodyB.m_xf.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- this.m_separations[i] = (clipPointX - planePointX) * this.m_normal.x + (clipPointY - planePointY) * this.m_normal.y - cc.radius;
- this.m_points[i].x = clipPointX;
- this.m_points[i].y = clipPointY;
- }
- }
- break;
- case b2Manifold.e_faceB:
- {
- tMat = cc.bodyB.m_xf.R;
- tVec = cc.localPlaneNormal;
- this.m_normal.x = tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- this.m_normal.y = tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tMat = cc.bodyB.m_xf.R;
- tVec = cc.localPoint;
- planePointX = cc.bodyB.m_xf.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- planePointY = cc.bodyB.m_xf.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- tMat = cc.bodyA.m_xf.R;
- for (i = 0;
- i < cc.pointCount; ++i) {
- tVec = cc.points[i].localPoint;
- clipPointX = cc.bodyA.m_xf.position.x + (tMat.col1.x * tVec.x + tMat.col2.x * tVec.y);
- clipPointY = cc.bodyA.m_xf.position.y + (tMat.col1.y * tVec.x + tMat.col2.y * tVec.y);
- this.m_separations[i] = (clipPointX - planePointX) * this.m_normal.x + (clipPointY - planePointY) * this.m_normal.y - cc.radius;
- this.m_points[i].Set(clipPointX, clipPointY);
- }
- this.m_normal.x *= (-1);
- this.m_normal.y *= (-1);
- }
- break;
- }
- }
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.Contacts.b2PositionSolverManifold.circlePointA = new b2Vec2();
- Box2D.Dynamics.Contacts.b2PositionSolverManifold.circlePointB = new b2Vec2();
- });
-})();
-(function () {
- var b2Body = Box2D.Dynamics.b2Body,
- b2BodyDef = Box2D.Dynamics.b2BodyDef,
- b2ContactFilter = Box2D.Dynamics.b2ContactFilter,
- b2ContactImpulse = Box2D.Dynamics.b2ContactImpulse,
- b2ContactListener = Box2D.Dynamics.b2ContactListener,
- b2ContactManager = Box2D.Dynamics.b2ContactManager,
- b2DebugDraw = Box2D.Dynamics.b2DebugDraw,
- b2DestructionListener = Box2D.Dynamics.b2DestructionListener,
- b2FilterData = Box2D.Dynamics.b2FilterData,
- b2Fixture = Box2D.Dynamics.b2Fixture,
- b2FixtureDef = Box2D.Dynamics.b2FixtureDef,
- b2Island = Box2D.Dynamics.b2Island,
- b2TimeStep = Box2D.Dynamics.b2TimeStep,
- b2World = Box2D.Dynamics.b2World,
- b2Mat22 = Box2D.Common.Math.b2Mat22,
- b2Mat33 = Box2D.Common.Math.b2Mat33,
- b2Math = Box2D.Common.Math.b2Math,
- b2Sweep = Box2D.Common.Math.b2Sweep,
- b2Transform = Box2D.Common.Math.b2Transform,
- b2Vec2 = Box2D.Common.Math.b2Vec2,
- b2Vec3 = Box2D.Common.Math.b2Vec3,
- b2Color = Box2D.Common.b2Color,
- b2internal = Box2D.Common.b2internal,
- b2Settings = Box2D.Common.b2Settings,
- b2CircleShape = Box2D.Collision.Shapes.b2CircleShape,
- b2EdgeChainDef = Box2D.Collision.Shapes.b2EdgeChainDef,
- b2EdgeShape = Box2D.Collision.Shapes.b2EdgeShape,
- b2MassData = Box2D.Collision.Shapes.b2MassData,
- b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape,
- b2Shape = Box2D.Collision.Shapes.b2Shape,
- b2BuoyancyController = Box2D.Dynamics.Controllers.b2BuoyancyController,
- b2ConstantAccelController = Box2D.Dynamics.Controllers.b2ConstantAccelController,
- b2ConstantForceController = Box2D.Dynamics.Controllers.b2ConstantForceController,
- b2Controller = Box2D.Dynamics.Controllers.b2Controller,
- b2ControllerEdge = Box2D.Dynamics.Controllers.b2ControllerEdge,
- b2GravityController = Box2D.Dynamics.Controllers.b2GravityController,
- b2TensorDampingController = Box2D.Dynamics.Controllers.b2TensorDampingController;
-
- Box2D.inherit(b2BuoyancyController, Box2D.Dynamics.Controllers.b2Controller);
- b2BuoyancyController.prototype.__super = Box2D.Dynamics.Controllers.b2Controller.prototype;
- b2BuoyancyController.b2BuoyancyController = function () {
- Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this, arguments);
- this.normal = new b2Vec2(0, (-1));
- this.offset = 0;
- this.density = 0;
- this.velocity = new b2Vec2(0, 0);
- this.linearDrag = 2;
- this.angularDrag = 1;
- this.useDensity = false;
- this.useWorldGravity = true;
- this.gravity = null;
- };
- b2BuoyancyController.prototype.Step = function (step) {
- if (!this.m_bodyList) return;
- if (this.useWorldGravity) {
- this.gravity = this.GetWorld().GetGravity().Copy();
- }
- for (var i = this.m_bodyList; i; i = i.nextBody) {
- var body = i.body;
- if (body.IsAwake() == false) {
- continue;
- }
- var areac = new b2Vec2();
- var massc = new b2Vec2();
- var area = 0.0;
- var mass = 0.0;
- for (var fixture = body.GetFixtureList(); fixture; fixture = fixture.GetNext()) {
- var sc = new b2Vec2();
- var sarea = fixture.GetShape().ComputeSubmergedArea(this.normal, this.offset, body.GetTransform(), sc);
- area += sarea;
- areac.x += sarea * sc.x;
- areac.y += sarea * sc.y;
- var shapeDensity = 0;
- if (this.useDensity) {
- shapeDensity = 1;
- }
- else {
- shapeDensity = 1;
- }
- mass += sarea * shapeDensity;
- massc.x += sarea * sc.x * shapeDensity;
- massc.y += sarea * sc.y * shapeDensity;
- }
- areac.x /= area;
- areac.y /= area;
- massc.x /= mass;
- massc.y /= mass;
- if (area < Number.MIN_VALUE) continue;
- var buoyancyForce = this.gravity.GetNegative();
- buoyancyForce.Multiply(this.density * area);
- body.ApplyForce(buoyancyForce, massc);
- var dragForce = body.GetLinearVelocityFromWorldPoint(areac);
- dragForce.Subtract(this.velocity);
- dragForce.Multiply((-this.linearDrag * area));
- body.ApplyForce(dragForce, areac);
- body.ApplyTorque((-body.GetInertia() / body.GetMass() * area * body.GetAngularVelocity() * this.angularDrag));
- }
- }
- b2BuoyancyController.prototype.Draw = function (debugDraw) {
- var r = 1000;
- var p1 = new b2Vec2();
- var p2 = new b2Vec2();
- p1.x = this.normal.x * this.offset + this.normal.y * r;
- p1.y = this.normal.y * this.offset - this.normal.x * r;
- p2.x = this.normal.x * this.offset - this.normal.y * r;
- p2.y = this.normal.y * this.offset + this.normal.x * r;
- var color = new b2Color(0, 0, 1);
- debugDraw.DrawSegment(p1, p2, color);
- }
- Box2D.inherit(b2ConstantAccelController, Box2D.Dynamics.Controllers.b2Controller);
- b2ConstantAccelController.prototype.__super = Box2D.Dynamics.Controllers.b2Controller.prototype;
- b2ConstantAccelController.b2ConstantAccelController = function () {
- Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this, arguments);
- this.A = new b2Vec2(0, 0);
- };
- b2ConstantAccelController.prototype.Step = function (step) {
- var smallA = new b2Vec2(this.A.x * step.dt, this.A.y * step.dt);
- for (var i = this.m_bodyList; i; i = i.nextBody) {
- var body = i.body;
- if (!body.IsAwake()) continue;
- body.SetLinearVelocity(new b2Vec2(body.GetLinearVelocity().x + smallA.x, body.GetLinearVelocity().y + smallA.y));
- }
- }
- Box2D.inherit(b2ConstantForceController, Box2D.Dynamics.Controllers.b2Controller);
- b2ConstantForceController.prototype.__super = Box2D.Dynamics.Controllers.b2Controller.prototype;
- b2ConstantForceController.b2ConstantForceController = function () {
- Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this, arguments);
- this.F = new b2Vec2(0, 0);
- };
- b2ConstantForceController.prototype.Step = function (step) {
- for (var i = this.m_bodyList; i; i = i.nextBody) {
- var body = i.body;
- if (!body.IsAwake()) continue;
- body.ApplyForce(this.F, body.GetWorldCenter());
- }
- }
- b2Controller.b2Controller = function () {};
- b2Controller.prototype.Step = function (step) {}
- b2Controller.prototype.Draw = function (debugDraw) {}
- b2Controller.prototype.AddBody = function (body) {
- var edge = new b2ControllerEdge();
- edge.controller = this;
- edge.body = body;
- edge.nextBody = this.m_bodyList;
- edge.prevBody = null;
- this.m_bodyList = edge;
- if (edge.nextBody) edge.nextBody.prevBody = edge;
- this.m_bodyCount++;
- edge.nextController = body.m_controllerList;
- edge.prevController = null;
- body.m_controllerList = edge;
- if (edge.nextController) edge.nextController.prevController = edge;
- body.m_controllerCount++;
- }
- b2Controller.prototype.RemoveBody = function (body) {
- var edge = body.m_controllerList;
- while (edge && edge.controller != this)
- edge = edge.nextController;
- if (edge.prevBody) edge.prevBody.nextBody = edge.nextBody;
- if (edge.nextBody) edge.nextBody.prevBody = edge.prevBody;
- if (edge.nextController) edge.nextController.prevController = edge.prevController;
- if (edge.prevController) edge.prevController.nextController = edge.nextController;
- if (this.m_bodyList == edge) this.m_bodyList = edge.nextBody;
- if (body.m_controllerList == edge) body.m_controllerList = edge.nextController;
- body.m_controllerCount--;
- this.m_bodyCount--;
- }
- b2Controller.prototype.Clear = function () {
- while (this.m_bodyList)
- this.RemoveBody(this.m_bodyList.body);
- }
- b2Controller.prototype.GetNext = function () {
- return this.m_next;
- }
- b2Controller.prototype.GetWorld = function () {
- return this.m_world;
- }
- b2Controller.prototype.GetBodyList = function () {
- return this.m_bodyList;
- }
- b2ControllerEdge.b2ControllerEdge = function () {};
- Box2D.inherit(b2GravityController, Box2D.Dynamics.Controllers.b2Controller);
- b2GravityController.prototype.__super = Box2D.Dynamics.Controllers.b2Controller.prototype;
- b2GravityController.b2GravityController = function () {
- Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this, arguments);
- this.G = 1;
- this.invSqr = true;
- };
- b2GravityController.prototype.Step = function (step) {
- var i = null;
- var body1 = null;
- var p1 = null;
- var mass1 = 0;
- var j = null;
- var body2 = null;
- var p2 = null;
- var dx = 0;
- var dy = 0;
- var r2 = 0;
- var f = null;
- if (this.invSqr) {
- for (i = this.m_bodyList;
- i; i = i.nextBody) {
- body1 = i.body;
- p1 = body1.GetWorldCenter();
- mass1 = body1.GetMass();
- for (j = this.m_bodyList;
- j != i; j = j.nextBody) {
- body2 = j.body;
- p2 = body2.GetWorldCenter();
- dx = p2.x - p1.x;
- dy = p2.y - p1.y;
- r2 = dx * dx + dy * dy;
- if (r2 < Number.MIN_VALUE) continue;
- f = new b2Vec2(dx, dy);
- f.Multiply(this.G / r2 / Math.sqrt(r2) * mass1 * body2.GetMass());
- if (body1.IsAwake()) body1.ApplyForce(f, p1);
- f.Multiply((-1));
- if (body2.IsAwake()) body2.ApplyForce(f, p2);
- }
- }
- }
- else {
- for (i = this.m_bodyList;
- i; i = i.nextBody) {
- body1 = i.body;
- p1 = body1.GetWorldCenter();
- mass1 = body1.GetMass();
- for (j = this.m_bodyList;
- j != i; j = j.nextBody) {
- body2 = j.body;
- p2 = body2.GetWorldCenter();
- dx = p2.x - p1.x;
- dy = p2.y - p1.y;
- r2 = dx * dx + dy * dy;
- if (r2 < Number.MIN_VALUE) continue;
- f = new b2Vec2(dx, dy);
- f.Multiply(this.G / r2 * mass1 * body2.GetMass());
- if (body1.IsAwake()) body1.ApplyForce(f, p1);
- f.Multiply((-1));
- if (body2.IsAwake()) body2.ApplyForce(f, p2);
- }
- }
- }
- }
- Box2D.inherit(b2TensorDampingController, Box2D.Dynamics.Controllers.b2Controller);
- b2TensorDampingController.prototype.__super = Box2D.Dynamics.Controllers.b2Controller.prototype;
- b2TensorDampingController.b2TensorDampingController = function () {
- Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this, arguments);
- this.T = new b2Mat22();
- this.maxTimestep = 0;
- };
- b2TensorDampingController.prototype.SetAxisAligned = function (xDamping, yDamping) {
- if (xDamping === undefined) xDamping = 0;
- if (yDamping === undefined) yDamping = 0;
- this.T.col1.x = (-xDamping);
- this.T.col1.y = 0;
- this.T.col2.x = 0;
- this.T.col2.y = (-yDamping);
- if (xDamping > 0 || yDamping > 0) {
- this.maxTimestep = 1 / Math.max(xDamping, yDamping);
- }
- else {
- this.maxTimestep = 0;
- }
- }
- b2TensorDampingController.prototype.Step = function (step) {
- var timestep = step.dt;
- if (timestep <= Number.MIN_VALUE) return;
- if (timestep > this.maxTimestep && this.maxTimestep > 0) timestep = this.maxTimestep;
- for (var i = this.m_bodyList; i; i = i.nextBody) {
- var body = i.body;
- if (!body.IsAwake()) {
- continue;
- }
- var damping = body.GetWorldVector(b2Math.MulMV(this.T, body.GetLocalVector(body.GetLinearVelocity())));
- body.SetLinearVelocity(new b2Vec2(body.GetLinearVelocity().x + damping.x * timestep, body.GetLinearVelocity().y + damping.y * timestep));
- }
- }
-})();
-(function () {
- var b2Color = Box2D.Common.b2Color,
- b2internal = Box2D.Common.b2internal,
- b2Settings = Box2D.Common.b2Settings,
- b2Mat22 = Box2D.Common.Math.b2Mat22,
- b2Mat33 = Box2D.Common.Math.b2Mat33,
- b2Math = Box2D.Common.Math.b2Math,
- b2Sweep = Box2D.Common.Math.b2Sweep,
- b2Transform = Box2D.Common.Math.b2Transform,
- b2Vec2 = Box2D.Common.Math.b2Vec2,
- b2Vec3 = Box2D.Common.Math.b2Vec3,
- b2DistanceJoint = Box2D.Dynamics.Joints.b2DistanceJoint,
- b2DistanceJointDef = Box2D.Dynamics.Joints.b2DistanceJointDef,
- b2FrictionJoint = Box2D.Dynamics.Joints.b2FrictionJoint,
- b2FrictionJointDef = Box2D.Dynamics.Joints.b2FrictionJointDef,
- b2GearJoint = Box2D.Dynamics.Joints.b2GearJoint,
- b2GearJointDef = Box2D.Dynamics.Joints.b2GearJointDef,
- b2Jacobian = Box2D.Dynamics.Joints.b2Jacobian,
- b2Joint = Box2D.Dynamics.Joints.b2Joint,
- b2JointDef = Box2D.Dynamics.Joints.b2JointDef,
- b2JointEdge = Box2D.Dynamics.Joints.b2JointEdge,
- b2LineJoint = Box2D.Dynamics.Joints.b2LineJoint,
- b2LineJointDef = Box2D.Dynamics.Joints.b2LineJointDef,
- b2MouseJoint = Box2D.Dynamics.Joints.b2MouseJoint,
- b2MouseJointDef = Box2D.Dynamics.Joints.b2MouseJointDef,
- b2PrismaticJoint = Box2D.Dynamics.Joints.b2PrismaticJoint,
- b2PrismaticJointDef = Box2D.Dynamics.Joints.b2PrismaticJointDef,
- b2PulleyJoint = Box2D.Dynamics.Joints.b2PulleyJoint,
- b2PulleyJointDef = Box2D.Dynamics.Joints.b2PulleyJointDef,
- b2RevoluteJoint = Box2D.Dynamics.Joints.b2RevoluteJoint,
- b2RevoluteJointDef = Box2D.Dynamics.Joints.b2RevoluteJointDef,
- b2WeldJoint = Box2D.Dynamics.Joints.b2WeldJoint,
- b2WeldJointDef = Box2D.Dynamics.Joints.b2WeldJointDef,
- b2Body = Box2D.Dynamics.b2Body,
- b2BodyDef = Box2D.Dynamics.b2BodyDef,
- b2ContactFilter = Box2D.Dynamics.b2ContactFilter,
- b2ContactImpulse = Box2D.Dynamics.b2ContactImpulse,
- b2ContactListener = Box2D.Dynamics.b2ContactListener,
- b2ContactManager = Box2D.Dynamics.b2ContactManager,
- b2DebugDraw = Box2D.Dynamics.b2DebugDraw,
- b2DestructionListener = Box2D.Dynamics.b2DestructionListener,
- b2FilterData = Box2D.Dynamics.b2FilterData,
- b2Fixture = Box2D.Dynamics.b2Fixture,
- b2FixtureDef = Box2D.Dynamics.b2FixtureDef,
- b2Island = Box2D.Dynamics.b2Island,
- b2TimeStep = Box2D.Dynamics.b2TimeStep,
- b2World = Box2D.Dynamics.b2World;
-
- Box2D.inherit(b2DistanceJoint, Box2D.Dynamics.Joints.b2Joint);
- b2DistanceJoint.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype;
- b2DistanceJoint.b2DistanceJoint = function () {
- Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);
- this.m_localAnchor1 = new b2Vec2();
- this.m_localAnchor2 = new b2Vec2();
- this.m_u = new b2Vec2();
- };
- b2DistanceJoint.prototype.GetAnchorA = function () {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
- }
- b2DistanceJoint.prototype.GetAnchorB = function () {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
- }
- b2DistanceJoint.prototype.GetReactionForce = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return new b2Vec2(inv_dt * this.m_impulse * this.m_u.x, inv_dt * this.m_impulse * this.m_u.y);
- }
- b2DistanceJoint.prototype.GetReactionTorque = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return 0.0;
- }
- b2DistanceJoint.prototype.GetLength = function () {
- return this.m_length;
- }
- b2DistanceJoint.prototype.SetLength = function (length) {
- if (length === undefined) length = 0;
- this.m_length = length;
- }
- b2DistanceJoint.prototype.GetFrequency = function () {
- return this.m_frequencyHz;
- }
- b2DistanceJoint.prototype.SetFrequency = function (hz) {
- if (hz === undefined) hz = 0;
- this.m_frequencyHz = hz;
- }
- b2DistanceJoint.prototype.GetDampingRatio = function () {
- return this.m_dampingRatio;
- }
- b2DistanceJoint.prototype.SetDampingRatio = function (ratio) {
- if (ratio === undefined) ratio = 0;
- this.m_dampingRatio = ratio;
- }
- b2DistanceJoint.prototype.b2DistanceJoint = function (def) {
- this.__super.b2Joint.call(this, def);
- var tMat;
- var tX = 0;
- var tY = 0;
- this.m_localAnchor1.SetV(def.localAnchorA);
- this.m_localAnchor2.SetV(def.localAnchorB);
- this.m_length = def.length;
- this.m_frequencyHz = def.frequencyHz;
- this.m_dampingRatio = def.dampingRatio;
- this.m_impulse = 0.0;
- this.m_gamma = 0.0;
- this.m_bias = 0.0;
- }
- b2DistanceJoint.prototype.InitVelocityConstraints = function (step) {
- var tMat;
- var tX = 0;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- var r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- var r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- this.m_u.x = bB.m_sweep.c.x + r2X - bA.m_sweep.c.x - r1X;
- this.m_u.y = bB.m_sweep.c.y + r2Y - bA.m_sweep.c.y - r1Y;
- var length = Math.sqrt(this.m_u.x * this.m_u.x + this.m_u.y * this.m_u.y);
- if (length > b2Settings.b2_linearSlop) {
- this.m_u.Multiply(1.0 / length);
- }
- else {
- this.m_u.SetZero();
- }
- var cr1u = (r1X * this.m_u.y - r1Y * this.m_u.x);
- var cr2u = (r2X * this.m_u.y - r2Y * this.m_u.x);
- var invMass = bA.m_invMass + bA.m_invI * cr1u * cr1u + bB.m_invMass + bB.m_invI * cr2u * cr2u;
- this.m_mass = invMass != 0.0 ? 1.0 / invMass : 0.0;
- if (this.m_frequencyHz > 0.0) {
- var C = length - this.m_length;
- var omega = 2.0 * Math.PI * this.m_frequencyHz;
- var d = 2.0 * this.m_mass * this.m_dampingRatio * omega;
- var k = this.m_mass * omega * omega;
- this.m_gamma = step.dt * (d + step.dt * k);
- this.m_gamma = this.m_gamma != 0.0 ? 1 / this.m_gamma : 0.0;
- this.m_bias = C * step.dt * k * this.m_gamma;
- this.m_mass = invMass + this.m_gamma;
- this.m_mass = this.m_mass != 0.0 ? 1.0 / this.m_mass : 0.0;
- }
- if (step.warmStarting) {
- this.m_impulse *= step.dtRatio;
- var PX = this.m_impulse * this.m_u.x;
- var PY = this.m_impulse * this.m_u.y;
- bA.m_linearVelocity.x -= bA.m_invMass * PX;
- bA.m_linearVelocity.y -= bA.m_invMass * PY;
- bA.m_angularVelocity -= bA.m_invI * (r1X * PY - r1Y * PX);
- bB.m_linearVelocity.x += bB.m_invMass * PX;
- bB.m_linearVelocity.y += bB.m_invMass * PY;
- bB.m_angularVelocity += bB.m_invI * (r2X * PY - r2Y * PX);
- }
- else {
- this.m_impulse = 0.0;
- }
- }
- b2DistanceJoint.prototype.SolveVelocityConstraints = function (step) {
- var tMat;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- var r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- var tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- var r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var v1X = bA.m_linearVelocity.x + ((-bA.m_angularVelocity * r1Y));
- var v1Y = bA.m_linearVelocity.y + (bA.m_angularVelocity * r1X);
- var v2X = bB.m_linearVelocity.x + ((-bB.m_angularVelocity * r2Y));
- var v2Y = bB.m_linearVelocity.y + (bB.m_angularVelocity * r2X);
- var Cdot = (this.m_u.x * (v2X - v1X) + this.m_u.y * (v2Y - v1Y));
- var impulse = (-this.m_mass * (Cdot + this.m_bias + this.m_gamma * this.m_impulse));
- this.m_impulse += impulse;
- var PX = impulse * this.m_u.x;
- var PY = impulse * this.m_u.y;
- bA.m_linearVelocity.x -= bA.m_invMass * PX;
- bA.m_linearVelocity.y -= bA.m_invMass * PY;
- bA.m_angularVelocity -= bA.m_invI * (r1X * PY - r1Y * PX);
- bB.m_linearVelocity.x += bB.m_invMass * PX;
- bB.m_linearVelocity.y += bB.m_invMass * PY;
- bB.m_angularVelocity += bB.m_invI * (r2X * PY - r2Y * PX);
- }
- b2DistanceJoint.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- var tMat;
- if (this.m_frequencyHz > 0.0) {
- return true;
- }
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- var r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- var tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- var r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var dX = bB.m_sweep.c.x + r2X - bA.m_sweep.c.x - r1X;
- var dY = bB.m_sweep.c.y + r2Y - bA.m_sweep.c.y - r1Y;
- var length = Math.sqrt(dX * dX + dY * dY);
- dX /= length;
- dY /= length;
- var C = length - this.m_length;
- C = b2Math.Clamp(C, (-b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
- var impulse = (-this.m_mass * C);
- this.m_u.Set(dX, dY);
- var PX = impulse * this.m_u.x;
- var PY = impulse * this.m_u.y;
- bA.m_sweep.c.x -= bA.m_invMass * PX;
- bA.m_sweep.c.y -= bA.m_invMass * PY;
- bA.m_sweep.a -= bA.m_invI * (r1X * PY - r1Y * PX);
- bB.m_sweep.c.x += bB.m_invMass * PX;
- bB.m_sweep.c.y += bB.m_invMass * PY;
- bB.m_sweep.a += bB.m_invI * (r2X * PY - r2Y * PX);
- bA.SynchronizeTransform();
- bB.SynchronizeTransform();
- return b2Math.Abs(C) < b2Settings.b2_linearSlop;
- }
- Box2D.inherit(b2DistanceJointDef, Box2D.Dynamics.Joints.b2JointDef);
- b2DistanceJointDef.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype;
- b2DistanceJointDef.b2DistanceJointDef = function () {
- Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);
- this.localAnchorA = new b2Vec2();
- this.localAnchorB = new b2Vec2();
- };
- b2DistanceJointDef.prototype.b2DistanceJointDef = function () {
- this.__super.b2JointDef.call(this);
- this.type = b2Joint.e_distanceJoint;
- this.length = 1.0;
- this.frequencyHz = 0.0;
- this.dampingRatio = 0.0;
- }
- b2DistanceJointDef.prototype.Initialize = function (bA, bB, anchorA, anchorB) {
- this.bodyA = bA;
- this.bodyB = bB;
- this.localAnchorA.SetV(this.bodyA.GetLocalPoint(anchorA));
- this.localAnchorB.SetV(this.bodyB.GetLocalPoint(anchorB));
- var dX = anchorB.x - anchorA.x;
- var dY = anchorB.y - anchorA.y;
- this.length = Math.sqrt(dX * dX + dY * dY);
- this.frequencyHz = 0.0;
- this.dampingRatio = 0.0;
- }
- Box2D.inherit(b2FrictionJoint, Box2D.Dynamics.Joints.b2Joint);
- b2FrictionJoint.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype;
- b2FrictionJoint.b2FrictionJoint = function () {
- Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);
- this.m_localAnchorA = new b2Vec2();
- this.m_localAnchorB = new b2Vec2();
- this.m_linearMass = new b2Mat22();
- this.m_linearImpulse = new b2Vec2();
- };
- b2FrictionJoint.prototype.GetAnchorA = function () {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA);
- }
- b2FrictionJoint.prototype.GetAnchorB = function () {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB);
- }
- b2FrictionJoint.prototype.GetReactionForce = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return new b2Vec2(inv_dt * this.m_linearImpulse.x, inv_dt * this.m_linearImpulse.y);
- }
- b2FrictionJoint.prototype.GetReactionTorque = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return inv_dt * this.m_angularImpulse;
- }
- b2FrictionJoint.prototype.SetMaxForce = function (force) {
- if (force === undefined) force = 0;
- this.m_maxForce = force;
- }
- b2FrictionJoint.prototype.GetMaxForce = function () {
- return this.m_maxForce;
- }
- b2FrictionJoint.prototype.SetMaxTorque = function (torque) {
- if (torque === undefined) torque = 0;
- this.m_maxTorque = torque;
- }
- b2FrictionJoint.prototype.GetMaxTorque = function () {
- return this.m_maxTorque;
- }
- b2FrictionJoint.prototype.b2FrictionJoint = function (def) {
- this.__super.b2Joint.call(this, def);
- this.m_localAnchorA.SetV(def.localAnchorA);
- this.m_localAnchorB.SetV(def.localAnchorB);
- this.m_linearMass.SetZero();
- this.m_angularMass = 0.0;
- this.m_linearImpulse.SetZero();
- this.m_angularImpulse = 0.0;
- this.m_maxForce = def.maxForce;
- this.m_maxTorque = def.maxTorque;
- }
- b2FrictionJoint.prototype.InitVelocityConstraints = function (step) {
- var tMat;
- var tX = 0;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- tMat = bA.m_xf.R;
- var rAX = this.m_localAnchorA.x - bA.m_sweep.localCenter.x;
- var rAY = this.m_localAnchorA.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rAX + tMat.col2.x * rAY);
- rAY = (tMat.col1.y * rAX + tMat.col2.y * rAY);
- rAX = tX;
- tMat = bB.m_xf.R;
- var rBX = this.m_localAnchorB.x - bB.m_sweep.localCenter.x;
- var rBY = this.m_localAnchorB.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rBX + tMat.col2.x * rBY);
- rBY = (tMat.col1.y * rBX + tMat.col2.y * rBY);
- rBX = tX;
- var mA = bA.m_invMass;
- var mB = bB.m_invMass;
- var iA = bA.m_invI;
- var iB = bB.m_invI;
- var K = new b2Mat22();
- K.col1.x = mA + mB;
- K.col2.x = 0.0;
- K.col1.y = 0.0;
- K.col2.y = mA + mB;
- K.col1.x += iA * rAY * rAY;
- K.col2.x += (-iA * rAX * rAY);
- K.col1.y += (-iA * rAX * rAY);
- K.col2.y += iA * rAX * rAX;
- K.col1.x += iB * rBY * rBY;
- K.col2.x += (-iB * rBX * rBY);
- K.col1.y += (-iB * rBX * rBY);
- K.col2.y += iB * rBX * rBX;
- K.GetInverse(this.m_linearMass);
- this.m_angularMass = iA + iB;
- if (this.m_angularMass > 0.0) {
- this.m_angularMass = 1.0 / this.m_angularMass;
- }
- if (step.warmStarting) {
- this.m_linearImpulse.x *= step.dtRatio;
- this.m_linearImpulse.y *= step.dtRatio;
- this.m_angularImpulse *= step.dtRatio;
- var P = this.m_linearImpulse;
- bA.m_linearVelocity.x -= mA * P.x;
- bA.m_linearVelocity.y -= mA * P.y;
- bA.m_angularVelocity -= iA * (rAX * P.y - rAY * P.x + this.m_angularImpulse);
- bB.m_linearVelocity.x += mB * P.x;
- bB.m_linearVelocity.y += mB * P.y;
- bB.m_angularVelocity += iB * (rBX * P.y - rBY * P.x + this.m_angularImpulse);
- }
- else {
- this.m_linearImpulse.SetZero();
- this.m_angularImpulse = 0.0;
- }
- }
- b2FrictionJoint.prototype.SolveVelocityConstraints = function (step) {
- var tMat;
- var tX = 0;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var vA = bA.m_linearVelocity;
- var wA = bA.m_angularVelocity;
- var vB = bB.m_linearVelocity;
- var wB = bB.m_angularVelocity;
- var mA = bA.m_invMass;
- var mB = bB.m_invMass;
- var iA = bA.m_invI;
- var iB = bB.m_invI;
- tMat = bA.m_xf.R;
- var rAX = this.m_localAnchorA.x - bA.m_sweep.localCenter.x;
- var rAY = this.m_localAnchorA.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rAX + tMat.col2.x * rAY);
- rAY = (tMat.col1.y * rAX + tMat.col2.y * rAY);
- rAX = tX;
- tMat = bB.m_xf.R;
- var rBX = this.m_localAnchorB.x - bB.m_sweep.localCenter.x;
- var rBY = this.m_localAnchorB.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rBX + tMat.col2.x * rBY);
- rBY = (tMat.col1.y * rBX + tMat.col2.y * rBY);
- rBX = tX;
- var maxImpulse = 0; {
- var Cdot = wB - wA;
- var impulse = (-this.m_angularMass * Cdot);
- var oldImpulse = this.m_angularImpulse;
- maxImpulse = step.dt * this.m_maxTorque;
- this.m_angularImpulse = b2Math.Clamp(this.m_angularImpulse + impulse, (-maxImpulse), maxImpulse);
- impulse = this.m_angularImpulse - oldImpulse;
- wA -= iA * impulse;
- wB += iB * impulse;
- } {
- var CdotX = vB.x - wB * rBY - vA.x + wA * rAY;
- var CdotY = vB.y + wB * rBX - vA.y - wA * rAX;
- var impulseV = b2Math.MulMV(this.m_linearMass, new b2Vec2((-CdotX), (-CdotY)));
- var oldImpulseV = this.m_linearImpulse.Copy();
- this.m_linearImpulse.Add(impulseV);
- maxImpulse = step.dt * this.m_maxForce;
- if (this.m_linearImpulse.LengthSquared() > maxImpulse * maxImpulse) {
- this.m_linearImpulse.Normalize();
- this.m_linearImpulse.Multiply(maxImpulse);
- }
- impulseV = b2Math.SubtractVV(this.m_linearImpulse, oldImpulseV);
- vA.x -= mA * impulseV.x;
- vA.y -= mA * impulseV.y;
- wA -= iA * (rAX * impulseV.y - rAY * impulseV.x);
- vB.x += mB * impulseV.x;
- vB.y += mB * impulseV.y;
- wB += iB * (rBX * impulseV.y - rBY * impulseV.x);
- }
- bA.m_angularVelocity = wA;
- bB.m_angularVelocity = wB;
- }
- b2FrictionJoint.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- return true;
- }
- Box2D.inherit(b2FrictionJointDef, Box2D.Dynamics.Joints.b2JointDef);
- b2FrictionJointDef.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype;
- b2FrictionJointDef.b2FrictionJointDef = function () {
- Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);
- this.localAnchorA = new b2Vec2();
- this.localAnchorB = new b2Vec2();
- };
- b2FrictionJointDef.prototype.b2FrictionJointDef = function () {
- this.__super.b2JointDef.call(this);
- this.type = b2Joint.e_frictionJoint;
- this.maxForce = 0.0;
- this.maxTorque = 0.0;
- }
- b2FrictionJointDef.prototype.Initialize = function (bA, bB, anchor) {
- this.bodyA = bA;
- this.bodyB = bB;
- this.localAnchorA.SetV(this.bodyA.GetLocalPoint(anchor));
- this.localAnchorB.SetV(this.bodyB.GetLocalPoint(anchor));
- }
- Box2D.inherit(b2GearJoint, Box2D.Dynamics.Joints.b2Joint);
- b2GearJoint.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype;
- b2GearJoint.b2GearJoint = function () {
- Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);
- this.m_groundAnchor1 = new b2Vec2();
- this.m_groundAnchor2 = new b2Vec2();
- this.m_localAnchor1 = new b2Vec2();
- this.m_localAnchor2 = new b2Vec2();
- this.m_J = new b2Jacobian();
- };
- b2GearJoint.prototype.GetAnchorA = function () {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
- }
- b2GearJoint.prototype.GetAnchorB = function () {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
- }
- b2GearJoint.prototype.GetReactionForce = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return new b2Vec2(inv_dt * this.m_impulse * this.m_J.linearB.x, inv_dt * this.m_impulse * this.m_J.linearB.y);
- }
- b2GearJoint.prototype.GetReactionTorque = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- var tMat = this.m_bodyB.m_xf.R;
- var rX = this.m_localAnchor1.x - this.m_bodyB.m_sweep.localCenter.x;
- var rY = this.m_localAnchor1.y - this.m_bodyB.m_sweep.localCenter.y;
- var tX = tMat.col1.x * rX + tMat.col2.x * rY;
- rY = tMat.col1.y * rX + tMat.col2.y * rY;
- rX = tX;
- var PX = this.m_impulse * this.m_J.linearB.x;
- var PY = this.m_impulse * this.m_J.linearB.y;
- return inv_dt * (this.m_impulse * this.m_J.angularB - rX * PY + rY * PX);
- }
- b2GearJoint.prototype.GetRatio = function () {
- return this.m_ratio;
- }
- b2GearJoint.prototype.SetRatio = function (ratio) {
- if (ratio === undefined) ratio = 0;
- this.m_ratio = ratio;
- }
- b2GearJoint.prototype.b2GearJoint = function (def) {
- this.__super.b2Joint.call(this, def);
- var type1 = parseInt(def.joint1.m_type);
- var type2 = parseInt(def.joint2.m_type);
- this.m_revolute1 = null;
- this.m_prismatic1 = null;
- this.m_revolute2 = null;
- this.m_prismatic2 = null;
- var coordinate1 = 0;
- var coordinate2 = 0;
- this.m_ground1 = def.joint1.GetBodyA();
- this.m_bodyA = def.joint1.GetBodyB();
- if (type1 == b2Joint.e_revoluteJoint) {
- this.m_revolute1 = (def.joint1 instanceof b2RevoluteJoint ? def.joint1 : null);
- this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1);
- this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2);
- coordinate1 = this.m_revolute1.GetJointAngle();
- }
- else {
- this.m_prismatic1 = (def.joint1 instanceof b2PrismaticJoint ? def.joint1 : null);
- this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1);
- this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2);
- coordinate1 = this.m_prismatic1.GetJointTranslation();
- }
- this.m_ground2 = def.joint2.GetBodyA();
- this.m_bodyB = def.joint2.GetBodyB();
- if (type2 == b2Joint.e_revoluteJoint) {
- this.m_revolute2 = (def.joint2 instanceof b2RevoluteJoint ? def.joint2 : null);
- this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1);
- this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2);
- coordinate2 = this.m_revolute2.GetJointAngle();
- }
- else {
- this.m_prismatic2 = (def.joint2 instanceof b2PrismaticJoint ? def.joint2 : null);
- this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1);
- this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2);
- coordinate2 = this.m_prismatic2.GetJointTranslation();
- }
- this.m_ratio = def.ratio;
- this.m_constant = coordinate1 + this.m_ratio * coordinate2;
- this.m_impulse = 0.0;
- }
- b2GearJoint.prototype.InitVelocityConstraints = function (step) {
- var g1 = this.m_ground1;
- var g2 = this.m_ground2;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var ugX = 0;
- var ugY = 0;
- var rX = 0;
- var rY = 0;
- var tMat;
- var tVec;
- var crug = 0;
- var tX = 0;
- var K = 0.0;
- this.m_J.SetZero();
- if (this.m_revolute1) {
- this.m_J.angularA = (-1.0);
- K += bA.m_invI;
- }
- else {
- tMat = g1.m_xf.R;
- tVec = this.m_prismatic1.m_localXAxis1;
- ugX = tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- ugY = tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tMat = bA.m_xf.R;
- rX = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- rY = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- tX = tMat.col1.x * rX + tMat.col2.x * rY;
- rY = tMat.col1.y * rX + tMat.col2.y * rY;
- rX = tX;
- crug = rX * ugY - rY * ugX;
- this.m_J.linearA.Set((-ugX), (-ugY));
- this.m_J.angularA = (-crug);
- K += bA.m_invMass + bA.m_invI * crug * crug;
- }
- if (this.m_revolute2) {
- this.m_J.angularB = (-this.m_ratio);
- K += this.m_ratio * this.m_ratio * bB.m_invI;
- }
- else {
- tMat = g2.m_xf.R;
- tVec = this.m_prismatic2.m_localXAxis1;
- ugX = tMat.col1.x * tVec.x + tMat.col2.x * tVec.y;
- ugY = tMat.col1.y * tVec.x + tMat.col2.y * tVec.y;
- tMat = bB.m_xf.R;
- rX = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- rY = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = tMat.col1.x * rX + tMat.col2.x * rY;
- rY = tMat.col1.y * rX + tMat.col2.y * rY;
- rX = tX;
- crug = rX * ugY - rY * ugX;
- this.m_J.linearB.Set((-this.m_ratio * ugX), (-this.m_ratio * ugY));
- this.m_J.angularB = (-this.m_ratio * crug);
- K += this.m_ratio * this.m_ratio * (bB.m_invMass + bB.m_invI * crug * crug);
- }
- this.m_mass = K > 0.0 ? 1.0 / K : 0.0;
- if (step.warmStarting) {
- bA.m_linearVelocity.x += bA.m_invMass * this.m_impulse * this.m_J.linearA.x;
- bA.m_linearVelocity.y += bA.m_invMass * this.m_impulse * this.m_J.linearA.y;
- bA.m_angularVelocity += bA.m_invI * this.m_impulse * this.m_J.angularA;
- bB.m_linearVelocity.x += bB.m_invMass * this.m_impulse * this.m_J.linearB.x;
- bB.m_linearVelocity.y += bB.m_invMass * this.m_impulse * this.m_J.linearB.y;
- bB.m_angularVelocity += bB.m_invI * this.m_impulse * this.m_J.angularB;
- }
- else {
- this.m_impulse = 0.0;
- }
- }
- b2GearJoint.prototype.SolveVelocityConstraints = function (step) {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var Cdot = this.m_J.Compute(bA.m_linearVelocity, bA.m_angularVelocity, bB.m_linearVelocity, bB.m_angularVelocity);
- var impulse = (-this.m_mass * Cdot);
- this.m_impulse += impulse;
- bA.m_linearVelocity.x += bA.m_invMass * impulse * this.m_J.linearA.x;
- bA.m_linearVelocity.y += bA.m_invMass * impulse * this.m_J.linearA.y;
- bA.m_angularVelocity += bA.m_invI * impulse * this.m_J.angularA;
- bB.m_linearVelocity.x += bB.m_invMass * impulse * this.m_J.linearB.x;
- bB.m_linearVelocity.y += bB.m_invMass * impulse * this.m_J.linearB.y;
- bB.m_angularVelocity += bB.m_invI * impulse * this.m_J.angularB;
- }
- b2GearJoint.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- var linearError = 0.0;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var coordinate1 = 0;
- var coordinate2 = 0;
- if (this.m_revolute1) {
- coordinate1 = this.m_revolute1.GetJointAngle();
- }
- else {
- coordinate1 = this.m_prismatic1.GetJointTranslation();
- }
- if (this.m_revolute2) {
- coordinate2 = this.m_revolute2.GetJointAngle();
- }
- else {
- coordinate2 = this.m_prismatic2.GetJointTranslation();
- }
- var C = this.m_constant - (coordinate1 + this.m_ratio * coordinate2);
- var impulse = (-this.m_mass * C);
- bA.m_sweep.c.x += bA.m_invMass * impulse * this.m_J.linearA.x;
- bA.m_sweep.c.y += bA.m_invMass * impulse * this.m_J.linearA.y;
- bA.m_sweep.a += bA.m_invI * impulse * this.m_J.angularA;
- bB.m_sweep.c.x += bB.m_invMass * impulse * this.m_J.linearB.x;
- bB.m_sweep.c.y += bB.m_invMass * impulse * this.m_J.linearB.y;
- bB.m_sweep.a += bB.m_invI * impulse * this.m_J.angularB;
- bA.SynchronizeTransform();
- bB.SynchronizeTransform();
- return linearError < b2Settings.b2_linearSlop;
- }
- Box2D.inherit(b2GearJointDef, Box2D.Dynamics.Joints.b2JointDef);
- b2GearJointDef.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype;
- b2GearJointDef.b2GearJointDef = function () {
- Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);
- };
- b2GearJointDef.prototype.b2GearJointDef = function () {
- this.__super.b2JointDef.call(this);
- this.type = b2Joint.e_gearJoint;
- this.joint1 = null;
- this.joint2 = null;
- this.ratio = 1.0;
- }
- b2Jacobian.b2Jacobian = function () {
- this.linearA = new b2Vec2();
- this.linearB = new b2Vec2();
- };
- b2Jacobian.prototype.SetZero = function () {
- this.linearA.SetZero();
- this.angularA = 0.0;
- this.linearB.SetZero();
- this.angularB = 0.0;
- }
- b2Jacobian.prototype.Set = function (x1, a1, x2, a2) {
- if (a1 === undefined) a1 = 0;
- if (a2 === undefined) a2 = 0;
- this.linearA.SetV(x1);
- this.angularA = a1;
- this.linearB.SetV(x2);
- this.angularB = a2;
- }
- b2Jacobian.prototype.Compute = function (x1, a1, x2, a2) {
- if (a1 === undefined) a1 = 0;
- if (a2 === undefined) a2 = 0;
- return (this.linearA.x * x1.x + this.linearA.y * x1.y) + this.angularA * a1 + (this.linearB.x * x2.x + this.linearB.y * x2.y) + this.angularB * a2;
- }
- b2Joint.b2Joint = function () {
- this.m_edgeA = new b2JointEdge();
- this.m_edgeB = new b2JointEdge();
- this.m_localCenterA = new b2Vec2();
- this.m_localCenterB = new b2Vec2();
- };
- b2Joint.prototype.GetType = function () {
- return this.m_type;
- }
- b2Joint.prototype.GetAnchorA = function () {
- return null;
- }
- b2Joint.prototype.GetAnchorB = function () {
- return null;
- }
- b2Joint.prototype.GetReactionForce = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return null;
- }
- b2Joint.prototype.GetReactionTorque = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return 0.0;
- }
- b2Joint.prototype.GetBodyA = function () {
- return this.m_bodyA;
- }
- b2Joint.prototype.GetBodyB = function () {
- return this.m_bodyB;
- }
- b2Joint.prototype.GetNext = function () {
- return this.m_next;
- }
- b2Joint.prototype.GetUserData = function () {
- return this.m_userData;
- }
- b2Joint.prototype.SetUserData = function (data) {
- this.m_userData = data;
- }
- b2Joint.prototype.IsActive = function () {
- return this.m_bodyA.IsActive() && this.m_bodyB.IsActive();
- }
- b2Joint.Create = function (def, allocator) {
- var joint = null;
- switch (def.type) {
- case b2Joint.e_distanceJoint:
- {
- joint = new b2DistanceJoint((def instanceof b2DistanceJointDef ? def : null));
- }
- break;
- case b2Joint.e_mouseJoint:
- {
- joint = new b2MouseJoint((def instanceof b2MouseJointDef ? def : null));
- }
- break;
- case b2Joint.e_prismaticJoint:
- {
- joint = new b2PrismaticJoint((def instanceof b2PrismaticJointDef ? def : null));
- }
- break;
- case b2Joint.e_revoluteJoint:
- {
- joint = new b2RevoluteJoint((def instanceof b2RevoluteJointDef ? def : null));
- }
- break;
- case b2Joint.e_pulleyJoint:
- {
- joint = new b2PulleyJoint((def instanceof b2PulleyJointDef ? def : null));
- }
- break;
- case b2Joint.e_gearJoint:
- {
- joint = new b2GearJoint((def instanceof b2GearJointDef ? def : null));
- }
- break;
- case b2Joint.e_lineJoint:
- {
- joint = new b2LineJoint((def instanceof b2LineJointDef ? def : null));
- }
- break;
- case b2Joint.e_weldJoint:
- {
- joint = new b2WeldJoint((def instanceof b2WeldJointDef ? def : null));
- }
- break;
- case b2Joint.e_frictionJoint:
- {
- joint = new b2FrictionJoint((def instanceof b2FrictionJointDef ? def : null));
- }
- break;
- default:
- break;
- }
- return joint;
- }
- b2Joint.Destroy = function (joint, allocator) {}
- b2Joint.prototype.b2Joint = function (def) {
- b2Settings.b2Assert(def.bodyA != def.bodyB);
- this.m_type = def.type;
- this.m_prev = null;
- this.m_next = null;
- this.m_bodyA = def.bodyA;
- this.m_bodyB = def.bodyB;
- this.m_collideConnected = def.collideConnected;
- this.m_islandFlag = false;
- this.m_userData = def.userData;
- }
- b2Joint.prototype.InitVelocityConstraints = function (step) {}
- b2Joint.prototype.SolveVelocityConstraints = function (step) {}
- b2Joint.prototype.FinalizeVelocityConstraints = function () {}
- b2Joint.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- 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;
- });
- b2JointDef.b2JointDef = function () {};
- b2JointDef.prototype.b2JointDef = function () {
- this.type = b2Joint.e_unknownJoint;
- this.userData = null;
- this.bodyA = null;
- this.bodyB = null;
- this.collideConnected = false;
- }
- b2JointEdge.b2JointEdge = function () {};
- Box2D.inherit(b2LineJoint, Box2D.Dynamics.Joints.b2Joint);
- b2LineJoint.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype;
- b2LineJoint.b2LineJoint = function () {
- Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);
- this.m_localAnchor1 = new b2Vec2();
- this.m_localAnchor2 = new b2Vec2();
- this.m_localXAxis1 = new b2Vec2();
- this.m_localYAxis1 = new b2Vec2();
- this.m_axis = new b2Vec2();
- this.m_perp = new b2Vec2();
- this.m_K = new b2Mat22();
- this.m_impulse = new b2Vec2();
- };
- b2LineJoint.prototype.GetAnchorA = function () {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
- }
- b2LineJoint.prototype.GetAnchorB = function () {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
- }
- b2LineJoint.prototype.GetReactionForce = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return new b2Vec2(inv_dt * (this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.y) * this.m_axis.x), inv_dt * (this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.y) * this.m_axis.y));
- }
- b2LineJoint.prototype.GetReactionTorque = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return inv_dt * this.m_impulse.y;
- }
- b2LineJoint.prototype.GetJointTranslation = function () {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- var p1 = bA.GetWorldPoint(this.m_localAnchor1);
- var p2 = bB.GetWorldPoint(this.m_localAnchor2);
- var dX = p2.x - p1.x;
- var dY = p2.y - p1.y;
- var axis = bA.GetWorldVector(this.m_localXAxis1);
- var translation = axis.x * dX + axis.y * dY;
- return translation;
- }
- b2LineJoint.prototype.GetJointSpeed = function () {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- var r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- var tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- var r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var p1X = bA.m_sweep.c.x + r1X;
- var p1Y = bA.m_sweep.c.y + r1Y;
- var p2X = bB.m_sweep.c.x + r2X;
- var p2Y = bB.m_sweep.c.y + r2Y;
- var dX = p2X - p1X;
- var dY = p2Y - p1Y;
- var axis = bA.GetWorldVector(this.m_localXAxis1);
- var v1 = bA.m_linearVelocity;
- var v2 = bB.m_linearVelocity;
- var w1 = bA.m_angularVelocity;
- var w2 = bB.m_angularVelocity;
- var speed = (dX * ((-w1 * axis.y)) + dY * (w1 * axis.x)) + (axis.x * (((v2.x + ((-w2 * r2Y))) - v1.x) - ((-w1 * r1Y))) + axis.y * (((v2.y + (w2 * r2X)) - v1.y) - (w1 * r1X)));
- return speed;
- }
- b2LineJoint.prototype.IsLimitEnabled = function () {
- return this.m_enableLimit;
- }
- b2LineJoint.prototype.EnableLimit = function (flag) {
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_enableLimit = flag;
- }
- b2LineJoint.prototype.GetLowerLimit = function () {
- return this.m_lowerTranslation;
- }
- b2LineJoint.prototype.GetUpperLimit = function () {
- return this.m_upperTranslation;
- }
- b2LineJoint.prototype.SetLimits = function (lower, upper) {
- if (lower === undefined) lower = 0;
- if (upper === undefined) upper = 0;
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_lowerTranslation = lower;
- this.m_upperTranslation = upper;
- }
- b2LineJoint.prototype.IsMotorEnabled = function () {
- return this.m_enableMotor;
- }
- b2LineJoint.prototype.EnableMotor = function (flag) {
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_enableMotor = flag;
- }
- b2LineJoint.prototype.SetMotorSpeed = function (speed) {
- if (speed === undefined) speed = 0;
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_motorSpeed = speed;
- }
- b2LineJoint.prototype.GetMotorSpeed = function () {
- return this.m_motorSpeed;
- }
- b2LineJoint.prototype.SetMaxMotorForce = function (force) {
- if (force === undefined) force = 0;
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_maxMotorForce = force;
- }
- b2LineJoint.prototype.GetMaxMotorForce = function () {
- return this.m_maxMotorForce;
- }
- b2LineJoint.prototype.GetMotorForce = function () {
- return this.m_motorImpulse;
- }
- b2LineJoint.prototype.b2LineJoint = function (def) {
- this.__super.b2Joint.call(this, def);
- var tMat;
- var tX = 0;
- var tY = 0;
- this.m_localAnchor1.SetV(def.localAnchorA);
- this.m_localAnchor2.SetV(def.localAnchorB);
- this.m_localXAxis1.SetV(def.localAxisA);
- this.m_localYAxis1.x = (-this.m_localXAxis1.y);
- this.m_localYAxis1.y = this.m_localXAxis1.x;
- this.m_impulse.SetZero();
- this.m_motorMass = 0.0;
- this.m_motorImpulse = 0.0;
- this.m_lowerTranslation = def.lowerTranslation;
- this.m_upperTranslation = def.upperTranslation;
- this.m_maxMotorForce = def.maxMotorForce;
- this.m_motorSpeed = def.motorSpeed;
- this.m_enableLimit = def.enableLimit;
- this.m_enableMotor = def.enableMotor;
- this.m_limitState = b2Joint.e_inactiveLimit;
- this.m_axis.SetZero();
- this.m_perp.SetZero();
- }
- b2LineJoint.prototype.InitVelocityConstraints = function (step) {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- var tX = 0;
- this.m_localCenterA.SetV(bA.GetLocalCenter());
- this.m_localCenterB.SetV(bB.GetLocalCenter());
- var xf1 = bA.GetTransform();
- var xf2 = bB.GetTransform();
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - this.m_localCenterA.x;
- var r1Y = this.m_localAnchor1.y - this.m_localCenterA.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - this.m_localCenterB.x;
- var r2Y = this.m_localAnchor2.y - this.m_localCenterB.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var dX = bB.m_sweep.c.x + r2X - bA.m_sweep.c.x - r1X;
- var dY = bB.m_sweep.c.y + r2Y - bA.m_sweep.c.y - r1Y;
- this.m_invMassA = bA.m_invMass;
- this.m_invMassB = bB.m_invMass;
- this.m_invIA = bA.m_invI;
- this.m_invIB = bB.m_invI; {
- this.m_axis.SetV(b2Math.MulMV(xf1.R, this.m_localXAxis1));
- this.m_a1 = (dX + r1X) * this.m_axis.y - (dY + r1Y) * this.m_axis.x;
- this.m_a2 = r2X * this.m_axis.y - r2Y * 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.0 / this.m_motorMass : 0.0;
- } {
- this.m_perp.SetV(b2Math.MulMV(xf1.R, this.m_localYAxis1));
- this.m_s1 = (dX + r1X) * this.m_perp.y - (dY + r1Y) * this.m_perp.x;
- this.m_s2 = r2X * this.m_perp.y - r2Y * this.m_perp.x;
- var m1 = this.m_invMassA;
- var m2 = this.m_invMassB;
- var i1 = this.m_invIA;
- var i2 = this.m_invIB;
- this.m_K.col1.x = m1 + m2 + i1 * this.m_s1 * this.m_s1 + i2 * this.m_s2 * this.m_s2;
- this.m_K.col1.y = i1 * this.m_s1 * this.m_a1 + i2 * this.m_s2 * this.m_a2;
- this.m_K.col2.x = this.m_K.col1.y;
- this.m_K.col2.y = m1 + m2 + i1 * this.m_a1 * this.m_a1 + i2 * this.m_a2 * this.m_a2;
- }
- if (this.m_enableLimit) {
- var jointTransition = this.m_axis.x * dX + this.m_axis.y * dY;
- if (b2Math.Abs(this.m_upperTranslation - this.m_lowerTranslation) < 2.0 * b2Settings.b2_linearSlop) {
- this.m_limitState = b2Joint.e_equalLimits;
- }
- else if (jointTransition <= this.m_lowerTranslation) {
- if (this.m_limitState != b2Joint.e_atLowerLimit) {
- this.m_limitState = b2Joint.e_atLowerLimit;
- this.m_impulse.y = 0.0;
- }
- }
- else if (jointTransition >= this.m_upperTranslation) {
- if (this.m_limitState != b2Joint.e_atUpperLimit) {
- this.m_limitState = b2Joint.e_atUpperLimit;
- this.m_impulse.y = 0.0;
- }
- }
- else {
- this.m_limitState = b2Joint.e_inactiveLimit;
- this.m_impulse.y = 0.0;
- }
- }
- else {
- this.m_limitState = b2Joint.e_inactiveLimit;
- }
- if (this.m_enableMotor == false) {
- this.m_motorImpulse = 0.0;
- }
- if (step.warmStarting) {
- this.m_impulse.x *= step.dtRatio;
- this.m_impulse.y *= step.dtRatio;
- this.m_motorImpulse *= step.dtRatio;
- var PX = this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.y) * this.m_axis.x;
- var PY = this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.y) * this.m_axis.y;
- var L1 = this.m_impulse.x * this.m_s1 + (this.m_motorImpulse + this.m_impulse.y) * this.m_a1;
- var L2 = this.m_impulse.x * this.m_s2 + (this.m_motorImpulse + this.m_impulse.y) * this.m_a2;
- bA.m_linearVelocity.x -= this.m_invMassA * PX;
- bA.m_linearVelocity.y -= this.m_invMassA * PY;
- bA.m_angularVelocity -= this.m_invIA * L1;
- bB.m_linearVelocity.x += this.m_invMassB * PX;
- bB.m_linearVelocity.y += this.m_invMassB * PY;
- bB.m_angularVelocity += this.m_invIB * L2;
- }
- else {
- this.m_impulse.SetZero();
- this.m_motorImpulse = 0.0;
- }
- }
- b2LineJoint.prototype.SolveVelocityConstraints = function (step) {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var v1 = bA.m_linearVelocity;
- var w1 = bA.m_angularVelocity;
- var v2 = bB.m_linearVelocity;
- var w2 = bB.m_angularVelocity;
- var PX = 0;
- var PY = 0;
- var L1 = 0;
- var L2 = 0;
- if (this.m_enableMotor && this.m_limitState != b2Joint.e_equalLimits) {
- var Cdot = this.m_axis.x * (v2.x - v1.x) + this.m_axis.y * (v2.y - v1.y) + this.m_a2 * w2 - this.m_a1 * w1;
- var impulse = this.m_motorMass * (this.m_motorSpeed - Cdot);
- var oldImpulse = this.m_motorImpulse;
- var maxImpulse = step.dt * this.m_maxMotorForce;
- this.m_motorImpulse = b2Math.Clamp(this.m_motorImpulse + impulse, (-maxImpulse), maxImpulse);
- impulse = this.m_motorImpulse - oldImpulse;
- PX = impulse * this.m_axis.x;
- PY = impulse * this.m_axis.y;
- L1 = impulse * this.m_a1;
- L2 = impulse * this.m_a2;
- v1.x -= this.m_invMassA * PX;
- v1.y -= this.m_invMassA * PY;
- w1 -= this.m_invIA * L1;
- v2.x += this.m_invMassB * PX;
- v2.y += this.m_invMassB * PY;
- w2 += this.m_invIB * L2;
- }
- var Cdot1 = this.m_perp.x * (v2.x - v1.x) + this.m_perp.y * (v2.y - v1.y) + this.m_s2 * w2 - this.m_s1 * w1;
- if (this.m_enableLimit && this.m_limitState != b2Joint.e_inactiveLimit) {
- var Cdot2 = this.m_axis.x * (v2.x - v1.x) + this.m_axis.y * (v2.y - v1.y) + this.m_a2 * w2 - this.m_a1 * w1;
- var f1 = this.m_impulse.Copy();
- var df = this.m_K.Solve(new b2Vec2(), (-Cdot1), (-Cdot2));
- this.m_impulse.Add(df);
- if (this.m_limitState == b2Joint.e_atLowerLimit) {
- this.m_impulse.y = b2Math.Max(this.m_impulse.y, 0.0);
- }
- else if (this.m_limitState == b2Joint.e_atUpperLimit) {
- this.m_impulse.y = b2Math.Min(this.m_impulse.y, 0.0);
- }
- var b = (-Cdot1) - (this.m_impulse.y - f1.y) * this.m_K.col2.x;
- var f2r = 0;
- if (this.m_K.col1.x != 0.0) {
- f2r = b / this.m_K.col1.x + f1.x;
- }
- else {
- f2r = f1.x;
- }
- this.m_impulse.x = f2r;
- df.x = this.m_impulse.x - f1.x;
- df.y = this.m_impulse.y - f1.y;
- PX = df.x * this.m_perp.x + df.y * this.m_axis.x;
- PY = df.x * this.m_perp.y + df.y * this.m_axis.y;
- L1 = df.x * this.m_s1 + df.y * this.m_a1;
- L2 = df.x * this.m_s2 + df.y * this.m_a2;
- v1.x -= this.m_invMassA * PX;
- v1.y -= this.m_invMassA * PY;
- w1 -= this.m_invIA * L1;
- v2.x += this.m_invMassB * PX;
- v2.y += this.m_invMassB * PY;
- w2 += this.m_invIB * L2;
- }
- else {
- var df2 = 0;
- if (this.m_K.col1.x != 0.0) {
- df2 = ((-Cdot1)) / this.m_K.col1.x;
- }
- else {
- df2 = 0.0;
- }
- this.m_impulse.x += df2;
- PX = df2 * this.m_perp.x;
- PY = df2 * this.m_perp.y;
- L1 = df2 * this.m_s1;
- L2 = df2 * this.m_s2;
- v1.x -= this.m_invMassA * PX;
- v1.y -= this.m_invMassA * PY;
- w1 -= this.m_invIA * L1;
- v2.x += this.m_invMassB * PX;
- v2.y += this.m_invMassB * PY;
- w2 += this.m_invIB * L2;
- }
- bA.m_linearVelocity.SetV(v1);
- bA.m_angularVelocity = w1;
- bB.m_linearVelocity.SetV(v2);
- bB.m_angularVelocity = w2;
- }
- b2LineJoint.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- var limitC = 0;
- var oldLimitImpulse = 0;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var c1 = bA.m_sweep.c;
- var a1 = bA.m_sweep.a;
- var c2 = bB.m_sweep.c;
- var a2 = bB.m_sweep.a;
- var tMat;
- var tX = 0;
- var m1 = 0;
- var m2 = 0;
- var i1 = 0;
- var i2 = 0;
- var linearError = 0.0;
- var angularError = 0.0;
- var active = false;
- var C2 = 0.0;
- var R1 = b2Mat22.FromAngle(a1);
- var R2 = b2Mat22.FromAngle(a2);
- tMat = R1;
- var r1X = this.m_localAnchor1.x - this.m_localCenterA.x;
- var r1Y = this.m_localAnchor1.y - this.m_localCenterA.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = R2;
- var r2X = this.m_localAnchor2.x - this.m_localCenterB.x;
- var r2Y = this.m_localAnchor2.y - this.m_localCenterB.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var dX = c2.x + r2X - c1.x - r1X;
- var dY = c2.y + r2Y - c1.y - r1Y;
- if (this.m_enableLimit) {
- this.m_axis = b2Math.MulMV(R1, this.m_localXAxis1);
- this.m_a1 = (dX + r1X) * this.m_axis.y - (dY + r1Y) * this.m_axis.x;
- this.m_a2 = r2X * this.m_axis.y - r2Y * this.m_axis.x;
- var translation = this.m_axis.x * dX + this.m_axis.y * dY;
- if (b2Math.Abs(this.m_upperTranslation - this.m_lowerTranslation) < 2.0 * b2Settings.b2_linearSlop) {
- C2 = b2Math.Clamp(translation, (-b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
- linearError = b2Math.Abs(translation);
- active = true;
- }
- else if (translation <= this.m_lowerTranslation) {
- C2 = b2Math.Clamp(translation - this.m_lowerTranslation + b2Settings.b2_linearSlop, (-b2Settings.b2_maxLinearCorrection), 0.0);
- linearError = this.m_lowerTranslation - translation;
- active = true;
- }
- else if (translation >= this.m_upperTranslation) {
- C2 = b2Math.Clamp(translation - this.m_upperTranslation + b2Settings.b2_linearSlop, 0.0, b2Settings.b2_maxLinearCorrection);
- linearError = translation - this.m_upperTranslation;
- active = true;
- }
- }
- this.m_perp = b2Math.MulMV(R1, this.m_localYAxis1);
- this.m_s1 = (dX + r1X) * this.m_perp.y - (dY + r1Y) * this.m_perp.x;
- this.m_s2 = r2X * this.m_perp.y - r2Y * this.m_perp.x;
- var impulse = new b2Vec2();
- var C1 = this.m_perp.x * dX + this.m_perp.y * dY;
- linearError = b2Math.Max(linearError, b2Math.Abs(C1));
- angularError = 0.0;
- if (active) {
- m1 = this.m_invMassA;
- m2 = this.m_invMassB;
- i1 = this.m_invIA;
- i2 = this.m_invIB;
- this.m_K.col1.x = m1 + m2 + i1 * this.m_s1 * this.m_s1 + i2 * this.m_s2 * this.m_s2;
- this.m_K.col1.y = i1 * this.m_s1 * this.m_a1 + i2 * this.m_s2 * this.m_a2;
- this.m_K.col2.x = this.m_K.col1.y;
- this.m_K.col2.y = m1 + m2 + i1 * this.m_a1 * this.m_a1 + i2 * this.m_a2 * this.m_a2;
- this.m_K.Solve(impulse, (-C1), (-C2));
- }
- else {
- m1 = this.m_invMassA;
- m2 = this.m_invMassB;
- i1 = this.m_invIA;
- i2 = this.m_invIB;
- var k11 = m1 + m2 + i1 * this.m_s1 * this.m_s1 + i2 * this.m_s2 * this.m_s2;
- var impulse1 = 0;
- if (k11 != 0.0) {
- impulse1 = ((-C1)) / k11;
- }
- else {
- impulse1 = 0.0;
- }
- impulse.x = impulse1;
- impulse.y = 0.0;
- }
- var PX = impulse.x * this.m_perp.x + impulse.y * this.m_axis.x;
- var PY = impulse.x * this.m_perp.y + impulse.y * this.m_axis.y;
- var L1 = impulse.x * this.m_s1 + impulse.y * this.m_a1;
- var L2 = impulse.x * this.m_s2 + impulse.y * this.m_a2;
- c1.x -= this.m_invMassA * PX;
- c1.y -= this.m_invMassA * PY;
- a1 -= this.m_invIA * L1;
- c2.x += this.m_invMassB * PX;
- c2.y += this.m_invMassB * PY;
- a2 += this.m_invIB * L2;
- bA.m_sweep.a = a1;
- bB.m_sweep.a = a2;
- bA.SynchronizeTransform();
- bB.SynchronizeTransform();
- return linearError <= b2Settings.b2_linearSlop && angularError <= b2Settings.b2_angularSlop;
- }
- Box2D.inherit(b2LineJointDef, Box2D.Dynamics.Joints.b2JointDef);
- b2LineJointDef.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype;
- b2LineJointDef.b2LineJointDef = function () {
- Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);
- this.localAnchorA = new b2Vec2();
- this.localAnchorB = new b2Vec2();
- this.localAxisA = new b2Vec2();
- };
- b2LineJointDef.prototype.b2LineJointDef = function () {
- this.__super.b2JointDef.call(this);
- this.type = b2Joint.e_lineJoint;
- this.localAxisA.Set(1.0, 0.0);
- this.enableLimit = false;
- this.lowerTranslation = 0.0;
- this.upperTranslation = 0.0;
- this.enableMotor = false;
- this.maxMotorForce = 0.0;
- this.motorSpeed = 0.0;
- }
- b2LineJointDef.prototype.Initialize = function (bA, bB, anchor, axis) {
- this.bodyA = bA;
- this.bodyB = bB;
- this.localAnchorA = this.bodyA.GetLocalPoint(anchor);
- this.localAnchorB = this.bodyB.GetLocalPoint(anchor);
- this.localAxisA = this.bodyA.GetLocalVector(axis);
- }
- Box2D.inherit(b2MouseJoint, Box2D.Dynamics.Joints.b2Joint);
- b2MouseJoint.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype;
- b2MouseJoint.b2MouseJoint = function () {
- Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);
- this.K = new b2Mat22();
- this.K1 = new b2Mat22();
- this.K2 = new b2Mat22();
- this.m_localAnchor = new b2Vec2();
- this.m_target = new b2Vec2();
- this.m_impulse = new b2Vec2();
- this.m_mass = new b2Mat22();
- this.m_C = new b2Vec2();
- };
- b2MouseJoint.prototype.GetAnchorA = function () {
- return this.m_target;
- }
- b2MouseJoint.prototype.GetAnchorB = function () {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchor);
- }
- b2MouseJoint.prototype.GetReactionForce = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return new b2Vec2(inv_dt * this.m_impulse.x, inv_dt * this.m_impulse.y);
- }
- b2MouseJoint.prototype.GetReactionTorque = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return 0.0;
- }
- b2MouseJoint.prototype.GetTarget = function () {
- return this.m_target;
- }
- b2MouseJoint.prototype.SetTarget = function (target) {
- if (this.m_bodyB.IsAwake() == false) {
- this.m_bodyB.SetAwake(true);
- }
- this.m_target = target;
- }
- b2MouseJoint.prototype.GetMaxForce = function () {
- return this.m_maxForce;
- }
- b2MouseJoint.prototype.SetMaxForce = function (maxForce) {
- if (maxForce === undefined) maxForce = 0;
- this.m_maxForce = maxForce;
- }
- b2MouseJoint.prototype.GetFrequency = function () {
- return this.m_frequencyHz;
- }
- b2MouseJoint.prototype.SetFrequency = function (hz) {
- if (hz === undefined) hz = 0;
- this.m_frequencyHz = hz;
- }
- b2MouseJoint.prototype.GetDampingRatio = function () {
- return this.m_dampingRatio;
- }
- b2MouseJoint.prototype.SetDampingRatio = function (ratio) {
- if (ratio === undefined) ratio = 0;
- this.m_dampingRatio = ratio;
- }
- b2MouseJoint.prototype.b2MouseJoint = function (def) {
- this.__super.b2Joint.call(this, def);
- this.m_target.SetV(def.target);
- var tX = this.m_target.x - this.m_bodyB.m_xf.position.x;
- var tY = this.m_target.y - this.m_bodyB.m_xf.position.y;
- var tMat = this.m_bodyB.m_xf.R;
- this.m_localAnchor.x = (tX * tMat.col1.x + tY * tMat.col1.y);
- this.m_localAnchor.y = (tX * tMat.col2.x + tY * tMat.col2.y);
- this.m_maxForce = def.maxForce;
- this.m_impulse.SetZero();
- this.m_frequencyHz = def.frequencyHz;
- this.m_dampingRatio = def.dampingRatio;
- this.m_beta = 0.0;
- this.m_gamma = 0.0;
- }
- b2MouseJoint.prototype.InitVelocityConstraints = function (step) {
- var b = this.m_bodyB;
- var mass = b.GetMass();
- var omega = 2.0 * Math.PI * this.m_frequencyHz;
- var d = 2.0 * mass * this.m_dampingRatio * omega;
- var k = mass * omega * omega;
- this.m_gamma = step.dt * (d + step.dt * k);
- this.m_gamma = this.m_gamma != 0 ? 1 / this.m_gamma : 0.0;
- this.m_beta = step.dt * k * this.m_gamma;
- var tMat;tMat = b.m_xf.R;
- var rX = this.m_localAnchor.x - b.m_sweep.localCenter.x;
- var rY = this.m_localAnchor.y - b.m_sweep.localCenter.y;
- var tX = (tMat.col1.x * rX + tMat.col2.x * rY);rY = (tMat.col1.y * rX + tMat.col2.y * rY);
- rX = tX;
- var invMass = b.m_invMass;
- var invI = b.m_invI;this.K1.col1.x = invMass;
- this.K1.col2.x = 0.0;
- this.K1.col1.y = 0.0;
- this.K1.col2.y = invMass;
- this.K2.col1.x = invI * rY * rY;
- this.K2.col2.x = (-invI * rX * rY);
- this.K2.col1.y = (-invI * rX * rY);
- this.K2.col2.y = invI * rX * rX;
- 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 = b.m_sweep.c.x + rX - this.m_target.x;
- this.m_C.y = b.m_sweep.c.y + rY - this.m_target.y;
- b.m_angularVelocity *= 0.98;
- this.m_impulse.x *= step.dtRatio;
- this.m_impulse.y *= step.dtRatio;
- b.m_linearVelocity.x += invMass * this.m_impulse.x;
- b.m_linearVelocity.y += invMass * this.m_impulse.y;
- b.m_angularVelocity += invI * (rX * this.m_impulse.y - rY * this.m_impulse.x);
- }
- b2MouseJoint.prototype.SolveVelocityConstraints = function (step) {
- var b = this.m_bodyB;
- var tMat;
- var tX = 0;
- var tY = 0;
- tMat = b.m_xf.R;
- var rX = this.m_localAnchor.x - b.m_sweep.localCenter.x;
- var rY = this.m_localAnchor.y - b.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rX + tMat.col2.x * rY);
- rY = (tMat.col1.y * rX + tMat.col2.y * rY);
- rX = tX;
- var CdotX = b.m_linearVelocity.x + ((-b.m_angularVelocity * rY));
- var CdotY = b.m_linearVelocity.y + (b.m_angularVelocity * rX);
- tMat = this.m_mass;
- tX = CdotX + this.m_beta * this.m_C.x + this.m_gamma * this.m_impulse.x;
- tY = CdotY + this.m_beta * this.m_C.y + this.m_gamma * this.m_impulse.y;
- var impulseX = (-(tMat.col1.x * tX + tMat.col2.x * tY));
- var impulseY = (-(tMat.col1.y * tX + tMat.col2.y * tY));
- var oldImpulseX = this.m_impulse.x;
- var oldImpulseY = this.m_impulse.y;
- this.m_impulse.x += impulseX;
- this.m_impulse.y += impulseY;
- var maxImpulse = step.dt * this.m_maxForce;
- if (this.m_impulse.LengthSquared() > maxImpulse * maxImpulse) {
- this.m_impulse.Multiply(maxImpulse / this.m_impulse.Length());
- }
- impulseX = this.m_impulse.x - oldImpulseX;
- impulseY = this.m_impulse.y - oldImpulseY;
- b.m_linearVelocity.x += b.m_invMass * impulseX;
- b.m_linearVelocity.y += b.m_invMass * impulseY;
- b.m_angularVelocity += b.m_invI * (rX * impulseY - rY * impulseX);
- }
- b2MouseJoint.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- return true;
- }
- Box2D.inherit(b2MouseJointDef, Box2D.Dynamics.Joints.b2JointDef);
- b2MouseJointDef.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype;
- b2MouseJointDef.b2MouseJointDef = function () {
- Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);
- this.target = new b2Vec2();
- };
- b2MouseJointDef.prototype.b2MouseJointDef = function () {
- this.__super.b2JointDef.call(this);
- this.type = b2Joint.e_mouseJoint;
- this.maxForce = 0.0;
- this.frequencyHz = 5.0;
- this.dampingRatio = 0.7;
- }
- Box2D.inherit(b2PrismaticJoint, Box2D.Dynamics.Joints.b2Joint);
- b2PrismaticJoint.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype;
- b2PrismaticJoint.b2PrismaticJoint = function () {
- Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);
- this.m_localAnchor1 = new b2Vec2();
- this.m_localAnchor2 = new b2Vec2();
- this.m_localXAxis1 = new b2Vec2();
- this.m_localYAxis1 = new b2Vec2();
- this.m_axis = new b2Vec2();
- this.m_perp = new b2Vec2();
- this.m_K = new b2Mat33();
- this.m_impulse = new b2Vec3();
- };
- b2PrismaticJoint.prototype.GetAnchorA = function () {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
- }
- b2PrismaticJoint.prototype.GetAnchorB = function () {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
- }
- b2PrismaticJoint.prototype.GetReactionForce = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return new b2Vec2(inv_dt * (this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.x), inv_dt * (this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.y));
- }
- b2PrismaticJoint.prototype.GetReactionTorque = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return inv_dt * this.m_impulse.y;
- }
- b2PrismaticJoint.prototype.GetJointTranslation = function () {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- var p1 = bA.GetWorldPoint(this.m_localAnchor1);
- var p2 = bB.GetWorldPoint(this.m_localAnchor2);
- var dX = p2.x - p1.x;
- var dY = p2.y - p1.y;
- var axis = bA.GetWorldVector(this.m_localXAxis1);
- var translation = axis.x * dX + axis.y * dY;
- return translation;
- }
- b2PrismaticJoint.prototype.GetJointSpeed = function () {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- var r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- var tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- var r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var p1X = bA.m_sweep.c.x + r1X;
- var p1Y = bA.m_sweep.c.y + r1Y;
- var p2X = bB.m_sweep.c.x + r2X;
- var p2Y = bB.m_sweep.c.y + r2Y;
- var dX = p2X - p1X;
- var dY = p2Y - p1Y;
- var axis = bA.GetWorldVector(this.m_localXAxis1);
- var v1 = bA.m_linearVelocity;
- var v2 = bB.m_linearVelocity;
- var w1 = bA.m_angularVelocity;
- var w2 = bB.m_angularVelocity;
- var speed = (dX * ((-w1 * axis.y)) + dY * (w1 * axis.x)) + (axis.x * (((v2.x + ((-w2 * r2Y))) - v1.x) - ((-w1 * r1Y))) + axis.y * (((v2.y + (w2 * r2X)) - v1.y) - (w1 * r1X)));
- return speed;
- }
- b2PrismaticJoint.prototype.IsLimitEnabled = function () {
- return this.m_enableLimit;
- }
- b2PrismaticJoint.prototype.EnableLimit = function (flag) {
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_enableLimit = flag;
- }
- b2PrismaticJoint.prototype.GetLowerLimit = function () {
- return this.m_lowerTranslation;
- }
- b2PrismaticJoint.prototype.GetUpperLimit = function () {
- return this.m_upperTranslation;
- }
- b2PrismaticJoint.prototype.SetLimits = function (lower, upper) {
- if (lower === undefined) lower = 0;
- if (upper === undefined) upper = 0;
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_lowerTranslation = lower;
- this.m_upperTranslation = upper;
- }
- b2PrismaticJoint.prototype.IsMotorEnabled = function () {
- return this.m_enableMotor;
- }
- b2PrismaticJoint.prototype.EnableMotor = function (flag) {
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_enableMotor = flag;
- }
- b2PrismaticJoint.prototype.SetMotorSpeed = function (speed) {
- if (speed === undefined) speed = 0;
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_motorSpeed = speed;
- }
- b2PrismaticJoint.prototype.GetMotorSpeed = function () {
- return this.m_motorSpeed;
- }
- b2PrismaticJoint.prototype.SetMaxMotorForce = function (force) {
- if (force === undefined) force = 0;
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_maxMotorForce = force;
- }
- b2PrismaticJoint.prototype.GetMotorForce = function () {
- return this.m_motorImpulse;
- }
- b2PrismaticJoint.prototype.b2PrismaticJoint = function (def) {
- this.__super.b2Joint.call(this, def);
- var tMat;
- var tX = 0;
- var tY = 0;
- this.m_localAnchor1.SetV(def.localAnchorA);
- this.m_localAnchor2.SetV(def.localAnchorB);
- this.m_localXAxis1.SetV(def.localAxisA);
- this.m_localYAxis1.x = (-this.m_localXAxis1.y);
- this.m_localYAxis1.y = this.m_localXAxis1.x;
- this.m_refAngle = def.referenceAngle;
- this.m_impulse.SetZero();
- this.m_motorMass = 0.0;
- this.m_motorImpulse = 0.0;
- this.m_lowerTranslation = def.lowerTranslation;
- this.m_upperTranslation = def.upperTranslation;
- this.m_maxMotorForce = def.maxMotorForce;
- this.m_motorSpeed = def.motorSpeed;
- this.m_enableLimit = def.enableLimit;
- this.m_enableMotor = def.enableMotor;
- this.m_limitState = b2Joint.e_inactiveLimit;
- this.m_axis.SetZero();
- this.m_perp.SetZero();
- }
- b2PrismaticJoint.prototype.InitVelocityConstraints = function (step) {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- var tX = 0;
- this.m_localCenterA.SetV(bA.GetLocalCenter());
- this.m_localCenterB.SetV(bB.GetLocalCenter());
- var xf1 = bA.GetTransform();
- var xf2 = bB.GetTransform();
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - this.m_localCenterA.x;
- var r1Y = this.m_localAnchor1.y - this.m_localCenterA.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - this.m_localCenterB.x;
- var r2Y = this.m_localAnchor2.y - this.m_localCenterB.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var dX = bB.m_sweep.c.x + r2X - bA.m_sweep.c.x - r1X;
- var dY = bB.m_sweep.c.y + r2Y - bA.m_sweep.c.y - r1Y;
- this.m_invMassA = bA.m_invMass;
- this.m_invMassB = bB.m_invMass;
- this.m_invIA = bA.m_invI;
- this.m_invIB = bB.m_invI; {
- this.m_axis.SetV(b2Math.MulMV(xf1.R, this.m_localXAxis1));
- this.m_a1 = (dX + r1X) * this.m_axis.y - (dY + r1Y) * this.m_axis.x;
- this.m_a2 = r2X * this.m_axis.y - r2Y * 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.0 / this.m_motorMass;
- } {
- this.m_perp.SetV(b2Math.MulMV(xf1.R, this.m_localYAxis1));
- this.m_s1 = (dX + r1X) * this.m_perp.y - (dY + r1Y) * this.m_perp.x;
- this.m_s2 = r2X * this.m_perp.y - r2Y * this.m_perp.x;
- var m1 = this.m_invMassA;
- var m2 = this.m_invMassB;
- var i1 = this.m_invIA;
- var i2 = this.m_invIB;
- this.m_K.col1.x = m1 + m2 + i1 * this.m_s1 * this.m_s1 + i2 * this.m_s2 * this.m_s2;
- this.m_K.col1.y = i1 * this.m_s1 + i2 * this.m_s2;
- this.m_K.col1.z = i1 * this.m_s1 * this.m_a1 + i2 * this.m_s2 * this.m_a2;
- this.m_K.col2.x = this.m_K.col1.y;
- this.m_K.col2.y = i1 + i2;
- this.m_K.col2.z = i1 * this.m_a1 + i2 * 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 = m1 + m2 + i1 * this.m_a1 * this.m_a1 + i2 * this.m_a2 * this.m_a2;
- }
- if (this.m_enableLimit) {
- var jointTransition = this.m_axis.x * dX + this.m_axis.y * dY;
- if (b2Math.Abs(this.m_upperTranslation - this.m_lowerTranslation) < 2.0 * b2Settings.b2_linearSlop) {
- this.m_limitState = b2Joint.e_equalLimits;
- }
- else if (jointTransition <= this.m_lowerTranslation) {
- if (this.m_limitState != b2Joint.e_atLowerLimit) {
- this.m_limitState = b2Joint.e_atLowerLimit;
- this.m_impulse.z = 0.0;
- }
- }
- else if (jointTransition >= this.m_upperTranslation) {
- if (this.m_limitState != b2Joint.e_atUpperLimit) {
- this.m_limitState = b2Joint.e_atUpperLimit;
- this.m_impulse.z = 0.0;
- }
- }
- else {
- this.m_limitState = b2Joint.e_inactiveLimit;
- this.m_impulse.z = 0.0;
- }
- }
- else {
- this.m_limitState = b2Joint.e_inactiveLimit;
- }
- if (this.m_enableMotor == false) {
- this.m_motorImpulse = 0.0;
- }
- if (step.warmStarting) {
- this.m_impulse.x *= step.dtRatio;
- this.m_impulse.y *= step.dtRatio;
- this.m_motorImpulse *= step.dtRatio;
- var PX = this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.x;
- var PY = this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.y;
- var L1 = this.m_impulse.x * this.m_s1 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a1;
- var L2 = this.m_impulse.x * this.m_s2 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a2;
- bA.m_linearVelocity.x -= this.m_invMassA * PX;
- bA.m_linearVelocity.y -= this.m_invMassA * PY;
- bA.m_angularVelocity -= this.m_invIA * L1;
- bB.m_linearVelocity.x += this.m_invMassB * PX;
- bB.m_linearVelocity.y += this.m_invMassB * PY;
- bB.m_angularVelocity += this.m_invIB * L2;
- }
- else {
- this.m_impulse.SetZero();
- this.m_motorImpulse = 0.0;
- }
- }
- b2PrismaticJoint.prototype.SolveVelocityConstraints = function (step) {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var v1 = bA.m_linearVelocity;
- var w1 = bA.m_angularVelocity;
- var v2 = bB.m_linearVelocity;
- var w2 = bB.m_angularVelocity;
- var PX = 0;
- var PY = 0;
- var L1 = 0;
- var L2 = 0;
- if (this.m_enableMotor && this.m_limitState != b2Joint.e_equalLimits) {
- var Cdot = this.m_axis.x * (v2.x - v1.x) + this.m_axis.y * (v2.y - v1.y) + this.m_a2 * w2 - this.m_a1 * w1;
- var impulse = this.m_motorMass * (this.m_motorSpeed - Cdot);
- var oldImpulse = this.m_motorImpulse;
- var maxImpulse = step.dt * this.m_maxMotorForce;
- this.m_motorImpulse = b2Math.Clamp(this.m_motorImpulse + impulse, (-maxImpulse), maxImpulse);
- impulse = this.m_motorImpulse - oldImpulse;
- PX = impulse * this.m_axis.x;
- PY = impulse * this.m_axis.y;
- L1 = impulse * this.m_a1;
- L2 = impulse * this.m_a2;
- v1.x -= this.m_invMassA * PX;
- v1.y -= this.m_invMassA * PY;
- w1 -= this.m_invIA * L1;
- v2.x += this.m_invMassB * PX;
- v2.y += this.m_invMassB * PY;
- w2 += this.m_invIB * L2;
- }
- var Cdot1X = this.m_perp.x * (v2.x - v1.x) + this.m_perp.y * (v2.y - v1.y) + this.m_s2 * w2 - this.m_s1 * w1;
- var Cdot1Y = w2 - w1;
- if (this.m_enableLimit && this.m_limitState != b2Joint.e_inactiveLimit) {
- var Cdot2 = this.m_axis.x * (v2.x - v1.x) + this.m_axis.y * (v2.y - v1.y) + this.m_a2 * w2 - this.m_a1 * w1;
- var f1 = this.m_impulse.Copy();
- var df = this.m_K.Solve33(new b2Vec3(), (-Cdot1X), (-Cdot1Y), (-Cdot2));
- this.m_impulse.Add(df);
- if (this.m_limitState == b2Joint.e_atLowerLimit) {
- this.m_impulse.z = b2Math.Max(this.m_impulse.z, 0.0);
- }
- else if (this.m_limitState == b2Joint.e_atUpperLimit) {
- this.m_impulse.z = b2Math.Min(this.m_impulse.z, 0.0);
- }
- var bX = (-Cdot1X) - (this.m_impulse.z - f1.z) * this.m_K.col3.x;
- var bY = (-Cdot1Y) - (this.m_impulse.z - f1.z) * this.m_K.col3.y;
- var f2r = this.m_K.Solve22(new b2Vec2(), bX, bY);
- f2r.x += f1.x;
- f2r.y += f1.y;
- this.m_impulse.x = f2r.x;
- this.m_impulse.y = f2r.y;
- df.x = this.m_impulse.x - f1.x;
- df.y = this.m_impulse.y - f1.y;
- df.z = this.m_impulse.z - f1.z;
- PX = df.x * this.m_perp.x + df.z * this.m_axis.x;
- PY = df.x * this.m_perp.y + df.z * this.m_axis.y;
- L1 = df.x * this.m_s1 + df.y + df.z * this.m_a1;
- L2 = df.x * this.m_s2 + df.y + df.z * this.m_a2;
- v1.x -= this.m_invMassA * PX;
- v1.y -= this.m_invMassA * PY;
- w1 -= this.m_invIA * L1;
- v2.x += this.m_invMassB * PX;
- v2.y += this.m_invMassB * PY;
- w2 += this.m_invIB * L2;
- }
- else {
- var df2 = this.m_K.Solve22(new b2Vec2(), (-Cdot1X), (-Cdot1Y));
- this.m_impulse.x += df2.x;
- this.m_impulse.y += df2.y;
- PX = df2.x * this.m_perp.x;
- PY = df2.x * this.m_perp.y;
- L1 = df2.x * this.m_s1 + df2.y;
- L2 = df2.x * this.m_s2 + df2.y;
- v1.x -= this.m_invMassA * PX;
- v1.y -= this.m_invMassA * PY;
- w1 -= this.m_invIA * L1;
- v2.x += this.m_invMassB * PX;
- v2.y += this.m_invMassB * PY;
- w2 += this.m_invIB * L2;
- }
- bA.m_linearVelocity.SetV(v1);
- bA.m_angularVelocity = w1;
- bB.m_linearVelocity.SetV(v2);
- bB.m_angularVelocity = w2;
- }
- b2PrismaticJoint.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- var limitC = 0;
- var oldLimitImpulse = 0;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var c1 = bA.m_sweep.c;
- var a1 = bA.m_sweep.a;
- var c2 = bB.m_sweep.c;
- var a2 = bB.m_sweep.a;
- var tMat;
- var tX = 0;
- var m1 = 0;
- var m2 = 0;
- var i1 = 0;
- var i2 = 0;
- var linearError = 0.0;
- var angularError = 0.0;
- var active = false;
- var C2 = 0.0;
- var R1 = b2Mat22.FromAngle(a1);
- var R2 = b2Mat22.FromAngle(a2);
- tMat = R1;
- var r1X = this.m_localAnchor1.x - this.m_localCenterA.x;
- var r1Y = this.m_localAnchor1.y - this.m_localCenterA.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = R2;
- var r2X = this.m_localAnchor2.x - this.m_localCenterB.x;
- var r2Y = this.m_localAnchor2.y - this.m_localCenterB.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var dX = c2.x + r2X - c1.x - r1X;
- var dY = c2.y + r2Y - c1.y - r1Y;
- if (this.m_enableLimit) {
- this.m_axis = b2Math.MulMV(R1, this.m_localXAxis1);
- this.m_a1 = (dX + r1X) * this.m_axis.y - (dY + r1Y) * this.m_axis.x;
- this.m_a2 = r2X * this.m_axis.y - r2Y * this.m_axis.x;
- var translation = this.m_axis.x * dX + this.m_axis.y * dY;
- if (b2Math.Abs(this.m_upperTranslation - this.m_lowerTranslation) < 2.0 * b2Settings.b2_linearSlop) {
- C2 = b2Math.Clamp(translation, (-b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
- linearError = b2Math.Abs(translation);
- active = true;
- }
- else if (translation <= this.m_lowerTranslation) {
- C2 = b2Math.Clamp(translation - this.m_lowerTranslation + b2Settings.b2_linearSlop, (-b2Settings.b2_maxLinearCorrection), 0.0);
- linearError = this.m_lowerTranslation - translation;
- active = true;
- }
- else if (translation >= this.m_upperTranslation) {
- C2 = b2Math.Clamp(translation - this.m_upperTranslation + b2Settings.b2_linearSlop, 0.0, b2Settings.b2_maxLinearCorrection);
- linearError = translation - this.m_upperTranslation;
- active = true;
- }
- }
- this.m_perp = b2Math.MulMV(R1, this.m_localYAxis1);
- this.m_s1 = (dX + r1X) * this.m_perp.y - (dY + r1Y) * this.m_perp.x;
- this.m_s2 = r2X * this.m_perp.y - r2Y * this.m_perp.x;
- var impulse = new b2Vec3();
- var C1X = this.m_perp.x * dX + this.m_perp.y * dY;
- var C1Y = a2 - a1 - this.m_refAngle;
- linearError = b2Math.Max(linearError, b2Math.Abs(C1X));
- angularError = b2Math.Abs(C1Y);
- if (active) {
- m1 = this.m_invMassA;
- m2 = this.m_invMassB;
- i1 = this.m_invIA;
- i2 = this.m_invIB;
- this.m_K.col1.x = m1 + m2 + i1 * this.m_s1 * this.m_s1 + i2 * this.m_s2 * this.m_s2;
- this.m_K.col1.y = i1 * this.m_s1 + i2 * this.m_s2;
- this.m_K.col1.z = i1 * this.m_s1 * this.m_a1 + i2 * this.m_s2 * this.m_a2;
- this.m_K.col2.x = this.m_K.col1.y;
- this.m_K.col2.y = i1 + i2;
- this.m_K.col2.z = i1 * this.m_a1 + i2 * 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 = m1 + m2 + i1 * this.m_a1 * this.m_a1 + i2 * this.m_a2 * this.m_a2;
- this.m_K.Solve33(impulse, (-C1X), (-C1Y), (-C2));
- }
- else {
- m1 = this.m_invMassA;
- m2 = this.m_invMassB;
- i1 = this.m_invIA;
- i2 = this.m_invIB;
- var k11 = m1 + m2 + i1 * this.m_s1 * this.m_s1 + i2 * this.m_s2 * this.m_s2;
- var k12 = i1 * this.m_s1 + i2 * this.m_s2;
- var k22 = i1 + i2;
- this.m_K.col1.Set(k11, k12, 0.0);
- this.m_K.col2.Set(k12, k22, 0.0);
- var impulse1 = this.m_K.Solve22(new b2Vec2(), (-C1X), (-C1Y));
- impulse.x = impulse1.x;
- impulse.y = impulse1.y;
- impulse.z = 0.0;
- }
- var PX = impulse.x * this.m_perp.x + impulse.z * this.m_axis.x;
- var PY = impulse.x * this.m_perp.y + impulse.z * this.m_axis.y;
- var L1 = impulse.x * this.m_s1 + impulse.y + impulse.z * this.m_a1;
- var L2 = impulse.x * this.m_s2 + impulse.y + impulse.z * this.m_a2;
- c1.x -= this.m_invMassA * PX;
- c1.y -= this.m_invMassA * PY;
- a1 -= this.m_invIA * L1;
- c2.x += this.m_invMassB * PX;
- c2.y += this.m_invMassB * PY;
- a2 += this.m_invIB * L2;
- bA.m_sweep.a = a1;
- bB.m_sweep.a = a2;
- bA.SynchronizeTransform();
- bB.SynchronizeTransform();
- return linearError <= b2Settings.b2_linearSlop && angularError <= b2Settings.b2_angularSlop;
- }
- Box2D.inherit(b2PrismaticJointDef, Box2D.Dynamics.Joints.b2JointDef);
- b2PrismaticJointDef.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype;
- b2PrismaticJointDef.b2PrismaticJointDef = function () {
- Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);
- this.localAnchorA = new b2Vec2();
- this.localAnchorB = new b2Vec2();
- this.localAxisA = new b2Vec2();
- };
- b2PrismaticJointDef.prototype.b2PrismaticJointDef = function () {
- this.__super.b2JointDef.call(this);
- this.type = b2Joint.e_prismaticJoint;
- this.localAxisA.Set(1.0, 0.0);
- this.referenceAngle = 0.0;
- this.enableLimit = false;
- this.lowerTranslation = 0.0;
- this.upperTranslation = 0.0;
- this.enableMotor = false;
- this.maxMotorForce = 0.0;
- this.motorSpeed = 0.0;
- }
- b2PrismaticJointDef.prototype.Initialize = function (bA, bB, anchor, axis) {
- this.bodyA = bA;
- this.bodyB = bB;
- this.localAnchorA = this.bodyA.GetLocalPoint(anchor);
- this.localAnchorB = this.bodyB.GetLocalPoint(anchor);
- this.localAxisA = this.bodyA.GetLocalVector(axis);
- this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
- }
- Box2D.inherit(b2PulleyJoint, Box2D.Dynamics.Joints.b2Joint);
- b2PulleyJoint.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype;
- b2PulleyJoint.b2PulleyJoint = function () {
- Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);
- this.m_groundAnchor1 = new b2Vec2();
- this.m_groundAnchor2 = new b2Vec2();
- this.m_localAnchor1 = new b2Vec2();
- this.m_localAnchor2 = new b2Vec2();
- this.m_u1 = new b2Vec2();
- this.m_u2 = new b2Vec2();
- };
- b2PulleyJoint.prototype.GetAnchorA = function () {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
- }
- b2PulleyJoint.prototype.GetAnchorB = function () {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
- }
- b2PulleyJoint.prototype.GetReactionForce = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return new b2Vec2(inv_dt * this.m_impulse * this.m_u2.x, inv_dt * this.m_impulse * this.m_u2.y);
- }
- b2PulleyJoint.prototype.GetReactionTorque = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return 0.0;
- }
- b2PulleyJoint.prototype.GetGroundAnchorA = function () {
- var a = this.m_ground.m_xf.position.Copy();
- a.Add(this.m_groundAnchor1);
- return a;
- }
- b2PulleyJoint.prototype.GetGroundAnchorB = function () {
- var a = this.m_ground.m_xf.position.Copy();
- a.Add(this.m_groundAnchor2);
- return a;
- }
- b2PulleyJoint.prototype.GetLength1 = function () {
- var p = this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
- var sX = this.m_ground.m_xf.position.x + this.m_groundAnchor1.x;
- var sY = this.m_ground.m_xf.position.y + this.m_groundAnchor1.y;
- var dX = p.x - sX;
- var dY = p.y - sY;
- return Math.sqrt(dX * dX + dY * dY);
- }
- b2PulleyJoint.prototype.GetLength2 = function () {
- var p = this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
- var sX = this.m_ground.m_xf.position.x + this.m_groundAnchor2.x;
- var sY = this.m_ground.m_xf.position.y + this.m_groundAnchor2.y;
- var dX = p.x - sX;
- var dY = p.y - sY;
- return Math.sqrt(dX * dX + dY * dY);
- }
- b2PulleyJoint.prototype.GetRatio = function () {
- return this.m_ratio;
- }
- b2PulleyJoint.prototype.b2PulleyJoint = function (def) {
- this.__super.b2Joint.call(this, def);
- var tMat;
- var tX = 0;
- var tY = 0;
- this.m_ground = this.m_bodyA.m_world.m_groundBody;
- this.m_groundAnchor1.x = def.groundAnchorA.x - this.m_ground.m_xf.position.x;
- this.m_groundAnchor1.y = def.groundAnchorA.y - this.m_ground.m_xf.position.y;
- this.m_groundAnchor2.x = def.groundAnchorB.x - this.m_ground.m_xf.position.x;
- this.m_groundAnchor2.y = def.groundAnchorB.y - this.m_ground.m_xf.position.y;
- this.m_localAnchor1.SetV(def.localAnchorA);
- this.m_localAnchor2.SetV(def.localAnchorB);
- this.m_ratio = def.ratio;
- this.m_constant = def.lengthA + this.m_ratio * def.lengthB;
- this.m_maxLength1 = b2Math.Min(def.maxLengthA, this.m_constant - this.m_ratio * b2PulleyJoint.b2_minPulleyLength);
- this.m_maxLength2 = b2Math.Min(def.maxLengthB, (this.m_constant - b2PulleyJoint.b2_minPulleyLength) / this.m_ratio);
- this.m_impulse = 0.0;
- this.m_limitImpulse1 = 0.0;
- this.m_limitImpulse2 = 0.0;
- }
- b2PulleyJoint.prototype.InitVelocityConstraints = function (step) {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- var r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- var tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- var r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var p1X = bA.m_sweep.c.x + r1X;
- var p1Y = bA.m_sweep.c.y + r1Y;
- var p2X = bB.m_sweep.c.x + r2X;
- var p2Y = bB.m_sweep.c.y + r2Y;
- var s1X = this.m_ground.m_xf.position.x + this.m_groundAnchor1.x;
- var s1Y = this.m_ground.m_xf.position.y + this.m_groundAnchor1.y;
- var s2X = this.m_ground.m_xf.position.x + this.m_groundAnchor2.x;
- var s2Y = this.m_ground.m_xf.position.y + this.m_groundAnchor2.y;
- this.m_u1.Set(p1X - s1X, p1Y - s1Y);
- this.m_u2.Set(p2X - s2X, p2Y - s2Y);
- var length1 = this.m_u1.Length();
- var length2 = this.m_u2.Length();
- if (length1 > b2Settings.b2_linearSlop) {
- this.m_u1.Multiply(1.0 / length1);
- }
- else {
- this.m_u1.SetZero();
- }
- if (length2 > b2Settings.b2_linearSlop) {
- this.m_u2.Multiply(1.0 / length2);
- }
- else {
- this.m_u2.SetZero();
- }
- var C = this.m_constant - length1 - this.m_ratio * length2;
- if (C > 0.0) {
- this.m_state = b2Joint.e_inactiveLimit;
- this.m_impulse = 0.0;
- }
- else {
- this.m_state = b2Joint.e_atUpperLimit;
- }
- if (length1 < this.m_maxLength1) {
- this.m_limitState1 = b2Joint.e_inactiveLimit;
- this.m_limitImpulse1 = 0.0;
- }
- else {
- this.m_limitState1 = b2Joint.e_atUpperLimit;
- }
- if (length2 < this.m_maxLength2) {
- this.m_limitState2 = b2Joint.e_inactiveLimit;
- this.m_limitImpulse2 = 0.0;
- }
- else {
- this.m_limitState2 = b2Joint.e_atUpperLimit;
- }
- var cr1u1 = r1X * this.m_u1.y - r1Y * this.m_u1.x;
- var cr2u2 = r2X * this.m_u2.y - r2Y * this.m_u2.x;
- this.m_limitMass1 = bA.m_invMass + bA.m_invI * cr1u1 * cr1u1;
- this.m_limitMass2 = bB.m_invMass + bB.m_invI * cr2u2 * cr2u2;
- this.m_pulleyMass = this.m_limitMass1 + this.m_ratio * this.m_ratio * this.m_limitMass2;
- this.m_limitMass1 = 1.0 / this.m_limitMass1;
- this.m_limitMass2 = 1.0 / this.m_limitMass2;
- this.m_pulleyMass = 1.0 / this.m_pulleyMass;
- if (step.warmStarting) {
- this.m_impulse *= step.dtRatio;
- this.m_limitImpulse1 *= step.dtRatio;
- this.m_limitImpulse2 *= step.dtRatio;
- var P1X = ((-this.m_impulse) - this.m_limitImpulse1) * this.m_u1.x;
- var P1Y = ((-this.m_impulse) - this.m_limitImpulse1) * this.m_u1.y;
- var P2X = ((-this.m_ratio * this.m_impulse) - this.m_limitImpulse2) * this.m_u2.x;
- var P2Y = ((-this.m_ratio * this.m_impulse) - this.m_limitImpulse2) * this.m_u2.y;
- bA.m_linearVelocity.x += bA.m_invMass * P1X;
- bA.m_linearVelocity.y += bA.m_invMass * P1Y;
- bA.m_angularVelocity += bA.m_invI * (r1X * P1Y - r1Y * P1X);
- bB.m_linearVelocity.x += bB.m_invMass * P2X;
- bB.m_linearVelocity.y += bB.m_invMass * P2Y;
- bB.m_angularVelocity += bB.m_invI * (r2X * P2Y - r2Y * P2X);
- }
- else {
- this.m_impulse = 0.0;
- this.m_limitImpulse1 = 0.0;
- this.m_limitImpulse2 = 0.0;
- }
- }
- b2PulleyJoint.prototype.SolveVelocityConstraints = function (step) {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- var r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- var tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- var r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var v1X = 0;
- var v1Y = 0;
- var v2X = 0;
- var v2Y = 0;
- var P1X = 0;
- var P1Y = 0;
- var P2X = 0;
- var P2Y = 0;
- var Cdot = 0;
- var impulse = 0;
- var oldImpulse = 0;
- if (this.m_state == b2Joint.e_atUpperLimit) {
- v1X = bA.m_linearVelocity.x + ((-bA.m_angularVelocity * r1Y));
- v1Y = bA.m_linearVelocity.y + (bA.m_angularVelocity * r1X);
- v2X = bB.m_linearVelocity.x + ((-bB.m_angularVelocity * r2Y));
- v2Y = bB.m_linearVelocity.y + (bB.m_angularVelocity * r2X);
- Cdot = (-(this.m_u1.x * v1X + this.m_u1.y * v1Y)) - this.m_ratio * (this.m_u2.x * v2X + this.m_u2.y * v2Y);
- impulse = this.m_pulleyMass * ((-Cdot));
- oldImpulse = this.m_impulse;
- this.m_impulse = b2Math.Max(0.0, this.m_impulse + impulse);
- impulse = this.m_impulse - oldImpulse;
- P1X = (-impulse * this.m_u1.x);
- P1Y = (-impulse * this.m_u1.y);
- P2X = (-this.m_ratio * impulse * this.m_u2.x);
- P2Y = (-this.m_ratio * impulse * this.m_u2.y);
- bA.m_linearVelocity.x += bA.m_invMass * P1X;
- bA.m_linearVelocity.y += bA.m_invMass * P1Y;
- bA.m_angularVelocity += bA.m_invI * (r1X * P1Y - r1Y * P1X);
- bB.m_linearVelocity.x += bB.m_invMass * P2X;
- bB.m_linearVelocity.y += bB.m_invMass * P2Y;
- bB.m_angularVelocity += bB.m_invI * (r2X * P2Y - r2Y * P2X);
- }
- if (this.m_limitState1 == b2Joint.e_atUpperLimit) {
- v1X = bA.m_linearVelocity.x + ((-bA.m_angularVelocity * r1Y));
- v1Y = bA.m_linearVelocity.y + (bA.m_angularVelocity * r1X);
- Cdot = (-(this.m_u1.x * v1X + this.m_u1.y * v1Y));
- impulse = (-this.m_limitMass1 * Cdot);
- oldImpulse = this.m_limitImpulse1;
- this.m_limitImpulse1 = b2Math.Max(0.0, this.m_limitImpulse1 + impulse);
- impulse = this.m_limitImpulse1 - oldImpulse;
- P1X = (-impulse * this.m_u1.x);
- P1Y = (-impulse * this.m_u1.y);
- bA.m_linearVelocity.x += bA.m_invMass * P1X;
- bA.m_linearVelocity.y += bA.m_invMass * P1Y;
- bA.m_angularVelocity += bA.m_invI * (r1X * P1Y - r1Y * P1X);
- }
- if (this.m_limitState2 == b2Joint.e_atUpperLimit) {
- v2X = bB.m_linearVelocity.x + ((-bB.m_angularVelocity * r2Y));
- v2Y = bB.m_linearVelocity.y + (bB.m_angularVelocity * r2X);
- Cdot = (-(this.m_u2.x * v2X + this.m_u2.y * v2Y));
- impulse = (-this.m_limitMass2 * Cdot);
- oldImpulse = this.m_limitImpulse2;
- this.m_limitImpulse2 = b2Math.Max(0.0, this.m_limitImpulse2 + impulse);
- impulse = this.m_limitImpulse2 - oldImpulse;
- P2X = (-impulse * this.m_u2.x);
- P2Y = (-impulse * this.m_u2.y);
- bB.m_linearVelocity.x += bB.m_invMass * P2X;
- bB.m_linearVelocity.y += bB.m_invMass * P2Y;
- bB.m_angularVelocity += bB.m_invI * (r2X * P2Y - r2Y * P2X);
- }
- }
- b2PulleyJoint.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- var s1X = this.m_ground.m_xf.position.x + this.m_groundAnchor1.x;
- var s1Y = this.m_ground.m_xf.position.y + this.m_groundAnchor1.y;
- var s2X = this.m_ground.m_xf.position.x + this.m_groundAnchor2.x;
- var s2Y = this.m_ground.m_xf.position.y + this.m_groundAnchor2.y;
- var r1X = 0;
- var r1Y = 0;
- var r2X = 0;
- var r2Y = 0;
- var p1X = 0;
- var p1Y = 0;
- var p2X = 0;
- var p2Y = 0;
- var length1 = 0;
- var length2 = 0;
- var C = 0;
- var impulse = 0;
- var oldImpulse = 0;
- var oldLimitPositionImpulse = 0;
- var tX = 0;
- var linearError = 0.0;
- if (this.m_state == b2Joint.e_atUpperLimit) {
- tMat = bA.m_xf.R;
- r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- p1X = bA.m_sweep.c.x + r1X;
- p1Y = bA.m_sweep.c.y + r1Y;
- p2X = bB.m_sweep.c.x + r2X;
- p2Y = bB.m_sweep.c.y + r2Y;
- this.m_u1.Set(p1X - s1X, p1Y - s1Y);
- this.m_u2.Set(p2X - s2X, p2Y - s2Y);
- length1 = this.m_u1.Length();
- length2 = this.m_u2.Length();
- if (length1 > b2Settings.b2_linearSlop) {
- this.m_u1.Multiply(1.0 / length1);
- }
- else {
- this.m_u1.SetZero();
- }
- if (length2 > b2Settings.b2_linearSlop) {
- this.m_u2.Multiply(1.0 / length2);
- }
- else {
- this.m_u2.SetZero();
- }
- C = this.m_constant - length1 - this.m_ratio * length2;
- linearError = b2Math.Max(linearError, (-C));
- C = b2Math.Clamp(C + b2Settings.b2_linearSlop, (-b2Settings.b2_maxLinearCorrection), 0.0);
- impulse = (-this.m_pulleyMass * C);
- p1X = (-impulse * this.m_u1.x);
- p1Y = (-impulse * this.m_u1.y);
- p2X = (-this.m_ratio * impulse * this.m_u2.x);
- p2Y = (-this.m_ratio * impulse * this.m_u2.y);
- bA.m_sweep.c.x += bA.m_invMass * p1X;
- bA.m_sweep.c.y += bA.m_invMass * p1Y;
- bA.m_sweep.a += bA.m_invI * (r1X * p1Y - r1Y * p1X);
- bB.m_sweep.c.x += bB.m_invMass * p2X;
- bB.m_sweep.c.y += bB.m_invMass * p2Y;
- bB.m_sweep.a += bB.m_invI * (r2X * p2Y - r2Y * p2X);
- bA.SynchronizeTransform();
- bB.SynchronizeTransform();
- }
- if (this.m_limitState1 == b2Joint.e_atUpperLimit) {
- tMat = bA.m_xf.R;
- r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- p1X = bA.m_sweep.c.x + r1X;
- p1Y = bA.m_sweep.c.y + r1Y;
- this.m_u1.Set(p1X - s1X, p1Y - s1Y);
- length1 = this.m_u1.Length();
- if (length1 > b2Settings.b2_linearSlop) {
- this.m_u1.x *= 1.0 / length1;
- this.m_u1.y *= 1.0 / length1;
- }
- else {
- this.m_u1.SetZero();
- }
- C = this.m_maxLength1 - length1;
- linearError = b2Math.Max(linearError, (-C));
- C = b2Math.Clamp(C + b2Settings.b2_linearSlop, (-b2Settings.b2_maxLinearCorrection), 0.0);
- impulse = (-this.m_limitMass1 * C);
- p1X = (-impulse * this.m_u1.x);
- p1Y = (-impulse * this.m_u1.y);
- bA.m_sweep.c.x += bA.m_invMass * p1X;
- bA.m_sweep.c.y += bA.m_invMass * p1Y;
- bA.m_sweep.a += bA.m_invI * (r1X * p1Y - r1Y * p1X);
- bA.SynchronizeTransform();
- }
- if (this.m_limitState2 == b2Joint.e_atUpperLimit) {
- tMat = bB.m_xf.R;
- r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- p2X = bB.m_sweep.c.x + r2X;
- p2Y = bB.m_sweep.c.y + r2Y;
- this.m_u2.Set(p2X - s2X, p2Y - s2Y);
- length2 = this.m_u2.Length();
- if (length2 > b2Settings.b2_linearSlop) {
- this.m_u2.x *= 1.0 / length2;
- this.m_u2.y *= 1.0 / length2;
- }
- else {
- this.m_u2.SetZero();
- }
- C = this.m_maxLength2 - length2;
- linearError = b2Math.Max(linearError, (-C));
- C = b2Math.Clamp(C + b2Settings.b2_linearSlop, (-b2Settings.b2_maxLinearCorrection), 0.0);
- impulse = (-this.m_limitMass2 * C);
- p2X = (-impulse * this.m_u2.x);
- p2Y = (-impulse * this.m_u2.y);
- bB.m_sweep.c.x += bB.m_invMass * p2X;
- bB.m_sweep.c.y += bB.m_invMass * p2Y;
- bB.m_sweep.a += bB.m_invI * (r2X * p2Y - r2Y * p2X);
- bB.SynchronizeTransform();
- }
- return linearError < b2Settings.b2_linearSlop;
- }
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.Joints.b2PulleyJoint.b2_minPulleyLength = 2.0;
- });
- Box2D.inherit(b2PulleyJointDef, Box2D.Dynamics.Joints.b2JointDef);
- b2PulleyJointDef.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype;
- b2PulleyJointDef.b2PulleyJointDef = function () {
- Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);
- this.groundAnchorA = new b2Vec2();
- this.groundAnchorB = new b2Vec2();
- this.localAnchorA = new b2Vec2();
- this.localAnchorB = new b2Vec2();
- };
- b2PulleyJointDef.prototype.b2PulleyJointDef = function () {
- this.__super.b2JointDef.call(this);
- this.type = b2Joint.e_pulleyJoint;
- this.groundAnchorA.Set((-1.0), 1.0);
- this.groundAnchorB.Set(1.0, 1.0);
- this.localAnchorA.Set((-1.0), 0.0);
- this.localAnchorB.Set(1.0, 0.0);
- this.lengthA = 0.0;
- this.maxLengthA = 0.0;
- this.lengthB = 0.0;
- this.maxLengthB = 0.0;
- this.ratio = 1.0;
- this.collideConnected = true;
- }
- b2PulleyJointDef.prototype.Initialize = function (bA, bB, gaA, gaB, anchorA, anchorB, r) {
- if (r === undefined) r = 0;
- this.bodyA = bA;
- this.bodyB = bB;
- this.groundAnchorA.SetV(gaA);
- this.groundAnchorB.SetV(gaB);
- this.localAnchorA = this.bodyA.GetLocalPoint(anchorA);
- this.localAnchorB = this.bodyB.GetLocalPoint(anchorB);
- var d1X = anchorA.x - gaA.x;
- var d1Y = anchorA.y - gaA.y;
- this.lengthA = Math.sqrt(d1X * d1X + d1Y * d1Y);
- var d2X = anchorB.x - gaB.x;
- var d2Y = anchorB.y - gaB.y;
- this.lengthB = Math.sqrt(d2X * d2X + d2Y * d2Y);
- this.ratio = r;
- var C = this.lengthA + this.ratio * this.lengthB;
- this.maxLengthA = C - this.ratio * b2PulleyJoint.b2_minPulleyLength;
- this.maxLengthB = (C - b2PulleyJoint.b2_minPulleyLength) / this.ratio;
- }
- Box2D.inherit(b2RevoluteJoint, Box2D.Dynamics.Joints.b2Joint);
- b2RevoluteJoint.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype;
- b2RevoluteJoint.b2RevoluteJoint = function () {
- Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);
- this.K = new b2Mat22();
- this.K1 = new b2Mat22();
- this.K2 = new b2Mat22();
- this.K3 = new b2Mat22();
- this.impulse3 = new b2Vec3();
- this.impulse2 = new b2Vec2();
- this.reduced = new b2Vec2();
- this.m_localAnchor1 = new b2Vec2();
- this.m_localAnchor2 = new b2Vec2();
- this.m_impulse = new b2Vec3();
- this.m_mass = new b2Mat33();
- };
- b2RevoluteJoint.prototype.GetAnchorA = function () {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
- }
- b2RevoluteJoint.prototype.GetAnchorB = function () {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
- }
- b2RevoluteJoint.prototype.GetReactionForce = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return new b2Vec2(inv_dt * this.m_impulse.x, inv_dt * this.m_impulse.y);
- }
- b2RevoluteJoint.prototype.GetReactionTorque = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return inv_dt * this.m_impulse.z;
- }
- b2RevoluteJoint.prototype.GetJointAngle = function () {
- return this.m_bodyB.m_sweep.a - this.m_bodyA.m_sweep.a - this.m_referenceAngle;
- }
- b2RevoluteJoint.prototype.GetJointSpeed = function () {
- return this.m_bodyB.m_angularVelocity - this.m_bodyA.m_angularVelocity;
- }
- b2RevoluteJoint.prototype.IsLimitEnabled = function () {
- return this.m_enableLimit;
- }
- b2RevoluteJoint.prototype.EnableLimit = function (flag) {
- this.m_enableLimit = flag;
- }
- b2RevoluteJoint.prototype.GetLowerLimit = function () {
- return this.m_lowerAngle;
- }
- b2RevoluteJoint.prototype.GetUpperLimit = function () {
- return this.m_upperAngle;
- }
- b2RevoluteJoint.prototype.SetLimits = function (lower, upper) {
- if (lower === undefined) lower = 0;
- if (upper === undefined) upper = 0;
- this.m_lowerAngle = lower;
- this.m_upperAngle = upper;
- }
- b2RevoluteJoint.prototype.IsMotorEnabled = function () {
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- return this.m_enableMotor;
- }
- b2RevoluteJoint.prototype.EnableMotor = function (flag) {
- this.m_enableMotor = flag;
- }
- b2RevoluteJoint.prototype.SetMotorSpeed = function (speed) {
- if (speed === undefined) speed = 0;
- this.m_bodyA.SetAwake(true);
- this.m_bodyB.SetAwake(true);
- this.m_motorSpeed = speed;
- }
- b2RevoluteJoint.prototype.GetMotorSpeed = function () {
- return this.m_motorSpeed;
- }
- b2RevoluteJoint.prototype.SetMaxMotorTorque = function (torque) {
- if (torque === undefined) torque = 0;
- this.m_maxMotorTorque = torque;
- }
- b2RevoluteJoint.prototype.GetMotorTorque = function () {
- return this.m_maxMotorTorque;
- }
- b2RevoluteJoint.prototype.b2RevoluteJoint = function (def) {
- this.__super.b2Joint.call(this, def);
- this.m_localAnchor1.SetV(def.localAnchorA);
- this.m_localAnchor2.SetV(def.localAnchorB);
- this.m_referenceAngle = def.referenceAngle;
- this.m_impulse.SetZero();
- this.m_motorImpulse = 0.0;
- this.m_lowerAngle = def.lowerAngle;
- this.m_upperAngle = def.upperAngle;
- this.m_maxMotorTorque = def.maxMotorTorque;
- this.m_motorSpeed = def.motorSpeed;
- this.m_enableLimit = def.enableLimit;
- this.m_enableMotor = def.enableMotor;
- this.m_limitState = b2Joint.e_inactiveLimit;
- }
- b2RevoluteJoint.prototype.InitVelocityConstraints = function (step) {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- var tX = 0;
- if (this.m_enableMotor || this.m_enableLimit) {}
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- var r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- var r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var m1 = bA.m_invMass;
- var m2 = bB.m_invMass;
- var i1 = bA.m_invI;
- var i2 = bB.m_invI;
- this.m_mass.col1.x = m1 + m2 + r1Y * r1Y * i1 + r2Y * r2Y * i2;
- this.m_mass.col2.x = (-r1Y * r1X * i1) - r2Y * r2X * i2;
- this.m_mass.col3.x = (-r1Y * i1) - r2Y * i2;
- this.m_mass.col1.y = this.m_mass.col2.x;
- this.m_mass.col2.y = m1 + m2 + r1X * r1X * i1 + r2X * r2X * i2;
- this.m_mass.col3.y = r1X * i1 + r2X * i2;
- 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 = i1 + i2;
- this.m_motorMass = 1.0 / (i1 + i2);
- if (this.m_enableMotor == false) {
- this.m_motorImpulse = 0.0;
- }
- if (this.m_enableLimit) {
- var jointAngle = bB.m_sweep.a - bA.m_sweep.a - this.m_referenceAngle;
- if (b2Math.Abs(this.m_upperAngle - this.m_lowerAngle) < 2.0 * b2Settings.b2_angularSlop) {
- this.m_limitState = b2Joint.e_equalLimits;
- }
- else if (jointAngle <= this.m_lowerAngle) {
- if (this.m_limitState != b2Joint.e_atLowerLimit) {
- this.m_impulse.z = 0.0;
- }
- this.m_limitState = b2Joint.e_atLowerLimit;
- }
- else if (jointAngle >= this.m_upperAngle) {
- if (this.m_limitState != b2Joint.e_atUpperLimit) {
- this.m_impulse.z = 0.0;
- }
- this.m_limitState = b2Joint.e_atUpperLimit;
- }
- else {
- this.m_limitState = b2Joint.e_inactiveLimit;
- this.m_impulse.z = 0.0;
- }
- }
- else {
- this.m_limitState = b2Joint.e_inactiveLimit;
- }
- if (step.warmStarting) {
- this.m_impulse.x *= step.dtRatio;
- this.m_impulse.y *= step.dtRatio;
- this.m_motorImpulse *= step.dtRatio;
- var PX = this.m_impulse.x;
- var PY = this.m_impulse.y;
- bA.m_linearVelocity.x -= m1 * PX;
- bA.m_linearVelocity.y -= m1 * PY;
- bA.m_angularVelocity -= i1 * ((r1X * PY - r1Y * PX) + this.m_motorImpulse + this.m_impulse.z);
- bB.m_linearVelocity.x += m2 * PX;
- bB.m_linearVelocity.y += m2 * PY;
- bB.m_angularVelocity += i2 * ((r2X * PY - r2Y * PX) + this.m_motorImpulse + this.m_impulse.z);
- }
- else {
- this.m_impulse.SetZero();
- this.m_motorImpulse = 0.0;
- }
- }
- b2RevoluteJoint.prototype.SolveVelocityConstraints = function (step) {
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var tMat;
- var tX = 0;
- var newImpulse = 0;
- var r1X = 0;
- var r1Y = 0;
- var r2X = 0;
- var r2Y = 0;
- var v1 = bA.m_linearVelocity;
- var w1 = bA.m_angularVelocity;
- var v2 = bB.m_linearVelocity;
- var w2 = bB.m_angularVelocity;
- var m1 = bA.m_invMass;
- var m2 = bB.m_invMass;
- var i1 = bA.m_invI;
- var i2 = bB.m_invI;
- if (this.m_enableMotor && this.m_limitState != b2Joint.e_equalLimits) {
- var Cdot = w2 - w1 - this.m_motorSpeed;
- var impulse = this.m_motorMass * ((-Cdot));
- var oldImpulse = this.m_motorImpulse;
- var maxImpulse = step.dt * this.m_maxMotorTorque;
- this.m_motorImpulse = b2Math.Clamp(this.m_motorImpulse + impulse, (-maxImpulse), maxImpulse);
- impulse = this.m_motorImpulse - oldImpulse;
- w1 -= i1 * impulse;
- w2 += i2 * impulse;
- }
- if (this.m_enableLimit && this.m_limitState != b2Joint.e_inactiveLimit) {
- tMat = bA.m_xf.R;
- r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var Cdot1X = v2.x + ((-w2 * r2Y)) - v1.x - ((-w1 * r1Y));
- var Cdot1Y = v2.y + (w2 * r2X) - v1.y - (w1 * r1X);
- var Cdot2 = w2 - w1;
- this.m_mass.Solve33(this.impulse3, (-Cdot1X), (-Cdot1Y), (-Cdot2));
- if (this.m_limitState == b2Joint.e_equalLimits) {
- this.m_impulse.Add(this.impulse3);
- }
- else if (this.m_limitState == b2Joint.e_atLowerLimit) {
- newImpulse = this.m_impulse.z + this.impulse3.z;
- if (newImpulse < 0.0) {
- this.m_mass.Solve22(this.reduced, (-Cdot1X), (-Cdot1Y));
- 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.0;
- }
- }
- else if (this.m_limitState == b2Joint.e_atUpperLimit) {
- newImpulse = this.m_impulse.z + this.impulse3.z;
- if (newImpulse > 0.0) {
- this.m_mass.Solve22(this.reduced, (-Cdot1X), (-Cdot1Y));
- 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.0;
- }
- }
- v1.x -= m1 * this.impulse3.x;
- v1.y -= m1 * this.impulse3.y;
- w1 -= i1 * (r1X * this.impulse3.y - r1Y * this.impulse3.x + this.impulse3.z);
- v2.x += m2 * this.impulse3.x;
- v2.y += m2 * this.impulse3.y;
- w2 += i2 * (r2X * this.impulse3.y - r2Y * this.impulse3.x + this.impulse3.z);
- }
- else {
- tMat = bA.m_xf.R;
- r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var CdotX = v2.x + ((-w2 * r2Y)) - v1.x - ((-w1 * r1Y));
- var CdotY = v2.y + (w2 * r2X) - v1.y - (w1 * r1X);
- this.m_mass.Solve22(this.impulse2, (-CdotX), (-CdotY));
- this.m_impulse.x += this.impulse2.x;
- this.m_impulse.y += this.impulse2.y;
- v1.x -= m1 * this.impulse2.x;
- v1.y -= m1 * this.impulse2.y;
- w1 -= i1 * (r1X * this.impulse2.y - r1Y * this.impulse2.x);
- v2.x += m2 * this.impulse2.x;
- v2.y += m2 * this.impulse2.y;
- w2 += i2 * (r2X * this.impulse2.y - r2Y * this.impulse2.x);
- }
- bA.m_linearVelocity.SetV(v1);
- bA.m_angularVelocity = w1;
- bB.m_linearVelocity.SetV(v2);
- bB.m_angularVelocity = w2;
- }
- b2RevoluteJoint.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- var oldLimitImpulse = 0;
- var C = 0;
- var tMat;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var angularError = 0.0;
- var positionError = 0.0;
- var tX = 0;
- var impulseX = 0;
- var impulseY = 0;
- if (this.m_enableLimit && this.m_limitState != b2Joint.e_inactiveLimit) {
- var angle = bB.m_sweep.a - bA.m_sweep.a - this.m_referenceAngle;
- var limitImpulse = 0.0;
- if (this.m_limitState == b2Joint.e_equalLimits) {
- C = b2Math.Clamp(angle - this.m_lowerAngle, (-b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
- limitImpulse = (-this.m_motorMass * C);
- angularError = b2Math.Abs(C);
- }
- else if (this.m_limitState == b2Joint.e_atLowerLimit) {
- C = angle - this.m_lowerAngle;
- angularError = (-C);
- C = b2Math.Clamp(C + b2Settings.b2_angularSlop, (-b2Settings.b2_maxAngularCorrection), 0.0);
- limitImpulse = (-this.m_motorMass * C);
- }
- else if (this.m_limitState == b2Joint.e_atUpperLimit) {
- C = angle - this.m_upperAngle;
- angularError = C;
- C = b2Math.Clamp(C - b2Settings.b2_angularSlop, 0.0, b2Settings.b2_maxAngularCorrection);
- limitImpulse = (-this.m_motorMass * C);
- }
- bA.m_sweep.a -= bA.m_invI * limitImpulse;
- bB.m_sweep.a += bB.m_invI * limitImpulse;
- bA.SynchronizeTransform();
- bB.SynchronizeTransform();
- } {
- tMat = bA.m_xf.R;
- var r1X = this.m_localAnchor1.x - bA.m_sweep.localCenter.x;
- var r1Y = this.m_localAnchor1.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r1X + tMat.col2.x * r1Y);
- r1Y = (tMat.col1.y * r1X + tMat.col2.y * r1Y);
- r1X = tX;
- tMat = bB.m_xf.R;
- var r2X = this.m_localAnchor2.x - bB.m_sweep.localCenter.x;
- var r2Y = this.m_localAnchor2.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * r2X + tMat.col2.x * r2Y);
- r2Y = (tMat.col1.y * r2X + tMat.col2.y * r2Y);
- r2X = tX;
- var CX = bB.m_sweep.c.x + r2X - bA.m_sweep.c.x - r1X;
- var CY = bB.m_sweep.c.y + r2Y - bA.m_sweep.c.y - r1Y;
- var CLengthSquared = CX * CX + CY * CY;
- var CLength = Math.sqrt(CLengthSquared);
- positionError = CLength;
- var invMass1 = bA.m_invMass;
- var invMass2 = bB.m_invMass;
- var invI1 = bA.m_invI;
- var invI2 = bB.m_invI;
- var k_allowedStretch = 10.0 * b2Settings.b2_linearSlop;
- if (CLengthSquared > k_allowedStretch * k_allowedStretch) {
- var uX = CX / CLength;
- var uY = CY / CLength;
- var k = invMass1 + invMass2;
- var m = 1.0 / k;
- impulseX = m * ((-CX));
- impulseY = m * ((-CY));
- var k_beta = 0.5;
- bA.m_sweep.c.x -= k_beta * invMass1 * impulseX;
- bA.m_sweep.c.y -= k_beta * invMass1 * impulseY;
- bB.m_sweep.c.x += k_beta * invMass2 * impulseX;
- bB.m_sweep.c.y += k_beta * invMass2 * impulseY;
- CX = bB.m_sweep.c.x + r2X - bA.m_sweep.c.x - r1X;
- CY = bB.m_sweep.c.y + r2Y - bA.m_sweep.c.y - r1Y;
- }
- this.K1.col1.x = invMass1 + invMass2;
- this.K1.col2.x = 0.0;
- this.K1.col1.y = 0.0;
- this.K1.col2.y = invMass1 + invMass2;
- this.K2.col1.x = invI1 * r1Y * r1Y;
- this.K2.col2.x = (-invI1 * r1X * r1Y);
- this.K2.col1.y = (-invI1 * r1X * r1Y);
- this.K2.col2.y = invI1 * r1X * r1X;
- this.K3.col1.x = invI2 * r2Y * r2Y;
- this.K3.col2.x = (-invI2 * r2X * r2Y);
- this.K3.col1.y = (-invI2 * r2X * r2Y);
- this.K3.col2.y = invI2 * r2X * r2X;
- this.K.SetM(this.K1);
- this.K.AddM(this.K2);
- this.K.AddM(this.K3);
- this.K.Solve(b2RevoluteJoint.tImpulse, (-CX), (-CY));
- impulseX = b2RevoluteJoint.tImpulse.x;
- impulseY = b2RevoluteJoint.tImpulse.y;
- bA.m_sweep.c.x -= bA.m_invMass * impulseX;
- bA.m_sweep.c.y -= bA.m_invMass * impulseY;
- bA.m_sweep.a -= bA.m_invI * (r1X * impulseY - r1Y * impulseX);
- bB.m_sweep.c.x += bB.m_invMass * impulseX;
- bB.m_sweep.c.y += bB.m_invMass * impulseY;
- bB.m_sweep.a += bB.m_invI * (r2X * impulseY - r2Y * impulseX);
- bA.SynchronizeTransform();
- bB.SynchronizeTransform();
- }
- return positionError <= b2Settings.b2_linearSlop && angularError <= b2Settings.b2_angularSlop;
- }
- Box2D.postDefs.push(function () {
- Box2D.Dynamics.Joints.b2RevoluteJoint.tImpulse = new b2Vec2();
- });
- Box2D.inherit(b2RevoluteJointDef, Box2D.Dynamics.Joints.b2JointDef);
- b2RevoluteJointDef.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype;
- b2RevoluteJointDef.b2RevoluteJointDef = function () {
- Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);
- this.localAnchorA = new b2Vec2();
- this.localAnchorB = new b2Vec2();
- };
- b2RevoluteJointDef.prototype.b2RevoluteJointDef = function () {
- this.__super.b2JointDef.call(this);
- this.type = b2Joint.e_revoluteJoint;
- this.localAnchorA.Set(0.0, 0.0);
- this.localAnchorB.Set(0.0, 0.0);
- this.referenceAngle = 0.0;
- this.lowerAngle = 0.0;
- this.upperAngle = 0.0;
- this.maxMotorTorque = 0.0;
- this.motorSpeed = 0.0;
- this.enableLimit = false;
- this.enableMotor = false;
- }
- b2RevoluteJointDef.prototype.Initialize = function (bA, bB, anchor) {
- this.bodyA = bA;
- this.bodyB = bB;
- this.localAnchorA = this.bodyA.GetLocalPoint(anchor);
- this.localAnchorB = this.bodyB.GetLocalPoint(anchor);
- this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
- }
- Box2D.inherit(b2WeldJoint, Box2D.Dynamics.Joints.b2Joint);
- b2WeldJoint.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype;
- b2WeldJoint.b2WeldJoint = function () {
- Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments);
- this.m_localAnchorA = new b2Vec2();
- this.m_localAnchorB = new b2Vec2();
- this.m_impulse = new b2Vec3();
- this.m_mass = new b2Mat33();
- };
- b2WeldJoint.prototype.GetAnchorA = function () {
- return this.m_bodyA.GetWorldPoint(this.m_localAnchorA);
- }
- b2WeldJoint.prototype.GetAnchorB = function () {
- return this.m_bodyB.GetWorldPoint(this.m_localAnchorB);
- }
- b2WeldJoint.prototype.GetReactionForce = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return new b2Vec2(inv_dt * this.m_impulse.x, inv_dt * this.m_impulse.y);
- }
- b2WeldJoint.prototype.GetReactionTorque = function (inv_dt) {
- if (inv_dt === undefined) inv_dt = 0;
- return inv_dt * this.m_impulse.z;
- }
- b2WeldJoint.prototype.b2WeldJoint = function (def) {
- this.__super.b2Joint.call(this, def);
- this.m_localAnchorA.SetV(def.localAnchorA);
- this.m_localAnchorB.SetV(def.localAnchorB);
- this.m_referenceAngle = def.referenceAngle;
- this.m_impulse.SetZero();
- this.m_mass = new b2Mat33();
- }
- b2WeldJoint.prototype.InitVelocityConstraints = function (step) {
- var tMat;
- var tX = 0;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- tMat = bA.m_xf.R;
- var rAX = this.m_localAnchorA.x - bA.m_sweep.localCenter.x;
- var rAY = this.m_localAnchorA.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rAX + tMat.col2.x * rAY);
- rAY = (tMat.col1.y * rAX + tMat.col2.y * rAY);
- rAX = tX;
- tMat = bB.m_xf.R;
- var rBX = this.m_localAnchorB.x - bB.m_sweep.localCenter.x;
- var rBY = this.m_localAnchorB.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rBX + tMat.col2.x * rBY);
- rBY = (tMat.col1.y * rBX + tMat.col2.y * rBY);
- rBX = tX;
- var mA = bA.m_invMass;
- var mB = bB.m_invMass;
- var iA = bA.m_invI;
- var iB = bB.m_invI;
- this.m_mass.col1.x = mA + mB + rAY * rAY * iA + rBY * rBY * iB;
- this.m_mass.col2.x = (-rAY * rAX * iA) - rBY * rBX * iB;
- this.m_mass.col3.x = (-rAY * iA) - rBY * iB;
- this.m_mass.col1.y = this.m_mass.col2.x;
- this.m_mass.col2.y = mA + mB + rAX * rAX * iA + rBX * rBX * iB;
- this.m_mass.col3.y = rAX * iA + rBX * iB;
- 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 = iA + iB;
- if (step.warmStarting) {
- this.m_impulse.x *= step.dtRatio;
- this.m_impulse.y *= step.dtRatio;
- this.m_impulse.z *= step.dtRatio;
- bA.m_linearVelocity.x -= mA * this.m_impulse.x;
- bA.m_linearVelocity.y -= mA * this.m_impulse.y;
- bA.m_angularVelocity -= iA * (rAX * this.m_impulse.y - rAY * this.m_impulse.x + this.m_impulse.z);
- bB.m_linearVelocity.x += mB * this.m_impulse.x;
- bB.m_linearVelocity.y += mB * this.m_impulse.y;
- bB.m_angularVelocity += iB * (rBX * this.m_impulse.y - rBY * this.m_impulse.x + this.m_impulse.z);
- }
- else {
- this.m_impulse.SetZero();
- }
- }
- b2WeldJoint.prototype.SolveVelocityConstraints = function (step) {
- var tMat;
- var tX = 0;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- var vA = bA.m_linearVelocity;
- var wA = bA.m_angularVelocity;
- var vB = bB.m_linearVelocity;
- var wB = bB.m_angularVelocity;
- var mA = bA.m_invMass;
- var mB = bB.m_invMass;
- var iA = bA.m_invI;
- var iB = bB.m_invI;
- tMat = bA.m_xf.R;
- var rAX = this.m_localAnchorA.x - bA.m_sweep.localCenter.x;
- var rAY = this.m_localAnchorA.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rAX + tMat.col2.x * rAY);
- rAY = (tMat.col1.y * rAX + tMat.col2.y * rAY);
- rAX = tX;
- tMat = bB.m_xf.R;
- var rBX = this.m_localAnchorB.x - bB.m_sweep.localCenter.x;
- var rBY = this.m_localAnchorB.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rBX + tMat.col2.x * rBY);
- rBY = (tMat.col1.y * rBX + tMat.col2.y * rBY);
- rBX = tX;
- var Cdot1X = vB.x - wB * rBY - vA.x + wA * rAY;
- var Cdot1Y = vB.y + wB * rBX - vA.y - wA * rAX;
- var Cdot2 = wB - wA;
- var impulse = new b2Vec3();
- this.m_mass.Solve33(impulse, (-Cdot1X), (-Cdot1Y), (-Cdot2));
- this.m_impulse.Add(impulse);
- vA.x -= mA * impulse.x;
- vA.y -= mA * impulse.y;
- wA -= iA * (rAX * impulse.y - rAY * impulse.x + impulse.z);
- vB.x += mB * impulse.x;
- vB.y += mB * impulse.y;
- wB += iB * (rBX * impulse.y - rBY * impulse.x + impulse.z);
- bA.m_angularVelocity = wA;
- bB.m_angularVelocity = wB;
- }
- b2WeldJoint.prototype.SolvePositionConstraints = function (baumgarte) {
- if (baumgarte === undefined) baumgarte = 0;
- var tMat;
- var tX = 0;
- var bA = this.m_bodyA;
- var bB = this.m_bodyB;
- tMat = bA.m_xf.R;
- var rAX = this.m_localAnchorA.x - bA.m_sweep.localCenter.x;
- var rAY = this.m_localAnchorA.y - bA.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rAX + tMat.col2.x * rAY);
- rAY = (tMat.col1.y * rAX + tMat.col2.y * rAY);
- rAX = tX;
- tMat = bB.m_xf.R;
- var rBX = this.m_localAnchorB.x - bB.m_sweep.localCenter.x;
- var rBY = this.m_localAnchorB.y - bB.m_sweep.localCenter.y;
- tX = (tMat.col1.x * rBX + tMat.col2.x * rBY);
- rBY = (tMat.col1.y * rBX + tMat.col2.y * rBY);
- rBX = tX;
- var mA = bA.m_invMass;
- var mB = bB.m_invMass;
- var iA = bA.m_invI;
- var iB = bB.m_invI;
- var C1X = bB.m_sweep.c.x + rBX - bA.m_sweep.c.x - rAX;
- var C1Y = bB.m_sweep.c.y + rBY - bA.m_sweep.c.y - rAY;
- var C2 = bB.m_sweep.a - bA.m_sweep.a - this.m_referenceAngle;
- var k_allowedStretch = 10.0 * b2Settings.b2_linearSlop;
- var positionError = Math.sqrt(C1X * C1X + C1Y * C1Y);
- var angularError = b2Math.Abs(C2);
- if (positionError > k_allowedStretch) {
- iA *= 1.0;
- iB *= 1.0;
- }
- this.m_mass.col1.x = mA + mB + rAY * rAY * iA + rBY * rBY * iB;
- this.m_mass.col2.x = (-rAY * rAX * iA) - rBY * rBX * iB;
- this.m_mass.col3.x = (-rAY * iA) - rBY * iB;
- this.m_mass.col1.y = this.m_mass.col2.x;
- this.m_mass.col2.y = mA + mB + rAX * rAX * iA + rBX * rBX * iB;
- this.m_mass.col3.y = rAX * iA + rBX * iB;
- 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 = iA + iB;
- var impulse = new b2Vec3();
- this.m_mass.Solve33(impulse, (-C1X), (-C1Y), (-C2));
- bA.m_sweep.c.x -= mA * impulse.x;
- bA.m_sweep.c.y -= mA * impulse.y;
- bA.m_sweep.a -= iA * (rAX * impulse.y - rAY * impulse.x + impulse.z);
- bB.m_sweep.c.x += mB * impulse.x;
- bB.m_sweep.c.y += mB * impulse.y;
- bB.m_sweep.a += iB * (rBX * impulse.y - rBY * impulse.x + impulse.z);
- bA.SynchronizeTransform();
- bB.SynchronizeTransform();
- return positionError <= b2Settings.b2_linearSlop && angularError <= b2Settings.b2_angularSlop;
- }
- Box2D.inherit(b2WeldJointDef, Box2D.Dynamics.Joints.b2JointDef);
- b2WeldJointDef.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype;
- b2WeldJointDef.b2WeldJointDef = function () {
- Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);
- this.localAnchorA = new b2Vec2();
- this.localAnchorB = new b2Vec2();
- };
- b2WeldJointDef.prototype.b2WeldJointDef = function () {
- this.__super.b2JointDef.call(this);
- this.type = b2Joint.e_weldJoint;
- this.referenceAngle = 0.0;
- }
- b2WeldJointDef.prototype.Initialize = function (bA, bB, anchor) {
- this.bodyA = bA;
- this.bodyB = bB;
- this.localAnchorA.SetV(this.bodyA.GetLocalPoint(anchor));
- this.localAnchorB.SetV(this.bodyB.GetLocalPoint(anchor));
- this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
- }
-})();
-(function () {
- var b2DebugDraw = Box2D.Dynamics.b2DebugDraw;
- b2DebugDraw.b2DebugDraw = function () {
- this.m_drawScale = 1.0;
- this.m_lineThickness = 1.0;
- this.m_alpha = 1.0;
- this.m_fillAlpha = 1.0;
- this.m_xformScale = 1.0;
- var __this = this;
- //#WORKAROUND
- this.m_sprite = {
- graphics: {
- clear: function () {
- __this.m_ctx.clearRect(0, 0, __this.m_ctx.canvas.width, __this.m_ctx.canvas.height)
- }
- }
- };
- };
- b2DebugDraw.prototype._color = function (color, alpha) {
- return "rgba(" + ((color & 0xFF0000) >> 16) + "," + ((color & 0xFF00) >> 8) + "," + (color & 0xFF) + "," + alpha + ")";
- };
- b2DebugDraw.prototype.b2DebugDraw = function () {
- this.m_drawFlags = 0;
- };
- b2DebugDraw.prototype.SetFlags = function (flags) {
- if (flags === undefined) flags = 0;
- this.m_drawFlags = flags;
- };
- b2DebugDraw.prototype.GetFlags = function () {
- return this.m_drawFlags;
- };
- b2DebugDraw.prototype.AppendFlags = function (flags) {
- if (flags === undefined) flags = 0;
- this.m_drawFlags |= flags;
- };
- b2DebugDraw.prototype.ClearFlags = function (flags) {
- if (flags === undefined) flags = 0;
- this.m_drawFlags &= ~flags;
- };
- b2DebugDraw.prototype.SetSprite = function (sprite) {
- this.m_ctx = sprite;
- };
- b2DebugDraw.prototype.GetSprite = function () {
- return this.m_ctx;
- };
- b2DebugDraw.prototype.SetDrawScale = function (drawScale) {
- if (drawScale === undefined) drawScale = 0;
- this.m_drawScale = drawScale;
- };
- b2DebugDraw.prototype.GetDrawScale = function () {
- return this.m_drawScale;
- };
- b2DebugDraw.prototype.SetLineThickness = function (lineThickness) {
- if (lineThickness === undefined) lineThickness = 0;
- this.m_lineThickness = lineThickness;
- this.m_ctx.strokeWidth = lineThickness;
- };
- b2DebugDraw.prototype.GetLineThickness = function () {
- return this.m_lineThickness;
- };
- b2DebugDraw.prototype.SetAlpha = function (alpha) {
- if (alpha === undefined) alpha = 0;
- this.m_alpha = alpha;
- };
- b2DebugDraw.prototype.GetAlpha = function () {
- return this.m_alpha;
- };
- b2DebugDraw.prototype.SetFillAlpha = function (alpha) {
- if (alpha === undefined) alpha = 0;
- this.m_fillAlpha = alpha;
- };
- b2DebugDraw.prototype.GetFillAlpha = function () {
- return this.m_fillAlpha;
- };
- b2DebugDraw.prototype.SetXFormScale = function (xformScale) {
- if (xformScale === undefined) xformScale = 0;
- this.m_xformScale = xformScale;
- };
- b2DebugDraw.prototype.GetXFormScale = function () {
- return this.m_xformScale;
- };
- b2DebugDraw.prototype.DrawPolygon = function (vertices, vertexCount, color) {
- if (!vertexCount) return;
- var s = this.m_ctx;
- var drawScale = this.m_drawScale;
- s.beginPath();
- s.strokeStyle = this._color(color.color, this.m_alpha);
- s.moveTo(vertices[0].x * drawScale, vertices[0].y * drawScale);
- for (var i = 1; i < vertexCount; i++) {
- s.lineTo(vertices[i].x * drawScale, vertices[i].y * drawScale);
- }
- s.lineTo(vertices[0].x * drawScale, vertices[0].y * drawScale);
- s.closePath();
- s.stroke();
- };
- b2DebugDraw.prototype.DrawSolidPolygon = function (vertices, vertexCount, color) {
- if (!vertexCount) return;
- var s = this.m_ctx;
- var drawScale = this.m_drawScale;
- s.beginPath();
- s.strokeStyle = this._color(color.color, this.m_alpha);
- s.fillStyle = this._color(color.color, this.m_fillAlpha);
- s.moveTo(vertices[0].x * drawScale, vertices[0].y * drawScale);
- for (var i = 1; i < vertexCount; i++) {
- s.lineTo(vertices[i].x * drawScale, vertices[i].y * drawScale);
- }
- s.lineTo(vertices[0].x * drawScale, vertices[0].y * drawScale);
- s.closePath();
- s.fill();
- s.stroke();
- };
- b2DebugDraw.prototype.DrawCircle = function (center, radius, color) {
- if (!radius) return;
- var s = this.m_ctx;
- var drawScale = this.m_drawScale;
- s.beginPath();
- s.strokeStyle = this._color(color.color, this.m_alpha);
- s.arc(center.x * drawScale, center.y * drawScale, radius * drawScale, 0, Math.PI * 2, true);
- s.closePath();
- s.stroke();
- };
- b2DebugDraw.prototype.DrawSolidCircle = function (center, radius, axis, color) {
- if (!radius) return;
- var s = this.m_ctx,
- drawScale = this.m_drawScale,
- cx = center.x * drawScale,
- cy = center.y * drawScale;
- s.moveTo(0, 0);
- s.beginPath();
- s.strokeStyle = this._color(color.color, this.m_alpha);
- s.fillStyle = this._color(color.color, this.m_fillAlpha);
- s.arc(cx, cy, radius * drawScale, 0, Math.PI * 2, true);
- s.moveTo(cx, cy);
- s.lineTo((center.x + axis.x * radius) * drawScale, (center.y + axis.y * radius) * drawScale);
- s.closePath();
- s.fill();
- s.stroke();
- };
- b2DebugDraw.prototype.DrawSegment = function (p1, p2, color) {
- var s = this.m_ctx,
- drawScale = this.m_drawScale;
- s.strokeStyle = this._color(color.color, this.m_alpha);
- s.beginPath();
- s.moveTo(p1.x * drawScale, p1.y * drawScale);
- s.lineTo(p2.x * drawScale, p2.y * drawScale);
- s.closePath();
- s.stroke();
- };
- b2DebugDraw.prototype.DrawTransform = function (xf) {
- var s = this.m_ctx,
- drawScale = this.m_drawScale;
- s.beginPath();
- s.strokeStyle = this._color(0xff0000, this.m_alpha);
- s.moveTo(xf.position.x * drawScale, xf.position.y * drawScale);
- s.lineTo((xf.position.x + this.m_xformScale * xf.R.col1.x) * drawScale, (xf.position.y + this.m_xformScale * xf.R.col1.y) * drawScale);
-
- s.strokeStyle = this._color(0xff00, this.m_alpha);
- s.moveTo(xf.position.x * drawScale, xf.position.y * drawScale);
- s.lineTo((xf.position.x + this.m_xformScale * xf.R.col2.x) * drawScale, (xf.position.y + this.m_xformScale * xf.R.col2.y) * drawScale);
- s.closePath();
- s.stroke();
- };
-})(); //post-definitions
-var i;
-for (i = 0; i < Box2D.postDefs.length; ++i) Box2D.postDefs[i]();
-delete Box2D.postDefs;
\ No newline at end of file
--- a/integ/js/vs/lib/Box2DWeb/Box2DWeb-2.1.a.3.min.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,445 +0,0 @@
-var Box2D={};
-(function(F,G){function K(){}if(!(Object.prototype.defineProperty instanceof Function)&&Object.prototype.__defineGetter__ instanceof Function&&Object.prototype.__defineSetter__ instanceof Function)Object.defineProperty=function(y,w,A){A.get instanceof Function&&y.__defineGetter__(w,A.get);A.set instanceof Function&&y.__defineSetter__(w,A.set)};F.inherit=function(y,w){K.prototype=w.prototype;y.prototype=new K;y.prototype.constructor=y};F.generateCallback=function(y,w){return function(){w.apply(y,arguments)}};
-F.NVector=function(y){if(y===G)y=0;for(var w=Array(y||0),A=0;A<y;++A)w[A]=0;return w};F.is=function(y,w){if(y===null)return false;if(w instanceof Function&&y instanceof w)return true;if(y.constructor.__implements!=G&&y.constructor.__implements[w])return true;return false};F.parseUInt=function(y){return Math.abs(parseInt(y))}})(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 F(){F.b2AABB.apply(this,arguments)}function G(){G.b2Bound.apply(this,arguments)}function K(){K.b2BoundValues.apply(this,arguments);this.constructor===K&&this.b2BoundValues.apply(this,arguments)}function y(){y.b2Collision.apply(this,arguments)}function w(){w.b2ContactID.apply(this,arguments);this.constructor===w&&this.b2ContactID.apply(this,arguments)}function A(){A.b2ContactPoint.apply(this,arguments)}function U(){U.b2Distance.apply(this,arguments)}function p(){p.b2DistanceInput.apply(this,
-arguments)}function B(){B.b2DistanceOutput.apply(this,arguments)}function Q(){Q.b2DistanceProxy.apply(this,arguments)}function V(){V.b2DynamicTree.apply(this,arguments);this.constructor===V&&this.b2DynamicTree.apply(this,arguments)}function M(){M.b2DynamicTreeBroadPhase.apply(this,arguments)}function L(){L.b2DynamicTreeNode.apply(this,arguments)}function I(){I.b2DynamicTreePair.apply(this,arguments)}function W(){W.b2Manifold.apply(this,arguments);this.constructor===W&&this.b2Manifold.apply(this,arguments)}
-function Y(){Y.b2ManifoldPoint.apply(this,arguments);this.constructor===Y&&this.b2ManifoldPoint.apply(this,arguments)}function k(){k.b2Point.apply(this,arguments)}function z(){z.b2RayCastInput.apply(this,arguments);this.constructor===z&&this.b2RayCastInput.apply(this,arguments)}function u(){u.b2RayCastOutput.apply(this,arguments)}function D(){D.b2Segment.apply(this,arguments)}function H(){H.b2SeparationFunction.apply(this,arguments)}function O(){O.b2Simplex.apply(this,arguments);this.constructor===
-O&&this.b2Simplex.apply(this,arguments)}function E(){E.b2SimplexCache.apply(this,arguments)}function R(){R.b2SimplexVertex.apply(this,arguments)}function N(){N.b2TimeOfImpact.apply(this,arguments)}function S(){S.b2TOIInput.apply(this,arguments)}function aa(){aa.b2WorldManifold.apply(this,arguments);this.constructor===aa&&this.b2WorldManifold.apply(this,arguments)}function Z(){Z.ClipVertex.apply(this,arguments)}function d(){d.Features.apply(this,arguments)}function h(){h.b2CircleShape.apply(this,arguments);
-this.constructor===h&&this.b2CircleShape.apply(this,arguments)}function l(){l.b2EdgeChainDef.apply(this,arguments);this.constructor===l&&this.b2EdgeChainDef.apply(this,arguments)}function j(){j.b2EdgeShape.apply(this,arguments);this.constructor===j&&this.b2EdgeShape.apply(this,arguments)}function o(){o.b2MassData.apply(this,arguments)}function q(){q.b2PolygonShape.apply(this,arguments);this.constructor===q&&this.b2PolygonShape.apply(this,arguments)}function n(){n.b2Shape.apply(this,arguments);this.constructor===
-n&&this.b2Shape.apply(this,arguments)}function a(){a.b2Color.apply(this,arguments);this.constructor===a&&this.b2Color.apply(this,arguments)}function c(){c.b2Settings.apply(this,arguments)}function g(){g.b2Mat22.apply(this,arguments);this.constructor===g&&this.b2Mat22.apply(this,arguments)}function b(){b.b2Mat33.apply(this,arguments);this.constructor===b&&this.b2Mat33.apply(this,arguments)}function e(){e.b2Math.apply(this,arguments)}function f(){f.b2Sweep.apply(this,arguments)}function m(){m.b2Transform.apply(this,
-arguments);this.constructor===m&&this.b2Transform.apply(this,arguments)}function r(){r.b2Vec2.apply(this,arguments);this.constructor===r&&this.b2Vec2.apply(this,arguments)}function s(){s.b2Vec3.apply(this,arguments);this.constructor===s&&this.b2Vec3.apply(this,arguments)}function v(){v.b2Body.apply(this,arguments);this.constructor===v&&this.b2Body.apply(this,arguments)}function t(){t.b2BodyDef.apply(this,arguments);this.constructor===t&&this.b2BodyDef.apply(this,arguments)}function x(){x.b2ContactFilter.apply(this,
-arguments)}function C(){C.b2ContactImpulse.apply(this,arguments)}function J(){J.b2ContactListener.apply(this,arguments)}function T(){T.b2ContactManager.apply(this,arguments);this.constructor===T&&this.b2ContactManager.apply(this,arguments)}function P(){P.b2DebugDraw.apply(this,arguments);this.constructor===P&&this.b2DebugDraw.apply(this,arguments)}function X(){X.b2DestructionListener.apply(this,arguments)}function $(){$.b2FilterData.apply(this,arguments)}function ba(){ba.b2Fixture.apply(this,arguments);
-this.constructor===ba&&this.b2Fixture.apply(this,arguments)}function ca(){ca.b2FixtureDef.apply(this,arguments);this.constructor===ca&&this.b2FixtureDef.apply(this,arguments)}function da(){da.b2Island.apply(this,arguments);this.constructor===da&&this.b2Island.apply(this,arguments)}function Fa(){Fa.b2TimeStep.apply(this,arguments)}function ea(){ea.b2World.apply(this,arguments);this.constructor===ea&&this.b2World.apply(this,arguments)}function Ga(){Ga.b2CircleContact.apply(this,arguments)}function fa(){fa.b2Contact.apply(this,
-arguments);this.constructor===fa&&this.b2Contact.apply(this,arguments)}function ga(){ga.b2ContactConstraint.apply(this,arguments);this.constructor===ga&&this.b2ContactConstraint.apply(this,arguments)}function Ha(){Ha.b2ContactConstraintPoint.apply(this,arguments)}function Ia(){Ia.b2ContactEdge.apply(this,arguments)}function ha(){ha.b2ContactFactory.apply(this,arguments);this.constructor===ha&&this.b2ContactFactory.apply(this,arguments)}function Ja(){Ja.b2ContactRegister.apply(this,arguments)}function Ka(){Ka.b2ContactResult.apply(this,
-arguments)}function ia(){ia.b2ContactSolver.apply(this,arguments);this.constructor===ia&&this.b2ContactSolver.apply(this,arguments)}function La(){La.b2EdgeAndCircleContact.apply(this,arguments)}function ja(){ja.b2NullContact.apply(this,arguments);this.constructor===ja&&this.b2NullContact.apply(this,arguments)}function Ma(){Ma.b2PolyAndCircleContact.apply(this,arguments)}function Na(){Na.b2PolyAndEdgeContact.apply(this,arguments)}function Oa(){Oa.b2PolygonContact.apply(this,arguments)}function ka(){ka.b2PositionSolverManifold.apply(this,
-arguments);this.constructor===ka&&this.b2PositionSolverManifold.apply(this,arguments)}function Pa(){Pa.b2BuoyancyController.apply(this,arguments)}function Qa(){Qa.b2ConstantAccelController.apply(this,arguments)}function Ra(){Ra.b2ConstantForceController.apply(this,arguments)}function Sa(){Sa.b2Controller.apply(this,arguments)}function Ta(){Ta.b2ControllerEdge.apply(this,arguments)}function Ua(){Ua.b2GravityController.apply(this,arguments)}function Va(){Va.b2TensorDampingController.apply(this,arguments)}
-function la(){la.b2DistanceJoint.apply(this,arguments);this.constructor===la&&this.b2DistanceJoint.apply(this,arguments)}function ma(){ma.b2DistanceJointDef.apply(this,arguments);this.constructor===ma&&this.b2DistanceJointDef.apply(this,arguments)}function na(){na.b2FrictionJoint.apply(this,arguments);this.constructor===na&&this.b2FrictionJoint.apply(this,arguments)}function oa(){oa.b2FrictionJointDef.apply(this,arguments);this.constructor===oa&&this.b2FrictionJointDef.apply(this,arguments)}function pa(){pa.b2GearJoint.apply(this,
-arguments);this.constructor===pa&&this.b2GearJoint.apply(this,arguments)}function qa(){qa.b2GearJointDef.apply(this,arguments);this.constructor===qa&&this.b2GearJointDef.apply(this,arguments)}function Wa(){Wa.b2Jacobian.apply(this,arguments)}function ra(){ra.b2Joint.apply(this,arguments);this.constructor===ra&&this.b2Joint.apply(this,arguments)}function sa(){sa.b2JointDef.apply(this,arguments);this.constructor===sa&&this.b2JointDef.apply(this,arguments)}function Xa(){Xa.b2JointEdge.apply(this,arguments)}
-function ta(){ta.b2LineJoint.apply(this,arguments);this.constructor===ta&&this.b2LineJoint.apply(this,arguments)}function ua(){ua.b2LineJointDef.apply(this,arguments);this.constructor===ua&&this.b2LineJointDef.apply(this,arguments)}function va(){va.b2MouseJoint.apply(this,arguments);this.constructor===va&&this.b2MouseJoint.apply(this,arguments)}function wa(){wa.b2MouseJointDef.apply(this,arguments);this.constructor===wa&&this.b2MouseJointDef.apply(this,arguments)}function xa(){xa.b2PrismaticJoint.apply(this,
-arguments);this.constructor===xa&&this.b2PrismaticJoint.apply(this,arguments)}function ya(){ya.b2PrismaticJointDef.apply(this,arguments);this.constructor===ya&&this.b2PrismaticJointDef.apply(this,arguments)}function za(){za.b2PulleyJoint.apply(this,arguments);this.constructor===za&&this.b2PulleyJoint.apply(this,arguments)}function Aa(){Aa.b2PulleyJointDef.apply(this,arguments);this.constructor===Aa&&this.b2PulleyJointDef.apply(this,arguments)}function Ba(){Ba.b2RevoluteJoint.apply(this,arguments);
-this.constructor===Ba&&this.b2RevoluteJoint.apply(this,arguments)}function Ca(){Ca.b2RevoluteJointDef.apply(this,arguments);this.constructor===Ca&&this.b2RevoluteJointDef.apply(this,arguments)}function Da(){Da.b2WeldJoint.apply(this,arguments);this.constructor===Da&&this.b2WeldJoint.apply(this,arguments)}function Ea(){Ea.b2WeldJointDef.apply(this,arguments);this.constructor===Ea&&this.b2WeldJointDef.apply(this,arguments)}Box2D.Collision.IBroadPhase="Box2D.Collision.IBroadPhase";Box2D.Collision.b2AABB=
-F;Box2D.Collision.b2Bound=G;Box2D.Collision.b2BoundValues=K;Box2D.Collision.b2Collision=y;Box2D.Collision.b2ContactID=w;Box2D.Collision.b2ContactPoint=A;Box2D.Collision.b2Distance=U;Box2D.Collision.b2DistanceInput=p;Box2D.Collision.b2DistanceOutput=B;Box2D.Collision.b2DistanceProxy=Q;Box2D.Collision.b2DynamicTree=V;Box2D.Collision.b2DynamicTreeBroadPhase=M;Box2D.Collision.b2DynamicTreeNode=L;Box2D.Collision.b2DynamicTreePair=I;Box2D.Collision.b2Manifold=W;Box2D.Collision.b2ManifoldPoint=Y;Box2D.Collision.b2Point=
-k;Box2D.Collision.b2RayCastInput=z;Box2D.Collision.b2RayCastOutput=u;Box2D.Collision.b2Segment=D;Box2D.Collision.b2SeparationFunction=H;Box2D.Collision.b2Simplex=O;Box2D.Collision.b2SimplexCache=E;Box2D.Collision.b2SimplexVertex=R;Box2D.Collision.b2TimeOfImpact=N;Box2D.Collision.b2TOIInput=S;Box2D.Collision.b2WorldManifold=aa;Box2D.Collision.ClipVertex=Z;Box2D.Collision.Features=d;Box2D.Collision.Shapes.b2CircleShape=h;Box2D.Collision.Shapes.b2EdgeChainDef=l;Box2D.Collision.Shapes.b2EdgeShape=j;Box2D.Collision.Shapes.b2MassData=
-o;Box2D.Collision.Shapes.b2PolygonShape=q;Box2D.Collision.Shapes.b2Shape=n;Box2D.Common.b2internal="Box2D.Common.b2internal";Box2D.Common.b2Color=a;Box2D.Common.b2Settings=c;Box2D.Common.Math.b2Mat22=g;Box2D.Common.Math.b2Mat33=b;Box2D.Common.Math.b2Math=e;Box2D.Common.Math.b2Sweep=f;Box2D.Common.Math.b2Transform=m;Box2D.Common.Math.b2Vec2=r;Box2D.Common.Math.b2Vec3=s;Box2D.Dynamics.b2Body=v;Box2D.Dynamics.b2BodyDef=t;Box2D.Dynamics.b2ContactFilter=x;Box2D.Dynamics.b2ContactImpulse=C;Box2D.Dynamics.b2ContactListener=
-J;Box2D.Dynamics.b2ContactManager=T;Box2D.Dynamics.b2DebugDraw=P;Box2D.Dynamics.b2DestructionListener=X;Box2D.Dynamics.b2FilterData=$;Box2D.Dynamics.b2Fixture=ba;Box2D.Dynamics.b2FixtureDef=ca;Box2D.Dynamics.b2Island=da;Box2D.Dynamics.b2TimeStep=Fa;Box2D.Dynamics.b2World=ea;Box2D.Dynamics.Contacts.b2CircleContact=Ga;Box2D.Dynamics.Contacts.b2Contact=fa;Box2D.Dynamics.Contacts.b2ContactConstraint=ga;Box2D.Dynamics.Contacts.b2ContactConstraintPoint=Ha;Box2D.Dynamics.Contacts.b2ContactEdge=Ia;Box2D.Dynamics.Contacts.b2ContactFactory=
-ha;Box2D.Dynamics.Contacts.b2ContactRegister=Ja;Box2D.Dynamics.Contacts.b2ContactResult=Ka;Box2D.Dynamics.Contacts.b2ContactSolver=ia;Box2D.Dynamics.Contacts.b2EdgeAndCircleContact=La;Box2D.Dynamics.Contacts.b2NullContact=ja;Box2D.Dynamics.Contacts.b2PolyAndCircleContact=Ma;Box2D.Dynamics.Contacts.b2PolyAndEdgeContact=Na;Box2D.Dynamics.Contacts.b2PolygonContact=Oa;Box2D.Dynamics.Contacts.b2PositionSolverManifold=ka;Box2D.Dynamics.Controllers.b2BuoyancyController=Pa;Box2D.Dynamics.Controllers.b2ConstantAccelController=
-Qa;Box2D.Dynamics.Controllers.b2ConstantForceController=Ra;Box2D.Dynamics.Controllers.b2Controller=Sa;Box2D.Dynamics.Controllers.b2ControllerEdge=Ta;Box2D.Dynamics.Controllers.b2GravityController=Ua;Box2D.Dynamics.Controllers.b2TensorDampingController=Va;Box2D.Dynamics.Joints.b2DistanceJoint=la;Box2D.Dynamics.Joints.b2DistanceJointDef=ma;Box2D.Dynamics.Joints.b2FrictionJoint=na;Box2D.Dynamics.Joints.b2FrictionJointDef=oa;Box2D.Dynamics.Joints.b2GearJoint=pa;Box2D.Dynamics.Joints.b2GearJointDef=qa;
-Box2D.Dynamics.Joints.b2Jacobian=Wa;Box2D.Dynamics.Joints.b2Joint=ra;Box2D.Dynamics.Joints.b2JointDef=sa;Box2D.Dynamics.Joints.b2JointEdge=Xa;Box2D.Dynamics.Joints.b2LineJoint=ta;Box2D.Dynamics.Joints.b2LineJointDef=ua;Box2D.Dynamics.Joints.b2MouseJoint=va;Box2D.Dynamics.Joints.b2MouseJointDef=wa;Box2D.Dynamics.Joints.b2PrismaticJoint=xa;Box2D.Dynamics.Joints.b2PrismaticJointDef=ya;Box2D.Dynamics.Joints.b2PulleyJoint=za;Box2D.Dynamics.Joints.b2PulleyJointDef=Aa;Box2D.Dynamics.Joints.b2RevoluteJoint=
-Ba;Box2D.Dynamics.Joints.b2RevoluteJointDef=Ca;Box2D.Dynamics.Joints.b2WeldJoint=Da;Box2D.Dynamics.Joints.b2WeldJointDef=Ea})();Box2D.postDefs=[];
-(function(){var F=Box2D.Collision.Shapes.b2CircleShape,G=Box2D.Collision.Shapes.b2PolygonShape,K=Box2D.Collision.Shapes.b2Shape,y=Box2D.Common.b2Settings,w=Box2D.Common.Math.b2Math,A=Box2D.Common.Math.b2Sweep,U=Box2D.Common.Math.b2Transform,p=Box2D.Common.Math.b2Vec2,B=Box2D.Collision.b2AABB,Q=Box2D.Collision.b2Bound,V=Box2D.Collision.b2BoundValues,M=Box2D.Collision.b2Collision,L=Box2D.Collision.b2ContactID,I=Box2D.Collision.b2ContactPoint,W=Box2D.Collision.b2Distance,Y=Box2D.Collision.b2DistanceInput,
-k=Box2D.Collision.b2DistanceOutput,z=Box2D.Collision.b2DistanceProxy,u=Box2D.Collision.b2DynamicTree,D=Box2D.Collision.b2DynamicTreeBroadPhase,H=Box2D.Collision.b2DynamicTreeNode,O=Box2D.Collision.b2DynamicTreePair,E=Box2D.Collision.b2Manifold,R=Box2D.Collision.b2ManifoldPoint,N=Box2D.Collision.b2Point,S=Box2D.Collision.b2RayCastInput,aa=Box2D.Collision.b2RayCastOutput,Z=Box2D.Collision.b2Segment,d=Box2D.Collision.b2SeparationFunction,h=Box2D.Collision.b2Simplex,l=Box2D.Collision.b2SimplexCache,j=
-Box2D.Collision.b2SimplexVertex,o=Box2D.Collision.b2TimeOfImpact,q=Box2D.Collision.b2TOIInput,n=Box2D.Collision.b2WorldManifold,a=Box2D.Collision.ClipVertex,c=Box2D.Collision.Features,g=Box2D.Collision.IBroadPhase;B.b2AABB=function(){this.lowerBound=new p;this.upperBound=new p};B.prototype.IsValid=function(){var b=this.upperBound.y-this.lowerBound.y;return b=(b=this.upperBound.x-this.lowerBound.x>=0&&b>=0)&&this.lowerBound.IsValid()&&this.upperBound.IsValid()};B.prototype.GetCenter=function(){return new p((this.lowerBound.x+
-this.upperBound.x)/2,(this.lowerBound.y+this.upperBound.y)/2)};B.prototype.GetExtents=function(){return new p((this.upperBound.x-this.lowerBound.x)/2,(this.upperBound.y-this.lowerBound.y)/2)};B.prototype.Contains=function(b){var e=true;return e=(e=(e=(e=e&&this.lowerBound.x<=b.lowerBound.x)&&this.lowerBound.y<=b.lowerBound.y)&&b.upperBound.x<=this.upperBound.x)&&b.upperBound.y<=this.upperBound.y};B.prototype.RayCast=function(b,e){var f=-Number.MAX_VALUE,m=Number.MAX_VALUE,r=e.p1.x,s=e.p1.y,v=e.p2.x-
-e.p1.x,t=e.p2.y-e.p1.y,x=Math.abs(t),C=b.normal,J=0,T=0,P=J=0;P=0;if(Math.abs(v)<Number.MIN_VALUE){if(r<this.lowerBound.x||this.upperBound.x<r)return false}else{J=1/v;T=(this.lowerBound.x-r)*J;J=(this.upperBound.x-r)*J;P=-1;if(T>J){P=T;T=J;J=P;P=1}if(T>f){C.x=P;C.y=0;f=T}m=Math.min(m,J);if(f>m)return false}if(x<Number.MIN_VALUE){if(s<this.lowerBound.y||this.upperBound.y<s)return false}else{J=1/t;T=(this.lowerBound.y-s)*J;J=(this.upperBound.y-s)*J;P=-1;if(T>J){P=T;T=J;J=P;P=1}if(T>f){C.y=P;C.x=0;f=
-T}m=Math.min(m,J);if(f>m)return false}b.fraction=f;return true};B.prototype.TestOverlap=function(b){var e=b.lowerBound.y-this.upperBound.y,f=this.lowerBound.y-b.upperBound.y;if(b.lowerBound.x-this.upperBound.x>0||e>0)return false;if(this.lowerBound.x-b.upperBound.x>0||f>0)return false;return true};B.Combine=function(b,e){var f=new B;f.Combine(b,e);return f};B.prototype.Combine=function(b,e){this.lowerBound.x=Math.min(b.lowerBound.x,e.lowerBound.x);this.lowerBound.y=Math.min(b.lowerBound.y,e.lowerBound.y);
-this.upperBound.x=Math.max(b.upperBound.x,e.upperBound.x);this.upperBound.y=Math.max(b.upperBound.y,e.upperBound.y)};Q.b2Bound=function(){};Q.prototype.IsLower=function(){return(this.value&1)==0};Q.prototype.IsUpper=function(){return(this.value&1)==1};Q.prototype.Swap=function(b){var e=this.value,f=this.proxy,m=this.stabbingCount;this.value=b.value;this.proxy=b.proxy;this.stabbingCount=b.stabbingCount;b.value=e;b.proxy=f;b.stabbingCount=m};V.b2BoundValues=function(){};V.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};M.b2Collision=function(){};M.ClipSegmentToLine=function(b,e,f,m){if(m===undefined)m=0;var r,s=0;r=e[0];var v=r.v;r=e[1];var t=r.v,x=f.x*v.x+f.y*v.y-m;r=f.x*t.x+f.y*t.y-m;x<=0&&b[s++].Set(e[0]);r<=0&&b[s++].Set(e[1]);if(x*r<0){f=x/(x-r);r=b[s];r=r.v;r.x=v.x+f*(t.x-v.x);r.y=v.y+f*(t.y-v.y);r=b[s];r.id=(x>0?e[0]:e[1]).id;++s}return s};M.EdgeSeparation=
-function(b,e,f,m,r){if(f===undefined)f=0;parseInt(b.m_vertexCount);var s=b.m_vertices;b=b.m_normals;var v=parseInt(m.m_vertexCount),t=m.m_vertices,x,C;x=e.R;C=b[f];b=x.col1.x*C.x+x.col2.x*C.y;m=x.col1.y*C.x+x.col2.y*C.y;x=r.R;var J=x.col1.x*b+x.col1.y*m;x=x.col2.x*b+x.col2.y*m;for(var T=0,P=Number.MAX_VALUE,X=0;X<v;++X){C=t[X];C=C.x*J+C.y*x;if(C<P){P=C;T=X}}C=s[f];x=e.R;f=e.position.x+(x.col1.x*C.x+x.col2.x*C.y);e=e.position.y+(x.col1.y*C.x+x.col2.y*C.y);C=t[T];x=r.R;s=r.position.x+(x.col1.x*C.x+
-x.col2.x*C.y);r=r.position.y+(x.col1.y*C.x+x.col2.y*C.y);s-=f;r-=e;return s*b+r*m};M.FindMaxSeparation=function(b,e,f,m,r){var s=parseInt(e.m_vertexCount),v=e.m_normals,t,x;x=r.R;t=m.m_centroid;var C=r.position.x+(x.col1.x*t.x+x.col2.x*t.y),J=r.position.y+(x.col1.y*t.x+x.col2.y*t.y);x=f.R;t=e.m_centroid;C-=f.position.x+(x.col1.x*t.x+x.col2.x*t.y);J-=f.position.y+(x.col1.y*t.x+x.col2.y*t.y);x=C*f.R.col1.x+J*f.R.col1.y;J=C*f.R.col2.x+J*f.R.col2.y;C=0;for(var T=-Number.MAX_VALUE,P=0;P<s;++P){t=v[P];
-t=t.x*x+t.y*J;if(t>T){T=t;C=P}}v=M.EdgeSeparation(e,f,C,m,r);t=parseInt(C-1>=0?C-1:s-1);x=M.EdgeSeparation(e,f,t,m,r);J=parseInt(C+1<s?C+1:0);T=M.EdgeSeparation(e,f,J,m,r);var X=P=0,$=0;if(x>v&&x>T){$=-1;P=t;X=x}else if(T>v){$=1;P=J;X=T}else{b[0]=C;return v}for(;;){C=$==-1?P-1>=0?P-1:s-1:P+1<s?P+1:0;v=M.EdgeSeparation(e,f,C,m,r);if(v>X){P=C;X=v}else break}b[0]=P;return X};M.FindIncidentEdge=function(b,e,f,m,r,s){if(m===undefined)m=0;parseInt(e.m_vertexCount);var v=e.m_normals,t=parseInt(r.m_vertexCount);
-e=r.m_vertices;r=r.m_normals;var x;x=f.R;f=v[m];v=x.col1.x*f.x+x.col2.x*f.y;var C=x.col1.y*f.x+x.col2.y*f.y;x=s.R;f=x.col1.x*v+x.col1.y*C;C=x.col2.x*v+x.col2.y*C;v=f;x=0;for(var J=Number.MAX_VALUE,T=0;T<t;++T){f=r[T];f=v*f.x+C*f.y;if(f<J){J=f;x=T}}r=parseInt(x);v=parseInt(r+1<t?r+1:0);t=b[0];f=e[r];x=s.R;t.v.x=s.position.x+(x.col1.x*f.x+x.col2.x*f.y);t.v.y=s.position.y+(x.col1.y*f.x+x.col2.y*f.y);t.id.features.referenceEdge=m;t.id.features.incidentEdge=r;t.id.features.incidentVertex=0;t=b[1];f=e[v];
-x=s.R;t.v.x=s.position.x+(x.col1.x*f.x+x.col2.x*f.y);t.v.y=s.position.y+(x.col1.y*f.x+x.col2.y*f.y);t.id.features.referenceEdge=m;t.id.features.incidentEdge=v;t.id.features.incidentVertex=1};M.MakeClipPointVector=function(){var b=new Vector(2);b[0]=new a;b[1]=new a;return b};M.CollidePolygons=function(b,e,f,m,r){var s;b.m_pointCount=0;var v=e.m_radius+m.m_radius;s=0;M.s_edgeAO[0]=s;var t=M.FindMaxSeparation(M.s_edgeAO,e,f,m,r);s=M.s_edgeAO[0];if(!(t>v)){var x=0;M.s_edgeBO[0]=x;var C=M.FindMaxSeparation(M.s_edgeBO,
-m,r,e,f);x=M.s_edgeBO[0];if(!(C>v)){var J=0,T=0;if(C>0.98*t+0.0010){t=m;m=e;e=r;f=f;J=x;b.m_type=E.e_faceB;T=1}else{t=e;m=m;e=f;f=r;J=s;b.m_type=E.e_faceA;T=0}s=M.s_incidentEdge;M.FindIncidentEdge(s,t,e,J,m,f);x=parseInt(t.m_vertexCount);r=t.m_vertices;t=r[J];var P;P=J+1<x?r[parseInt(J+1)]:r[0];J=M.s_localTangent;J.Set(P.x-t.x,P.y-t.y);J.Normalize();r=M.s_localNormal;r.x=J.y;r.y=-J.x;m=M.s_planePoint;m.Set(0.5*(t.x+P.x),0.5*(t.y+P.y));C=M.s_tangent;x=e.R;C.x=x.col1.x*J.x+x.col2.x*J.y;C.y=x.col1.y*
-J.x+x.col2.y*J.y;var X=M.s_tangent2;X.x=-C.x;X.y=-C.y;J=M.s_normal;J.x=C.y;J.y=-C.x;var $=M.s_v11,ba=M.s_v12;$.x=e.position.x+(x.col1.x*t.x+x.col2.x*t.y);$.y=e.position.y+(x.col1.y*t.x+x.col2.y*t.y);ba.x=e.position.x+(x.col1.x*P.x+x.col2.x*P.y);ba.y=e.position.y+(x.col1.y*P.x+x.col2.y*P.y);e=J.x*$.x+J.y*$.y;x=C.x*ba.x+C.y*ba.y+v;P=M.s_clipPoints1;t=M.s_clipPoints2;ba=0;ba=M.ClipSegmentToLine(P,s,X,-C.x*$.x-C.y*$.y+v);if(!(ba<2)){ba=M.ClipSegmentToLine(t,P,C,x);if(!(ba<2)){b.m_localPlaneNormal.SetV(r);
-b.m_localPoint.SetV(m);for(m=r=0;m<y.b2_maxManifoldPoints;++m){s=t[m];if(J.x*s.v.x+J.y*s.v.y-e<=v){C=b.m_points[r];x=f.R;X=s.v.x-f.position.x;$=s.v.y-f.position.y;C.m_localPoint.x=X*x.col1.x+$*x.col1.y;C.m_localPoint.y=X*x.col2.x+$*x.col2.y;C.m_id.Set(s.id);C.m_id.features.flip=T;++r}}b.m_pointCount=r}}}}};M.CollideCircles=function(b,e,f,m,r){b.m_pointCount=0;var s,v;s=f.R;v=e.m_p;var t=f.position.x+(s.col1.x*v.x+s.col2.x*v.y);f=f.position.y+(s.col1.y*v.x+s.col2.y*v.y);s=r.R;v=m.m_p;t=r.position.x+
-(s.col1.x*v.x+s.col2.x*v.y)-t;r=r.position.y+(s.col1.y*v.x+s.col2.y*v.y)-f;s=e.m_radius+m.m_radius;if(!(t*t+r*r>s*s)){b.m_type=E.e_circles;b.m_localPoint.SetV(e.m_p);b.m_localPlaneNormal.SetZero();b.m_pointCount=1;b.m_points[0].m_localPoint.SetV(m.m_p);b.m_points[0].m_id.key=0}};M.CollidePolygonAndCircle=function(b,e,f,m,r){var s=b.m_pointCount=0,v=0,t,x;x=r.R;t=m.m_p;var C=r.position.y+(x.col1.y*t.x+x.col2.y*t.y);s=r.position.x+(x.col1.x*t.x+x.col2.x*t.y)-f.position.x;v=C-f.position.y;x=f.R;f=s*
-x.col1.x+v*x.col1.y;x=s*x.col2.x+v*x.col2.y;var J=0;C=-Number.MAX_VALUE;r=e.m_radius+m.m_radius;var T=parseInt(e.m_vertexCount),P=e.m_vertices;e=e.m_normals;for(var X=0;X<T;++X){t=P[X];s=f-t.x;v=x-t.y;t=e[X];s=t.x*s+t.y*v;if(s>r)return;if(s>C){C=s;J=X}}s=parseInt(J);v=parseInt(s+1<T?s+1:0);t=P[s];P=P[v];if(C<Number.MIN_VALUE){b.m_pointCount=1;b.m_type=E.e_faceA;b.m_localPlaneNormal.SetV(e[J]);b.m_localPoint.x=0.5*(t.x+P.x);b.m_localPoint.y=0.5*(t.y+P.y)}else{C=(f-P.x)*(t.x-P.x)+(x-P.y)*(t.y-P.y);
-if((f-t.x)*(P.x-t.x)+(x-t.y)*(P.y-t.y)<=0){if((f-t.x)*(f-t.x)+(x-t.y)*(x-t.y)>r*r)return;b.m_pointCount=1;b.m_type=E.e_faceA;b.m_localPlaneNormal.x=f-t.x;b.m_localPlaneNormal.y=x-t.y;b.m_localPlaneNormal.Normalize();b.m_localPoint.SetV(t)}else if(C<=0){if((f-P.x)*(f-P.x)+(x-P.y)*(x-P.y)>r*r)return;b.m_pointCount=1;b.m_type=E.e_faceA;b.m_localPlaneNormal.x=f-P.x;b.m_localPlaneNormal.y=x-P.y;b.m_localPlaneNormal.Normalize();b.m_localPoint.SetV(P)}else{J=0.5*(t.x+P.x);t=0.5*(t.y+P.y);C=(f-J)*e[s].x+
-(x-t)*e[s].y;if(C>r)return;b.m_pointCount=1;b.m_type=E.e_faceA;b.m_localPlaneNormal.x=e[s].x;b.m_localPlaneNormal.y=e[s].y;b.m_localPlaneNormal.Normalize();b.m_localPoint.Set(J,t)}}b.m_points[0].m_localPoint.SetV(m.m_p);b.m_points[0].m_id.key=0};M.TestOverlap=function(b,e){var f=e.lowerBound,m=b.upperBound,r=f.x-m.x,s=f.y-m.y;f=b.lowerBound;m=e.upperBound;var v=f.y-m.y;if(r>0||s>0)return false;if(f.x-m.x>0||v>0)return false;return true};Box2D.postDefs.push(function(){Box2D.Collision.b2Collision.s_incidentEdge=
-M.MakeClipPointVector();Box2D.Collision.b2Collision.s_clipPoints1=M.MakeClipPointVector();Box2D.Collision.b2Collision.s_clipPoints2=M.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 p;Box2D.Collision.b2Collision.s_localNormal=new p;Box2D.Collision.b2Collision.s_planePoint=new p;Box2D.Collision.b2Collision.s_normal=new p;Box2D.Collision.b2Collision.s_tangent=
-new p;Box2D.Collision.b2Collision.s_tangent2=new p;Box2D.Collision.b2Collision.s_v11=new p;Box2D.Collision.b2Collision.s_v12=new p;Box2D.Collision.b2Collision.b2CollidePolyTempVec=new p;Box2D.Collision.b2Collision.b2_nullFeature=255});L.b2ContactID=function(){this.features=new c};L.prototype.b2ContactID=function(){this.features._m_id=this};L.prototype.Set=function(b){this.key=b._key};L.prototype.Copy=function(){var b=new L;b.key=this.key;return b};Object.defineProperty(L.prototype,"key",{enumerable:false,
-configurable:true,get:function(){return this._key}});Object.defineProperty(L.prototype,"key",{enumerable:false,configurable:true,set:function(b){if(b===undefined)b=0;this._key=b;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}});I.b2ContactPoint=function(){this.position=new p;this.velocity=new p;this.normal=new p;this.id=new L};W.b2Distance=
-function(){};W.Distance=function(b,e,f){++W.b2_gjkCalls;var m=f.proxyA,r=f.proxyB,s=f.transformA,v=f.transformB,t=W.s_simplex;t.ReadCache(e,m,s,r,v);var x=t.m_vertices,C=W.s_saveA,J=W.s_saveB,T=0;t.GetClosestPoint().LengthSquared();for(var P=0,X,$=0;$<20;){T=t.m_count;for(P=0;P<T;P++){C[P]=x[P].indexA;J[P]=x[P].indexB}switch(t.m_count){case 1:break;case 2:t.Solve2();break;case 3:t.Solve3();break;default:y.b2Assert(false)}if(t.m_count==3)break;X=t.GetClosestPoint();X.LengthSquared();P=t.GetSearchDirection();
-if(P.LengthSquared()<Number.MIN_VALUE*Number.MIN_VALUE)break;X=x[t.m_count];X.indexA=m.GetSupport(w.MulTMV(s.R,P.GetNegative()));X.wA=w.MulX(s,m.GetVertex(X.indexA));X.indexB=r.GetSupport(w.MulTMV(v.R,P));X.wB=w.MulX(v,r.GetVertex(X.indexB));X.w=w.SubtractVV(X.wB,X.wA);++$;++W.b2_gjkIters;var ba=false;for(P=0;P<T;P++)if(X.indexA==C[P]&&X.indexB==J[P]){ba=true;break}if(ba)break;++t.m_count}W.b2_gjkMaxIters=w.Max(W.b2_gjkMaxIters,$);t.GetWitnessPoints(b.pointA,b.pointB);b.distance=w.SubtractVV(b.pointA,
-b.pointB).Length();b.iterations=$;t.WriteCache(e);if(f.useRadii){e=m.m_radius;r=r.m_radius;if(b.distance>e+r&&b.distance>Number.MIN_VALUE){b.distance-=e+r;f=w.SubtractVV(b.pointB,b.pointA);f.Normalize();b.pointA.x+=e*f.x;b.pointA.y+=e*f.y;b.pointB.x-=r*f.x;b.pointB.y-=r*f.y}else{X=new p;X.x=0.5*(b.pointA.x+b.pointB.x);X.y=0.5*(b.pointA.y+b.pointB.y);b.pointA.x=b.pointB.x=X.x;b.pointA.y=b.pointB.y=X.y;b.distance=0}}};Box2D.postDefs.push(function(){Box2D.Collision.b2Distance.s_simplex=new h;Box2D.Collision.b2Distance.s_saveA=
-new Vector_a2j_Number(3);Box2D.Collision.b2Distance.s_saveB=new Vector_a2j_Number(3)});Y.b2DistanceInput=function(){};k.b2DistanceOutput=function(){this.pointA=new p;this.pointB=new p};z.b2DistanceProxy=function(){};z.prototype.Set=function(b){switch(b.GetType()){case K.e_circleShape:b=b instanceof F?b:null;this.m_vertices=new Vector(1,true);this.m_vertices[0]=b.m_p;this.m_count=1;this.m_radius=b.m_radius;break;case K.e_polygonShape:b=b instanceof G?b:null;this.m_vertices=b.m_vertices;this.m_count=
-b.m_vertexCount;this.m_radius=b.m_radius;break;default:y.b2Assert(false)}};z.prototype.GetSupport=function(b){for(var e=0,f=this.m_vertices[0].x*b.x+this.m_vertices[0].y*b.y,m=1;m<this.m_count;++m){var r=this.m_vertices[m].x*b.x+this.m_vertices[m].y*b.y;if(r>f){e=m;f=r}}return e};z.prototype.GetSupportVertex=function(b){for(var e=0,f=this.m_vertices[0].x*b.x+this.m_vertices[0].y*b.y,m=1;m<this.m_count;++m){var r=this.m_vertices[m].x*b.x+this.m_vertices[m].y*b.y;if(r>f){e=m;f=r}}return this.m_vertices[e]};
-z.prototype.GetVertexCount=function(){return this.m_count};z.prototype.GetVertex=function(b){if(b===undefined)b=0;y.b2Assert(0<=b&&b<this.m_count);return this.m_vertices[b]};u.b2DynamicTree=function(){};u.prototype.b2DynamicTree=function(){this.m_freeList=this.m_root=null;this.m_insertionCount=this.m_path=0};u.prototype.CreateProxy=function(b,e){var f=this.AllocateNode(),m=y.b2_aabbExtension,r=y.b2_aabbExtension;f.aabb.lowerBound.x=b.lowerBound.x-m;f.aabb.lowerBound.y=b.lowerBound.y-r;f.aabb.upperBound.x=
-b.upperBound.x+m;f.aabb.upperBound.y=b.upperBound.y+r;f.userData=e;this.InsertLeaf(f);return f};u.prototype.DestroyProxy=function(b){this.RemoveLeaf(b);this.FreeNode(b)};u.prototype.MoveProxy=function(b,e,f){y.b2Assert(b.IsLeaf());if(b.aabb.Contains(e))return false;this.RemoveLeaf(b);var m=y.b2_aabbExtension+y.b2_aabbMultiplier*(f.x>0?f.x:-f.x);f=y.b2_aabbExtension+y.b2_aabbMultiplier*(f.y>0?f.y:-f.y);b.aabb.lowerBound.x=e.lowerBound.x-m;b.aabb.lowerBound.y=e.lowerBound.y-f;b.aabb.upperBound.x=e.upperBound.x+
-m;b.aabb.upperBound.y=e.upperBound.y+f;this.InsertLeaf(b);return true};u.prototype.Rebalance=function(b){if(b===undefined)b=0;if(this.m_root!=null)for(var e=0;e<b;e++){for(var f=this.m_root,m=0;f.IsLeaf()==false;){f=this.m_path>>m&1?f.child2:f.child1;m=m+1&31}++this.m_path;this.RemoveLeaf(f);this.InsertLeaf(f)}};u.prototype.GetFatAABB=function(b){return b.aabb};u.prototype.GetUserData=function(b){return b.userData};u.prototype.Query=function(b,e){if(this.m_root!=null){var f=new Vector,m=0;for(f[m++]=
-this.m_root;m>0;){var r=f[--m];if(r.aabb.TestOverlap(e))if(r.IsLeaf()){if(!b(r))break}else{f[m++]=r.child1;f[m++]=r.child2}}}};u.prototype.RayCast=function(b,e){if(this.m_root!=null){var f=e.p1,m=e.p2,r=w.SubtractVV(f,m);r.Normalize();r=w.CrossFV(1,r);var s=w.AbsV(r),v=e.maxFraction,t=new B,x=0,C=0;x=f.x+v*(m.x-f.x);C=f.y+v*(m.y-f.y);t.lowerBound.x=Math.min(f.x,x);t.lowerBound.y=Math.min(f.y,C);t.upperBound.x=Math.max(f.x,x);t.upperBound.y=Math.max(f.y,C);var J=new Vector,T=0;for(J[T++]=this.m_root;T>
-0;){v=J[--T];if(v.aabb.TestOverlap(t)!=false){x=v.aabb.GetCenter();C=v.aabb.GetExtents();if(!(Math.abs(r.x*(f.x-x.x)+r.y*(f.y-x.y))-s.x*C.x-s.y*C.y>0))if(v.IsLeaf()){x=new S;x.p1=e.p1;x.p2=e.p2;x.maxFraction=e.maxFraction;v=b(x,v);if(v==0)break;if(v>0){x=f.x+v*(m.x-f.x);C=f.y+v*(m.y-f.y);t.lowerBound.x=Math.min(f.x,x);t.lowerBound.y=Math.min(f.y,C);t.upperBound.x=Math.max(f.x,x);t.upperBound.y=Math.max(f.y,C)}}else{J[T++]=v.child1;J[T++]=v.child2}}}}};u.prototype.AllocateNode=function(){if(this.m_freeList){var b=
-this.m_freeList;this.m_freeList=b.parent;b.parent=null;b.child1=null;b.child2=null;return b}return new H};u.prototype.FreeNode=function(b){b.parent=this.m_freeList;this.m_freeList=b};u.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(),f=this.m_root;if(f.IsLeaf()==false){do{var m=f.child1;f=f.child2;f=Math.abs((m.aabb.lowerBound.x+m.aabb.upperBound.x)/2-e.x)+Math.abs((m.aabb.lowerBound.y+m.aabb.upperBound.y)/
-2-e.y)<Math.abs((f.aabb.lowerBound.x+f.aabb.upperBound.x)/2-e.x)+Math.abs((f.aabb.lowerBound.y+f.aabb.upperBound.y)/2-e.y)?m:f}while(f.IsLeaf()==false)}e=f.parent;m=this.AllocateNode();m.parent=e;m.userData=null;m.aabb.Combine(b.aabb,f.aabb);if(e){if(f.parent.child1==f)e.child1=m;else e.child2=m;m.child1=f;m.child2=b;f.parent=m;b.parent=m;do{if(e.aabb.Contains(m.aabb))break;e.aabb.Combine(e.child1.aabb,e.child2.aabb);m=e;e=e.parent}while(e)}else{m.child1=f;m.child2=b;f.parent=m;this.m_root=b.parent=
-m}}};u.prototype.RemoveLeaf=function(b){if(b==this.m_root)this.m_root=null;else{var e=b.parent,f=e.parent;b=e.child1==b?e.child2:e.child1;if(f){if(f.child1==e)f.child1=b;else f.child2=b;b.parent=f;for(this.FreeNode(e);f;){e=f.aabb;f.aabb=B.Combine(f.child1.aabb,f.child2.aabb);if(e.Contains(f.aabb))break;f=f.parent}}else{this.m_root=b;b.parent=null;this.FreeNode(e)}}};D.b2DynamicTreeBroadPhase=function(){this.m_tree=new u;this.m_moveBuffer=new Vector;this.m_pairBuffer=new Vector;this.m_pairCount=0};
-D.prototype.CreateProxy=function(b,e){var f=this.m_tree.CreateProxy(b,e);++this.m_proxyCount;this.BufferMove(f);return f};D.prototype.DestroyProxy=function(b){this.UnBufferMove(b);--this.m_proxyCount;this.m_tree.DestroyProxy(b)};D.prototype.MoveProxy=function(b,e,f){this.m_tree.MoveProxy(b,e,f)&&this.BufferMove(b)};D.prototype.TestOverlap=function(b,e){var f=this.m_tree.GetFatAABB(b),m=this.m_tree.GetFatAABB(e);return f.TestOverlap(m)};D.prototype.GetUserData=function(b){return this.m_tree.GetUserData(b)};
-D.prototype.GetFatAABB=function(b){return this.m_tree.GetFatAABB(b)};D.prototype.GetProxyCount=function(){return this.m_proxyCount};D.prototype.UpdatePairs=function(b){var e=this;var f=e.m_pairCount=0,m;for(f=0;f<e.m_moveBuffer.length;++f){m=e.m_moveBuffer[f];var r=e.m_tree.GetFatAABB(m);e.m_tree.Query(function(t){if(t==m)return true;if(e.m_pairCount==e.m_pairBuffer.length)e.m_pairBuffer[e.m_pairCount]=new O;var x=e.m_pairBuffer[e.m_pairCount];x.proxyA=t<m?t:m;x.proxyB=t>=m?t:m;++e.m_pairCount;return true},
-r)}for(f=e.m_moveBuffer.length=0;f<e.m_pairCount;){r=e.m_pairBuffer[f];var s=e.m_tree.GetUserData(r.proxyA),v=e.m_tree.GetUserData(r.proxyB);b(s,v);for(++f;f<e.m_pairCount;){s=e.m_pairBuffer[f];if(s.proxyA!=r.proxyA||s.proxyB!=r.proxyB)break;++f}}};D.prototype.Query=function(b,e){this.m_tree.Query(b,e)};D.prototype.RayCast=function(b,e){this.m_tree.RayCast(b,e)};D.prototype.Validate=function(){};D.prototype.Rebalance=function(b){if(b===undefined)b=0;this.m_tree.Rebalance(b)};D.prototype.BufferMove=
-function(b){this.m_moveBuffer[this.m_moveBuffer.length]=b};D.prototype.UnBufferMove=function(b){this.m_moveBuffer.splice(parseInt(this.m_moveBuffer.indexOf(b)),1)};D.prototype.ComparePairs=function(){return 0};D.__implements={};D.__implements[g]=true;H.b2DynamicTreeNode=function(){this.aabb=new B};H.prototype.IsLeaf=function(){return this.child1==null};O.b2DynamicTreePair=function(){};E.b2Manifold=function(){this.m_pointCount=0};E.prototype.b2Manifold=function(){this.m_points=new Vector(y.b2_maxManifoldPoints);
-for(var b=0;b<y.b2_maxManifoldPoints;b++)this.m_points[b]=new R;this.m_localPlaneNormal=new p;this.m_localPoint=new p};E.prototype.Reset=function(){for(var b=0;b<y.b2_maxManifoldPoints;b++)(this.m_points[b]instanceof R?this.m_points[b]:null).Reset();this.m_localPlaneNormal.SetZero();this.m_localPoint.SetZero();this.m_pointCount=this.m_type=0};E.prototype.Set=function(b){this.m_pointCount=b.m_pointCount;for(var e=0;e<y.b2_maxManifoldPoints;e++)(this.m_points[e]instanceof R?this.m_points[e]:null).Set(b.m_points[e]);
-this.m_localPlaneNormal.SetV(b.m_localPlaneNormal);this.m_localPoint.SetV(b.m_localPoint);this.m_type=b.m_type};E.prototype.Copy=function(){var b=new E;b.Set(this);return b};Box2D.postDefs.push(function(){Box2D.Collision.b2Manifold.e_circles=1;Box2D.Collision.b2Manifold.e_faceA=2;Box2D.Collision.b2Manifold.e_faceB=4});R.b2ManifoldPoint=function(){this.m_localPoint=new p;this.m_id=new L};R.prototype.b2ManifoldPoint=function(){this.Reset()};R.prototype.Reset=function(){this.m_localPoint.SetZero();this.m_tangentImpulse=
-this.m_normalImpulse=0;this.m_id.key=0};R.prototype.Set=function(b){this.m_localPoint.SetV(b.m_localPoint);this.m_normalImpulse=b.m_normalImpulse;this.m_tangentImpulse=b.m_tangentImpulse;this.m_id.Set(b.m_id)};N.b2Point=function(){this.p=new p};N.prototype.Support=function(){return this.p};N.prototype.GetFirstVertex=function(){return this.p};S.b2RayCastInput=function(){this.p1=new p;this.p2=new p};S.prototype.b2RayCastInput=function(b,e,f){if(b===undefined)b=null;if(e===undefined)e=null;if(f===undefined)f=
-1;b&&this.p1.SetV(b);e&&this.p2.SetV(e);this.maxFraction=f};aa.b2RayCastOutput=function(){this.normal=new p};Z.b2Segment=function(){this.p1=new p;this.p2=new p};Z.prototype.TestSegment=function(b,e,f,m){if(m===undefined)m=0;var r=f.p1,s=f.p2.x-r.x,v=f.p2.y-r.y;f=this.p2.y-this.p1.y;var t=-(this.p2.x-this.p1.x),x=100*Number.MIN_VALUE,C=-(s*f+v*t);if(C>x){var J=r.x-this.p1.x,T=r.y-this.p1.y;r=J*f+T*t;if(0<=r&&r<=m*C){m=-s*T+v*J;if(-x*C<=m&&m<=C*(1+x)){r/=C;m=Math.sqrt(f*f+t*t);f/=m;t/=m;b[0]=r;e.Set(f,
-t);return true}}}return false};Z.prototype.Extend=function(b){this.ExtendForward(b);this.ExtendBackward(b)};Z.prototype.ExtendForward=function(b){var e=this.p2.x-this.p1.x,f=this.p2.y-this.p1.y;b=Math.min(e>0?(b.upperBound.x-this.p1.x)/e:e<0?(b.lowerBound.x-this.p1.x)/e:Number.POSITIVE_INFINITY,f>0?(b.upperBound.y-this.p1.y)/f:f<0?(b.lowerBound.y-this.p1.y)/f:Number.POSITIVE_INFINITY);this.p2.x=this.p1.x+e*b;this.p2.y=this.p1.y+f*b};Z.prototype.ExtendBackward=function(b){var e=-this.p2.x+this.p1.x,
-f=-this.p2.y+this.p1.y;b=Math.min(e>0?(b.upperBound.x-this.p2.x)/e:e<0?(b.lowerBound.x-this.p2.x)/e:Number.POSITIVE_INFINITY,f>0?(b.upperBound.y-this.p2.y)/f:f<0?(b.lowerBound.y-this.p2.y)/f:Number.POSITIVE_INFINITY);this.p1.x=this.p2.x+e*b;this.p1.y=this.p2.y+f*b};d.b2SeparationFunction=function(){this.m_localPoint=new p;this.m_axis=new p};d.prototype.Initialize=function(b,e,f,m,r){this.m_proxyA=e;this.m_proxyB=m;var s=parseInt(b.count);y.b2Assert(0<s&&s<3);var v,t,x,C,J=C=x=m=e=0,T=0;J=0;if(s==
-1){this.m_type=d.e_points;v=this.m_proxyA.GetVertex(b.indexA[0]);t=this.m_proxyB.GetVertex(b.indexB[0]);s=v;b=f.R;e=f.position.x+(b.col1.x*s.x+b.col2.x*s.y);m=f.position.y+(b.col1.y*s.x+b.col2.y*s.y);s=t;b=r.R;x=r.position.x+(b.col1.x*s.x+b.col2.x*s.y);C=r.position.y+(b.col1.y*s.x+b.col2.y*s.y);this.m_axis.x=x-e;this.m_axis.y=C-m;this.m_axis.Normalize()}else{if(b.indexB[0]==b.indexB[1]){this.m_type=d.e_faceA;e=this.m_proxyA.GetVertex(b.indexA[0]);m=this.m_proxyA.GetVertex(b.indexA[1]);t=this.m_proxyB.GetVertex(b.indexB[0]);
-this.m_localPoint.x=0.5*(e.x+m.x);this.m_localPoint.y=0.5*(e.y+m.y);this.m_axis=w.CrossVF(w.SubtractVV(m,e),1);this.m_axis.Normalize();s=this.m_axis;b=f.R;J=b.col1.x*s.x+b.col2.x*s.y;T=b.col1.y*s.x+b.col2.y*s.y;s=this.m_localPoint;b=f.R;e=f.position.x+(b.col1.x*s.x+b.col2.x*s.y);m=f.position.y+(b.col1.y*s.x+b.col2.y*s.y);s=t;b=r.R;x=r.position.x+(b.col1.x*s.x+b.col2.x*s.y);C=r.position.y+(b.col1.y*s.x+b.col2.y*s.y);J=(x-e)*J+(C-m)*T}else if(b.indexA[0]==b.indexA[0]){this.m_type=d.e_faceB;x=this.m_proxyB.GetVertex(b.indexB[0]);
-C=this.m_proxyB.GetVertex(b.indexB[1]);v=this.m_proxyA.GetVertex(b.indexA[0]);this.m_localPoint.x=0.5*(x.x+C.x);this.m_localPoint.y=0.5*(x.y+C.y);this.m_axis=w.CrossVF(w.SubtractVV(C,x),1);this.m_axis.Normalize();s=this.m_axis;b=r.R;J=b.col1.x*s.x+b.col2.x*s.y;T=b.col1.y*s.x+b.col2.y*s.y;s=this.m_localPoint;b=r.R;x=r.position.x+(b.col1.x*s.x+b.col2.x*s.y);C=r.position.y+(b.col1.y*s.x+b.col2.y*s.y);s=v;b=f.R;e=f.position.x+(b.col1.x*s.x+b.col2.x*s.y);m=f.position.y+(b.col1.y*s.x+b.col2.y*s.y);J=(e-
-x)*J+(m-C)*T}else{e=this.m_proxyA.GetVertex(b.indexA[0]);m=this.m_proxyA.GetVertex(b.indexA[1]);x=this.m_proxyB.GetVertex(b.indexB[0]);C=this.m_proxyB.GetVertex(b.indexB[1]);w.MulX(f,v);v=w.MulMV(f.R,w.SubtractVV(m,e));w.MulX(r,t);J=w.MulMV(r.R,w.SubtractVV(C,x));r=v.x*v.x+v.y*v.y;t=J.x*J.x+J.y*J.y;b=w.SubtractVV(J,v);f=v.x*b.x+v.y*b.y;b=J.x*b.x+J.y*b.y;v=v.x*J.x+v.y*J.y;T=r*t-v*v;J=0;if(T!=0)J=w.Clamp((v*b-f*t)/T,0,1);if((v*J+b)/t<0)J=w.Clamp((v-f)/r,0,1);v=new p;v.x=e.x+J*(m.x-e.x);v.y=e.y+J*(m.y-
-e.y);t=new p;t.x=x.x+J*(C.x-x.x);t.y=x.y+J*(C.y-x.y);if(J==0||J==1){this.m_type=d.e_faceB;this.m_axis=w.CrossVF(w.SubtractVV(C,x),1);this.m_axis.Normalize();this.m_localPoint=t}else{this.m_type=d.e_faceA;this.m_axis=w.CrossVF(w.SubtractVV(m,e),1);this.m_localPoint=v}}J<0&&this.m_axis.NegativeSelf()}};d.prototype.Evaluate=function(b,e){var f,m,r=0;switch(this.m_type){case d.e_points:f=w.MulTMV(b.R,this.m_axis);m=w.MulTMV(e.R,this.m_axis.GetNegative());f=this.m_proxyA.GetSupportVertex(f);m=this.m_proxyB.GetSupportVertex(m);
-f=w.MulX(b,f);m=w.MulX(e,m);return r=(m.x-f.x)*this.m_axis.x+(m.y-f.y)*this.m_axis.y;case d.e_faceA:r=w.MulMV(b.R,this.m_axis);f=w.MulX(b,this.m_localPoint);m=w.MulTMV(e.R,r.GetNegative());m=this.m_proxyB.GetSupportVertex(m);m=w.MulX(e,m);return r=(m.x-f.x)*r.x+(m.y-f.y)*r.y;case d.e_faceB:r=w.MulMV(e.R,this.m_axis);m=w.MulX(e,this.m_localPoint);f=w.MulTMV(b.R,r.GetNegative());f=this.m_proxyA.GetSupportVertex(f);f=w.MulX(b,f);return r=(f.x-m.x)*r.x+(f.y-m.y)*r.y;default:y.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});h.b2Simplex=function(){this.m_v1=new j;this.m_v2=new j;this.m_v3=new j;this.m_vertices=new Vector(3)};h.prototype.b2Simplex=function(){this.m_vertices[0]=this.m_v1;this.m_vertices[1]=this.m_v2;this.m_vertices[2]=this.m_v3};h.prototype.ReadCache=function(b,e,f,m,r){y.b2Assert(0<=b.count&&b.count<=3);var s,v;this.m_count=b.count;
-for(var t=this.m_vertices,x=0;x<this.m_count;x++){var C=t[x];C.indexA=b.indexA[x];C.indexB=b.indexB[x];s=e.GetVertex(C.indexA);v=m.GetVertex(C.indexB);C.wA=w.MulX(f,s);C.wB=w.MulX(r,v);C.w=w.SubtractVV(C.wB,C.wA);C.a=0}if(this.m_count>1){b=b.metric;s=this.GetMetric();if(s<0.5*b||2*b<s||s<Number.MIN_VALUE)this.m_count=0}if(this.m_count==0){C=t[0];C.indexA=0;C.indexB=0;s=e.GetVertex(0);v=m.GetVertex(0);C.wA=w.MulX(f,s);C.wB=w.MulX(r,v);C.w=w.SubtractVV(C.wB,C.wA);this.m_count=1}};h.prototype.WriteCache=
-function(b){b.metric=this.GetMetric();b.count=Box2D.parseUInt(this.m_count);for(var e=this.m_vertices,f=0;f<this.m_count;f++){b.indexA[f]=Box2D.parseUInt(e[f].indexA);b.indexB[f]=Box2D.parseUInt(e[f].indexB)}};h.prototype.GetSearchDirection=function(){switch(this.m_count){case 1:return this.m_v1.w.GetNegative();case 2:var b=w.SubtractVV(this.m_v2.w,this.m_v1.w);return w.CrossVV(b,this.m_v1.w.GetNegative())>0?w.CrossFV(1,b):w.CrossVF(b,1);default:y.b2Assert(false);return new p}};h.prototype.GetClosestPoint=
-function(){switch(this.m_count){case 0:y.b2Assert(false);return new p;case 1:return this.m_v1.w;case 2:return new p(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:y.b2Assert(false);return new p}};h.prototype.GetWitnessPoints=function(b,e){switch(this.m_count){case 0:y.b2Assert(false);break;case 1:b.SetV(this.m_v1.wA);e.SetV(this.m_v1.wB);break;case 2:b.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x;b.y=this.m_v1.a*this.m_v1.wA.y+
-this.m_v2.a*this.m_v2.wA.y;e.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x;e.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:e.x=b.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;e.y=b.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:y.b2Assert(false)}};h.prototype.GetMetric=function(){switch(this.m_count){case 0:y.b2Assert(false);return 0;case 1:return 0;case 2:return w.SubtractVV(this.m_v1.w,
-this.m_v2.w).Length();case 3:return w.CrossVV(w.SubtractVV(this.m_v2.w,this.m_v1.w),w.SubtractVV(this.m_v3.w,this.m_v1.w));default:y.b2Assert(false);return 0}};h.prototype.Solve2=function(){var b=this.m_v1.w,e=this.m_v2.w,f=w.SubtractVV(e,b);b=-(b.x*f.x+b.y*f.y);if(b<=0)this.m_count=this.m_v1.a=1;else{e=e.x*f.x+e.y*f.y;if(e<=0){this.m_count=this.m_v2.a=1;this.m_v1.Set(this.m_v2)}else{f=1/(e+b);this.m_v1.a=e*f;this.m_v2.a=b*f;this.m_count=2}}};h.prototype.Solve3=function(){var b=this.m_v1.w,e=this.m_v2.w,
-f=this.m_v3.w,m=w.SubtractVV(e,b),r=w.Dot(b,m),s=w.Dot(e,m);r=-r;var v=w.SubtractVV(f,b),t=w.Dot(b,v),x=w.Dot(f,v);t=-t;var C=w.SubtractVV(f,e),J=w.Dot(e,C);C=w.Dot(f,C);J=-J;v=w.CrossVV(m,v);m=v*w.CrossVV(e,f);f=v*w.CrossVV(f,b);b=v*w.CrossVV(b,e);if(r<=0&&t<=0)this.m_count=this.m_v1.a=1;else if(s>0&&r>0&&b<=0){x=1/(s+r);this.m_v1.a=s*x;this.m_v2.a=r*x;this.m_count=2}else if(x>0&&t>0&&f<=0){s=1/(x+t);this.m_v1.a=x*s;this.m_v3.a=t*s;this.m_count=2;this.m_v2.Set(this.m_v3)}else if(s<=0&&J<=0){this.m_count=
-this.m_v2.a=1;this.m_v1.Set(this.m_v2)}else if(x<=0&&C<=0){this.m_count=this.m_v3.a=1;this.m_v1.Set(this.m_v3)}else if(C>0&&J>0&&m<=0){s=1/(C+J);this.m_v2.a=C*s;this.m_v3.a=J*s;this.m_count=2;this.m_v1.Set(this.m_v3)}else{s=1/(m+f+b);this.m_v1.a=m*s;this.m_v2.a=f*s;this.m_v3.a=b*s;this.m_count=3}};l.b2SimplexCache=function(){this.indexA=new Vector_a2j_Number(3);this.indexB=new Vector_a2j_Number(3)};j.b2SimplexVertex=function(){};j.prototype.Set=function(b){this.wA.SetV(b.wA);this.wB.SetV(b.wB);this.w.SetV(b.w);
-this.a=b.a;this.indexA=b.indexA;this.indexB=b.indexB};o.b2TimeOfImpact=function(){};o.TimeOfImpact=function(b){++o.b2_toiCalls;var e=b.proxyA,f=b.proxyB,m=b.sweepA,r=b.sweepB;y.b2Assert(m.t0==r.t0);y.b2Assert(1-m.t0>Number.MIN_VALUE);var s=e.m_radius+f.m_radius;b=b.tolerance;var v=0,t=0,x=0;o.s_cache.count=0;for(o.s_distanceInput.useRadii=false;;){m.GetTransform(o.s_xfA,v);r.GetTransform(o.s_xfB,v);o.s_distanceInput.proxyA=e;o.s_distanceInput.proxyB=f;o.s_distanceInput.transformA=o.s_xfA;o.s_distanceInput.transformB=
-o.s_xfB;W.Distance(o.s_distanceOutput,o.s_cache,o.s_distanceInput);if(o.s_distanceOutput.distance<=0){v=1;break}o.s_fcn.Initialize(o.s_cache,e,o.s_xfA,f,o.s_xfB);var C=o.s_fcn.Evaluate(o.s_xfA,o.s_xfB);if(C<=0){v=1;break}if(t==0)x=C>s?w.Max(s-b,0.75*s):w.Max(C-b,0.02*s);if(C-x<0.5*b){if(t==0){v=1;break}break}var J=v,T=v,P=1;C=C;m.GetTransform(o.s_xfA,P);r.GetTransform(o.s_xfB,P);var X=o.s_fcn.Evaluate(o.s_xfA,o.s_xfB);if(X>=x){v=1;break}for(var $=0;;){var ba=0;ba=$&1?T+(x-C)*(P-T)/(X-C):0.5*(T+P);
-m.GetTransform(o.s_xfA,ba);r.GetTransform(o.s_xfB,ba);var ca=o.s_fcn.Evaluate(o.s_xfA,o.s_xfB);if(w.Abs(ca-x)<0.025*b){J=ba;break}if(ca>x){T=ba;C=ca}else{P=ba;X=ca}++$;++o.b2_toiRootIters;if($==50)break}o.b2_toiMaxRootIters=w.Max(o.b2_toiMaxRootIters,$);if(J<(1+100*Number.MIN_VALUE)*v)break;v=J;t++;++o.b2_toiIters;if(t==1E3)break}o.b2_toiMaxIters=w.Max(o.b2_toiMaxIters,t);return v};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 l;Box2D.Collision.b2TimeOfImpact.s_distanceInput=new Y;Box2D.Collision.b2TimeOfImpact.s_xfA=new U;Box2D.Collision.b2TimeOfImpact.s_xfB=new U;Box2D.Collision.b2TimeOfImpact.s_fcn=new d;Box2D.Collision.b2TimeOfImpact.s_distanceOutput=new k});q.b2TOIInput=function(){this.proxyA=new z;this.proxyB=new z;this.sweepA=
-new A;this.sweepB=new A};n.b2WorldManifold=function(){this.m_normal=new p};n.prototype.b2WorldManifold=function(){this.m_points=new Vector(y.b2_maxManifoldPoints);for(var b=0;b<y.b2_maxManifoldPoints;b++)this.m_points[b]=new p};n.prototype.Initialize=function(b,e,f,m,r){if(f===undefined)f=0;if(r===undefined)r=0;if(b.m_pointCount!=0){var s=0,v,t,x=0,C=0,J=0,T=0,P=0;v=0;switch(b.m_type){case E.e_circles:t=e.R;v=b.m_localPoint;s=e.position.x+t.col1.x*v.x+t.col2.x*v.y;e=e.position.y+t.col1.y*v.x+t.col2.y*
-v.y;t=m.R;v=b.m_points[0].m_localPoint;b=m.position.x+t.col1.x*v.x+t.col2.x*v.y;m=m.position.y+t.col1.y*v.x+t.col2.y*v.y;v=b-s;t=m-e;x=v*v+t*t;if(x>Number.MIN_VALUE*Number.MIN_VALUE){x=Math.sqrt(x);this.m_normal.x=v/x;this.m_normal.y=t/x}else{this.m_normal.x=1;this.m_normal.y=0}v=e+f*this.m_normal.y;m=m-r*this.m_normal.y;this.m_points[0].x=0.5*(s+f*this.m_normal.x+(b-r*this.m_normal.x));this.m_points[0].y=0.5*(v+m);break;case E.e_faceA:t=e.R;v=b.m_localPlaneNormal;x=t.col1.x*v.x+t.col2.x*v.y;C=t.col1.y*
-v.x+t.col2.y*v.y;t=e.R;v=b.m_localPoint;J=e.position.x+t.col1.x*v.x+t.col2.x*v.y;T=e.position.y+t.col1.y*v.x+t.col2.y*v.y;this.m_normal.x=x;this.m_normal.y=C;for(s=0;s<b.m_pointCount;s++){t=m.R;v=b.m_points[s].m_localPoint;P=m.position.x+t.col1.x*v.x+t.col2.x*v.y;v=m.position.y+t.col1.y*v.x+t.col2.y*v.y;this.m_points[s].x=P+0.5*(f-(P-J)*x-(v-T)*C-r)*x;this.m_points[s].y=v+0.5*(f-(P-J)*x-(v-T)*C-r)*C}break;case E.e_faceB:t=m.R;v=b.m_localPlaneNormal;x=t.col1.x*v.x+t.col2.x*v.y;C=t.col1.y*v.x+t.col2.y*
-v.y;t=m.R;v=b.m_localPoint;J=m.position.x+t.col1.x*v.x+t.col2.x*v.y;T=m.position.y+t.col1.y*v.x+t.col2.y*v.y;this.m_normal.x=-x;this.m_normal.y=-C;for(s=0;s<b.m_pointCount;s++){t=e.R;v=b.m_points[s].m_localPoint;P=e.position.x+t.col1.x*v.x+t.col2.x*v.y;v=e.position.y+t.col1.y*v.x+t.col2.y*v.y;this.m_points[s].x=P+0.5*(r-(P-J)*x-(v-T)*C-f)*x;this.m_points[s].y=v+0.5*(r-(P-J)*x-(v-T)*C-f)*C}}}};a.ClipVertex=function(){this.v=new p;this.id=new L};a.prototype.Set=function(b){this.v.SetV(b.v);this.id.Set(b.id)};
-c.Features=function(){};Object.defineProperty(c.prototype,"referenceEdge",{enumerable:false,configurable:true,get:function(){return this._referenceEdge}});Object.defineProperty(c.prototype,"referenceEdge",{enumerable:false,configurable:true,set:function(b){if(b===undefined)b=0;this._referenceEdge=b;this._m_id._key=this._m_id._key&4294967040|this._referenceEdge&255}});Object.defineProperty(c.prototype,"incidentEdge",{enumerable:false,configurable:true,get:function(){return this._incidentEdge}});Object.defineProperty(c.prototype,
-"incidentEdge",{enumerable:false,configurable:true,set:function(b){if(b===undefined)b=0;this._incidentEdge=b;this._m_id._key=this._m_id._key&4294902015|this._incidentEdge<<8&65280}});Object.defineProperty(c.prototype,"incidentVertex",{enumerable:false,configurable:true,get:function(){return this._incidentVertex}});Object.defineProperty(c.prototype,"incidentVertex",{enumerable:false,configurable:true,set:function(b){if(b===undefined)b=0;this._incidentVertex=b;this._m_id._key=this._m_id._key&4278255615|
-this._incidentVertex<<16&16711680}});Object.defineProperty(c.prototype,"flip",{enumerable:false,configurable:true,get:function(){return this._flip}});Object.defineProperty(c.prototype,"flip",{enumerable:false,configurable:true,set:function(b){if(b===undefined)b=0;this._flip=b;this._m_id._key=this._m_id._key&16777215|this._flip<<24&4278190080}})})();
-(function(){var F=Box2D.Common.b2Settings,G=Box2D.Collision.Shapes.b2CircleShape,K=Box2D.Collision.Shapes.b2EdgeChainDef,y=Box2D.Collision.Shapes.b2EdgeShape,w=Box2D.Collision.Shapes.b2MassData,A=Box2D.Collision.Shapes.b2PolygonShape,U=Box2D.Collision.Shapes.b2Shape,p=Box2D.Common.Math.b2Mat22,B=Box2D.Common.Math.b2Math,Q=Box2D.Common.Math.b2Transform,V=Box2D.Common.Math.b2Vec2,M=Box2D.Collision.b2Distance,L=Box2D.Collision.b2DistanceInput,I=Box2D.Collision.b2DistanceOutput,W=Box2D.Collision.b2DistanceProxy,
-Y=Box2D.Collision.b2SimplexCache;Box2D.inherit(G,Box2D.Collision.Shapes.b2Shape);G.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;G.b2CircleShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments);this.m_p=new V};G.prototype.Copy=function(){var k=new G;k.Set(this);return k};G.prototype.Set=function(k){this.__super.Set.call(this,k);if(Box2D.is(k,G))this.m_p.SetV((k instanceof G?k:null).m_p)};G.prototype.TestPoint=function(k,z){var u=k.R,D=k.position.x+(u.col1.x*this.m_p.x+
-u.col2.x*this.m_p.y);u=k.position.y+(u.col1.y*this.m_p.x+u.col2.y*this.m_p.y);D=z.x-D;u=z.y-u;return D*D+u*u<=this.m_radius*this.m_radius};G.prototype.RayCast=function(k,z,u){var D=u.R,H=z.p1.x-(u.position.x+(D.col1.x*this.m_p.x+D.col2.x*this.m_p.y));u=z.p1.y-(u.position.y+(D.col1.y*this.m_p.x+D.col2.y*this.m_p.y));D=z.p2.x-z.p1.x;var O=z.p2.y-z.p1.y,E=H*D+u*O,R=D*D+O*O,N=E*E-R*(H*H+u*u-this.m_radius*this.m_radius);if(N<0||R<Number.MIN_VALUE)return false;E=-(E+Math.sqrt(N));if(0<=E&&E<=z.maxFraction*
-R){E/=R;k.fraction=E;k.normal.x=H+E*D;k.normal.y=u+E*O;k.normal.Normalize();return true}return false};G.prototype.ComputeAABB=function(k,z){var u=z.R,D=z.position.x+(u.col1.x*this.m_p.x+u.col2.x*this.m_p.y);u=z.position.y+(u.col1.y*this.m_p.x+u.col2.y*this.m_p.y);k.lowerBound.Set(D-this.m_radius,u-this.m_radius);k.upperBound.Set(D+this.m_radius,u+this.m_radius)};G.prototype.ComputeMass=function(k,z){if(z===undefined)z=0;k.mass=z*F.b2_pi*this.m_radius*this.m_radius;k.center.SetV(this.m_p);k.I=k.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))};G.prototype.ComputeSubmergedArea=function(k,z,u,D){if(z===undefined)z=0;u=B.MulX(u,this.m_p);var H=-(B.Dot(k,u)-z);if(H<-this.m_radius+Number.MIN_VALUE)return 0;if(H>this.m_radius){D.SetV(u);return Math.PI*this.m_radius*this.m_radius}z=this.m_radius*this.m_radius;var O=H*H;H=z*(Math.asin(H/this.m_radius)+Math.PI/2)+H*Math.sqrt(z-O);z=-2/3*Math.pow(z-O,1.5)/H;D.x=u.x+k.x*z;D.y=u.y+k.y*z;return H};G.prototype.GetLocalPosition=
-function(){return this.m_p};G.prototype.SetLocalPosition=function(k){this.m_p.SetV(k)};G.prototype.GetRadius=function(){return this.m_radius};G.prototype.SetRadius=function(k){if(k===undefined)k=0;this.m_radius=k};G.prototype.b2CircleShape=function(k){if(k===undefined)k=0;this.__super.b2Shape.call(this);this.m_type=U.e_circleShape;this.m_radius=k};K.b2EdgeChainDef=function(){};K.prototype.b2EdgeChainDef=function(){this.vertexCount=0;this.isALoop=true;this.vertices=[]};Box2D.inherit(y,Box2D.Collision.Shapes.b2Shape);
-y.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;y.b2EdgeShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments);this.s_supportVec=new V;this.m_v1=new V;this.m_v2=new V;this.m_coreV1=new V;this.m_coreV2=new V;this.m_normal=new V;this.m_direction=new V;this.m_cornerDir1=new V;this.m_cornerDir2=new V};y.prototype.TestPoint=function(){return false};y.prototype.RayCast=function(k,z,u){var D,H=z.p2.x-z.p1.x,O=z.p2.y-z.p1.y;D=u.R;var E=u.position.x+(D.col1.x*this.m_v1.x+
-D.col2.x*this.m_v1.y),R=u.position.y+(D.col1.y*this.m_v1.x+D.col2.y*this.m_v1.y),N=u.position.y+(D.col1.y*this.m_v2.x+D.col2.y*this.m_v2.y)-R;u=-(u.position.x+(D.col1.x*this.m_v2.x+D.col2.x*this.m_v2.y)-E);D=100*Number.MIN_VALUE;var S=-(H*N+O*u);if(S>D){E=z.p1.x-E;var aa=z.p1.y-R;R=E*N+aa*u;if(0<=R&&R<=z.maxFraction*S){z=-H*aa+O*E;if(-D*S<=z&&z<=S*(1+D)){R/=S;k.fraction=R;z=Math.sqrt(N*N+u*u);k.normal.x=N/z;k.normal.y=u/z;return true}}}return false};y.prototype.ComputeAABB=function(k,z){var u=z.R,
-D=z.position.x+(u.col1.x*this.m_v1.x+u.col2.x*this.m_v1.y),H=z.position.y+(u.col1.y*this.m_v1.x+u.col2.y*this.m_v1.y),O=z.position.x+(u.col1.x*this.m_v2.x+u.col2.x*this.m_v2.y);u=z.position.y+(u.col1.y*this.m_v2.x+u.col2.y*this.m_v2.y);if(D<O){k.lowerBound.x=D;k.upperBound.x=O}else{k.lowerBound.x=O;k.upperBound.x=D}if(H<u){k.lowerBound.y=H;k.upperBound.y=u}else{k.lowerBound.y=u;k.upperBound.y=H}};y.prototype.ComputeMass=function(k){k.mass=0;k.center.SetV(this.m_v1);k.I=0};y.prototype.ComputeSubmergedArea=
-function(k,z,u,D){if(z===undefined)z=0;var H=new V(k.x*z,k.y*z),O=B.MulX(u,this.m_v1);u=B.MulX(u,this.m_v2);var E=B.Dot(k,O)-z;k=B.Dot(k,u)-z;if(E>0)if(k>0)return 0;else{O.x=-k/(E-k)*O.x+E/(E-k)*u.x;O.y=-k/(E-k)*O.y+E/(E-k)*u.y}else if(k>0){u.x=-k/(E-k)*O.x+E/(E-k)*u.x;u.y=-k/(E-k)*O.y+E/(E-k)*u.y}D.x=(H.x+O.x+u.x)/3;D.y=(H.y+O.y+u.y)/3;return 0.5*((O.x-H.x)*(u.y-H.y)-(O.y-H.y)*(u.x-H.x))};y.prototype.GetLength=function(){return this.m_length};y.prototype.GetVertex1=function(){return this.m_v1};y.prototype.GetVertex2=
-function(){return this.m_v2};y.prototype.GetCoreVertex1=function(){return this.m_coreV1};y.prototype.GetCoreVertex2=function(){return this.m_coreV2};y.prototype.GetNormalVector=function(){return this.m_normal};y.prototype.GetDirectionVector=function(){return this.m_direction};y.prototype.GetCorner1Vector=function(){return this.m_cornerDir1};y.prototype.GetCorner2Vector=function(){return this.m_cornerDir2};y.prototype.Corner1IsConvex=function(){return this.m_cornerConvex1};y.prototype.Corner2IsConvex=
-function(){return this.m_cornerConvex2};y.prototype.GetFirstVertex=function(k){var z=k.R;return new V(k.position.x+(z.col1.x*this.m_coreV1.x+z.col2.x*this.m_coreV1.y),k.position.y+(z.col1.y*this.m_coreV1.x+z.col2.y*this.m_coreV1.y))};y.prototype.GetNextEdge=function(){return this.m_nextEdge};y.prototype.GetPrevEdge=function(){return this.m_prevEdge};y.prototype.Support=function(k,z,u){if(z===undefined)z=0;if(u===undefined)u=0;var D=k.R,H=k.position.x+(D.col1.x*this.m_coreV1.x+D.col2.x*this.m_coreV1.y),
-O=k.position.y+(D.col1.y*this.m_coreV1.x+D.col2.y*this.m_coreV1.y),E=k.position.x+(D.col1.x*this.m_coreV2.x+D.col2.x*this.m_coreV2.y);k=k.position.y+(D.col1.y*this.m_coreV2.x+D.col2.y*this.m_coreV2.y);if(H*z+O*u>E*z+k*u){this.s_supportVec.x=H;this.s_supportVec.y=O}else{this.s_supportVec.x=E;this.s_supportVec.y=k}return this.s_supportVec};y.prototype.b2EdgeShape=function(k,z){this.__super.b2Shape.call(this);this.m_type=U.e_edgeShape;this.m_nextEdge=this.m_prevEdge=null;this.m_v1=k;this.m_v2=z;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)};
-y.prototype.SetPrevEdge=function(k,z,u,D){this.m_prevEdge=k;this.m_coreV1=z;this.m_cornerDir1=u;this.m_cornerConvex1=D};y.prototype.SetNextEdge=function(k,z,u,D){this.m_nextEdge=k;this.m_coreV2=z;this.m_cornerDir2=u;this.m_cornerConvex2=D};w.b2MassData=function(){this.mass=0;this.center=new V(0,0);this.I=0};Box2D.inherit(A,Box2D.Collision.Shapes.b2Shape);A.prototype.__super=Box2D.Collision.Shapes.b2Shape.prototype;A.b2PolygonShape=function(){Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this,arguments)};
-A.prototype.Copy=function(){var k=new A;k.Set(this);return k};A.prototype.Set=function(k){this.__super.Set.call(this,k);if(Box2D.is(k,A)){k=k instanceof A?k:null;this.m_centroid.SetV(k.m_centroid);this.m_vertexCount=k.m_vertexCount;this.Reserve(this.m_vertexCount);for(var z=0;z<this.m_vertexCount;z++){this.m_vertices[z].SetV(k.m_vertices[z]);this.m_normals[z].SetV(k.m_normals[z])}}};A.prototype.SetAsArray=function(k,z){if(z===undefined)z=0;var u=new Vector,D=0,H;for(D=0;D<k.length;++D){H=k[D];u.push(H)}this.SetAsVector(u,
-z)};A.AsArray=function(k,z){if(z===undefined)z=0;var u=new A;u.SetAsArray(k,z);return u};A.prototype.SetAsVector=function(k,z){if(z===undefined)z=0;if(z==0)z=k.length;F.b2Assert(2<=z);this.m_vertexCount=z;this.Reserve(z);var u=0;for(u=0;u<this.m_vertexCount;u++)this.m_vertices[u].SetV(k[u]);for(u=0;u<this.m_vertexCount;++u){var D=parseInt(u),H=parseInt(u+1<this.m_vertexCount?u+1:0);D=B.SubtractVV(this.m_vertices[H],this.m_vertices[D]);F.b2Assert(D.LengthSquared()>Number.MIN_VALUE);this.m_normals[u].SetV(B.CrossVF(D,
-1));this.m_normals[u].Normalize()}this.m_centroid=A.ComputeCentroid(this.m_vertices,this.m_vertexCount)};A.AsVector=function(k,z){if(z===undefined)z=0;var u=new A;u.SetAsVector(k,z);return u};A.prototype.SetAsBox=function(k,z){if(k===undefined)k=0;if(z===undefined)z=0;this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-k,-z);this.m_vertices[1].Set(k,-z);this.m_vertices[2].Set(k,z);this.m_vertices[3].Set(-k,z);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()};A.AsBox=function(k,z){if(k===undefined)k=0;if(z===undefined)z=0;var u=new A;u.SetAsBox(k,z);return u};A.prototype.SetAsOrientedBox=function(k,z,u,D){if(k===undefined)k=0;if(z===undefined)z=0;if(u===undefined)u=null;if(D===undefined)D=0;this.m_vertexCount=4;this.Reserve(4);this.m_vertices[0].Set(-k,-z);this.m_vertices[1].Set(k,-z);this.m_vertices[2].Set(k,z);this.m_vertices[3].Set(-k,z);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=u;k=new Q;k.position=u;k.R.Set(D);for(u=0;u<this.m_vertexCount;++u){this.m_vertices[u]=B.MulX(k,this.m_vertices[u]);this.m_normals[u]=B.MulMV(k.R,this.m_normals[u])}};A.AsOrientedBox=function(k,z,u,D){if(k===undefined)k=0;if(z===undefined)z=0;if(u===undefined)u=null;if(D===undefined)D=0;var H=new A;H.SetAsOrientedBox(k,z,u,D);return H};A.prototype.SetAsEdge=function(k,z){this.m_vertexCount=2;this.Reserve(2);this.m_vertices[0].SetV(k);
-this.m_vertices[1].SetV(z);this.m_centroid.x=0.5*(k.x+z.x);this.m_centroid.y=0.5*(k.y+z.y);this.m_normals[0]=B.CrossVF(B.SubtractVV(z,k),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};A.AsEdge=function(k,z){var u=new A;u.SetAsEdge(k,z);return u};A.prototype.TestPoint=function(k,z){var u;u=k.R;for(var D=z.x-k.position.x,H=z.y-k.position.y,O=D*u.col1.x+H*u.col1.y,E=D*u.col2.x+H*u.col2.y,R=0;R<this.m_vertexCount;++R){u=this.m_vertices[R];
-D=O-u.x;H=E-u.y;u=this.m_normals[R];if(u.x*D+u.y*H>0)return false}return true};A.prototype.RayCast=function(k,z,u){var D=0,H=z.maxFraction,O=0,E=0,R,N;O=z.p1.x-u.position.x;E=z.p1.y-u.position.y;R=u.R;var S=O*R.col1.x+E*R.col1.y,aa=O*R.col2.x+E*R.col2.y;O=z.p2.x-u.position.x;E=z.p2.y-u.position.y;R=u.R;z=O*R.col1.x+E*R.col1.y-S;R=O*R.col2.x+E*R.col2.y-aa;for(var Z=parseInt(-1),d=0;d<this.m_vertexCount;++d){N=this.m_vertices[d];O=N.x-S;E=N.y-aa;N=this.m_normals[d];O=N.x*O+N.y*E;E=N.x*z+N.y*R;if(E==
-0){if(O<0)return false}else if(E<0&&O<D*E){D=O/E;Z=d}else if(E>0&&O<H*E)H=O/E;if(H<D-Number.MIN_VALUE)return false}if(Z>=0){k.fraction=D;R=u.R;N=this.m_normals[Z];k.normal.x=R.col1.x*N.x+R.col2.x*N.y;k.normal.y=R.col1.y*N.x+R.col2.y*N.y;return true}return false};A.prototype.ComputeAABB=function(k,z){for(var u=z.R,D=this.m_vertices[0],H=z.position.x+(u.col1.x*D.x+u.col2.x*D.y),O=z.position.y+(u.col1.y*D.x+u.col2.y*D.y),E=H,R=O,N=1;N<this.m_vertexCount;++N){D=this.m_vertices[N];var S=z.position.x+(u.col1.x*
-D.x+u.col2.x*D.y);D=z.position.y+(u.col1.y*D.x+u.col2.y*D.y);H=H<S?H:S;O=O<D?O:D;E=E>S?E:S;R=R>D?R:D}k.lowerBound.x=H-this.m_radius;k.lowerBound.y=O-this.m_radius;k.upperBound.x=E+this.m_radius;k.upperBound.y=R+this.m_radius};A.prototype.ComputeMass=function(k,z){if(z===undefined)z=0;if(this.m_vertexCount==2){k.center.x=0.5*(this.m_vertices[0].x+this.m_vertices[1].x);k.center.y=0.5*(this.m_vertices[0].y+this.m_vertices[1].y);k.mass=0;k.I=0}else{for(var u=0,D=0,H=0,O=0,E=1/3,R=0;R<this.m_vertexCount;++R){var N=
-this.m_vertices[R],S=R+1<this.m_vertexCount?this.m_vertices[parseInt(R+1)]:this.m_vertices[0],aa=N.x-0,Z=N.y-0,d=S.x-0,h=S.y-0,l=aa*h-Z*d,j=0.5*l;H+=j;u+=j*E*(0+N.x+S.x);D+=j*E*(0+N.y+S.y);N=aa;Z=Z;d=d;h=h;O+=l*(E*(0.25*(N*N+d*N+d*d)+(0*N+0*d))+0+(E*(0.25*(Z*Z+h*Z+h*h)+(0*Z+0*h))+0))}k.mass=z*H;u*=1/H;D*=1/H;k.center.Set(u,D);k.I=z*O}};A.prototype.ComputeSubmergedArea=function(k,z,u,D){if(z===undefined)z=0;var H=B.MulTMV(u.R,k),O=z-B.Dot(k,u.position),E=new Vector_a2j_Number,R=0,N=parseInt(-1);z=
-parseInt(-1);var S=false;for(k=k=0;k<this.m_vertexCount;++k){E[k]=B.Dot(H,this.m_vertices[k])-O;var aa=E[k]<-Number.MIN_VALUE;if(k>0)if(aa){if(!S){N=k-1;R++}}else if(S){z=k-1;R++}S=aa}switch(R){case 0:if(S){k=new w;this.ComputeMass(k,1);D.SetV(B.MulX(u,k.center));return k.mass}else return 0;case 1:if(N==-1)N=this.m_vertexCount-1;else z=this.m_vertexCount-1}k=parseInt((N+1)%this.m_vertexCount);H=parseInt((z+1)%this.m_vertexCount);O=(0-E[N])/(E[k]-E[N]);E=(0-E[z])/(E[H]-E[z]);N=new V(this.m_vertices[N].x*
-(1-O)+this.m_vertices[k].x*O,this.m_vertices[N].y*(1-O)+this.m_vertices[k].y*O);z=new V(this.m_vertices[z].x*(1-E)+this.m_vertices[H].x*E,this.m_vertices[z].y*(1-E)+this.m_vertices[H].y*E);E=0;O=new V;R=this.m_vertices[k];for(k=k;k!=H;){k=(k+1)%this.m_vertexCount;S=k==H?z:this.m_vertices[k];aa=0.5*((R.x-N.x)*(S.y-N.y)-(R.y-N.y)*(S.x-N.x));E+=aa;O.x+=aa*(N.x+R.x+S.x)/3;O.y+=aa*(N.y+R.y+S.y)/3;R=S}O.Multiply(1/E);D.SetV(B.MulX(u,O));return E};A.prototype.GetVertexCount=function(){return this.m_vertexCount};
-A.prototype.GetVertices=function(){return this.m_vertices};A.prototype.GetNormals=function(){return this.m_normals};A.prototype.GetSupport=function(k){for(var z=0,u=this.m_vertices[0].x*k.x+this.m_vertices[0].y*k.y,D=1;D<this.m_vertexCount;++D){var H=this.m_vertices[D].x*k.x+this.m_vertices[D].y*k.y;if(H>u){z=D;u=H}}return z};A.prototype.GetSupportVertex=function(k){for(var z=0,u=this.m_vertices[0].x*k.x+this.m_vertices[0].y*k.y,D=1;D<this.m_vertexCount;++D){var H=this.m_vertices[D].x*k.x+this.m_vertices[D].y*
-k.y;if(H>u){z=D;u=H}}return this.m_vertices[z]};A.prototype.Validate=function(){return false};A.prototype.b2PolygonShape=function(){this.__super.b2Shape.call(this);this.m_type=U.e_polygonShape;this.m_centroid=new V;this.m_vertices=new Vector;this.m_normals=new Vector};A.prototype.Reserve=function(k){if(k===undefined)k=0;for(var z=parseInt(this.m_vertices.length);z<k;z++){this.m_vertices[z]=new V;this.m_normals[z]=new V}};A.ComputeCentroid=function(k,z){if(z===undefined)z=0;for(var u=new V,D=0,H=1/
-3,O=0;O<z;++O){var E=k[O],R=O+1<z?k[parseInt(O+1)]:k[0],N=0.5*((E.x-0)*(R.y-0)-(E.y-0)*(R.x-0));D+=N;u.x+=N*H*(0+E.x+R.x);u.y+=N*H*(0+E.y+R.y)}u.x*=1/D;u.y*=1/D;return u};A.ComputeOBB=function(k,z,u){if(u===undefined)u=0;var D=0,H=new Vector(u+1);for(D=0;D<u;++D)H[D]=z[D];H[u]=H[0];z=Number.MAX_VALUE;for(D=1;D<=u;++D){var O=H[parseInt(D-1)],E=H[D].x-O.x,R=H[D].y-O.y,N=Math.sqrt(E*E+R*R);E/=N;R/=N;for(var S=-R,aa=E,Z=N=Number.MAX_VALUE,d=-Number.MAX_VALUE,h=-Number.MAX_VALUE,l=0;l<u;++l){var j=H[l].x-
-O.x,o=H[l].y-O.y,q=E*j+R*o;j=S*j+aa*o;if(q<N)N=q;if(j<Z)Z=j;if(q>d)d=q;if(j>h)h=j}l=(d-N)*(h-Z);if(l<0.95*z){z=l;k.R.col1.x=E;k.R.col1.y=R;k.R.col2.x=S;k.R.col2.y=aa;E=0.5*(N+d);R=0.5*(Z+h);S=k.R;k.center.x=O.x+(S.col1.x*E+S.col2.x*R);k.center.y=O.y+(S.col1.y*E+S.col2.y*R);k.extents.x=0.5*(d-N);k.extents.y=0.5*(h-Z)}}};Box2D.postDefs.push(function(){Box2D.Collision.Shapes.b2PolygonShape.s_mat=new p});U.b2Shape=function(){};U.prototype.Copy=function(){return null};U.prototype.Set=function(k){this.m_radius=
-k.m_radius};U.prototype.GetType=function(){return this.m_type};U.prototype.TestPoint=function(){return false};U.prototype.RayCast=function(){return false};U.prototype.ComputeAABB=function(){};U.prototype.ComputeMass=function(){};U.prototype.ComputeSubmergedArea=function(){return 0};U.TestOverlap=function(k,z,u,D){var H=new L;H.proxyA=new W;H.proxyA.Set(k);H.proxyB=new W;H.proxyB.Set(u);H.transformA=z;H.transformB=D;H.useRadii=true;k=new Y;k.count=0;z=new I;M.Distance(z,k,H);return z.distance<10*Number.MIN_VALUE};
-U.prototype.b2Shape=function(){this.m_type=U.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 F=Box2D.Common.b2Color,G=Box2D.Common.b2Settings,K=Box2D.Common.Math.b2Math;F.b2Color=function(){this._b=this._g=this._r=0};F.prototype.b2Color=function(y,w,A){if(y===undefined)y=0;if(w===undefined)w=0;if(A===undefined)A=0;this._r=Box2D.parseUInt(255*K.Clamp(y,0,1));this._g=Box2D.parseUInt(255*K.Clamp(w,0,1));this._b=Box2D.parseUInt(255*K.Clamp(A,0,1))};F.prototype.Set=function(y,w,A){if(y===undefined)y=0;if(w===undefined)w=0;if(A===undefined)A=0;this._r=Box2D.parseUInt(255*K.Clamp(y,
-0,1));this._g=Box2D.parseUInt(255*K.Clamp(w,0,1));this._b=Box2D.parseUInt(255*K.Clamp(A,0,1))};Object.defineProperty(F.prototype,"r",{enumerable:false,configurable:true,set:function(y){if(y===undefined)y=0;this._r=Box2D.parseUInt(255*K.Clamp(y,0,1))}});Object.defineProperty(F.prototype,"g",{enumerable:false,configurable:true,set:function(y){if(y===undefined)y=0;this._g=Box2D.parseUInt(255*K.Clamp(y,0,1))}});Object.defineProperty(F.prototype,"b",{enumerable:false,configurable:true,set:function(y){if(y===
-undefined)y=0;this._b=Box2D.parseUInt(255*K.Clamp(y,0,1))}});Object.defineProperty(F.prototype,"color",{enumerable:false,configurable:true,get:function(){return this._r<<16|this._g<<8|this._b}});G.b2Settings=function(){};G.b2MixFriction=function(y,w){if(y===undefined)y=0;if(w===undefined)w=0;return Math.sqrt(y*w)};G.b2MixRestitution=function(y,w){if(y===undefined)y=0;if(w===undefined)w=0;return y>w?y:w};G.b2Assert=function(y){if(!y)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*G.b2_linearSlop;Box2D.Common.b2Settings.b2_linearSlop=0.0050;Box2D.Common.b2Settings.b2_angularSlop=2/180*G.b2_pi;Box2D.Common.b2Settings.b2_toiSlop=8*G.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*G.b2_pi;Box2D.Common.b2Settings.b2_maxTranslation=2;Box2D.Common.b2Settings.b2_maxTranslationSquared=G.b2_maxTranslation*G.b2_maxTranslation;Box2D.Common.b2Settings.b2_maxRotation=0.5*G.b2_pi;Box2D.Common.b2Settings.b2_maxRotationSquared=G.b2_maxRotation*G.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*G.b2_pi})})();
-(function(){var F=Box2D.Common.Math.b2Mat22,G=Box2D.Common.Math.b2Mat33,K=Box2D.Common.Math.b2Math,y=Box2D.Common.Math.b2Sweep,w=Box2D.Common.Math.b2Transform,A=Box2D.Common.Math.b2Vec2,U=Box2D.Common.Math.b2Vec3;F.b2Mat22=function(){this.col1=new A;this.col2=new A};F.prototype.b2Mat22=function(){this.SetIdentity()};F.FromAngle=function(p){if(p===undefined)p=0;var B=new F;B.Set(p);return B};F.FromVV=function(p,B){var Q=new F;Q.SetVV(p,B);return Q};F.prototype.Set=function(p){if(p===undefined)p=0;
-var B=Math.cos(p);p=Math.sin(p);this.col1.x=B;this.col2.x=-p;this.col1.y=p;this.col2.y=B};F.prototype.SetVV=function(p,B){this.col1.SetV(p);this.col2.SetV(B)};F.prototype.Copy=function(){var p=new F;p.SetM(this);return p};F.prototype.SetM=function(p){this.col1.SetV(p.col1);this.col2.SetV(p.col2)};F.prototype.AddM=function(p){this.col1.x+=p.col1.x;this.col1.y+=p.col1.y;this.col2.x+=p.col2.x;this.col2.y+=p.col2.y};F.prototype.SetIdentity=function(){this.col1.x=1;this.col2.x=0;this.col1.y=0;this.col2.y=
-1};F.prototype.SetZero=function(){this.col1.x=0;this.col2.x=0;this.col1.y=0;this.col2.y=0};F.prototype.GetAngle=function(){return Math.atan2(this.col1.y,this.col1.x)};F.prototype.GetInverse=function(p){var B=this.col1.x,Q=this.col2.x,V=this.col1.y,M=this.col2.y,L=B*M-Q*V;if(L!=0)L=1/L;p.col1.x=L*M;p.col2.x=-L*Q;p.col1.y=-L*V;p.col2.y=L*B;return p};F.prototype.Solve=function(p,B,Q){if(B===undefined)B=0;if(Q===undefined)Q=0;var V=this.col1.x,M=this.col2.x,L=this.col1.y,I=this.col2.y,W=V*I-M*L;if(W!=
-0)W=1/W;p.x=W*(I*B-M*Q);p.y=W*(V*Q-L*B);return p};F.prototype.Abs=function(){this.col1.Abs();this.col2.Abs()};G.b2Mat33=function(){this.col1=new U;this.col2=new U;this.col3=new U};G.prototype.b2Mat33=function(p,B,Q){if(p===undefined)p=null;if(B===undefined)B=null;if(Q===undefined)Q=null;if(!p&&!B&&!Q){this.col1.SetZero();this.col2.SetZero();this.col3.SetZero()}else{this.col1.SetV(p);this.col2.SetV(B);this.col3.SetV(Q)}};G.prototype.SetVVV=function(p,B,Q){this.col1.SetV(p);this.col2.SetV(B);this.col3.SetV(Q)};
-G.prototype.Copy=function(){return new G(this.col1,this.col2,this.col3)};G.prototype.SetM=function(p){this.col1.SetV(p.col1);this.col2.SetV(p.col2);this.col3.SetV(p.col3)};G.prototype.AddM=function(p){this.col1.x+=p.col1.x;this.col1.y+=p.col1.y;this.col1.z+=p.col1.z;this.col2.x+=p.col2.x;this.col2.y+=p.col2.y;this.col2.z+=p.col2.z;this.col3.x+=p.col3.x;this.col3.y+=p.col3.y;this.col3.z+=p.col3.z};G.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};G.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};G.prototype.Solve22=function(p,B,Q){if(B===undefined)B=0;if(Q===undefined)Q=0;var V=this.col1.x,M=this.col2.x,L=this.col1.y,I=this.col2.y,W=V*I-M*L;if(W!=0)W=1/W;p.x=W*(I*B-M*Q);p.y=W*(V*Q-L*B);return p};G.prototype.Solve33=function(p,B,Q,V){if(B===undefined)B=0;if(Q===undefined)Q=0;
-if(V===undefined)V=0;var M=this.col1.x,L=this.col1.y,I=this.col1.z,W=this.col2.x,Y=this.col2.y,k=this.col2.z,z=this.col3.x,u=this.col3.y,D=this.col3.z,H=M*(Y*D-k*u)+L*(k*z-W*D)+I*(W*u-Y*z);if(H!=0)H=1/H;p.x=H*(B*(Y*D-k*u)+Q*(k*z-W*D)+V*(W*u-Y*z));p.y=H*(M*(Q*D-V*u)+L*(V*z-B*D)+I*(B*u-Q*z));p.z=H*(M*(Y*V-k*Q)+L*(k*B-W*V)+I*(W*Q-Y*B));return p};K.b2Math=function(){};K.IsValid=function(p){if(p===undefined)p=0;return isFinite(p)};K.Dot=function(p,B){return p.x*B.x+p.y*B.y};K.CrossVV=function(p,B){return p.x*
-B.y-p.y*B.x};K.CrossVF=function(p,B){if(B===undefined)B=0;return new A(B*p.y,-B*p.x)};K.CrossFV=function(p,B){if(p===undefined)p=0;return new A(-p*B.y,p*B.x)};K.MulMV=function(p,B){return new A(p.col1.x*B.x+p.col2.x*B.y,p.col1.y*B.x+p.col2.y*B.y)};K.MulTMV=function(p,B){return new A(K.Dot(B,p.col1),K.Dot(B,p.col2))};K.MulX=function(p,B){var Q=K.MulMV(p.R,B);Q.x+=p.position.x;Q.y+=p.position.y;return Q};K.MulXT=function(p,B){var Q=K.SubtractVV(B,p.position),V=Q.x*p.R.col1.x+Q.y*p.R.col1.y;Q.y=Q.x*
-p.R.col2.x+Q.y*p.R.col2.y;Q.x=V;return Q};K.AddVV=function(p,B){return new A(p.x+B.x,p.y+B.y)};K.SubtractVV=function(p,B){return new A(p.x-B.x,p.y-B.y)};K.Distance=function(p,B){var Q=p.x-B.x,V=p.y-B.y;return Math.sqrt(Q*Q+V*V)};K.DistanceSquared=function(p,B){var Q=p.x-B.x,V=p.y-B.y;return Q*Q+V*V};K.MulFV=function(p,B){if(p===undefined)p=0;return new A(p*B.x,p*B.y)};K.AddMM=function(p,B){return F.FromVV(K.AddVV(p.col1,B.col1),K.AddVV(p.col2,B.col2))};K.MulMM=function(p,B){return F.FromVV(K.MulMV(p,
-B.col1),K.MulMV(p,B.col2))};K.MulTMM=function(p,B){var Q=new A(K.Dot(p.col1,B.col1),K.Dot(p.col2,B.col1)),V=new A(K.Dot(p.col1,B.col2),K.Dot(p.col2,B.col2));return F.FromVV(Q,V)};K.Abs=function(p){if(p===undefined)p=0;return p>0?p:-p};K.AbsV=function(p){return new A(K.Abs(p.x),K.Abs(p.y))};K.AbsM=function(p){return F.FromVV(K.AbsV(p.col1),K.AbsV(p.col2))};K.Min=function(p,B){if(p===undefined)p=0;if(B===undefined)B=0;return p<B?p:B};K.MinV=function(p,B){return new A(K.Min(p.x,B.x),K.Min(p.y,B.y))};
-K.Max=function(p,B){if(p===undefined)p=0;if(B===undefined)B=0;return p>B?p:B};K.MaxV=function(p,B){return new A(K.Max(p.x,B.x),K.Max(p.y,B.y))};K.Clamp=function(p,B,Q){if(p===undefined)p=0;if(B===undefined)B=0;if(Q===undefined)Q=0;return p<B?B:p>Q?Q:p};K.ClampV=function(p,B,Q){return K.MaxV(B,K.MinV(p,Q))};K.Swap=function(p,B){var Q=p[0];p[0]=B[0];B[0]=Q};K.Random=function(){return Math.random()*2-1};K.RandomRange=function(p,B){if(p===undefined)p=0;if(B===undefined)B=0;var Q=Math.random();return Q=
-(B-p)*Q+p};K.NextPowerOfTwo=function(p){if(p===undefined)p=0;p|=p>>1&2147483647;p|=p>>2&1073741823;p|=p>>4&268435455;p|=p>>8&16777215;p|=p>>16&65535;return p+1};K.IsPowerOfTwo=function(p){if(p===undefined)p=0;return p>0&&(p&p-1)==0};Box2D.postDefs.push(function(){Box2D.Common.Math.b2Math.b2Vec2_zero=new A(0,0);Box2D.Common.Math.b2Math.b2Mat22_identity=F.FromVV(new A(1,0),new A(0,1));Box2D.Common.Math.b2Math.b2Transform_identity=new w(K.b2Vec2_zero,K.b2Mat22_identity)});y.b2Sweep=function(){this.localCenter=
-new A;this.c0=new A;this.c=new A};y.prototype.Set=function(p){this.localCenter.SetV(p.localCenter);this.c0.SetV(p.c0);this.c.SetV(p.c);this.a0=p.a0;this.a=p.a;this.t0=p.t0};y.prototype.Copy=function(){var p=new y;p.localCenter.SetV(this.localCenter);p.c0.SetV(this.c0);p.c.SetV(this.c);p.a0=this.a0;p.a=this.a;p.t0=this.t0;return p};y.prototype.GetTransform=function(p,B){if(B===undefined)B=0;p.position.x=(1-B)*this.c0.x+B*this.c.x;p.position.y=(1-B)*this.c0.y+B*this.c.y;p.R.Set((1-B)*this.a0+B*this.a);
-var Q=p.R;p.position.x-=Q.col1.x*this.localCenter.x+Q.col2.x*this.localCenter.y;p.position.y-=Q.col1.y*this.localCenter.x+Q.col2.y*this.localCenter.y};y.prototype.Advance=function(p){if(p===undefined)p=0;if(this.t0<p&&1-this.t0>Number.MIN_VALUE){var B=(p-this.t0)/(1-this.t0);this.c0.x=(1-B)*this.c0.x+B*this.c.x;this.c0.y=(1-B)*this.c0.y+B*this.c.y;this.a0=(1-B)*this.a0+B*this.a;this.t0=p}};w.b2Transform=function(){this.position=new A;this.R=new F};w.prototype.b2Transform=function(p,B){if(p===undefined)p=
-null;if(B===undefined)B=null;if(p){this.position.SetV(p);this.R.SetM(B)}};w.prototype.Initialize=function(p,B){this.position.SetV(p);this.R.SetM(B)};w.prototype.SetIdentity=function(){this.position.SetZero();this.R.SetIdentity()};w.prototype.Set=function(p){this.position.SetV(p.position);this.R.SetM(p.R)};w.prototype.GetAngle=function(){return Math.atan2(this.R.col1.y,this.R.col1.x)};A.b2Vec2=function(){};A.prototype.b2Vec2=function(p,B){if(p===undefined)p=0;if(B===undefined)B=0;this.x=p;this.y=B};
-A.prototype.SetZero=function(){this.y=this.x=0};A.prototype.Set=function(p,B){if(p===undefined)p=0;if(B===undefined)B=0;this.x=p;this.y=B};A.prototype.SetV=function(p){this.x=p.x;this.y=p.y};A.prototype.GetNegative=function(){return new A(-this.x,-this.y)};A.prototype.NegativeSelf=function(){this.x=-this.x;this.y=-this.y};A.Make=function(p,B){if(p===undefined)p=0;if(B===undefined)B=0;return new A(p,B)};A.prototype.Copy=function(){return new A(this.x,this.y)};A.prototype.Add=function(p){this.x+=p.x;
-this.y+=p.y};A.prototype.Subtract=function(p){this.x-=p.x;this.y-=p.y};A.prototype.Multiply=function(p){if(p===undefined)p=0;this.x*=p;this.y*=p};A.prototype.MulM=function(p){var B=this.x;this.x=p.col1.x*B+p.col2.x*this.y;this.y=p.col1.y*B+p.col2.y*this.y};A.prototype.MulTM=function(p){var B=K.Dot(this,p.col1);this.y=K.Dot(this,p.col2);this.x=B};A.prototype.CrossVF=function(p){if(p===undefined)p=0;var B=this.x;this.x=p*this.y;this.y=-p*B};A.prototype.CrossFV=function(p){if(p===undefined)p=0;var B=
-this.x;this.x=-p*this.y;this.y=p*B};A.prototype.MinV=function(p){this.x=this.x<p.x?this.x:p.x;this.y=this.y<p.y?this.y:p.y};A.prototype.MaxV=function(p){this.x=this.x>p.x?this.x:p.x;this.y=this.y>p.y?this.y:p.y};A.prototype.Abs=function(){if(this.x<0)this.x=-this.x;if(this.y<0)this.y=-this.y};A.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};A.prototype.LengthSquared=function(){return this.x*this.x+this.y*this.y};A.prototype.Normalize=function(){var p=Math.sqrt(this.x*this.x+
-this.y*this.y);if(p<Number.MIN_VALUE)return 0;var B=1/p;this.x*=B;this.y*=B;return p};A.prototype.IsValid=function(){return K.IsValid(this.x)&&K.IsValid(this.y)};U.b2Vec3=function(){};U.prototype.b2Vec3=function(p,B,Q){if(p===undefined)p=0;if(B===undefined)B=0;if(Q===undefined)Q=0;this.x=p;this.y=B;this.z=Q};U.prototype.SetZero=function(){this.x=this.y=this.z=0};U.prototype.Set=function(p,B,Q){if(p===undefined)p=0;if(B===undefined)B=0;if(Q===undefined)Q=0;this.x=p;this.y=B;this.z=Q};U.prototype.SetV=
-function(p){this.x=p.x;this.y=p.y;this.z=p.z};U.prototype.GetNegative=function(){return new U(-this.x,-this.y,-this.z)};U.prototype.NegativeSelf=function(){this.x=-this.x;this.y=-this.y;this.z=-this.z};U.prototype.Copy=function(){return new U(this.x,this.y,this.z)};U.prototype.Add=function(p){this.x+=p.x;this.y+=p.y;this.z+=p.z};U.prototype.Subtract=function(p){this.x-=p.x;this.y-=p.y;this.z-=p.z};U.prototype.Multiply=function(p){if(p===undefined)p=0;this.x*=p;this.y*=p;this.z*=p}})();
-(function(){var F=Box2D.Common.Math.b2Math,G=Box2D.Common.Math.b2Sweep,K=Box2D.Common.Math.b2Transform,y=Box2D.Common.Math.b2Vec2,w=Box2D.Common.b2Color,A=Box2D.Common.b2Settings,U=Box2D.Collision.b2AABB,p=Box2D.Collision.b2ContactPoint,B=Box2D.Collision.b2DynamicTreeBroadPhase,Q=Box2D.Collision.b2RayCastInput,V=Box2D.Collision.b2RayCastOutput,M=Box2D.Collision.Shapes.b2CircleShape,L=Box2D.Collision.Shapes.b2EdgeShape,I=Box2D.Collision.Shapes.b2MassData,W=Box2D.Collision.Shapes.b2PolygonShape,Y=Box2D.Collision.Shapes.b2Shape,
-k=Box2D.Dynamics.b2Body,z=Box2D.Dynamics.b2BodyDef,u=Box2D.Dynamics.b2ContactFilter,D=Box2D.Dynamics.b2ContactImpulse,H=Box2D.Dynamics.b2ContactListener,O=Box2D.Dynamics.b2ContactManager,E=Box2D.Dynamics.b2DebugDraw,R=Box2D.Dynamics.b2DestructionListener,N=Box2D.Dynamics.b2FilterData,S=Box2D.Dynamics.b2Fixture,aa=Box2D.Dynamics.b2FixtureDef,Z=Box2D.Dynamics.b2Island,d=Box2D.Dynamics.b2TimeStep,h=Box2D.Dynamics.b2World,l=Box2D.Dynamics.Contacts.b2Contact,j=Box2D.Dynamics.Contacts.b2ContactFactory,
-o=Box2D.Dynamics.Contacts.b2ContactSolver,q=Box2D.Dynamics.Joints.b2Joint,n=Box2D.Dynamics.Joints.b2PulleyJoint;k.b2Body=function(){this.m_xf=new K;this.m_sweep=new G;this.m_linearVelocity=new y;this.m_force=new y};k.prototype.connectEdges=function(a,c,g){if(g===undefined)g=0;var b=Math.atan2(c.GetDirectionVector().y,c.GetDirectionVector().x);g=F.MulFV(Math.tan((b-g)*0.5),c.GetDirectionVector());g=F.SubtractVV(g,c.GetNormalVector());g=F.MulFV(A.b2_toiSlop,g);g=F.AddVV(g,c.GetVertex1());var e=F.AddVV(a.GetDirectionVector(),
-c.GetDirectionVector());e.Normalize();var f=F.Dot(a.GetDirectionVector(),c.GetNormalVector())>0;a.SetNextEdge(c,g,e,f);c.SetPrevEdge(a,g,e,f);return b};k.prototype.CreateFixture=function(a){if(this.m_world.IsLocked()==true)return null;var c=new S;c.Create(this,this.m_xf,a);this.m_flags&k.e_activeFlag&&c.CreateProxy(this.m_world.m_contactManager.m_broadPhase,this.m_xf);c.m_next=this.m_fixtureList;this.m_fixtureList=c;++this.m_fixtureCount;c.m_body=this;c.m_density>0&&this.ResetMassData();this.m_world.m_flags|=
-h.e_newFixture;return c};k.prototype.CreateFixture2=function(a,c){if(c===undefined)c=0;var g=new aa;g.shape=a;g.density=c;return this.CreateFixture(g)};k.prototype.DestroyFixture=function(a){if(this.m_world.IsLocked()!=true){for(var c=this.m_fixtureList,g=null;c!=null;){if(c==a){if(g)g.m_next=a.m_next;else this.m_fixtureList=a.m_next;break}g=c;c=c.m_next}for(c=this.m_contactList;c;){g=c.contact;c=c.next;var b=g.GetFixtureA(),e=g.GetFixtureB();if(a==b||a==e)this.m_world.m_contactManager.Destroy(g)}this.m_flags&
-k.e_activeFlag&&a.DestroyProxy(this.m_world.m_contactManager.m_broadPhase);a.Destroy();a.m_body=null;a.m_next=null;--this.m_fixtureCount;this.ResetMassData()}};k.prototype.SetPositionAndAngle=function(a,c){if(c===undefined)c=0;var g;if(this.m_world.IsLocked()!=true){this.m_xf.R.Set(c);this.m_xf.position.SetV(a);g=this.m_xf.R;var b=this.m_sweep.localCenter;this.m_sweep.c.x=g.col1.x*b.x+g.col2.x*b.y;this.m_sweep.c.y=g.col1.y*b.x+g.col2.y*b.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=c;b=this.m_world.m_contactManager.m_broadPhase;for(g=this.m_fixtureList;g;g=g.m_next)g.Synchronize(b,this.m_xf,this.m_xf);this.m_world.m_contactManager.FindNewContacts()}};k.prototype.SetTransform=function(a){this.SetPositionAndAngle(a.position,a.GetAngle())};k.prototype.GetTransform=function(){return this.m_xf};k.prototype.GetPosition=function(){return this.m_xf.position};k.prototype.SetPosition=function(a){this.SetPositionAndAngle(a,
-this.GetAngle())};k.prototype.GetAngle=function(){return this.m_sweep.a};k.prototype.SetAngle=function(a){if(a===undefined)a=0;this.SetPositionAndAngle(this.GetPosition(),a)};k.prototype.GetWorldCenter=function(){return this.m_sweep.c};k.prototype.GetLocalCenter=function(){return this.m_sweep.localCenter};k.prototype.SetLinearVelocity=function(a){this.m_type!=k.b2_staticBody&&this.m_linearVelocity.SetV(a)};k.prototype.GetLinearVelocity=function(){return this.m_linearVelocity};k.prototype.SetAngularVelocity=
-function(a){if(a===undefined)a=0;if(this.m_type!=k.b2_staticBody)this.m_angularVelocity=a};k.prototype.GetAngularVelocity=function(){return this.m_angularVelocity};k.prototype.GetDefinition=function(){var a=new z;a.type=this.GetType();a.allowSleep=(this.m_flags&k.e_allowSleepFlag)==k.e_allowSleepFlag;a.angle=this.GetAngle();a.angularDamping=this.m_angularDamping;a.angularVelocity=this.m_angularVelocity;a.fixedRotation=(this.m_flags&k.e_fixedRotationFlag)==k.e_fixedRotationFlag;a.bullet=(this.m_flags&
-k.e_bulletFlag)==k.e_bulletFlag;a.awake=(this.m_flags&k.e_awakeFlag)==k.e_awakeFlag;a.linearDamping=this.m_linearDamping;a.linearVelocity.SetV(this.GetLinearVelocity());a.position=this.GetPosition();a.userData=this.GetUserData();return a};k.prototype.ApplyForce=function(a,c){if(this.m_type==k.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_force.x+=a.x;this.m_force.y+=a.y;this.m_torque+=(c.x-this.m_sweep.c.x)*a.y-(c.y-this.m_sweep.c.y)*a.x}};k.prototype.ApplyTorque=function(a){if(a===
-undefined)a=0;if(this.m_type==k.b2_dynamicBody){this.IsAwake()==false&&this.SetAwake(true);this.m_torque+=a}};k.prototype.ApplyImpulse=function(a,c){if(this.m_type==k.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*((c.x-this.m_sweep.c.x)*a.y-(c.y-this.m_sweep.c.y)*a.x)}};k.prototype.Split=function(a){for(var c=this.GetLinearVelocity().Copy(),g=this.GetAngularVelocity(),
-b=this.GetWorldCenter(),e=this.m_world.CreateBody(this.GetDefinition()),f,m=this.m_fixtureList;m;)if(a(m)){var r=m.m_next;if(f)f.m_next=r;else this.m_fixtureList=r;this.m_fixtureCount--;m.m_next=e.m_fixtureList;e.m_fixtureList=m;e.m_fixtureCount++;m.m_body=e;m=r}else{f=m;m=m.m_next}this.ResetMassData();e.ResetMassData();f=this.GetWorldCenter();a=e.GetWorldCenter();f=F.AddVV(c,F.CrossFV(g,F.SubtractVV(f,b)));c=F.AddVV(c,F.CrossFV(g,F.SubtractVV(a,b)));this.SetLinearVelocity(f);e.SetLinearVelocity(c);
-this.SetAngularVelocity(g);e.SetAngularVelocity(g);this.SynchronizeFixtures();e.SynchronizeFixtures();return e};k.prototype.Merge=function(a){var c;for(c=a.m_fixtureList;c;){var g=c.m_next;a.m_fixtureCount--;c.m_next=this.m_fixtureList;this.m_fixtureList=c;this.m_fixtureCount++;c.m_body=e;c=g}b.m_fixtureCount=0;var b=this,e=a;b.GetWorldCenter();e.GetWorldCenter();b.GetLinearVelocity().Copy();e.GetLinearVelocity().Copy();b.GetAngularVelocity();e.GetAngularVelocity();b.ResetMassData();this.SynchronizeFixtures()};
-k.prototype.GetMass=function(){return this.m_mass};k.prototype.GetInertia=function(){return this.m_I};k.prototype.GetMassData=function(a){a.mass=this.m_mass;a.I=this.m_I;a.center.SetV(this.m_sweep.localCenter)};k.prototype.SetMassData=function(a){A.b2Assert(this.m_world.IsLocked()==false);if(this.m_world.IsLocked()!=true)if(this.m_type==k.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&k.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 c=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(a.center);this.m_sweep.c0.SetV(F.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-c.y);this.m_linearVelocity.y+=this.m_angularVelocity*+(this.m_sweep.c.x-c.x)}};k.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==k.b2_staticBody||this.m_type==k.b2_kinematicBody)){for(var a=y.Make(0,0),c=this.m_fixtureList;c;c=c.m_next)if(c.m_density!=0){var g=c.GetMassData();this.m_mass+=g.mass;a.x+=g.center.x*g.mass;a.y+=g.center.y*g.mass;this.m_I+=g.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&k.e_fixedRotationFlag)==0){this.m_I-=this.m_mass*(a.x*a.x+a.y*a.y);this.m_I*=this.m_inertiaScale;A.b2Assert(this.m_I>
-0);this.m_invI=1/this.m_I}else this.m_invI=this.m_I=0;c=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(a);this.m_sweep.c0.SetV(F.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-c.y);this.m_linearVelocity.y+=this.m_angularVelocity*+(this.m_sweep.c.x-c.x)}};k.prototype.GetWorldPoint=function(a){var c=this.m_xf.R;a=new y(c.col1.x*a.x+c.col2.x*a.y,c.col1.y*a.x+c.col2.y*a.y);a.x+=this.m_xf.position.x;
-a.y+=this.m_xf.position.y;return a};k.prototype.GetWorldVector=function(a){return F.MulMV(this.m_xf.R,a)};k.prototype.GetLocalPoint=function(a){return F.MulXT(this.m_xf,a)};k.prototype.GetLocalVector=function(a){return F.MulTMV(this.m_xf.R,a)};k.prototype.GetLinearVelocityFromWorldPoint=function(a){return new y(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))};k.prototype.GetLinearVelocityFromLocalPoint=function(a){var c=
-this.m_xf.R;a=new y(c.col1.x*a.x+c.col2.x*a.y,c.col1.y*a.x+c.col2.y*a.y);a.x+=this.m_xf.position.x;a.y+=this.m_xf.position.y;return new y(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))};k.prototype.GetLinearDamping=function(){return this.m_linearDamping};k.prototype.SetLinearDamping=function(a){if(a===undefined)a=0;this.m_linearDamping=a};k.prototype.GetAngularDamping=function(){return this.m_angularDamping};
-k.prototype.SetAngularDamping=function(a){if(a===undefined)a=0;this.m_angularDamping=a};k.prototype.SetType=function(a){if(a===undefined)a=0;if(this.m_type!=a){this.m_type=a;this.ResetMassData();if(this.m_type==k.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()}};k.prototype.GetType=function(){return this.m_type};k.prototype.SetBullet=function(a){if(a)this.m_flags|=
-k.e_bulletFlag;else this.m_flags&=~k.e_bulletFlag};k.prototype.IsBullet=function(){return(this.m_flags&k.e_bulletFlag)==k.e_bulletFlag};k.prototype.SetSleepingAllowed=function(a){if(a)this.m_flags|=k.e_allowSleepFlag;else{this.m_flags&=~k.e_allowSleepFlag;this.SetAwake(true)}};k.prototype.SetAwake=function(a){if(a){this.m_flags|=k.e_awakeFlag;this.m_sleepTime=0}else{this.m_flags&=~k.e_awakeFlag;this.m_sleepTime=0;this.m_linearVelocity.SetZero();this.m_angularVelocity=0;this.m_force.SetZero();this.m_torque=
-0}};k.prototype.IsAwake=function(){return(this.m_flags&k.e_awakeFlag)==k.e_awakeFlag};k.prototype.SetFixedRotation=function(a){if(a)this.m_flags|=k.e_fixedRotationFlag;else this.m_flags&=~k.e_fixedRotationFlag;this.ResetMassData()};k.prototype.IsFixedRotation=function(){return(this.m_flags&k.e_fixedRotationFlag)==k.e_fixedRotationFlag};k.prototype.SetActive=function(a){if(a!=this.IsActive()){var c;if(a){this.m_flags|=k.e_activeFlag;a=this.m_world.m_contactManager.m_broadPhase;for(c=this.m_fixtureList;c;c=
-c.m_next)c.CreateProxy(a,this.m_xf)}else{this.m_flags&=~k.e_activeFlag;a=this.m_world.m_contactManager.m_broadPhase;for(c=this.m_fixtureList;c;c=c.m_next)c.DestroyProxy(a);for(a=this.m_contactList;a;){c=a;a=a.next;this.m_world.m_contactManager.Destroy(c.contact)}this.m_contactList=null}}};k.prototype.IsActive=function(){return(this.m_flags&k.e_activeFlag)==k.e_activeFlag};k.prototype.IsSleepingAllowed=function(){return(this.m_flags&k.e_allowSleepFlag)==k.e_allowSleepFlag};k.prototype.GetFixtureList=
-function(){return this.m_fixtureList};k.prototype.GetJointList=function(){return this.m_jointList};k.prototype.GetControllerList=function(){return this.m_controllerList};k.prototype.GetContactList=function(){return this.m_contactList};k.prototype.GetNext=function(){return this.m_next};k.prototype.GetUserData=function(){return this.m_userData};k.prototype.SetUserData=function(a){this.m_userData=a};k.prototype.GetWorld=function(){return this.m_world};k.prototype.b2Body=function(a,c){this.m_flags=0;
-if(a.bullet)this.m_flags|=k.e_bulletFlag;if(a.fixedRotation)this.m_flags|=k.e_fixedRotationFlag;if(a.allowSleep)this.m_flags|=k.e_allowSleepFlag;if(a.awake)this.m_flags|=k.e_awakeFlag;if(a.active)this.m_flags|=k.e_activeFlag;this.m_world=c;this.m_xf.position.SetV(a.position);this.m_xf.R.Set(a.angle);this.m_sweep.localCenter.SetZero();this.m_sweep.t0=1;this.m_sweep.a0=this.m_sweep.a=a.angle;var g=this.m_xf.R,b=this.m_sweep.localCenter;this.m_sweep.c.x=g.col1.x*b.x+g.col2.x*b.y;this.m_sweep.c.y=g.col1.y*
-b.x+g.col2.y*b.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(a.linearVelocity);this.m_angularVelocity=a.angularVelocity;this.m_linearDamping=a.linearDamping;this.m_angularDamping=a.angularDamping;this.m_force.Set(0,0);this.m_sleepTime=this.m_torque=0;this.m_type=a.type;if(this.m_type==
-k.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=a.inertiaScale;this.m_userData=a.userData;this.m_fixtureList=null;this.m_fixtureCount=0};k.prototype.SynchronizeFixtures=function(){var a=k.s_xf1;a.R.Set(this.m_sweep.a0);var c=a.R,g=this.m_sweep.localCenter;a.position.x=this.m_sweep.c0.x-(c.col1.x*g.x+c.col2.x*g.y);a.position.y=this.m_sweep.c0.y-(c.col1.y*g.x+c.col2.y*g.y);g=this.m_world.m_contactManager.m_broadPhase;for(c=this.m_fixtureList;c;c=
-c.m_next)c.Synchronize(g,a,this.m_xf)};k.prototype.SynchronizeTransform=function(){this.m_xf.R.Set(this.m_sweep.a);var a=this.m_xf.R,c=this.m_sweep.localCenter;this.m_xf.position.x=this.m_sweep.c.x-(a.col1.x*c.x+a.col2.x*c.y);this.m_xf.position.y=this.m_sweep.c.y-(a.col1.y*c.x+a.col2.y*c.y)};k.prototype.ShouldCollide=function(a){if(this.m_type!=k.b2_dynamicBody&&a.m_type!=k.b2_dynamicBody)return false;for(var c=this.m_jointList;c;c=c.next)if(c.other==a)if(c.joint.m_collideConnected==false)return false;
-return true};k.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 K;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});z.b2BodyDef=function(){this.position=new y;this.linearVelocity=new y};z.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=k.b2_staticBody;this.active=true;this.inertiaScale=1};u.b2ContactFilter=function(){};u.prototype.ShouldCollide=
-function(a,c){var g=a.GetFilterData(),b=c.GetFilterData();if(g.groupIndex==b.groupIndex&&g.groupIndex!=0)return g.groupIndex>0;return(g.maskBits&b.categoryBits)!=0&&(g.categoryBits&b.maskBits)!=0};u.prototype.RayCollide=function(a,c){if(!a)return true;return this.ShouldCollide(a instanceof S?a:null,c)};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactFilter.b2_defaultFilter=new u});D.b2ContactImpulse=function(){this.normalImpulses=new Vector_a2j_Number(A.b2_maxManifoldPoints);this.tangentImpulses=
-new Vector_a2j_Number(A.b2_maxManifoldPoints)};H.b2ContactListener=function(){};H.prototype.BeginContact=function(){};H.prototype.EndContact=function(){};H.prototype.PreSolve=function(){};H.prototype.PostSolve=function(){};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactListener.b2_defaultListener=new H});O.b2ContactManager=function(){};O.prototype.b2ContactManager=function(){this.m_world=null;this.m_contactCount=0;this.m_contactFilter=u.b2_defaultFilter;this.m_contactListener=H.b2_defaultListener;
-this.m_contactFactory=new j(this.m_allocator);this.m_broadPhase=new B};O.prototype.AddPair=function(a,c){var g=a instanceof S?a:null,b=c instanceof S?c:null,e=g.GetBody(),f=b.GetBody();if(e!=f){for(var m=f.GetContactList();m;){if(m.other==e){var r=m.contact.GetFixtureA(),s=m.contact.GetFixtureB();if(r==g&&s==b)return;if(r==b&&s==g)return}m=m.next}if(f.ShouldCollide(e)!=false)if(this.m_contactFilter.ShouldCollide(g,b)!=false){m=this.m_contactFactory.Create(g,b);g=m.GetFixtureA();b=m.GetFixtureB();
-e=g.m_body;f=b.m_body;m.m_prev=null;m.m_next=this.m_world.m_contactList;if(this.m_world.m_contactList!=null)this.m_world.m_contactList.m_prev=m;this.m_world.m_contactList=m;m.m_nodeA.contact=m;m.m_nodeA.other=f;m.m_nodeA.prev=null;m.m_nodeA.next=e.m_contactList;if(e.m_contactList!=null)e.m_contactList.prev=m.m_nodeA;e.m_contactList=m.m_nodeA;m.m_nodeB.contact=m;m.m_nodeB.other=e;m.m_nodeB.prev=null;m.m_nodeB.next=f.m_contactList;if(f.m_contactList!=null)f.m_contactList.prev=m.m_nodeB;f.m_contactList=
-m.m_nodeB;++this.m_world.m_contactCount}}};O.prototype.FindNewContacts=function(){this.m_broadPhase.UpdatePairs(Box2D.generateCallback(this,this.AddPair))};O.prototype.Destroy=function(a){var c=a.GetFixtureA(),g=a.GetFixtureB();c=c.GetBody();g=g.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==c.m_contactList)c.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==g.m_contactList)g.m_contactList=a.m_nodeB.next;this.m_contactFactory.Destroy(a);--this.m_contactCount};O.prototype.Collide=function(){for(var a=this.m_world.m_contactList;a;){var c=a.GetFixtureA(),g=a.GetFixtureB(),b=c.GetBody(),e=g.GetBody();if(b.IsAwake()==false&&e.IsAwake()==
-false)a=a.GetNext();else{if(a.m_flags&l.e_filterFlag){if(e.ShouldCollide(b)==false){c=a;a=c.GetNext();this.Destroy(c);continue}if(this.m_contactFilter.ShouldCollide(c,g)==false){c=a;a=c.GetNext();this.Destroy(c);continue}a.m_flags&=~l.e_filterFlag}if(this.m_broadPhase.TestOverlap(c.m_proxy,g.m_proxy)==false){c=a;a=c.GetNext();this.Destroy(c)}else{a.Update(this.m_contactListener);a=a.GetNext()}}}};Box2D.postDefs.push(function(){Box2D.Dynamics.b2ContactManager.s_evalCP=new p});E.b2DebugDraw=function(){};
-E.prototype.b2DebugDraw=function(){};E.prototype.SetFlags=function(){};E.prototype.GetFlags=function(){};E.prototype.AppendFlags=function(){};E.prototype.ClearFlags=function(){};E.prototype.SetSprite=function(){};E.prototype.GetSprite=function(){};E.prototype.SetDrawScale=function(){};E.prototype.GetDrawScale=function(){};E.prototype.SetLineThickness=function(){};E.prototype.GetLineThickness=function(){};E.prototype.SetAlpha=function(){};E.prototype.GetAlpha=function(){};E.prototype.SetFillAlpha=
-function(){};E.prototype.GetFillAlpha=function(){};E.prototype.SetXFormScale=function(){};E.prototype.GetXFormScale=function(){};E.prototype.DrawPolygon=function(){};E.prototype.DrawSolidPolygon=function(){};E.prototype.DrawCircle=function(){};E.prototype.DrawSolidCircle=function(){};E.prototype.DrawSegment=function(){};E.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});R.b2DestructionListener=function(){};R.prototype.SayGoodbyeJoint=function(){};R.prototype.SayGoodbyeFixture=function(){};N.b2FilterData=function(){this.categoryBits=1;this.maskBits=65535;this.groupIndex=0};N.prototype.Copy=function(){var a=new N;a.categoryBits=this.categoryBits;a.maskBits=this.maskBits;a.groupIndex=this.groupIndex;return a};S.b2Fixture=function(){this.m_filter=
-new N};S.prototype.GetType=function(){return this.m_shape.GetType()};S.prototype.GetShape=function(){return this.m_shape};S.prototype.SetSensor=function(a){if(this.m_isSensor!=a){this.m_isSensor=a;if(this.m_body!=null)for(a=this.m_body.GetContactList();a;){var c=a.contact,g=c.GetFixtureA(),b=c.GetFixtureB();if(g==this||b==this)c.SetSensor(g.IsSensor()||b.IsSensor());a=a.next}}};S.prototype.IsSensor=function(){return this.m_isSensor};S.prototype.SetFilterData=function(a){this.m_filter=a.Copy();if(!this.m_body)for(a=
-this.m_body.GetContactList();a;){var c=a.contact,g=c.GetFixtureA(),b=c.GetFixtureB();if(g==this||b==this)c.FlagForFiltering();a=a.next}};S.prototype.GetFilterData=function(){return this.m_filter.Copy()};S.prototype.GetBody=function(){return this.m_body};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.TestPoint=function(a){return this.m_shape.TestPoint(this.m_body.GetTransform(),
-a)};S.prototype.RayCast=function(a,c){return this.m_shape.RayCast(a,c,this.m_body.GetTransform())};S.prototype.GetMassData=function(a){if(a===undefined)a=null;if(a==null)a=new I;this.m_shape.ComputeMass(a,this.m_density);return a};S.prototype.SetDensity=function(a){if(a===undefined)a=0;this.m_density=a};S.prototype.GetDensity=function(){return this.m_density};S.prototype.GetFriction=function(){return this.m_friction};S.prototype.SetFriction=function(a){if(a===undefined)a=0;this.m_friction=a};S.prototype.GetRestitution=
-function(){return this.m_restitution};S.prototype.SetRestitution=function(a){if(a===undefined)a=0;this.m_restitution=a};S.prototype.GetAABB=function(){return this.m_aabb};S.prototype.b2Fixture=function(){this.m_aabb=new U;this.m_shape=this.m_next=this.m_body=this.m_userData=null;this.m_restitution=this.m_friction=this.m_density=0};S.prototype.Create=function(a,c,g){this.m_userData=g.userData;this.m_friction=g.friction;this.m_restitution=g.restitution;this.m_body=a;this.m_next=null;this.m_filter=g.filter.Copy();
-this.m_isSensor=g.isSensor;this.m_shape=g.shape.Copy();this.m_density=g.density};S.prototype.Destroy=function(){this.m_shape=null};S.prototype.CreateProxy=function(a,c){this.m_shape.ComputeAABB(this.m_aabb,c);this.m_proxy=a.CreateProxy(this.m_aabb,this)};S.prototype.DestroyProxy=function(a){if(this.m_proxy!=null){a.DestroyProxy(this.m_proxy);this.m_proxy=null}};S.prototype.Synchronize=function(a,c,g){if(this.m_proxy){var b=new U,e=new U;this.m_shape.ComputeAABB(b,c);this.m_shape.ComputeAABB(e,g);
-this.m_aabb.Combine(b,e);c=F.SubtractVV(g.position,c.position);a.MoveProxy(this.m_proxy,this.m_aabb,c)}};aa.b2FixtureDef=function(){this.filter=new N};aa.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};Z.b2Island=function(){};Z.prototype.b2Island=function(){this.m_bodies=new Vector;this.m_contacts=new Vector;this.m_joints=new Vector};
-Z.prototype.Initialize=function(a,c,g,b,e,f){if(a===undefined)a=0;if(c===undefined)c=0;if(g===undefined)g=0;var m=0;this.m_bodyCapacity=a;this.m_contactCapacity=c;this.m_jointCapacity=g;this.m_jointCount=this.m_contactCount=this.m_bodyCount=0;this.m_allocator=b;this.m_listener=e;this.m_contactSolver=f;for(m=this.m_bodies.length;m<a;m++)this.m_bodies[m]=null;for(m=this.m_contacts.length;m<c;m++)this.m_contacts[m]=null;for(m=this.m_joints.length;m<g;m++)this.m_joints[m]=null};Z.prototype.Clear=function(){this.m_jointCount=
-this.m_contactCount=this.m_bodyCount=0};Z.prototype.Solve=function(a,c,g){var b=0,e=0,f;for(b=0;b<this.m_bodyCount;++b){e=this.m_bodies[b];if(e.GetType()==k.b2_dynamicBody){e.m_linearVelocity.x+=a.dt*(c.x+e.m_invMass*e.m_force.x);e.m_linearVelocity.y+=a.dt*(c.y+e.m_invMass*e.m_force.y);e.m_angularVelocity+=a.dt*e.m_invI*e.m_torque;e.m_linearVelocity.Multiply(F.Clamp(1-a.dt*e.m_linearDamping,0,1));e.m_angularVelocity*=F.Clamp(1-a.dt*e.m_angularDamping,0,1)}}this.m_contactSolver.Initialize(a,this.m_contacts,
-this.m_contactCount,this.m_allocator);c=this.m_contactSolver;c.InitVelocityConstraints(a);for(b=0;b<this.m_jointCount;++b){f=this.m_joints[b];f.InitVelocityConstraints(a)}for(b=0;b<a.velocityIterations;++b){for(e=0;e<this.m_jointCount;++e){f=this.m_joints[e];f.SolveVelocityConstraints(a)}c.SolveVelocityConstraints()}for(b=0;b<this.m_jointCount;++b){f=this.m_joints[b];f.FinalizeVelocityConstraints()}c.FinalizeVelocityConstraints();for(b=0;b<this.m_bodyCount;++b){e=this.m_bodies[b];if(e.GetType()!=
-k.b2_staticBody){var m=a.dt*e.m_linearVelocity.x,r=a.dt*e.m_linearVelocity.y;if(m*m+r*r>A.b2_maxTranslationSquared){e.m_linearVelocity.Normalize();e.m_linearVelocity.x*=A.b2_maxTranslation*a.inv_dt;e.m_linearVelocity.y*=A.b2_maxTranslation*a.inv_dt}m=a.dt*e.m_angularVelocity;if(m*m>A.b2_maxRotationSquared)e.m_angularVelocity=e.m_angularVelocity<0?-A.b2_maxRotation*a.inv_dt:A.b2_maxRotation*a.inv_dt;e.m_sweep.c0.SetV(e.m_sweep.c);e.m_sweep.a0=e.m_sweep.a;e.m_sweep.c.x+=a.dt*e.m_linearVelocity.x;e.m_sweep.c.y+=
-a.dt*e.m_linearVelocity.y;e.m_sweep.a+=a.dt*e.m_angularVelocity;e.SynchronizeTransform()}}for(b=0;b<a.positionIterations;++b){m=c.SolvePositionConstraints(A.b2_contactBaumgarte);r=true;for(e=0;e<this.m_jointCount;++e){f=this.m_joints[e];f=f.SolvePositionConstraints(A.b2_contactBaumgarte);r=r&&f}if(m&&r)break}this.Report(c.m_constraints);if(g){g=Number.MAX_VALUE;c=A.b2_linearSleepTolerance*A.b2_linearSleepTolerance;m=A.b2_angularSleepTolerance*A.b2_angularSleepTolerance;for(b=0;b<this.m_bodyCount;++b){e=
-this.m_bodies[b];if(e.GetType()!=k.b2_staticBody){if((e.m_flags&k.e_allowSleepFlag)==0)g=e.m_sleepTime=0;if((e.m_flags&k.e_allowSleepFlag)==0||e.m_angularVelocity*e.m_angularVelocity>m||F.Dot(e.m_linearVelocity,e.m_linearVelocity)>c)g=e.m_sleepTime=0;else{e.m_sleepTime+=a.dt;g=F.Min(g,e.m_sleepTime)}}}if(g>=A.b2_timeToSleep)for(b=0;b<this.m_bodyCount;++b){e=this.m_bodies[b];e.SetAwake(false)}}};Z.prototype.SolveTOI=function(a){var c=0,g=0;this.m_contactSolver.Initialize(a,this.m_contacts,this.m_contactCount,
-this.m_allocator);var b=this.m_contactSolver;for(c=0;c<this.m_jointCount;++c)this.m_joints[c].InitVelocityConstraints(a);for(c=0;c<a.velocityIterations;++c){b.SolveVelocityConstraints();for(g=0;g<this.m_jointCount;++g)this.m_joints[g].SolveVelocityConstraints(a)}for(c=0;c<this.m_bodyCount;++c){g=this.m_bodies[c];if(g.GetType()!=k.b2_staticBody){var e=a.dt*g.m_linearVelocity.x,f=a.dt*g.m_linearVelocity.y;if(e*e+f*f>A.b2_maxTranslationSquared){g.m_linearVelocity.Normalize();g.m_linearVelocity.x*=A.b2_maxTranslation*
-a.inv_dt;g.m_linearVelocity.y*=A.b2_maxTranslation*a.inv_dt}e=a.dt*g.m_angularVelocity;if(e*e>A.b2_maxRotationSquared)g.m_angularVelocity=g.m_angularVelocity<0?-A.b2_maxRotation*a.inv_dt:A.b2_maxRotation*a.inv_dt;g.m_sweep.c0.SetV(g.m_sweep.c);g.m_sweep.a0=g.m_sweep.a;g.m_sweep.c.x+=a.dt*g.m_linearVelocity.x;g.m_sweep.c.y+=a.dt*g.m_linearVelocity.y;g.m_sweep.a+=a.dt*g.m_angularVelocity;g.SynchronizeTransform()}}for(c=0;c<a.positionIterations;++c){e=b.SolvePositionConstraints(0.75);f=true;for(g=0;g<
-this.m_jointCount;++g){var m=this.m_joints[g].SolvePositionConstraints(A.b2_contactBaumgarte);f=f&&m}if(e&&f)break}this.Report(b.m_constraints)};Z.prototype.Report=function(a){if(this.m_listener!=null)for(var c=0;c<this.m_contactCount;++c){for(var g=this.m_contacts[c],b=a[c],e=0;e<b.pointCount;++e){Z.s_impulse.normalImpulses[e]=b.points[e].normalImpulse;Z.s_impulse.tangentImpulses[e]=b.points[e].tangentImpulse}this.m_listener.PostSolve(g,Z.s_impulse)}};Z.prototype.AddBody=function(a){a.m_islandIndex=
-this.m_bodyCount;this.m_bodies[this.m_bodyCount++]=a};Z.prototype.AddContact=function(a){this.m_contacts[this.m_contactCount++]=a};Z.prototype.AddJoint=function(a){this.m_joints[this.m_jointCount++]=a};Box2D.postDefs.push(function(){Box2D.Dynamics.b2Island.s_impulse=new D});d.b2TimeStep=function(){};d.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};h.b2World=function(){this.s_stack=
-new Vector;this.m_contactManager=new O;this.m_contactSolver=new o;this.m_island=new Z};h.prototype.b2World=function(a,c){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;h.m_warmStarting=true;h.m_continuousPhysics=true;this.m_allowSleep=c;this.m_gravity=a;this.m_inv_dt0=0;this.m_contactManager.m_world=this;this.m_groundBody=this.CreateBody(new z)};
-h.prototype.SetDestructionListener=function(a){this.m_destructionListener=a};h.prototype.SetContactFilter=function(a){this.m_contactManager.m_contactFilter=a};h.prototype.SetContactListener=function(a){this.m_contactManager.m_contactListener=a};h.prototype.SetDebugDraw=function(a){this.m_debugDraw=a};h.prototype.SetBroadPhase=function(a){var c=this.m_contactManager.m_broadPhase;this.m_contactManager.m_broadPhase=a;for(var g=this.m_bodyList;g;g=g.m_next)for(var b=g.m_fixtureList;b;b=b.m_next)b.m_proxy=
-a.CreateProxy(c.GetFatAABB(b.m_proxy),b)};h.prototype.Validate=function(){this.m_contactManager.m_broadPhase.Validate()};h.prototype.GetProxyCount=function(){return this.m_contactManager.m_broadPhase.GetProxyCount()};h.prototype.CreateBody=function(a){if(this.IsLocked()==true)return null;a=new k(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};h.prototype.DestroyBody=function(a){if(this.IsLocked()!=true){for(var c=a.m_jointList;c;){var g=
-c;c=c.next;this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(g.joint);this.DestroyJoint(g.joint)}for(c=a.m_controllerList;c;){g=c;c=c.nextController;g.controller.RemoveBody(a)}for(c=a.m_contactList;c;){g=c;c=c.next;this.m_contactManager.Destroy(g.contact)}a.m_contactList=null;for(c=a.m_fixtureList;c;){g=c;c=c.m_next;this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(g);g.DestroyProxy(this.m_contactManager.m_broadPhase);g.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}};h.prototype.CreateJoint=function(a){var c=q.Create(a,null);c.m_prev=null;if(c.m_next=this.m_jointList)this.m_jointList.m_prev=c;this.m_jointList=c;++this.m_jointCount;c.m_edgeA.joint=c;c.m_edgeA.other=c.m_bodyB;c.m_edgeA.prev=null;if(c.m_edgeA.next=c.m_bodyA.m_jointList)c.m_bodyA.m_jointList.prev=c.m_edgeA;c.m_bodyA.m_jointList=c.m_edgeA;c.m_edgeB.joint=c;
-c.m_edgeB.other=c.m_bodyA;c.m_edgeB.prev=null;if(c.m_edgeB.next=c.m_bodyB.m_jointList)c.m_bodyB.m_jointList.prev=c.m_edgeB;c.m_bodyB.m_jointList=c.m_edgeB;var g=a.bodyA,b=a.bodyB;if(a.collideConnected==false)for(a=b.GetContactList();a;){a.other==g&&a.contact.FlagForFiltering();a=a.next}return c};h.prototype.DestroyJoint=function(a){var c=a.m_collideConnected;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_jointList)this.m_jointList=a.m_next;var g=a.m_bodyA,b=
-a.m_bodyB;g.SetAwake(true);b.SetAwake(true);if(a.m_edgeA.prev)a.m_edgeA.prev.next=a.m_edgeA.next;if(a.m_edgeA.next)a.m_edgeA.next.prev=a.m_edgeA.prev;if(a.m_edgeA==g.m_jointList)g.m_jointList=a.m_edgeA.next;a.m_edgeA.prev=null;a.m_edgeA.next=null;if(a.m_edgeB.prev)a.m_edgeB.prev.next=a.m_edgeB.next;if(a.m_edgeB.next)a.m_edgeB.next.prev=a.m_edgeB.prev;if(a.m_edgeB==b.m_jointList)b.m_jointList=a.m_edgeB.next;a.m_edgeB.prev=null;a.m_edgeB.next=null;q.Destroy(a,null);--this.m_jointCount;if(c==false)for(a=
-b.GetContactList();a;){a.other==g&&a.contact.FlagForFiltering();a=a.next}};h.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};h.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--};h.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};h.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};h.prototype.SetWarmStarting=function(a){h.m_warmStarting=a};h.prototype.SetContinuousPhysics=function(a){h.m_continuousPhysics=
-a};h.prototype.GetBodyCount=function(){return this.m_bodyCount};h.prototype.GetJointCount=function(){return this.m_jointCount};h.prototype.GetContactCount=function(){return this.m_contactCount};h.prototype.SetGravity=function(a){this.m_gravity=a};h.prototype.GetGravity=function(){return this.m_gravity};h.prototype.GetGroundBody=function(){return this.m_groundBody};h.prototype.Step=function(a,c,g){if(a===undefined)a=0;if(c===undefined)c=0;if(g===undefined)g=0;if(this.m_flags&h.e_newFixture){this.m_contactManager.FindNewContacts();
-this.m_flags&=~h.e_newFixture}this.m_flags|=h.e_locked;var b=h.s_timestep2;b.dt=a;b.velocityIterations=c;b.positionIterations=g;b.inv_dt=a>0?1/a:0;b.dtRatio=this.m_inv_dt0*a;b.warmStarting=h.m_warmStarting;this.m_contactManager.Collide();b.dt>0&&this.Solve(b);h.m_continuousPhysics&&b.dt>0&&this.SolveTOI(b);if(b.dt>0)this.m_inv_dt0=b.inv_dt;this.m_flags&=~h.e_locked};h.prototype.ClearForces=function(){for(var a=this.m_bodyList;a;a=a.m_next){a.m_force.SetZero();a.m_torque=0}};h.prototype.DrawDebugData=
-function(){if(this.m_debugDraw!=null){this.m_debugDraw.m_sprite.graphics.clear();var a=this.m_debugDraw.GetFlags(),c,g,b;new y;new y;new y;var e;new U;new U;e=[new y,new y,new y,new y];var f=new w(0,0,0);if(a&E.e_shapeBit)for(c=this.m_bodyList;c;c=c.m_next){e=c.m_xf;for(g=c.GetFixtureList();g;g=g.m_next){b=g.GetShape();if(c.IsActive()==false)f.Set(0.5,0.5,0.3);else if(c.GetType()==k.b2_staticBody)f.Set(0.5,0.9,0.5);else if(c.GetType()==k.b2_kinematicBody)f.Set(0.5,0.5,0.9);else c.IsAwake()==false?
-f.Set(0.6,0.6,0.6):f.Set(0.9,0.7,0.7);this.DrawShape(b,e,f)}}if(a&E.e_jointBit)for(c=this.m_jointList;c;c=c.m_next)this.DrawJoint(c);if(a&E.e_controllerBit)for(c=this.m_controllerList;c;c=c.m_next)c.Draw(this.m_debugDraw);if(a&E.e_pairBit){f.Set(0.3,0.9,0.9);for(c=this.m_contactManager.m_contactList;c;c=c.GetNext()){b=c.GetFixtureA();g=c.GetFixtureB();b=b.GetAABB().GetCenter();g=g.GetAABB().GetCenter();this.m_debugDraw.DrawSegment(b,g,f)}}if(a&E.e_aabbBit){b=this.m_contactManager.m_broadPhase;e=[new y,
-new y,new y,new y];for(c=this.m_bodyList;c;c=c.GetNext())if(c.IsActive()!=false)for(g=c.GetFixtureList();g;g=g.GetNext()){var m=b.GetFatAABB(g.m_proxy);e[0].Set(m.lowerBound.x,m.lowerBound.y);e[1].Set(m.upperBound.x,m.lowerBound.y);e[2].Set(m.upperBound.x,m.upperBound.y);e[3].Set(m.lowerBound.x,m.upperBound.y);this.m_debugDraw.DrawPolygon(e,4,f)}}if(a&E.e_centerOfMassBit)for(c=this.m_bodyList;c;c=c.m_next){e=h.s_xf;e.R=c.m_xf.R;e.position=c.GetWorldCenter();this.m_debugDraw.DrawTransform(e)}}};h.prototype.QueryAABB=
-function(a,c){var g=this.m_contactManager.m_broadPhase;g.Query(function(b){return a(g.GetUserData(b))},c)};h.prototype.QueryShape=function(a,c,g){if(g===undefined)g=null;if(g==null){g=new K;g.SetIdentity()}var b=this.m_contactManager.m_broadPhase,e=new U;c.ComputeAABB(e,g);b.Query(function(f){f=b.GetUserData(f)instanceof S?b.GetUserData(f):null;if(Y.TestOverlap(c,g,f.GetShape(),f.GetBody().GetTransform()))return a(f);return true},e)};h.prototype.QueryPoint=function(a,c){var g=this.m_contactManager.m_broadPhase,
-b=new U;b.lowerBound.Set(c.x-A.b2_linearSlop,c.y-A.b2_linearSlop);b.upperBound.Set(c.x+A.b2_linearSlop,c.y+A.b2_linearSlop);g.Query(function(e){e=g.GetUserData(e)instanceof S?g.GetUserData(e):null;if(e.TestPoint(c))return a(e);return true},b)};h.prototype.RayCast=function(a,c,g){var b=this.m_contactManager.m_broadPhase,e=new V,f=new Q(c,g);b.RayCast(function(m,r){var s=b.GetUserData(r);s=s instanceof S?s:null;if(s.RayCast(e,m)){var v=e.fraction,t=new y((1-v)*c.x+v*g.x,(1-v)*c.y+v*g.y);return a(s,
-t,e.normal,v)}return m.maxFraction},f)};h.prototype.RayCastOne=function(a,c){var g;this.RayCast(function(b,e,f,m){if(m===undefined)m=0;g=b;return m},a,c);return g};h.prototype.RayCastAll=function(a,c){var g=new Vector;this.RayCast(function(b){g[g.length]=b;return 1},a,c);return g};h.prototype.GetBodyList=function(){return this.m_bodyList};h.prototype.GetJointList=function(){return this.m_jointList};h.prototype.GetContactList=function(){return this.m_contactList};h.prototype.IsLocked=function(){return(this.m_flags&
-h.e_locked)>0};h.prototype.Solve=function(a){for(var c,g=this.m_controllerList;g;g=g.m_next)g.Step(a);g=this.m_island;g.Initialize(this.m_bodyCount,this.m_contactCount,this.m_jointCount,null,this.m_contactManager.m_contactListener,this.m_contactSolver);for(c=this.m_bodyList;c;c=c.m_next)c.m_flags&=~k.e_islandFlag;for(var b=this.m_contactList;b;b=b.m_next)b.m_flags&=~l.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 e=this.m_bodyList;e;e=
-e.m_next)if(!(e.m_flags&k.e_islandFlag))if(!(e.IsAwake()==false||e.IsActive()==false))if(e.GetType()!=k.b2_staticBody){g.Clear();var f=0;b[f++]=e;for(e.m_flags|=k.e_islandFlag;f>0;){c=b[--f];g.AddBody(c);c.IsAwake()==false&&c.SetAwake(true);if(c.GetType()!=k.b2_staticBody){for(var m,r=c.m_contactList;r;r=r.next)if(!(r.contact.m_flags&l.e_islandFlag))if(!(r.contact.IsSensor()==true||r.contact.IsEnabled()==false||r.contact.IsTouching()==false)){g.AddContact(r.contact);r.contact.m_flags|=l.e_islandFlag;
-m=r.other;if(!(m.m_flags&k.e_islandFlag)){b[f++]=m;m.m_flags|=k.e_islandFlag}}for(c=c.m_jointList;c;c=c.next)if(c.joint.m_islandFlag!=true){m=c.other;if(m.IsActive()!=false){g.AddJoint(c.joint);c.joint.m_islandFlag=true;if(!(m.m_flags&k.e_islandFlag)){b[f++]=m;m.m_flags|=k.e_islandFlag}}}}}g.Solve(a,this.m_gravity,this.m_allowSleep);for(f=0;f<g.m_bodyCount;++f){c=g.m_bodies[f];if(c.GetType()==k.b2_staticBody)c.m_flags&=~k.e_islandFlag}}for(f=0;f<b.length;++f){if(!b[f])break;b[f]=null}for(c=this.m_bodyList;c;c=
-c.m_next)c.IsAwake()==false||c.IsActive()==false||c.GetType()!=k.b2_staticBody&&c.SynchronizeFixtures();this.m_contactManager.FindNewContacts()};h.prototype.SolveTOI=function(a){var c,g,b,e=this.m_island;e.Initialize(this.m_bodyCount,A.b2_maxTOIContactsPerIsland,A.b2_maxTOIJointsPerIsland,null,this.m_contactManager.m_contactListener,this.m_contactSolver);var f=h.s_queue;for(c=this.m_bodyList;c;c=c.m_next){c.m_flags&=~k.e_islandFlag;c.m_sweep.t0=0}for(b=this.m_contactList;b;b=b.m_next)b.m_flags&=~(l.e_toiFlag|
-l.e_islandFlag);for(b=this.m_jointList;b;b=b.m_next)b.m_islandFlag=false;for(;;){var m=null,r=1;for(b=this.m_contactList;b;b=b.m_next)if(!(b.IsSensor()==true||b.IsEnabled()==false||b.IsContinuous()==false)){c=1;if(b.m_flags&l.e_toiFlag)c=b.m_toi;else{c=b.m_fixtureA;g=b.m_fixtureB;c=c.m_body;g=g.m_body;if((c.GetType()!=k.b2_dynamicBody||c.IsAwake()==false)&&(g.GetType()!=k.b2_dynamicBody||g.IsAwake()==false))continue;var s=c.m_sweep.t0;if(c.m_sweep.t0<g.m_sweep.t0){s=g.m_sweep.t0;c.m_sweep.Advance(s)}else if(g.m_sweep.t0<
-c.m_sweep.t0){s=c.m_sweep.t0;g.m_sweep.Advance(s)}c=b.ComputeTOI(c.m_sweep,g.m_sweep);A.b2Assert(0<=c&&c<=1);if(c>0&&c<1){c=(1-c)*s+c;if(c>1)c=1}b.m_toi=c;b.m_flags|=l.e_toiFlag}if(Number.MIN_VALUE<c&&c<r){m=b;r=c}}if(m==null||1-100*Number.MIN_VALUE<r)break;c=m.m_fixtureA;g=m.m_fixtureB;c=c.m_body;g=g.m_body;h.s_backupA.Set(c.m_sweep);h.s_backupB.Set(g.m_sweep);c.Advance(r);g.Advance(r);m.Update(this.m_contactManager.m_contactListener);m.m_flags&=~l.e_toiFlag;if(m.IsSensor()==true||m.IsEnabled()==
-false){c.m_sweep.Set(h.s_backupA);g.m_sweep.Set(h.s_backupB);c.SynchronizeTransform();g.SynchronizeTransform()}else if(m.IsTouching()!=false){c=c;if(c.GetType()!=k.b2_dynamicBody)c=g;e.Clear();m=b=0;f[b+m++]=c;for(c.m_flags|=k.e_islandFlag;m>0;){c=f[b++];--m;e.AddBody(c);c.IsAwake()==false&&c.SetAwake(true);if(c.GetType()==k.b2_dynamicBody){for(g=c.m_contactList;g;g=g.next){if(e.m_contactCount==e.m_contactCapacity)break;if(!(g.contact.m_flags&l.e_islandFlag))if(!(g.contact.IsSensor()==true||g.contact.IsEnabled()==
-false||g.contact.IsTouching()==false)){e.AddContact(g.contact);g.contact.m_flags|=l.e_islandFlag;s=g.other;if(!(s.m_flags&k.e_islandFlag)){if(s.GetType()!=k.b2_staticBody){s.Advance(r);s.SetAwake(true)}f[b+m]=s;++m;s.m_flags|=k.e_islandFlag}}}for(c=c.m_jointList;c;c=c.next)if(e.m_jointCount!=e.m_jointCapacity)if(c.joint.m_islandFlag!=true){s=c.other;if(s.IsActive()!=false){e.AddJoint(c.joint);c.joint.m_islandFlag=true;if(!(s.m_flags&k.e_islandFlag)){if(s.GetType()!=k.b2_staticBody){s.Advance(r);s.SetAwake(true)}f[b+
-m]=s;++m;s.m_flags|=k.e_islandFlag}}}}}b=h.s_timestep;b.warmStarting=false;b.dt=(1-r)*a.dt;b.inv_dt=1/b.dt;b.dtRatio=0;b.velocityIterations=a.velocityIterations;b.positionIterations=a.positionIterations;e.SolveTOI(b);for(r=r=0;r<e.m_bodyCount;++r){c=e.m_bodies[r];c.m_flags&=~k.e_islandFlag;if(c.IsAwake()!=false)if(c.GetType()==k.b2_dynamicBody){c.SynchronizeFixtures();for(g=c.m_contactList;g;g=g.next)g.contact.m_flags&=~l.e_toiFlag}}for(r=0;r<e.m_contactCount;++r){b=e.m_contacts[r];b.m_flags&=~(l.e_toiFlag|
-l.e_islandFlag)}for(r=0;r<e.m_jointCount;++r){b=e.m_joints[r];b.m_islandFlag=false}this.m_contactManager.FindNewContacts()}}};h.prototype.DrawJoint=function(a){var c=a.GetBodyA(),g=a.GetBodyB(),b=c.m_xf.position,e=g.m_xf.position,f=a.GetAnchorA(),m=a.GetAnchorB(),r=h.s_jointColor;switch(a.m_type){case q.e_distanceJoint:this.m_debugDraw.DrawSegment(f,m,r);break;case q.e_pulleyJoint:c=a instanceof n?a:null;a=c.GetGroundAnchorA();c=c.GetGroundAnchorB();this.m_debugDraw.DrawSegment(a,f,r);this.m_debugDraw.DrawSegment(c,
-m,r);this.m_debugDraw.DrawSegment(a,c,r);break;case q.e_mouseJoint:this.m_debugDraw.DrawSegment(f,m,r);break;default:c!=this.m_groundBody&&this.m_debugDraw.DrawSegment(b,f,r);this.m_debugDraw.DrawSegment(f,m,r);g!=this.m_groundBody&&this.m_debugDraw.DrawSegment(e,m,r)}};h.prototype.DrawShape=function(a,c,g){switch(a.m_type){case Y.e_circleShape:var b=a instanceof M?a:null;this.m_debugDraw.DrawSolidCircle(F.MulX(c,b.m_p),b.m_radius,c.R.col1,g);break;case Y.e_polygonShape:b=0;b=a instanceof W?a:null;
-a=parseInt(b.GetVertexCount());var e=b.GetVertices(),f=new Vector(a);for(b=0;b<a;++b)f[b]=F.MulX(c,e[b]);this.m_debugDraw.DrawSolidPolygon(f,a,g);break;case Y.e_edgeShape:b=a instanceof L?a:null;this.m_debugDraw.DrawSegment(F.MulX(c,b.GetVertex1()),F.MulX(c,b.GetVertex2()),g)}};Box2D.postDefs.push(function(){Box2D.Dynamics.b2World.s_timestep2=new d;Box2D.Dynamics.b2World.s_xf=new K;Box2D.Dynamics.b2World.s_backupA=new G;Box2D.Dynamics.b2World.s_backupB=new G;Box2D.Dynamics.b2World.s_timestep=new d;
-Box2D.Dynamics.b2World.s_queue=new Vector;Box2D.Dynamics.b2World.s_jointColor=new w(0.5,0.8,0.8);Box2D.Dynamics.b2World.e_newFixture=1;Box2D.Dynamics.b2World.e_locked=2})})();
-(function(){var F=Box2D.Collision.Shapes.b2CircleShape,G=Box2D.Collision.Shapes.b2EdgeShape,K=Box2D.Collision.Shapes.b2PolygonShape,y=Box2D.Collision.Shapes.b2Shape,w=Box2D.Dynamics.Contacts.b2CircleContact,A=Box2D.Dynamics.Contacts.b2Contact,U=Box2D.Dynamics.Contacts.b2ContactConstraint,p=Box2D.Dynamics.Contacts.b2ContactConstraintPoint,B=Box2D.Dynamics.Contacts.b2ContactEdge,Q=Box2D.Dynamics.Contacts.b2ContactFactory,V=Box2D.Dynamics.Contacts.b2ContactRegister,M=Box2D.Dynamics.Contacts.b2ContactResult,
-L=Box2D.Dynamics.Contacts.b2ContactSolver,I=Box2D.Dynamics.Contacts.b2EdgeAndCircleContact,W=Box2D.Dynamics.Contacts.b2NullContact,Y=Box2D.Dynamics.Contacts.b2PolyAndCircleContact,k=Box2D.Dynamics.Contacts.b2PolyAndEdgeContact,z=Box2D.Dynamics.Contacts.b2PolygonContact,u=Box2D.Dynamics.Contacts.b2PositionSolverManifold,D=Box2D.Dynamics.b2Body,H=Box2D.Dynamics.b2TimeStep,O=Box2D.Common.b2Settings,E=Box2D.Common.Math.b2Mat22,R=Box2D.Common.Math.b2Math,N=Box2D.Common.Math.b2Vec2,S=Box2D.Collision.b2Collision,
-aa=Box2D.Collision.b2ContactID,Z=Box2D.Collision.b2Manifold,d=Box2D.Collision.b2TimeOfImpact,h=Box2D.Collision.b2TOIInput,l=Box2D.Collision.b2WorldManifold;Box2D.inherit(w,Box2D.Dynamics.Contacts.b2Contact);w.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;w.b2CircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};w.Create=function(){return new w};w.Destroy=function(){};w.prototype.Reset=function(j,o){this.__super.Reset.call(this,j,o)};w.prototype.Evaluate=
-function(){var j=this.m_fixtureA.GetBody(),o=this.m_fixtureB.GetBody();S.CollideCircles(this.m_manifold,this.m_fixtureA.GetShape()instanceof F?this.m_fixtureA.GetShape():null,j.m_xf,this.m_fixtureB.GetShape()instanceof F?this.m_fixtureB.GetShape():null,o.m_xf)};A.b2Contact=function(){this.m_nodeA=new B;this.m_nodeB=new B;this.m_manifold=new Z;this.m_oldManifold=new Z};A.prototype.GetManifold=function(){return this.m_manifold};A.prototype.GetWorldManifold=function(j){var o=this.m_fixtureA.GetBody(),
-q=this.m_fixtureB.GetBody(),n=this.m_fixtureA.GetShape(),a=this.m_fixtureB.GetShape();j.Initialize(this.m_manifold,o.GetTransform(),n.m_radius,q.GetTransform(),a.m_radius)};A.prototype.IsTouching=function(){return(this.m_flags&A.e_touchingFlag)==A.e_touchingFlag};A.prototype.IsContinuous=function(){return(this.m_flags&A.e_continuousFlag)==A.e_continuousFlag};A.prototype.SetSensor=function(j){if(j)this.m_flags|=A.e_sensorFlag;else this.m_flags&=~A.e_sensorFlag};A.prototype.IsSensor=function(){return(this.m_flags&
-A.e_sensorFlag)==A.e_sensorFlag};A.prototype.SetEnabled=function(j){if(j)this.m_flags|=A.e_enabledFlag;else this.m_flags&=~A.e_enabledFlag};A.prototype.IsEnabled=function(){return(this.m_flags&A.e_enabledFlag)==A.e_enabledFlag};A.prototype.GetNext=function(){return this.m_next};A.prototype.GetFixtureA=function(){return this.m_fixtureA};A.prototype.GetFixtureB=function(){return this.m_fixtureB};A.prototype.FlagForFiltering=function(){this.m_flags|=A.e_filterFlag};A.prototype.b2Contact=function(){};
-A.prototype.Reset=function(j,o){if(j===undefined)j=null;if(o===undefined)o=null;this.m_flags=A.e_enabledFlag;if(!j||!o)this.m_fixtureB=this.m_fixtureA=null;else{if(j.IsSensor()||o.IsSensor())this.m_flags|=A.e_sensorFlag;var q=j.GetBody(),n=o.GetBody();if(q.GetType()!=D.b2_dynamicBody||q.IsBullet()||n.GetType()!=D.b2_dynamicBody||n.IsBullet())this.m_flags|=A.e_continuousFlag;this.m_fixtureA=j;this.m_fixtureB=o;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}};A.prototype.Update=function(j){var o=this.m_oldManifold;this.m_oldManifold=this.m_manifold;this.m_manifold=o;this.m_flags|=A.e_enabledFlag;var q=false;o=(this.m_flags&A.e_touchingFlag)==A.e_touchingFlag;var n=this.m_fixtureA.m_body,a=this.m_fixtureB.m_body,c=this.m_fixtureA.m_aabb.TestOverlap(this.m_fixtureB.m_aabb);if(this.m_flags&A.e_sensorFlag){if(c){q=
-this.m_fixtureA.GetShape();c=this.m_fixtureB.GetShape();n=n.GetTransform();a=a.GetTransform();q=y.TestOverlap(q,n,c,a)}this.m_manifold.m_pointCount=0}else{if(n.GetType()!=D.b2_dynamicBody||n.IsBullet()||a.GetType()!=D.b2_dynamicBody||a.IsBullet())this.m_flags|=A.e_continuousFlag;else this.m_flags&=~A.e_continuousFlag;if(c){this.Evaluate();q=this.m_manifold.m_pointCount>0;for(c=0;c<this.m_manifold.m_pointCount;++c){var g=this.m_manifold.m_points[c];g.m_normalImpulse=0;g.m_tangentImpulse=0;for(var b=
-g.m_id,e=0;e<this.m_oldManifold.m_pointCount;++e){var f=this.m_oldManifold.m_points[e];if(f.m_id.key==b.key){g.m_normalImpulse=f.m_normalImpulse;g.m_tangentImpulse=f.m_tangentImpulse;break}}}}else this.m_manifold.m_pointCount=0;if(q!=o){n.SetAwake(true);a.SetAwake(true)}}if(q)this.m_flags|=A.e_touchingFlag;else this.m_flags&=~A.e_touchingFlag;o==false&&q==true&&j.BeginContact(this);o==true&&q==false&&j.EndContact(this);(this.m_flags&A.e_sensorFlag)==0&&j.PreSolve(this,this.m_oldManifold)};A.prototype.Evaluate=
-function(){};A.prototype.ComputeTOI=function(j,o){A.s_input.proxyA.Set(this.m_fixtureA.GetShape());A.s_input.proxyB.Set(this.m_fixtureB.GetShape());A.s_input.sweepA=j;A.s_input.sweepB=o;A.s_input.tolerance=O.b2_linearSlop;return d.TimeOfImpact(A.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 h});U.b2ContactConstraint=function(){this.localPlaneNormal=new N;this.localPoint=new N;this.normal=new N;this.normalMass=new E;this.K=new E};U.prototype.b2ContactConstraint=function(){this.points=new Vector(O.b2_maxManifoldPoints);for(var j=0;j<O.b2_maxManifoldPoints;j++)this.points[j]=new p};p.b2ContactConstraintPoint=function(){this.localPoint=new N;
-this.rA=new N;this.rB=new N};B.b2ContactEdge=function(){};Q.b2ContactFactory=function(){};Q.prototype.b2ContactFactory=function(j){this.m_allocator=j;this.InitializeRegisters()};Q.prototype.AddType=function(j,o,q,n){if(q===undefined)q=0;if(n===undefined)n=0;this.m_registers[q][n].createFcn=j;this.m_registers[q][n].destroyFcn=o;this.m_registers[q][n].primary=true;if(q!=n){this.m_registers[n][q].createFcn=j;this.m_registers[n][q].destroyFcn=o;this.m_registers[n][q].primary=false}};Q.prototype.InitializeRegisters=
-function(){this.m_registers=new Vector(y.e_shapeTypeCount);for(var j=0;j<y.e_shapeTypeCount;j++){this.m_registers[j]=new Vector(y.e_shapeTypeCount);for(var o=0;o<y.e_shapeTypeCount;o++)this.m_registers[j][o]=new V}this.AddType(w.Create,w.Destroy,y.e_circleShape,y.e_circleShape);this.AddType(Y.Create,Y.Destroy,y.e_polygonShape,y.e_circleShape);this.AddType(z.Create,z.Destroy,y.e_polygonShape,y.e_polygonShape);this.AddType(I.Create,I.Destroy,y.e_edgeShape,y.e_circleShape);this.AddType(k.Create,k.Destroy,
-y.e_polygonShape,y.e_edgeShape)};Q.prototype.Create=function(j,o){var q=parseInt(j.GetType()),n=parseInt(o.GetType());q=this.m_registers[q][n];if(q.pool){n=q.pool;q.pool=n.m_next;q.poolCount--;n.Reset(j,o);return n}n=q.createFcn;if(n!=null){if(q.primary){n=n(this.m_allocator);n.Reset(j,o)}else{n=n(this.m_allocator);n.Reset(o,j)}return n}else return null};Q.prototype.Destroy=function(j){if(j.m_manifold.m_pointCount>0){j.m_fixtureA.m_body.SetAwake(true);j.m_fixtureB.m_body.SetAwake(true)}var o=parseInt(j.m_fixtureA.GetType()),
-q=parseInt(j.m_fixtureB.GetType());o=this.m_registers[o][q];o.poolCount++;j.m_next=o.pool;o.pool=j;o=o.destroyFcn;o(j,this.m_allocator)};V.b2ContactRegister=function(){};M.b2ContactResult=function(){this.position=new N;this.normal=new N;this.id=new aa};L.b2ContactSolver=function(){this.m_step=new H;this.m_constraints=new Vector};L.prototype.b2ContactSolver=function(){};L.prototype.Initialize=function(j,o,q,n){if(q===undefined)q=0;var a;this.m_step.Set(j);this.m_allocator=n;j=0;for(this.m_constraintCount=
-q;this.m_constraints.length<this.m_constraintCount;)this.m_constraints[this.m_constraints.length]=new U;for(j=0;j<q;++j){a=o[j];n=a.m_fixtureA;var c=a.m_fixtureB,g=n.m_shape.m_radius,b=c.m_shape.m_radius,e=n.m_body,f=c.m_body,m=a.GetManifold(),r=O.b2MixFriction(n.GetFriction(),c.GetFriction()),s=O.b2MixRestitution(n.GetRestitution(),c.GetRestitution()),v=e.m_linearVelocity.x,t=e.m_linearVelocity.y,x=f.m_linearVelocity.x,C=f.m_linearVelocity.y,J=e.m_angularVelocity,T=f.m_angularVelocity;O.b2Assert(m.m_pointCount>
-0);L.s_worldManifold.Initialize(m,e.m_xf,g,f.m_xf,b);c=L.s_worldManifold.m_normal.x;a=L.s_worldManifold.m_normal.y;n=this.m_constraints[j];n.bodyA=e;n.bodyB=f;n.manifold=m;n.normal.x=c;n.normal.y=a;n.pointCount=m.m_pointCount;n.friction=r;n.restitution=s;n.localPlaneNormal.x=m.m_localPlaneNormal.x;n.localPlaneNormal.y=m.m_localPlaneNormal.y;n.localPoint.x=m.m_localPoint.x;n.localPoint.y=m.m_localPoint.y;n.radius=g+b;n.type=m.m_type;for(g=0;g<n.pointCount;++g){r=m.m_points[g];b=n.points[g];b.normalImpulse=
-r.m_normalImpulse;b.tangentImpulse=r.m_tangentImpulse;b.localPoint.SetV(r.m_localPoint);r=b.rA.x=L.s_worldManifold.m_points[g].x-e.m_sweep.c.x;s=b.rA.y=L.s_worldManifold.m_points[g].y-e.m_sweep.c.y;var P=b.rB.x=L.s_worldManifold.m_points[g].x-f.m_sweep.c.x,X=b.rB.y=L.s_worldManifold.m_points[g].y-f.m_sweep.c.y,$=r*a-s*c,ba=P*a-X*c;$*=$;ba*=ba;b.normalMass=1/(e.m_invMass+f.m_invMass+e.m_invI*$+f.m_invI*ba);var ca=e.m_mass*e.m_invMass+f.m_mass*f.m_invMass;ca+=e.m_mass*e.m_invI*$+f.m_mass*f.m_invI*ba;
-b.equalizedMass=1/ca;ba=a;ca=-c;$=r*ca-s*ba;ba=P*ca-X*ba;$*=$;ba*=ba;b.tangentMass=1/(e.m_invMass+f.m_invMass+e.m_invI*$+f.m_invI*ba);b.velocityBias=0;r=n.normal.x*(x+-T*X-v- -J*s)+n.normal.y*(C+T*P-t-J*r);if(r<-O.b2_velocityThreshold)b.velocityBias+=-n.restitution*r}if(n.pointCount==2){C=n.points[0];x=n.points[1];m=e.m_invMass;e=e.m_invI;v=f.m_invMass;f=f.m_invI;t=C.rA.x*a-C.rA.y*c;C=C.rB.x*a-C.rB.y*c;J=x.rA.x*a-x.rA.y*c;x=x.rB.x*a-x.rB.y*c;c=m+v+e*t*t+f*C*C;a=m+v+e*J*J+f*x*x;f=m+v+e*t*J+f*C*x;if(c*
-c<100*(c*a-f*f)){n.K.col1.Set(c,f);n.K.col2.Set(f,a);n.K.GetInverse(n.normalMass)}else n.pointCount=1}}};L.prototype.InitVelocityConstraints=function(j){for(var o=0;o<this.m_constraintCount;++o){var q=this.m_constraints[o],n=q.bodyA,a=q.bodyB,c=n.m_invMass,g=n.m_invI,b=a.m_invMass,e=a.m_invI,f=q.normal.x,m=q.normal.y,r=m,s=-f,v=0,t=0;if(j.warmStarting){t=q.pointCount;for(v=0;v<t;++v){var x=q.points[v];x.normalImpulse*=j.dtRatio;x.tangentImpulse*=j.dtRatio;var C=x.normalImpulse*f+x.tangentImpulse*
-r,J=x.normalImpulse*m+x.tangentImpulse*s;n.m_angularVelocity-=g*(x.rA.x*J-x.rA.y*C);n.m_linearVelocity.x-=c*C;n.m_linearVelocity.y-=c*J;a.m_angularVelocity+=e*(x.rB.x*J-x.rB.y*C);a.m_linearVelocity.x+=b*C;a.m_linearVelocity.y+=b*J}}else{t=q.pointCount;for(v=0;v<t;++v){n=q.points[v];n.normalImpulse=0;n.tangentImpulse=0}}}};L.prototype.SolveVelocityConstraints=function(){for(var j=0,o,q=0,n=0,a=0,c=n=n=q=q=0,g=q=q=0,b=q=a=0,e=0,f,m=0;m<this.m_constraintCount;++m){a=this.m_constraints[m];var r=a.bodyA,
-s=a.bodyB,v=r.m_angularVelocity,t=s.m_angularVelocity,x=r.m_linearVelocity,C=s.m_linearVelocity,J=r.m_invMass,T=r.m_invI,P=s.m_invMass,X=s.m_invI;b=a.normal.x;var $=e=a.normal.y;f=-b;g=a.friction;for(j=0;j<a.pointCount;j++){o=a.points[j];q=C.x-t*o.rB.y-x.x+v*o.rA.y;n=C.y+t*o.rB.x-x.y-v*o.rA.x;q=q*$+n*f;q=o.tangentMass*-q;n=g*o.normalImpulse;n=R.Clamp(o.tangentImpulse+q,-n,n);q=n-o.tangentImpulse;c=q*$;q=q*f;x.x-=J*c;x.y-=J*q;v-=T*(o.rA.x*q-o.rA.y*c);C.x+=P*c;C.y+=P*q;t+=X*(o.rB.x*q-o.rB.y*c);o.tangentImpulse=
-n}parseInt(a.pointCount);if(a.pointCount==1){o=a.points[0];q=C.x+-t*o.rB.y-x.x- -v*o.rA.y;n=C.y+t*o.rB.x-x.y-v*o.rA.x;a=q*b+n*e;q=-o.normalMass*(a-o.velocityBias);n=o.normalImpulse+q;n=n>0?n:0;q=n-o.normalImpulse;c=q*b;q=q*e;x.x-=J*c;x.y-=J*q;v-=T*(o.rA.x*q-o.rA.y*c);C.x+=P*c;C.y+=P*q;t+=X*(o.rB.x*q-o.rB.y*c);o.normalImpulse=n}else{o=a.points[0];j=a.points[1];q=o.normalImpulse;g=j.normalImpulse;var ba=(C.x-t*o.rB.y-x.x+v*o.rA.y)*b+(C.y+t*o.rB.x-x.y-v*o.rA.x)*e,ca=(C.x-t*j.rB.y-x.x+v*j.rA.y)*b+(C.y+
-t*j.rB.x-x.y-v*j.rA.x)*e;n=ba-o.velocityBias;c=ca-j.velocityBias;f=a.K;n-=f.col1.x*q+f.col2.x*g;for(c-=f.col1.y*q+f.col2.y*g;;){f=a.normalMass;$=-(f.col1.x*n+f.col2.x*c);f=-(f.col1.y*n+f.col2.y*c);if($>=0&&f>=0){q=$-q;g=f-g;a=q*b;q=q*e;b=g*b;e=g*e;x.x-=J*(a+b);x.y-=J*(q+e);v-=T*(o.rA.x*q-o.rA.y*a+j.rA.x*e-j.rA.y*b);C.x+=P*(a+b);C.y+=P*(q+e);t+=X*(o.rB.x*q-o.rB.y*a+j.rB.x*e-j.rB.y*b);o.normalImpulse=$;j.normalImpulse=f;break}$=-o.normalMass*n;f=0;ca=a.K.col1.y*$+c;if($>=0&&ca>=0){q=$-q;g=f-g;a=q*b;
-q=q*e;b=g*b;e=g*e;x.x-=J*(a+b);x.y-=J*(q+e);v-=T*(o.rA.x*q-o.rA.y*a+j.rA.x*e-j.rA.y*b);C.x+=P*(a+b);C.y+=P*(q+e);t+=X*(o.rB.x*q-o.rB.y*a+j.rB.x*e-j.rB.y*b);o.normalImpulse=$;j.normalImpulse=f;break}$=0;f=-j.normalMass*c;ba=a.K.col2.x*f+n;if(f>=0&&ba>=0){q=$-q;g=f-g;a=q*b;q=q*e;b=g*b;e=g*e;x.x-=J*(a+b);x.y-=J*(q+e);v-=T*(o.rA.x*q-o.rA.y*a+j.rA.x*e-j.rA.y*b);C.x+=P*(a+b);C.y+=P*(q+e);t+=X*(o.rB.x*q-o.rB.y*a+j.rB.x*e-j.rB.y*b);o.normalImpulse=$;j.normalImpulse=f;break}f=$=0;ba=n;ca=c;if(ba>=0&&ca>=0){q=
-$-q;g=f-g;a=q*b;q=q*e;b=g*b;e=g*e;x.x-=J*(a+b);x.y-=J*(q+e);v-=T*(o.rA.x*q-o.rA.y*a+j.rA.x*e-j.rA.y*b);C.x+=P*(a+b);C.y+=P*(q+e);t+=X*(o.rB.x*q-o.rB.y*a+j.rB.x*e-j.rB.y*b);o.normalImpulse=$;j.normalImpulse=f;break}break}}r.m_angularVelocity=v;s.m_angularVelocity=t}};L.prototype.FinalizeVelocityConstraints=function(){for(var j=0;j<this.m_constraintCount;++j)for(var o=this.m_constraints[j],q=o.manifold,n=0;n<o.pointCount;++n){var a=q.m_points[n],c=o.points[n];a.m_normalImpulse=c.normalImpulse;a.m_tangentImpulse=
-c.tangentImpulse}};L.prototype.SolvePositionConstraints=function(j){if(j===undefined)j=0;for(var o=0,q=0;q<this.m_constraintCount;q++){var n=this.m_constraints[q],a=n.bodyA,c=n.bodyB,g=a.m_mass*a.m_invMass,b=a.m_mass*a.m_invI,e=c.m_mass*c.m_invMass,f=c.m_mass*c.m_invI;L.s_psm.Initialize(n);for(var m=L.s_psm.m_normal,r=0;r<n.pointCount;r++){var s=n.points[r],v=L.s_psm.m_points[r],t=L.s_psm.m_separations[r],x=v.x-a.m_sweep.c.x,C=v.y-a.m_sweep.c.y,J=v.x-c.m_sweep.c.x;v=v.y-c.m_sweep.c.y;o=o<t?o:t;t=
-R.Clamp(j*(t+O.b2_linearSlop),-O.b2_maxLinearCorrection,0);t=-s.equalizedMass*t;s=t*m.x;t=t*m.y;a.m_sweep.c.x-=g*s;a.m_sweep.c.y-=g*t;a.m_sweep.a-=b*(x*t-C*s);a.SynchronizeTransform();c.m_sweep.c.x+=e*s;c.m_sweep.c.y+=e*t;c.m_sweep.a+=f*(J*t-v*s);c.SynchronizeTransform()}}return o>-1.5*O.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2ContactSolver.s_worldManifold=new l;Box2D.Dynamics.Contacts.b2ContactSolver.s_psm=new u});Box2D.inherit(I,Box2D.Dynamics.Contacts.b2Contact);
-I.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;I.b2EdgeAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};I.Create=function(){return new I};I.Destroy=function(){};I.prototype.Reset=function(j,o){this.__super.Reset.call(this,j,o)};I.prototype.Evaluate=function(){var j=this.m_fixtureA.GetBody(),o=this.m_fixtureB.GetBody();this.b2CollideEdgeAndCircle(this.m_manifold,this.m_fixtureA.GetShape()instanceof G?this.m_fixtureA.GetShape():null,j.m_xf,
-this.m_fixtureB.GetShape()instanceof F?this.m_fixtureB.GetShape():null,o.m_xf)};I.prototype.b2CollideEdgeAndCircle=function(){};Box2D.inherit(W,Box2D.Dynamics.Contacts.b2Contact);W.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;W.b2NullContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};W.prototype.b2NullContact=function(){this.__super.b2Contact.call(this)};W.prototype.Evaluate=function(){};Box2D.inherit(Y,Box2D.Dynamics.Contacts.b2Contact);Y.prototype.__super=
-Box2D.Dynamics.Contacts.b2Contact.prototype;Y.b2PolyAndCircleContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};Y.Create=function(){return new Y};Y.Destroy=function(){};Y.prototype.Reset=function(j,o){this.__super.Reset.call(this,j,o);O.b2Assert(j.GetType()==y.e_polygonShape);O.b2Assert(o.GetType()==y.e_circleShape)};Y.prototype.Evaluate=function(){var j=this.m_fixtureA.m_body,o=this.m_fixtureB.m_body;S.CollidePolygonAndCircle(this.m_manifold,this.m_fixtureA.GetShape()instanceof
-K?this.m_fixtureA.GetShape():null,j.m_xf,this.m_fixtureB.GetShape()instanceof F?this.m_fixtureB.GetShape():null,o.m_xf)};Box2D.inherit(k,Box2D.Dynamics.Contacts.b2Contact);k.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;k.b2PolyAndEdgeContact=function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};k.Create=function(){return new k};k.Destroy=function(){};k.prototype.Reset=function(j,o){this.__super.Reset.call(this,j,o);O.b2Assert(j.GetType()==y.e_polygonShape);
-O.b2Assert(o.GetType()==y.e_edgeShape)};k.prototype.Evaluate=function(){var j=this.m_fixtureA.GetBody(),o=this.m_fixtureB.GetBody();this.b2CollidePolyAndEdge(this.m_manifold,this.m_fixtureA.GetShape()instanceof K?this.m_fixtureA.GetShape():null,j.m_xf,this.m_fixtureB.GetShape()instanceof G?this.m_fixtureB.GetShape():null,o.m_xf)};k.prototype.b2CollidePolyAndEdge=function(){};Box2D.inherit(z,Box2D.Dynamics.Contacts.b2Contact);z.prototype.__super=Box2D.Dynamics.Contacts.b2Contact.prototype;z.b2PolygonContact=
-function(){Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this,arguments)};z.Create=function(){return new z};z.Destroy=function(){};z.prototype.Reset=function(j,o){this.__super.Reset.call(this,j,o)};z.prototype.Evaluate=function(){var j=this.m_fixtureA.GetBody(),o=this.m_fixtureB.GetBody();S.CollidePolygons(this.m_manifold,this.m_fixtureA.GetShape()instanceof K?this.m_fixtureA.GetShape():null,j.m_xf,this.m_fixtureB.GetShape()instanceof K?this.m_fixtureB.GetShape():null,o.m_xf)};u.b2PositionSolverManifold=
-function(){};u.prototype.b2PositionSolverManifold=function(){this.m_normal=new N;this.m_separations=new Vector_a2j_Number(O.b2_maxManifoldPoints);this.m_points=new Vector(O.b2_maxManifoldPoints);for(var j=0;j<O.b2_maxManifoldPoints;j++)this.m_points[j]=new N};u.prototype.Initialize=function(j){O.b2Assert(j.pointCount>0);var o=0,q=0,n=0,a,c=0,g=0;switch(j.type){case Z.e_circles:a=j.bodyA.m_xf.R;n=j.localPoint;o=j.bodyA.m_xf.position.x+(a.col1.x*n.x+a.col2.x*n.y);q=j.bodyA.m_xf.position.y+(a.col1.y*
-n.x+a.col2.y*n.y);a=j.bodyB.m_xf.R;n=j.points[0].localPoint;c=j.bodyB.m_xf.position.x+(a.col1.x*n.x+a.col2.x*n.y);a=j.bodyB.m_xf.position.y+(a.col1.y*n.x+a.col2.y*n.y);n=c-o;g=a-q;var b=n*n+g*g;if(b>Number.MIN_VALUE*Number.MIN_VALUE){b=Math.sqrt(b);this.m_normal.x=n/b;this.m_normal.y=g/b}else{this.m_normal.x=1;this.m_normal.y=0}this.m_points[0].x=0.5*(o+c);this.m_points[0].y=0.5*(q+a);this.m_separations[0]=n*this.m_normal.x+g*this.m_normal.y-j.radius;break;case Z.e_faceA:a=j.bodyA.m_xf.R;n=j.localPlaneNormal;
-this.m_normal.x=a.col1.x*n.x+a.col2.x*n.y;this.m_normal.y=a.col1.y*n.x+a.col2.y*n.y;a=j.bodyA.m_xf.R;n=j.localPoint;c=j.bodyA.m_xf.position.x+(a.col1.x*n.x+a.col2.x*n.y);g=j.bodyA.m_xf.position.y+(a.col1.y*n.x+a.col2.y*n.y);a=j.bodyB.m_xf.R;for(o=0;o<j.pointCount;++o){n=j.points[o].localPoint;q=j.bodyB.m_xf.position.x+(a.col1.x*n.x+a.col2.x*n.y);n=j.bodyB.m_xf.position.y+(a.col1.y*n.x+a.col2.y*n.y);this.m_separations[o]=(q-c)*this.m_normal.x+(n-g)*this.m_normal.y-j.radius;this.m_points[o].x=q;this.m_points[o].y=
-n}break;case Z.e_faceB:a=j.bodyB.m_xf.R;n=j.localPlaneNormal;this.m_normal.x=a.col1.x*n.x+a.col2.x*n.y;this.m_normal.y=a.col1.y*n.x+a.col2.y*n.y;a=j.bodyB.m_xf.R;n=j.localPoint;c=j.bodyB.m_xf.position.x+(a.col1.x*n.x+a.col2.x*n.y);g=j.bodyB.m_xf.position.y+(a.col1.y*n.x+a.col2.y*n.y);a=j.bodyA.m_xf.R;for(o=0;o<j.pointCount;++o){n=j.points[o].localPoint;q=j.bodyA.m_xf.position.x+(a.col1.x*n.x+a.col2.x*n.y);n=j.bodyA.m_xf.position.y+(a.col1.y*n.x+a.col2.y*n.y);this.m_separations[o]=(q-c)*this.m_normal.x+
-(n-g)*this.m_normal.y-j.radius;this.m_points[o].Set(q,n)}this.m_normal.x*=-1;this.m_normal.y*=-1}};Box2D.postDefs.push(function(){Box2D.Dynamics.Contacts.b2PositionSolverManifold.circlePointA=new N;Box2D.Dynamics.Contacts.b2PositionSolverManifold.circlePointB=new N})})();
-(function(){var F=Box2D.Common.Math.b2Mat22,G=Box2D.Common.Math.b2Math,K=Box2D.Common.Math.b2Vec2,y=Box2D.Common.b2Color,w=Box2D.Dynamics.Controllers.b2BuoyancyController,A=Box2D.Dynamics.Controllers.b2ConstantAccelController,U=Box2D.Dynamics.Controllers.b2ConstantForceController,p=Box2D.Dynamics.Controllers.b2Controller,B=Box2D.Dynamics.Controllers.b2ControllerEdge,Q=Box2D.Dynamics.Controllers.b2GravityController,V=Box2D.Dynamics.Controllers.b2TensorDampingController;Box2D.inherit(w,Box2D.Dynamics.Controllers.b2Controller);
-w.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;w.b2BuoyancyController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.normal=new K(0,-1);this.density=this.offset=0;this.velocity=new K(0,0);this.linearDrag=2;this.angularDrag=1;this.useDensity=false;this.useWorldGravity=true;this.gravity=null};w.prototype.Step=function(){if(this.m_bodyList){if(this.useWorldGravity)this.gravity=this.GetWorld().GetGravity().Copy();for(var M=this.m_bodyList;M;M=
-M.nextBody){var L=M.body;if(L.IsAwake()!=false){for(var I=new K,W=new K,Y=0,k=0,z=L.GetFixtureList();z;z=z.GetNext()){var u=new K,D=z.GetShape().ComputeSubmergedArea(this.normal,this.offset,L.GetTransform(),u);Y+=D;I.x+=D*u.x;I.y+=D*u.y;var H=0;H=1;k+=D*H;W.x+=D*u.x*H;W.y+=D*u.y*H}I.x/=Y;I.y/=Y;W.x/=k;W.y/=k;if(!(Y<Number.MIN_VALUE)){k=this.gravity.GetNegative();k.Multiply(this.density*Y);L.ApplyForce(k,W);W=L.GetLinearVelocityFromWorldPoint(I);W.Subtract(this.velocity);W.Multiply(-this.linearDrag*
-Y);L.ApplyForce(W,I);L.ApplyTorque(-L.GetInertia()/L.GetMass()*Y*L.GetAngularVelocity()*this.angularDrag)}}}}};w.prototype.Draw=function(M){var L=new K,I=new K;L.x=this.normal.x*this.offset+this.normal.y*1E3;L.y=this.normal.y*this.offset-this.normal.x*1E3;I.x=this.normal.x*this.offset-this.normal.y*1E3;I.y=this.normal.y*this.offset+this.normal.x*1E3;var W=new y(0,0,1);M.DrawSegment(L,I,W)};Box2D.inherit(A,Box2D.Dynamics.Controllers.b2Controller);A.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;
-A.b2ConstantAccelController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.A=new K(0,0)};A.prototype.Step=function(M){M=new K(this.A.x*M.dt,this.A.y*M.dt);for(var L=this.m_bodyList;L;L=L.nextBody){var I=L.body;I.IsAwake()&&I.SetLinearVelocity(new K(I.GetLinearVelocity().x+M.x,I.GetLinearVelocity().y+M.y))}};Box2D.inherit(U,Box2D.Dynamics.Controllers.b2Controller);U.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;U.b2ConstantForceController=
-function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.F=new K(0,0)};U.prototype.Step=function(){for(var M=this.m_bodyList;M;M=M.nextBody){var L=M.body;L.IsAwake()&&L.ApplyForce(this.F,L.GetWorldCenter())}};p.b2Controller=function(){};p.prototype.Step=function(){};p.prototype.Draw=function(){};p.prototype.AddBody=function(M){var L=new B;L.controller=this;L.body=M;L.nextBody=this.m_bodyList;L.prevBody=null;this.m_bodyList=L;if(L.nextBody)L.nextBody.prevBody=L;this.m_bodyCount++;
-L.nextController=M.m_controllerList;L.prevController=null;M.m_controllerList=L;if(L.nextController)L.nextController.prevController=L;M.m_controllerCount++};p.prototype.RemoveBody=function(M){for(var L=M.m_controllerList;L&&L.controller!=this;)L=L.nextController;if(L.prevBody)L.prevBody.nextBody=L.nextBody;if(L.nextBody)L.nextBody.prevBody=L.prevBody;if(L.nextController)L.nextController.prevController=L.prevController;if(L.prevController)L.prevController.nextController=L.nextController;if(this.m_bodyList==
-L)this.m_bodyList=L.nextBody;if(M.m_controllerList==L)M.m_controllerList=L.nextController;M.m_controllerCount--;this.m_bodyCount--};p.prototype.Clear=function(){for(;this.m_bodyList;)this.RemoveBody(this.m_bodyList.body)};p.prototype.GetNext=function(){return this.m_next};p.prototype.GetWorld=function(){return this.m_world};p.prototype.GetBodyList=function(){return this.m_bodyList};B.b2ControllerEdge=function(){};Box2D.inherit(Q,Box2D.Dynamics.Controllers.b2Controller);Q.prototype.__super=Box2D.Dynamics.Controllers.b2Controller.prototype;
-Q.b2GravityController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.G=1;this.invSqr=true};Q.prototype.Step=function(){var M=null,L=null,I=null,W=0,Y=null,k=null,z=null,u=0,D=0,H=0;u=null;if(this.invSqr)for(M=this.m_bodyList;M;M=M.nextBody){L=M.body;I=L.GetWorldCenter();W=L.GetMass();for(Y=this.m_bodyList;Y!=M;Y=Y.nextBody){k=Y.body;z=k.GetWorldCenter();u=z.x-I.x;D=z.y-I.y;H=u*u+D*D;if(!(H<Number.MIN_VALUE)){u=new K(u,D);u.Multiply(this.G/H/Math.sqrt(H)*
-W*k.GetMass());L.IsAwake()&&L.ApplyForce(u,I);u.Multiply(-1);k.IsAwake()&&k.ApplyForce(u,z)}}}else for(M=this.m_bodyList;M;M=M.nextBody){L=M.body;I=L.GetWorldCenter();W=L.GetMass();for(Y=this.m_bodyList;Y!=M;Y=Y.nextBody){k=Y.body;z=k.GetWorldCenter();u=z.x-I.x;D=z.y-I.y;H=u*u+D*D;if(!(H<Number.MIN_VALUE)){u=new K(u,D);u.Multiply(this.G/H*W*k.GetMass());L.IsAwake()&&L.ApplyForce(u,I);u.Multiply(-1);k.IsAwake()&&k.ApplyForce(u,z)}}}};Box2D.inherit(V,Box2D.Dynamics.Controllers.b2Controller);V.prototype.__super=
-Box2D.Dynamics.Controllers.b2Controller.prototype;V.b2TensorDampingController=function(){Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this,arguments);this.T=new F;this.maxTimestep=0};V.prototype.SetAxisAligned=function(M,L){if(M===undefined)M=0;if(L===undefined)L=0;this.T.col1.x=-M;this.T.col1.y=0;this.T.col2.x=0;this.T.col2.y=-L;this.maxTimestep=M>0||L>0?1/Math.max(M,L):0};V.prototype.Step=function(M){M=M.dt;if(!(M<=Number.MIN_VALUE)){if(M>this.maxTimestep&&this.maxTimestep>0)M=this.maxTimestep;
-for(var L=this.m_bodyList;L;L=L.nextBody){var I=L.body;if(I.IsAwake()){var W=I.GetWorldVector(G.MulMV(this.T,I.GetLocalVector(I.GetLinearVelocity())));I.SetLinearVelocity(new K(I.GetLinearVelocity().x+W.x*M,I.GetLinearVelocity().y+W.y*M))}}}}})();
-(function(){var F=Box2D.Common.b2Settings,G=Box2D.Common.Math.b2Mat22,K=Box2D.Common.Math.b2Mat33,y=Box2D.Common.Math.b2Math,w=Box2D.Common.Math.b2Vec2,A=Box2D.Common.Math.b2Vec3,U=Box2D.Dynamics.Joints.b2DistanceJoint,p=Box2D.Dynamics.Joints.b2DistanceJointDef,B=Box2D.Dynamics.Joints.b2FrictionJoint,Q=Box2D.Dynamics.Joints.b2FrictionJointDef,V=Box2D.Dynamics.Joints.b2GearJoint,M=Box2D.Dynamics.Joints.b2GearJointDef,L=Box2D.Dynamics.Joints.b2Jacobian,I=Box2D.Dynamics.Joints.b2Joint,W=Box2D.Dynamics.Joints.b2JointDef,
-Y=Box2D.Dynamics.Joints.b2JointEdge,k=Box2D.Dynamics.Joints.b2LineJoint,z=Box2D.Dynamics.Joints.b2LineJointDef,u=Box2D.Dynamics.Joints.b2MouseJoint,D=Box2D.Dynamics.Joints.b2MouseJointDef,H=Box2D.Dynamics.Joints.b2PrismaticJoint,O=Box2D.Dynamics.Joints.b2PrismaticJointDef,E=Box2D.Dynamics.Joints.b2PulleyJoint,R=Box2D.Dynamics.Joints.b2PulleyJointDef,N=Box2D.Dynamics.Joints.b2RevoluteJoint,S=Box2D.Dynamics.Joints.b2RevoluteJointDef,aa=Box2D.Dynamics.Joints.b2WeldJoint,Z=Box2D.Dynamics.Joints.b2WeldJointDef;
-Box2D.inherit(U,Box2D.Dynamics.Joints.b2Joint);U.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;U.b2DistanceJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new w;this.m_localAnchor2=new w;this.m_u=new w};U.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};U.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};U.prototype.GetReactionForce=function(d){if(d===undefined)d=
-0;return new w(d*this.m_impulse*this.m_u.x,d*this.m_impulse*this.m_u.y)};U.prototype.GetReactionTorque=function(){return 0};U.prototype.GetLength=function(){return this.m_length};U.prototype.SetLength=function(d){if(d===undefined)d=0;this.m_length=d};U.prototype.GetFrequency=function(){return this.m_frequencyHz};U.prototype.SetFrequency=function(d){if(d===undefined)d=0;this.m_frequencyHz=d};U.prototype.GetDampingRatio=function(){return this.m_dampingRatio};U.prototype.SetDampingRatio=function(d){if(d===
-undefined)d=0;this.m_dampingRatio=d};U.prototype.b2DistanceJoint=function(d){this.__super.b2Joint.call(this,d);this.m_localAnchor1.SetV(d.localAnchorA);this.m_localAnchor2.SetV(d.localAnchorB);this.m_length=d.length;this.m_frequencyHz=d.frequencyHz;this.m_dampingRatio=d.dampingRatio;this.m_bias=this.m_gamma=this.m_impulse=0};U.prototype.InitVelocityConstraints=function(d){var h,l=0,j=this.m_bodyA,o=this.m_bodyB;h=j.m_xf.R;var q=this.m_localAnchor1.x-j.m_sweep.localCenter.x,n=this.m_localAnchor1.y-
-j.m_sweep.localCenter.y;l=h.col1.x*q+h.col2.x*n;n=h.col1.y*q+h.col2.y*n;q=l;h=o.m_xf.R;var a=this.m_localAnchor2.x-o.m_sweep.localCenter.x,c=this.m_localAnchor2.y-o.m_sweep.localCenter.y;l=h.col1.x*a+h.col2.x*c;c=h.col1.y*a+h.col2.y*c;a=l;this.m_u.x=o.m_sweep.c.x+a-j.m_sweep.c.x-q;this.m_u.y=o.m_sweep.c.y+c-j.m_sweep.c.y-n;l=Math.sqrt(this.m_u.x*this.m_u.x+this.m_u.y*this.m_u.y);l>F.b2_linearSlop?this.m_u.Multiply(1/l):this.m_u.SetZero();h=q*this.m_u.y-n*this.m_u.x;var g=a*this.m_u.y-c*this.m_u.x;
-h=j.m_invMass+j.m_invI*h*h+o.m_invMass+o.m_invI*g*g;this.m_mass=h!=0?1/h:0;if(this.m_frequencyHz>0){l=l-this.m_length;g=2*Math.PI*this.m_frequencyHz;var b=this.m_mass*g*g;this.m_gamma=d.dt*(2*this.m_mass*this.m_dampingRatio*g+d.dt*b);this.m_gamma=this.m_gamma!=0?1/this.m_gamma:0;this.m_bias=l*d.dt*b*this.m_gamma;this.m_mass=h+this.m_gamma;this.m_mass=this.m_mass!=0?1/this.m_mass:0}if(d.warmStarting){this.m_impulse*=d.dtRatio;d=this.m_impulse*this.m_u.x;h=this.m_impulse*this.m_u.y;j.m_linearVelocity.x-=
-j.m_invMass*d;j.m_linearVelocity.y-=j.m_invMass*h;j.m_angularVelocity-=j.m_invI*(q*h-n*d);o.m_linearVelocity.x+=o.m_invMass*d;o.m_linearVelocity.y+=o.m_invMass*h;o.m_angularVelocity+=o.m_invI*(a*h-c*d)}else this.m_impulse=0};U.prototype.SolveVelocityConstraints=function(){var d,h=this.m_bodyA,l=this.m_bodyB;d=h.m_xf.R;var j=this.m_localAnchor1.x-h.m_sweep.localCenter.x,o=this.m_localAnchor1.y-h.m_sweep.localCenter.y,q=d.col1.x*j+d.col2.x*o;o=d.col1.y*j+d.col2.y*o;j=q;d=l.m_xf.R;var n=this.m_localAnchor2.x-
-l.m_sweep.localCenter.x,a=this.m_localAnchor2.y-l.m_sweep.localCenter.y;q=d.col1.x*n+d.col2.x*a;a=d.col1.y*n+d.col2.y*a;n=q;q=-this.m_mass*(this.m_u.x*(l.m_linearVelocity.x+-l.m_angularVelocity*a-(h.m_linearVelocity.x+-h.m_angularVelocity*o))+this.m_u.y*(l.m_linearVelocity.y+l.m_angularVelocity*n-(h.m_linearVelocity.y+h.m_angularVelocity*j))+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=q;d=q*this.m_u.x;q=q*this.m_u.y;h.m_linearVelocity.x-=h.m_invMass*d;h.m_linearVelocity.y-=h.m_invMass*
-q;h.m_angularVelocity-=h.m_invI*(j*q-o*d);l.m_linearVelocity.x+=l.m_invMass*d;l.m_linearVelocity.y+=l.m_invMass*q;l.m_angularVelocity+=l.m_invI*(n*q-a*d)};U.prototype.SolvePositionConstraints=function(){var d;if(this.m_frequencyHz>0)return true;var h=this.m_bodyA,l=this.m_bodyB;d=h.m_xf.R;var j=this.m_localAnchor1.x-h.m_sweep.localCenter.x,o=this.m_localAnchor1.y-h.m_sweep.localCenter.y,q=d.col1.x*j+d.col2.x*o;o=d.col1.y*j+d.col2.y*o;j=q;d=l.m_xf.R;var n=this.m_localAnchor2.x-l.m_sweep.localCenter.x,
-a=this.m_localAnchor2.y-l.m_sweep.localCenter.y;q=d.col1.x*n+d.col2.x*a;a=d.col1.y*n+d.col2.y*a;n=q;q=l.m_sweep.c.x+n-h.m_sweep.c.x-j;var c=l.m_sweep.c.y+a-h.m_sweep.c.y-o;d=Math.sqrt(q*q+c*c);q/=d;c/=d;d=d-this.m_length;d=y.Clamp(d,-F.b2_maxLinearCorrection,F.b2_maxLinearCorrection);var g=-this.m_mass*d;this.m_u.Set(q,c);q=g*this.m_u.x;c=g*this.m_u.y;h.m_sweep.c.x-=h.m_invMass*q;h.m_sweep.c.y-=h.m_invMass*c;h.m_sweep.a-=h.m_invI*(j*c-o*q);l.m_sweep.c.x+=l.m_invMass*q;l.m_sweep.c.y+=l.m_invMass*c;
-l.m_sweep.a+=l.m_invI*(n*c-a*q);h.SynchronizeTransform();l.SynchronizeTransform();return y.Abs(d)<F.b2_linearSlop};Box2D.inherit(p,Box2D.Dynamics.Joints.b2JointDef);p.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;p.b2DistanceJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new w;this.localAnchorB=new w};p.prototype.b2DistanceJointDef=function(){this.__super.b2JointDef.call(this);this.type=I.e_distanceJoint;this.length=1;this.dampingRatio=
-this.frequencyHz=0};p.prototype.Initialize=function(d,h,l,j){this.bodyA=d;this.bodyB=h;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(l));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(j));d=j.x-l.x;l=j.y-l.y;this.length=Math.sqrt(d*d+l*l);this.dampingRatio=this.frequencyHz=0};Box2D.inherit(B,Box2D.Dynamics.Joints.b2Joint);B.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;B.b2FrictionJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new w;
-this.m_localAnchorB=new w;this.m_linearMass=new G;this.m_linearImpulse=new w};B.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};B.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)};B.prototype.GetReactionForce=function(d){if(d===undefined)d=0;return new w(d*this.m_linearImpulse.x,d*this.m_linearImpulse.y)};B.prototype.GetReactionTorque=function(d){if(d===undefined)d=0;return d*this.m_angularImpulse};B.prototype.SetMaxForce=
-function(d){if(d===undefined)d=0;this.m_maxForce=d};B.prototype.GetMaxForce=function(){return this.m_maxForce};B.prototype.SetMaxTorque=function(d){if(d===undefined)d=0;this.m_maxTorque=d};B.prototype.GetMaxTorque=function(){return this.m_maxTorque};B.prototype.b2FrictionJoint=function(d){this.__super.b2Joint.call(this,d);this.m_localAnchorA.SetV(d.localAnchorA);this.m_localAnchorB.SetV(d.localAnchorB);this.m_linearMass.SetZero();this.m_angularMass=0;this.m_linearImpulse.SetZero();this.m_angularImpulse=
-0;this.m_maxForce=d.maxForce;this.m_maxTorque=d.maxTorque};B.prototype.InitVelocityConstraints=function(d){var h,l=0,j=this.m_bodyA,o=this.m_bodyB;h=j.m_xf.R;var q=this.m_localAnchorA.x-j.m_sweep.localCenter.x,n=this.m_localAnchorA.y-j.m_sweep.localCenter.y;l=h.col1.x*q+h.col2.x*n;n=h.col1.y*q+h.col2.y*n;q=l;h=o.m_xf.R;var a=this.m_localAnchorB.x-o.m_sweep.localCenter.x,c=this.m_localAnchorB.y-o.m_sweep.localCenter.y;l=h.col1.x*a+h.col2.x*c;c=h.col1.y*a+h.col2.y*c;a=l;h=j.m_invMass;l=o.m_invMass;
-var g=j.m_invI,b=o.m_invI,e=new G;e.col1.x=h+l;e.col2.x=0;e.col1.y=0;e.col2.y=h+l;e.col1.x+=g*n*n;e.col2.x+=-g*q*n;e.col1.y+=-g*q*n;e.col2.y+=g*q*q;e.col1.x+=b*c*c;e.col2.x+=-b*a*c;e.col1.y+=-b*a*c;e.col2.y+=b*a*a;e.GetInverse(this.m_linearMass);this.m_angularMass=g+b;if(this.m_angularMass>0)this.m_angularMass=1/this.m_angularMass;if(d.warmStarting){this.m_linearImpulse.x*=d.dtRatio;this.m_linearImpulse.y*=d.dtRatio;this.m_angularImpulse*=d.dtRatio;d=this.m_linearImpulse;j.m_linearVelocity.x-=h*d.x;
-j.m_linearVelocity.y-=h*d.y;j.m_angularVelocity-=g*(q*d.y-n*d.x+this.m_angularImpulse);o.m_linearVelocity.x+=l*d.x;o.m_linearVelocity.y+=l*d.y;o.m_angularVelocity+=b*(a*d.y-c*d.x+this.m_angularImpulse)}else{this.m_linearImpulse.SetZero();this.m_angularImpulse=0}};B.prototype.SolveVelocityConstraints=function(d){var h,l=0,j=this.m_bodyA,o=this.m_bodyB,q=j.m_linearVelocity,n=j.m_angularVelocity,a=o.m_linearVelocity,c=o.m_angularVelocity,g=j.m_invMass,b=o.m_invMass,e=j.m_invI,f=o.m_invI;h=j.m_xf.R;var m=
-this.m_localAnchorA.x-j.m_sweep.localCenter.x,r=this.m_localAnchorA.y-j.m_sweep.localCenter.y;l=h.col1.x*m+h.col2.x*r;r=h.col1.y*m+h.col2.y*r;m=l;h=o.m_xf.R;var s=this.m_localAnchorB.x-o.m_sweep.localCenter.x,v=this.m_localAnchorB.y-o.m_sweep.localCenter.y;l=h.col1.x*s+h.col2.x*v;v=h.col1.y*s+h.col2.y*v;s=l;h=0;l=-this.m_angularMass*(c-n);var t=this.m_angularImpulse;h=d.dt*this.m_maxTorque;this.m_angularImpulse=y.Clamp(this.m_angularImpulse+l,-h,h);l=this.m_angularImpulse-t;n-=e*l;c+=f*l;h=y.MulMV(this.m_linearMass,
-new w(-(a.x-c*v-q.x+n*r),-(a.y+c*s-q.y-n*m)));l=this.m_linearImpulse.Copy();this.m_linearImpulse.Add(h);h=d.dt*this.m_maxForce;if(this.m_linearImpulse.LengthSquared()>h*h){this.m_linearImpulse.Normalize();this.m_linearImpulse.Multiply(h)}h=y.SubtractVV(this.m_linearImpulse,l);q.x-=g*h.x;q.y-=g*h.y;n-=e*(m*h.y-r*h.x);a.x+=b*h.x;a.y+=b*h.y;c+=f*(s*h.y-v*h.x);j.m_angularVelocity=n;o.m_angularVelocity=c};B.prototype.SolvePositionConstraints=function(){return true};Box2D.inherit(Q,Box2D.Dynamics.Joints.b2JointDef);
-Q.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;Q.b2FrictionJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new w;this.localAnchorB=new w};Q.prototype.b2FrictionJointDef=function(){this.__super.b2JointDef.call(this);this.type=I.e_frictionJoint;this.maxTorque=this.maxForce=0};Q.prototype.Initialize=function(d,h,l){this.bodyA=d;this.bodyB=h;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(l));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(l))};
-Box2D.inherit(V,Box2D.Dynamics.Joints.b2Joint);V.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;V.b2GearJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new w;this.m_groundAnchor2=new w;this.m_localAnchor1=new w;this.m_localAnchor2=new w;this.m_J=new L};V.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};V.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};V.prototype.GetReactionForce=
-function(d){if(d===undefined)d=0;return new w(d*this.m_impulse*this.m_J.linearB.x,d*this.m_impulse*this.m_J.linearB.y)};V.prototype.GetReactionTorque=function(d){if(d===undefined)d=0;var h=this.m_bodyB.m_xf.R,l=this.m_localAnchor1.x-this.m_bodyB.m_sweep.localCenter.x,j=this.m_localAnchor1.y-this.m_bodyB.m_sweep.localCenter.y,o=h.col1.x*l+h.col2.x*j;j=h.col1.y*l+h.col2.y*j;l=o;return d*(this.m_impulse*this.m_J.angularB-l*this.m_impulse*this.m_J.linearB.y+j*this.m_impulse*this.m_J.linearB.x)};V.prototype.GetRatio=
-function(){return this.m_ratio};V.prototype.SetRatio=function(d){if(d===undefined)d=0;this.m_ratio=d};V.prototype.b2GearJoint=function(d){this.__super.b2Joint.call(this,d);var h=parseInt(d.joint1.m_type),l=parseInt(d.joint2.m_type);this.m_prismatic2=this.m_revolute2=this.m_prismatic1=this.m_revolute1=null;var j=0,o=0;this.m_ground1=d.joint1.GetBodyA();this.m_bodyA=d.joint1.GetBodyB();if(h==I.e_revoluteJoint){this.m_revolute1=d.joint1 instanceof N?d.joint1:null;this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1);
-this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2);j=this.m_revolute1.GetJointAngle()}else{this.m_prismatic1=d.joint1 instanceof H?d.joint1:null;this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1);this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2);j=this.m_prismatic1.GetJointTranslation()}this.m_ground2=d.joint2.GetBodyA();this.m_bodyB=d.joint2.GetBodyB();if(l==I.e_revoluteJoint){this.m_revolute2=d.joint2 instanceof N?d.joint2:null;this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1);
-this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2);o=this.m_revolute2.GetJointAngle()}else{this.m_prismatic2=d.joint2 instanceof H?d.joint2:null;this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1);this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2);o=this.m_prismatic2.GetJointTranslation()}this.m_ratio=d.ratio;this.m_constant=j+this.m_ratio*o;this.m_impulse=0};V.prototype.InitVelocityConstraints=function(d){var h=this.m_ground1,l=this.m_ground2,j=this.m_bodyA,o=this.m_bodyB,
-q=0,n=0,a=0,c=0,g=a=0,b=0;this.m_J.SetZero();if(this.m_revolute1){this.m_J.angularA=-1;b+=j.m_invI}else{h=h.m_xf.R;n=this.m_prismatic1.m_localXAxis1;q=h.col1.x*n.x+h.col2.x*n.y;n=h.col1.y*n.x+h.col2.y*n.y;h=j.m_xf.R;a=this.m_localAnchor1.x-j.m_sweep.localCenter.x;c=this.m_localAnchor1.y-j.m_sweep.localCenter.y;g=h.col1.x*a+h.col2.x*c;c=h.col1.y*a+h.col2.y*c;a=g;a=a*n-c*q;this.m_J.linearA.Set(-q,-n);this.m_J.angularA=-a;b+=j.m_invMass+j.m_invI*a*a}if(this.m_revolute2){this.m_J.angularB=-this.m_ratio;
-b+=this.m_ratio*this.m_ratio*o.m_invI}else{h=l.m_xf.R;n=this.m_prismatic2.m_localXAxis1;q=h.col1.x*n.x+h.col2.x*n.y;n=h.col1.y*n.x+h.col2.y*n.y;h=o.m_xf.R;a=this.m_localAnchor2.x-o.m_sweep.localCenter.x;c=this.m_localAnchor2.y-o.m_sweep.localCenter.y;g=h.col1.x*a+h.col2.x*c;c=h.col1.y*a+h.col2.y*c;a=g;a=a*n-c*q;this.m_J.linearB.Set(-this.m_ratio*q,-this.m_ratio*n);this.m_J.angularB=-this.m_ratio*a;b+=this.m_ratio*this.m_ratio*(o.m_invMass+o.m_invI*a*a)}this.m_mass=b>0?1/b:0;if(d.warmStarting){j.m_linearVelocity.x+=
-j.m_invMass*this.m_impulse*this.m_J.linearA.x;j.m_linearVelocity.y+=j.m_invMass*this.m_impulse*this.m_J.linearA.y;j.m_angularVelocity+=j.m_invI*this.m_impulse*this.m_J.angularA;o.m_linearVelocity.x+=o.m_invMass*this.m_impulse*this.m_J.linearB.x;o.m_linearVelocity.y+=o.m_invMass*this.m_impulse*this.m_J.linearB.y;o.m_angularVelocity+=o.m_invI*this.m_impulse*this.m_J.angularB}else this.m_impulse=0};V.prototype.SolveVelocityConstraints=function(){var d=this.m_bodyA,h=this.m_bodyB,l=-this.m_mass*this.m_J.Compute(d.m_linearVelocity,
-d.m_angularVelocity,h.m_linearVelocity,h.m_angularVelocity);this.m_impulse+=l;d.m_linearVelocity.x+=d.m_invMass*l*this.m_J.linearA.x;d.m_linearVelocity.y+=d.m_invMass*l*this.m_J.linearA.y;d.m_angularVelocity+=d.m_invI*l*this.m_J.angularA;h.m_linearVelocity.x+=h.m_invMass*l*this.m_J.linearB.x;h.m_linearVelocity.y+=h.m_invMass*l*this.m_J.linearB.y;h.m_angularVelocity+=h.m_invI*l*this.m_J.angularB};V.prototype.SolvePositionConstraints=function(){var d=this.m_bodyA,h=this.m_bodyB,l=0,j=0;l=this.m_revolute1?
-this.m_revolute1.GetJointAngle():this.m_prismatic1.GetJointTranslation();j=this.m_revolute2?this.m_revolute2.GetJointAngle():this.m_prismatic2.GetJointTranslation();l=-this.m_mass*(this.m_constant-(l+this.m_ratio*j));d.m_sweep.c.x+=d.m_invMass*l*this.m_J.linearA.x;d.m_sweep.c.y+=d.m_invMass*l*this.m_J.linearA.y;d.m_sweep.a+=d.m_invI*l*this.m_J.angularA;h.m_sweep.c.x+=h.m_invMass*l*this.m_J.linearB.x;h.m_sweep.c.y+=h.m_invMass*l*this.m_J.linearB.y;h.m_sweep.a+=h.m_invI*l*this.m_J.angularB;d.SynchronizeTransform();
-h.SynchronizeTransform();return 0<F.b2_linearSlop};Box2D.inherit(M,Box2D.Dynamics.Joints.b2JointDef);M.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;M.b2GearJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments)};M.prototype.b2GearJointDef=function(){this.__super.b2JointDef.call(this);this.type=I.e_gearJoint;this.joint2=this.joint1=null;this.ratio=1};L.b2Jacobian=function(){this.linearA=new w;this.linearB=new w};L.prototype.SetZero=function(){this.linearA.SetZero();
-this.angularA=0;this.linearB.SetZero();this.angularB=0};L.prototype.Set=function(d,h,l,j){if(h===undefined)h=0;if(j===undefined)j=0;this.linearA.SetV(d);this.angularA=h;this.linearB.SetV(l);this.angularB=j};L.prototype.Compute=function(d,h,l,j){if(h===undefined)h=0;if(j===undefined)j=0;return this.linearA.x*d.x+this.linearA.y*d.y+this.angularA*h+(this.linearB.x*l.x+this.linearB.y*l.y)+this.angularB*j};I.b2Joint=function(){this.m_edgeA=new Y;this.m_edgeB=new Y;this.m_localCenterA=new w;this.m_localCenterB=
-new w};I.prototype.GetType=function(){return this.m_type};I.prototype.GetAnchorA=function(){return null};I.prototype.GetAnchorB=function(){return null};I.prototype.GetReactionForce=function(){return null};I.prototype.GetReactionTorque=function(){return 0};I.prototype.GetBodyA=function(){return this.m_bodyA};I.prototype.GetBodyB=function(){return this.m_bodyB};I.prototype.GetNext=function(){return this.m_next};I.prototype.GetUserData=function(){return this.m_userData};I.prototype.SetUserData=function(d){this.m_userData=
-d};I.prototype.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()};I.Create=function(d){var h=null;switch(d.type){case I.e_distanceJoint:h=new U(d instanceof p?d:null);break;case I.e_mouseJoint:h=new u(d instanceof D?d:null);break;case I.e_prismaticJoint:h=new H(d instanceof O?d:null);break;case I.e_revoluteJoint:h=new N(d instanceof S?d:null);break;case I.e_pulleyJoint:h=new E(d instanceof R?d:null);break;case I.e_gearJoint:h=new V(d instanceof M?d:null);break;case I.e_lineJoint:h=
-new k(d instanceof z?d:null);break;case I.e_weldJoint:h=new aa(d instanceof Z?d:null);break;case I.e_frictionJoint:h=new B(d instanceof Q?d:null)}return h};I.Destroy=function(){};I.prototype.b2Joint=function(d){F.b2Assert(d.bodyA!=d.bodyB);this.m_type=d.type;this.m_next=this.m_prev=null;this.m_bodyA=d.bodyA;this.m_bodyB=d.bodyB;this.m_collideConnected=d.collideConnected;this.m_islandFlag=false;this.m_userData=d.userData};I.prototype.InitVelocityConstraints=function(){};I.prototype.SolveVelocityConstraints=
-function(){};I.prototype.FinalizeVelocityConstraints=function(){};I.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});W.b2JointDef=function(){};W.prototype.b2JointDef=function(){this.type=I.e_unknownJoint;this.bodyB=this.bodyA=this.userData=null;this.collideConnected=false};Y.b2JointEdge=function(){};Box2D.inherit(k,Box2D.Dynamics.Joints.b2Joint);
-k.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;k.b2LineJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new w;this.m_localAnchor2=new w;this.m_localXAxis1=new w;this.m_localYAxis1=new w;this.m_axis=new w;this.m_perp=new w;this.m_K=new G;this.m_impulse=new w};k.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};k.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};k.prototype.GetReactionForce=
-function(d){if(d===undefined)d=0;return new w(d*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x),d*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y))};k.prototype.GetReactionTorque=function(d){if(d===undefined)d=0;return d*this.m_impulse.y};k.prototype.GetJointTranslation=function(){var d=this.m_bodyA,h=this.m_bodyB,l=d.GetWorldPoint(this.m_localAnchor1),j=h.GetWorldPoint(this.m_localAnchor2);h=j.x-l.x;l=j.y-l.y;d=d.GetWorldVector(this.m_localXAxis1);
-return d.x*h+d.y*l};k.prototype.GetJointSpeed=function(){var d=this.m_bodyA,h=this.m_bodyB,l;l=d.m_xf.R;var j=this.m_localAnchor1.x-d.m_sweep.localCenter.x,o=this.m_localAnchor1.y-d.m_sweep.localCenter.y,q=l.col1.x*j+l.col2.x*o;o=l.col1.y*j+l.col2.y*o;j=q;l=h.m_xf.R;var n=this.m_localAnchor2.x-h.m_sweep.localCenter.x,a=this.m_localAnchor2.y-h.m_sweep.localCenter.y;q=l.col1.x*n+l.col2.x*a;a=l.col1.y*n+l.col2.y*a;n=q;l=h.m_sweep.c.x+n-(d.m_sweep.c.x+j);q=h.m_sweep.c.y+a-(d.m_sweep.c.y+o);var c=d.GetWorldVector(this.m_localXAxis1),
-g=d.m_linearVelocity,b=h.m_linearVelocity;d=d.m_angularVelocity;h=h.m_angularVelocity;return l*-d*c.y+q*d*c.x+(c.x*(b.x+-h*a-g.x- -d*o)+c.y*(b.y+h*n-g.y-d*j))};k.prototype.IsLimitEnabled=function(){return this.m_enableLimit};k.prototype.EnableLimit=function(d){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableLimit=d};k.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};k.prototype.GetUpperLimit=function(){return this.m_upperTranslation};k.prototype.SetLimits=function(d,
-h){if(d===undefined)d=0;if(h===undefined)h=0;this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_lowerTranslation=d;this.m_upperTranslation=h};k.prototype.IsMotorEnabled=function(){return this.m_enableMotor};k.prototype.EnableMotor=function(d){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableMotor=d};k.prototype.SetMotorSpeed=function(d){if(d===undefined)d=0;this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=d};k.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};
-k.prototype.SetMaxMotorForce=function(d){if(d===undefined)d=0;this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_maxMotorForce=d};k.prototype.GetMaxMotorForce=function(){return this.m_maxMotorForce};k.prototype.GetMotorForce=function(){return this.m_motorImpulse};k.prototype.b2LineJoint=function(d){this.__super.b2Joint.call(this,d);this.m_localAnchor1.SetV(d.localAnchorA);this.m_localAnchor2.SetV(d.localAnchorB);this.m_localXAxis1.SetV(d.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=d.lowerTranslation;this.m_upperTranslation=d.upperTranslation;this.m_maxMotorForce=d.maxMotorForce;this.m_motorSpeed=d.motorSpeed;this.m_enableLimit=d.enableLimit;this.m_enableMotor=d.enableMotor;this.m_limitState=I.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};k.prototype.InitVelocityConstraints=function(d){var h=this.m_bodyA,l=this.m_bodyB,j,o=0;this.m_localCenterA.SetV(h.GetLocalCenter());
-this.m_localCenterB.SetV(l.GetLocalCenter());var q=h.GetTransform();l.GetTransform();j=h.m_xf.R;var n=this.m_localAnchor1.x-this.m_localCenterA.x,a=this.m_localAnchor1.y-this.m_localCenterA.y;o=j.col1.x*n+j.col2.x*a;a=j.col1.y*n+j.col2.y*a;n=o;j=l.m_xf.R;var c=this.m_localAnchor2.x-this.m_localCenterB.x,g=this.m_localAnchor2.y-this.m_localCenterB.y;o=j.col1.x*c+j.col2.x*g;g=j.col1.y*c+j.col2.y*g;c=o;j=l.m_sweep.c.x+c-h.m_sweep.c.x-n;o=l.m_sweep.c.y+g-h.m_sweep.c.y-a;this.m_invMassA=h.m_invMass;this.m_invMassB=
-l.m_invMass;this.m_invIA=h.m_invI;this.m_invIB=l.m_invI;this.m_axis.SetV(y.MulMV(q.R,this.m_localXAxis1));this.m_a1=(j+n)*this.m_axis.y-(o+a)*this.m_axis.x;this.m_a2=c*this.m_axis.y-g*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(y.MulMV(q.R,this.m_localYAxis1));this.m_s1=(j+n)*this.m_perp.y-(o+a)*this.m_perp.x;this.m_s2=c*this.m_perp.y-
-g*this.m_perp.x;q=this.m_invMassA;n=this.m_invMassB;a=this.m_invIA;c=this.m_invIB;this.m_K.col1.x=q+n+a*this.m_s1*this.m_s1+c*this.m_s2*this.m_s2;this.m_K.col1.y=a*this.m_s1*this.m_a1+c*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=q+n+a*this.m_a1*this.m_a1+c*this.m_a2*this.m_a2;if(this.m_enableLimit){j=this.m_axis.x*j+this.m_axis.y*o;if(y.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*F.b2_linearSlop)this.m_limitState=I.e_equalLimits;else if(j<=this.m_lowerTranslation){if(this.m_limitState!=
-I.e_atLowerLimit){this.m_limitState=I.e_atLowerLimit;this.m_impulse.y=0}}else if(j>=this.m_upperTranslation){if(this.m_limitState!=I.e_atUpperLimit){this.m_limitState=I.e_atUpperLimit;this.m_impulse.y=0}}else{this.m_limitState=I.e_inactiveLimit;this.m_impulse.y=0}}else this.m_limitState=I.e_inactiveLimit;if(this.m_enableMotor==false)this.m_motorImpulse=0;if(d.warmStarting){this.m_impulse.x*=d.dtRatio;this.m_impulse.y*=d.dtRatio;this.m_motorImpulse*=d.dtRatio;d=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+
-this.m_impulse.y)*this.m_axis.x;j=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y;o=this.m_impulse.x*this.m_s1+(this.m_motorImpulse+this.m_impulse.y)*this.m_a1;q=this.m_impulse.x*this.m_s2+(this.m_motorImpulse+this.m_impulse.y)*this.m_a2;h.m_linearVelocity.x-=this.m_invMassA*d;h.m_linearVelocity.y-=this.m_invMassA*j;h.m_angularVelocity-=this.m_invIA*o;l.m_linearVelocity.x+=this.m_invMassB*d;l.m_linearVelocity.y+=this.m_invMassB*j;l.m_angularVelocity+=this.m_invIB*
-q}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};k.prototype.SolveVelocityConstraints=function(d){var h=this.m_bodyA,l=this.m_bodyB,j=h.m_linearVelocity,o=h.m_angularVelocity,q=l.m_linearVelocity,n=l.m_angularVelocity,a=0,c=0,g=0,b=0;if(this.m_enableMotor&&this.m_limitState!=I.e_equalLimits){b=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(q.x-j.x)+this.m_axis.y*(q.y-j.y)+this.m_a2*n-this.m_a1*o));a=this.m_motorImpulse;c=d.dt*this.m_maxMotorForce;this.m_motorImpulse=y.Clamp(this.m_motorImpulse+
-b,-c,c);b=this.m_motorImpulse-a;a=b*this.m_axis.x;c=b*this.m_axis.y;g=b*this.m_a1;b=b*this.m_a2;j.x-=this.m_invMassA*a;j.y-=this.m_invMassA*c;o-=this.m_invIA*g;q.x+=this.m_invMassB*a;q.y+=this.m_invMassB*c;n+=this.m_invIB*b}c=this.m_perp.x*(q.x-j.x)+this.m_perp.y*(q.y-j.y)+this.m_s2*n-this.m_s1*o;if(this.m_enableLimit&&this.m_limitState!=I.e_inactiveLimit){g=this.m_axis.x*(q.x-j.x)+this.m_axis.y*(q.y-j.y)+this.m_a2*n-this.m_a1*o;a=this.m_impulse.Copy();d=this.m_K.Solve(new w,-c,-g);this.m_impulse.Add(d);
-if(this.m_limitState==I.e_atLowerLimit)this.m_impulse.y=y.Max(this.m_impulse.y,0);else if(this.m_limitState==I.e_atUpperLimit)this.m_impulse.y=y.Min(this.m_impulse.y,0);c=-c-(this.m_impulse.y-a.y)*this.m_K.col2.x;g=0;g=this.m_K.col1.x!=0?c/this.m_K.col1.x+a.x:a.x;this.m_impulse.x=g;d.x=this.m_impulse.x-a.x;d.y=this.m_impulse.y-a.y;a=d.x*this.m_perp.x+d.y*this.m_axis.x;c=d.x*this.m_perp.y+d.y*this.m_axis.y;g=d.x*this.m_s1+d.y*this.m_a1;b=d.x*this.m_s2+d.y*this.m_a2}else{d=0;d=this.m_K.col1.x!=0?-c/
-this.m_K.col1.x:0;this.m_impulse.x+=d;a=d*this.m_perp.x;c=d*this.m_perp.y;g=d*this.m_s1;b=d*this.m_s2}j.x-=this.m_invMassA*a;j.y-=this.m_invMassA*c;o-=this.m_invIA*g;q.x+=this.m_invMassB*a;q.y+=this.m_invMassB*c;n+=this.m_invIB*b;h.m_linearVelocity.SetV(j);h.m_angularVelocity=o;l.m_linearVelocity.SetV(q);l.m_angularVelocity=n};k.prototype.SolvePositionConstraints=function(){var d=this.m_bodyA,h=this.m_bodyB,l=d.m_sweep.c,j=d.m_sweep.a,o=h.m_sweep.c,q=h.m_sweep.a,n,a=0,c=0,g=0,b=0,e=n=0,f=0;c=false;
-var m=0,r=G.FromAngle(j);g=G.FromAngle(q);n=r;f=this.m_localAnchor1.x-this.m_localCenterA.x;var s=this.m_localAnchor1.y-this.m_localCenterA.y;a=n.col1.x*f+n.col2.x*s;s=n.col1.y*f+n.col2.y*s;f=a;n=g;g=this.m_localAnchor2.x-this.m_localCenterB.x;b=this.m_localAnchor2.y-this.m_localCenterB.y;a=n.col1.x*g+n.col2.x*b;b=n.col1.y*g+n.col2.y*b;g=a;n=o.x+g-l.x-f;a=o.y+b-l.y-s;if(this.m_enableLimit){this.m_axis=y.MulMV(r,this.m_localXAxis1);this.m_a1=(n+f)*this.m_axis.y-(a+s)*this.m_axis.x;this.m_a2=g*this.m_axis.y-
-b*this.m_axis.x;var v=this.m_axis.x*n+this.m_axis.y*a;if(y.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*F.b2_linearSlop){m=y.Clamp(v,-F.b2_maxLinearCorrection,F.b2_maxLinearCorrection);e=y.Abs(v);c=true}else if(v<=this.m_lowerTranslation){m=y.Clamp(v-this.m_lowerTranslation+F.b2_linearSlop,-F.b2_maxLinearCorrection,0);e=this.m_lowerTranslation-v;c=true}else if(v>=this.m_upperTranslation){m=y.Clamp(v-this.m_upperTranslation+F.b2_linearSlop,0,F.b2_maxLinearCorrection);e=v-this.m_upperTranslation;
-c=true}}this.m_perp=y.MulMV(r,this.m_localYAxis1);this.m_s1=(n+f)*this.m_perp.y-(a+s)*this.m_perp.x;this.m_s2=g*this.m_perp.y-b*this.m_perp.x;r=new w;s=this.m_perp.x*n+this.m_perp.y*a;e=y.Max(e,y.Abs(s));f=0;if(c){c=this.m_invMassA;g=this.m_invMassB;b=this.m_invIA;n=this.m_invIB;this.m_K.col1.x=c+g+b*this.m_s1*this.m_s1+n*this.m_s2*this.m_s2;this.m_K.col1.y=b*this.m_s1*this.m_a1+n*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=c+g+b*this.m_a1*this.m_a1+n*this.m_a2*this.m_a2;this.m_K.Solve(r,
--s,-m)}else{c=this.m_invMassA;g=this.m_invMassB;b=this.m_invIA;n=this.m_invIB;m=c+g+b*this.m_s1*this.m_s1+n*this.m_s2*this.m_s2;c=0;c=m!=0?-s/m:0;r.x=c;r.y=0}m=r.x*this.m_perp.x+r.y*this.m_axis.x;c=r.x*this.m_perp.y+r.y*this.m_axis.y;s=r.x*this.m_s1+r.y*this.m_a1;r=r.x*this.m_s2+r.y*this.m_a2;l.x-=this.m_invMassA*m;l.y-=this.m_invMassA*c;j-=this.m_invIA*s;o.x+=this.m_invMassB*m;o.y+=this.m_invMassB*c;q+=this.m_invIB*r;d.m_sweep.a=j;h.m_sweep.a=q;d.SynchronizeTransform();h.SynchronizeTransform();return e<=
-F.b2_linearSlop&&f<=F.b2_angularSlop};Box2D.inherit(z,Box2D.Dynamics.Joints.b2JointDef);z.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;z.b2LineJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new w;this.localAnchorB=new w;this.localAxisA=new w};z.prototype.b2LineJointDef=function(){this.__super.b2JointDef.call(this);this.type=I.e_lineJoint;this.localAxisA.Set(1,0);this.enableLimit=false;this.upperTranslation=this.lowerTranslation=
-0;this.enableMotor=false;this.motorSpeed=this.maxMotorForce=0};z.prototype.Initialize=function(d,h,l,j){this.bodyA=d;this.bodyB=h;this.localAnchorA=this.bodyA.GetLocalPoint(l);this.localAnchorB=this.bodyB.GetLocalPoint(l);this.localAxisA=this.bodyA.GetLocalVector(j)};Box2D.inherit(u,Box2D.Dynamics.Joints.b2Joint);u.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;u.b2MouseJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.K=new G;this.K1=new G;this.K2=new G;
-this.m_localAnchor=new w;this.m_target=new w;this.m_impulse=new w;this.m_mass=new G;this.m_C=new w};u.prototype.GetAnchorA=function(){return this.m_target};u.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor)};u.prototype.GetReactionForce=function(d){if(d===undefined)d=0;return new w(d*this.m_impulse.x,d*this.m_impulse.y)};u.prototype.GetReactionTorque=function(){return 0};u.prototype.GetTarget=function(){return this.m_target};u.prototype.SetTarget=function(d){this.m_bodyB.IsAwake()==
-false&&this.m_bodyB.SetAwake(true);this.m_target=d};u.prototype.GetMaxForce=function(){return this.m_maxForce};u.prototype.SetMaxForce=function(d){if(d===undefined)d=0;this.m_maxForce=d};u.prototype.GetFrequency=function(){return this.m_frequencyHz};u.prototype.SetFrequency=function(d){if(d===undefined)d=0;this.m_frequencyHz=d};u.prototype.GetDampingRatio=function(){return this.m_dampingRatio};u.prototype.SetDampingRatio=function(d){if(d===undefined)d=0;this.m_dampingRatio=d};u.prototype.b2MouseJoint=
-function(d){this.__super.b2Joint.call(this,d);this.m_target.SetV(d.target);var h=this.m_target.x-this.m_bodyB.m_xf.position.x,l=this.m_target.y-this.m_bodyB.m_xf.position.y,j=this.m_bodyB.m_xf.R;this.m_localAnchor.x=h*j.col1.x+l*j.col1.y;this.m_localAnchor.y=h*j.col2.x+l*j.col2.y;this.m_maxForce=d.maxForce;this.m_impulse.SetZero();this.m_frequencyHz=d.frequencyHz;this.m_dampingRatio=d.dampingRatio;this.m_gamma=this.m_beta=0};u.prototype.InitVelocityConstraints=function(d){var h=this.m_bodyB,l=h.GetMass(),
-j=2*Math.PI*this.m_frequencyHz,o=l*j*j;this.m_gamma=d.dt*(2*l*this.m_dampingRatio*j+d.dt*o);this.m_gamma=this.m_gamma!=0?1/this.m_gamma:0;this.m_beta=d.dt*o*this.m_gamma;o=h.m_xf.R;l=this.m_localAnchor.x-h.m_sweep.localCenter.x;j=this.m_localAnchor.y-h.m_sweep.localCenter.y;var q=o.col1.x*l+o.col2.x*j;j=o.col1.y*l+o.col2.y*j;l=q;o=h.m_invMass;q=h.m_invI;this.K1.col1.x=o;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=o;this.K2.col1.x=q*j*j;this.K2.col2.x=-q*l*j;this.K2.col1.y=-q*l*j;this.K2.col2.y=
-q*l*l;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=h.m_sweep.c.x+l-this.m_target.x;this.m_C.y=h.m_sweep.c.y+j-this.m_target.y;h.m_angularVelocity*=0.98;this.m_impulse.x*=d.dtRatio;this.m_impulse.y*=d.dtRatio;h.m_linearVelocity.x+=o*this.m_impulse.x;h.m_linearVelocity.y+=o*this.m_impulse.y;h.m_angularVelocity+=q*(l*this.m_impulse.y-j*this.m_impulse.x)};u.prototype.SolveVelocityConstraints=function(d){var h=
-this.m_bodyB,l,j=0,o=0;l=h.m_xf.R;var q=this.m_localAnchor.x-h.m_sweep.localCenter.x,n=this.m_localAnchor.y-h.m_sweep.localCenter.y;j=l.col1.x*q+l.col2.x*n;n=l.col1.y*q+l.col2.y*n;q=j;j=h.m_linearVelocity.x+-h.m_angularVelocity*n;var a=h.m_linearVelocity.y+h.m_angularVelocity*q;l=this.m_mass;j=j+this.m_beta*this.m_C.x+this.m_gamma*this.m_impulse.x;o=a+this.m_beta*this.m_C.y+this.m_gamma*this.m_impulse.y;a=-(l.col1.x*j+l.col2.x*o);o=-(l.col1.y*j+l.col2.y*o);l=this.m_impulse.x;j=this.m_impulse.y;this.m_impulse.x+=
-a;this.m_impulse.y+=o;d=d.dt*this.m_maxForce;this.m_impulse.LengthSquared()>d*d&&this.m_impulse.Multiply(d/this.m_impulse.Length());a=this.m_impulse.x-l;o=this.m_impulse.y-j;h.m_linearVelocity.x+=h.m_invMass*a;h.m_linearVelocity.y+=h.m_invMass*o;h.m_angularVelocity+=h.m_invI*(q*o-n*a)};u.prototype.SolvePositionConstraints=function(){return true};Box2D.inherit(D,Box2D.Dynamics.Joints.b2JointDef);D.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;D.b2MouseJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,
-arguments);this.target=new w};D.prototype.b2MouseJointDef=function(){this.__super.b2JointDef.call(this);this.type=I.e_mouseJoint;this.maxForce=0;this.frequencyHz=5;this.dampingRatio=0.7};Box2D.inherit(H,Box2D.Dynamics.Joints.b2Joint);H.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;H.b2PrismaticJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchor1=new w;this.m_localAnchor2=new w;this.m_localXAxis1=new w;this.m_localYAxis1=new w;this.m_axis=new w;
-this.m_perp=new w;this.m_K=new K;this.m_impulse=new A};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(d){if(d===undefined)d=0;return new w(d*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),d*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y))};H.prototype.GetReactionTorque=
-function(d){if(d===undefined)d=0;return d*this.m_impulse.y};H.prototype.GetJointTranslation=function(){var d=this.m_bodyA,h=this.m_bodyB,l=d.GetWorldPoint(this.m_localAnchor1),j=h.GetWorldPoint(this.m_localAnchor2);h=j.x-l.x;l=j.y-l.y;d=d.GetWorldVector(this.m_localXAxis1);return d.x*h+d.y*l};H.prototype.GetJointSpeed=function(){var d=this.m_bodyA,h=this.m_bodyB,l;l=d.m_xf.R;var j=this.m_localAnchor1.x-d.m_sweep.localCenter.x,o=this.m_localAnchor1.y-d.m_sweep.localCenter.y,q=l.col1.x*j+l.col2.x*o;
-o=l.col1.y*j+l.col2.y*o;j=q;l=h.m_xf.R;var n=this.m_localAnchor2.x-h.m_sweep.localCenter.x,a=this.m_localAnchor2.y-h.m_sweep.localCenter.y;q=l.col1.x*n+l.col2.x*a;a=l.col1.y*n+l.col2.y*a;n=q;l=h.m_sweep.c.x+n-(d.m_sweep.c.x+j);q=h.m_sweep.c.y+a-(d.m_sweep.c.y+o);var c=d.GetWorldVector(this.m_localXAxis1),g=d.m_linearVelocity,b=h.m_linearVelocity;d=d.m_angularVelocity;h=h.m_angularVelocity;return l*-d*c.y+q*d*c.x+(c.x*(b.x+-h*a-g.x- -d*o)+c.y*(b.y+h*n-g.y-d*j))};H.prototype.IsLimitEnabled=function(){return this.m_enableLimit};
-H.prototype.EnableLimit=function(d){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableLimit=d};H.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};H.prototype.GetUpperLimit=function(){return this.m_upperTranslation};H.prototype.SetLimits=function(d,h){if(d===undefined)d=0;if(h===undefined)h=0;this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_lowerTranslation=d;this.m_upperTranslation=h};H.prototype.IsMotorEnabled=function(){return this.m_enableMotor};
-H.prototype.EnableMotor=function(d){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_enableMotor=d};H.prototype.SetMotorSpeed=function(d){if(d===undefined)d=0;this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=d};H.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};H.prototype.SetMaxMotorForce=function(d){if(d===undefined)d=0;this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_maxMotorForce=d};H.prototype.GetMotorForce=function(){return this.m_motorImpulse};
-H.prototype.b2PrismaticJoint=function(d){this.__super.b2Joint.call(this,d);this.m_localAnchor1.SetV(d.localAnchorA);this.m_localAnchor2.SetV(d.localAnchorB);this.m_localXAxis1.SetV(d.localAxisA);this.m_localYAxis1.x=-this.m_localXAxis1.y;this.m_localYAxis1.y=this.m_localXAxis1.x;this.m_refAngle=d.referenceAngle;this.m_impulse.SetZero();this.m_motorImpulse=this.m_motorMass=0;this.m_lowerTranslation=d.lowerTranslation;this.m_upperTranslation=d.upperTranslation;this.m_maxMotorForce=d.maxMotorForce;this.m_motorSpeed=
-d.motorSpeed;this.m_enableLimit=d.enableLimit;this.m_enableMotor=d.enableMotor;this.m_limitState=I.e_inactiveLimit;this.m_axis.SetZero();this.m_perp.SetZero()};H.prototype.InitVelocityConstraints=function(d){var h=this.m_bodyA,l=this.m_bodyB,j,o=0;this.m_localCenterA.SetV(h.GetLocalCenter());this.m_localCenterB.SetV(l.GetLocalCenter());var q=h.GetTransform();l.GetTransform();j=h.m_xf.R;var n=this.m_localAnchor1.x-this.m_localCenterA.x,a=this.m_localAnchor1.y-this.m_localCenterA.y;o=j.col1.x*n+j.col2.x*
-a;a=j.col1.y*n+j.col2.y*a;n=o;j=l.m_xf.R;var c=this.m_localAnchor2.x-this.m_localCenterB.x,g=this.m_localAnchor2.y-this.m_localCenterB.y;o=j.col1.x*c+j.col2.x*g;g=j.col1.y*c+j.col2.y*g;c=o;j=l.m_sweep.c.x+c-h.m_sweep.c.x-n;o=l.m_sweep.c.y+g-h.m_sweep.c.y-a;this.m_invMassA=h.m_invMass;this.m_invMassB=l.m_invMass;this.m_invIA=h.m_invI;this.m_invIB=l.m_invI;this.m_axis.SetV(y.MulMV(q.R,this.m_localXAxis1));this.m_a1=(j+n)*this.m_axis.y-(o+a)*this.m_axis.x;this.m_a2=c*this.m_axis.y-g*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(y.MulMV(q.R,this.m_localYAxis1));this.m_s1=(j+n)*this.m_perp.y-(o+a)*this.m_perp.x;this.m_s2=c*this.m_perp.y-g*this.m_perp.x;q=this.m_invMassA;n=this.m_invMassB;a=this.m_invIA;c=this.m_invIB;this.m_K.col1.x=q+n+a*this.m_s1*this.m_s1+c*this.m_s2*this.m_s2;this.m_K.col1.y=a*this.m_s1+c*this.m_s2;this.m_K.col1.z=a*
-this.m_s1*this.m_a1+c*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=a+c;this.m_K.col2.z=a*this.m_a1+c*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=q+n+a*this.m_a1*this.m_a1+c*this.m_a2*this.m_a2;if(this.m_enableLimit){j=this.m_axis.x*j+this.m_axis.y*o;if(y.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*F.b2_linearSlop)this.m_limitState=I.e_equalLimits;else if(j<=this.m_lowerTranslation){if(this.m_limitState!=I.e_atLowerLimit){this.m_limitState=
-I.e_atLowerLimit;this.m_impulse.z=0}}else if(j>=this.m_upperTranslation){if(this.m_limitState!=I.e_atUpperLimit){this.m_limitState=I.e_atUpperLimit;this.m_impulse.z=0}}else{this.m_limitState=I.e_inactiveLimit;this.m_impulse.z=0}}else this.m_limitState=I.e_inactiveLimit;if(this.m_enableMotor==false)this.m_motorImpulse=0;if(d.warmStarting){this.m_impulse.x*=d.dtRatio;this.m_impulse.y*=d.dtRatio;this.m_motorImpulse*=d.dtRatio;d=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x;
-j=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y;o=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1;q=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;h.m_linearVelocity.x-=this.m_invMassA*d;h.m_linearVelocity.y-=this.m_invMassA*j;h.m_angularVelocity-=this.m_invIA*o;l.m_linearVelocity.x+=this.m_invMassB*d;l.m_linearVelocity.y+=this.m_invMassB*j;l.m_angularVelocity+=this.m_invIB*
-q}else{this.m_impulse.SetZero();this.m_motorImpulse=0}};H.prototype.SolveVelocityConstraints=function(d){var h=this.m_bodyA,l=this.m_bodyB,j=h.m_linearVelocity,o=h.m_angularVelocity,q=l.m_linearVelocity,n=l.m_angularVelocity,a=0,c=0,g=0,b=0;if(this.m_enableMotor&&this.m_limitState!=I.e_equalLimits){b=this.m_motorMass*(this.m_motorSpeed-(this.m_axis.x*(q.x-j.x)+this.m_axis.y*(q.y-j.y)+this.m_a2*n-this.m_a1*o));a=this.m_motorImpulse;d=d.dt*this.m_maxMotorForce;this.m_motorImpulse=y.Clamp(this.m_motorImpulse+
-b,-d,d);b=this.m_motorImpulse-a;a=b*this.m_axis.x;c=b*this.m_axis.y;g=b*this.m_a1;b=b*this.m_a2;j.x-=this.m_invMassA*a;j.y-=this.m_invMassA*c;o-=this.m_invIA*g;q.x+=this.m_invMassB*a;q.y+=this.m_invMassB*c;n+=this.m_invIB*b}g=this.m_perp.x*(q.x-j.x)+this.m_perp.y*(q.y-j.y)+this.m_s2*n-this.m_s1*o;c=n-o;if(this.m_enableLimit&&this.m_limitState!=I.e_inactiveLimit){d=this.m_axis.x*(q.x-j.x)+this.m_axis.y*(q.y-j.y)+this.m_a2*n-this.m_a1*o;a=this.m_impulse.Copy();d=this.m_K.Solve33(new A,-g,-c,-d);this.m_impulse.Add(d);
-if(this.m_limitState==I.e_atLowerLimit)this.m_impulse.z=y.Max(this.m_impulse.z,0);else if(this.m_limitState==I.e_atUpperLimit)this.m_impulse.z=y.Min(this.m_impulse.z,0);g=-g-(this.m_impulse.z-a.z)*this.m_K.col3.x;c=-c-(this.m_impulse.z-a.z)*this.m_K.col3.y;c=this.m_K.Solve22(new w,g,c);c.x+=a.x;c.y+=a.y;this.m_impulse.x=c.x;this.m_impulse.y=c.y;d.x=this.m_impulse.x-a.x;d.y=this.m_impulse.y-a.y;d.z=this.m_impulse.z-a.z;a=d.x*this.m_perp.x+d.z*this.m_axis.x;c=d.x*this.m_perp.y+d.z*this.m_axis.y;g=d.x*
-this.m_s1+d.y+d.z*this.m_a1;b=d.x*this.m_s2+d.y+d.z*this.m_a2}else{d=this.m_K.Solve22(new w,-g,-c);this.m_impulse.x+=d.x;this.m_impulse.y+=d.y;a=d.x*this.m_perp.x;c=d.x*this.m_perp.y;g=d.x*this.m_s1+d.y;b=d.x*this.m_s2+d.y}j.x-=this.m_invMassA*a;j.y-=this.m_invMassA*c;o-=this.m_invIA*g;q.x+=this.m_invMassB*a;q.y+=this.m_invMassB*c;n+=this.m_invIB*b;h.m_linearVelocity.SetV(j);h.m_angularVelocity=o;l.m_linearVelocity.SetV(q);l.m_angularVelocity=n};H.prototype.SolvePositionConstraints=function(){var d=
-this.m_bodyA,h=this.m_bodyB,l=d.m_sweep.c,j=d.m_sweep.a,o=h.m_sweep.c,q=h.m_sweep.a,n,a=0,c=0,g=0,b=a=n=0,e=0;c=false;var f=0,m=G.FromAngle(j),r=G.FromAngle(q);n=m;e=this.m_localAnchor1.x-this.m_localCenterA.x;var s=this.m_localAnchor1.y-this.m_localCenterA.y;a=n.col1.x*e+n.col2.x*s;s=n.col1.y*e+n.col2.y*s;e=a;n=r;r=this.m_localAnchor2.x-this.m_localCenterB.x;g=this.m_localAnchor2.y-this.m_localCenterB.y;a=n.col1.x*r+n.col2.x*g;g=n.col1.y*r+n.col2.y*g;r=a;n=o.x+r-l.x-e;a=o.y+g-l.y-s;if(this.m_enableLimit){this.m_axis=
-y.MulMV(m,this.m_localXAxis1);this.m_a1=(n+e)*this.m_axis.y-(a+s)*this.m_axis.x;this.m_a2=r*this.m_axis.y-g*this.m_axis.x;var v=this.m_axis.x*n+this.m_axis.y*a;if(y.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*F.b2_linearSlop){f=y.Clamp(v,-F.b2_maxLinearCorrection,F.b2_maxLinearCorrection);b=y.Abs(v);c=true}else if(v<=this.m_lowerTranslation){f=y.Clamp(v-this.m_lowerTranslation+F.b2_linearSlop,-F.b2_maxLinearCorrection,0);b=this.m_lowerTranslation-v;c=true}else if(v>=this.m_upperTranslation){f=
-y.Clamp(v-this.m_upperTranslation+F.b2_linearSlop,0,F.b2_maxLinearCorrection);b=v-this.m_upperTranslation;c=true}}this.m_perp=y.MulMV(m,this.m_localYAxis1);this.m_s1=(n+e)*this.m_perp.y-(a+s)*this.m_perp.x;this.m_s2=r*this.m_perp.y-g*this.m_perp.x;m=new A;s=this.m_perp.x*n+this.m_perp.y*a;r=q-j-this.m_refAngle;b=y.Max(b,y.Abs(s));e=y.Abs(r);if(c){c=this.m_invMassA;g=this.m_invMassB;n=this.m_invIA;a=this.m_invIB;this.m_K.col1.x=c+g+n*this.m_s1*this.m_s1+a*this.m_s2*this.m_s2;this.m_K.col1.y=n*this.m_s1+
-a*this.m_s2;this.m_K.col1.z=n*this.m_s1*this.m_a1+a*this.m_s2*this.m_a2;this.m_K.col2.x=this.m_K.col1.y;this.m_K.col2.y=n+a;this.m_K.col2.z=n*this.m_a1+a*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=c+g+n*this.m_a1*this.m_a1+a*this.m_a2*this.m_a2;this.m_K.Solve33(m,-s,-r,-f)}else{c=this.m_invMassA;g=this.m_invMassB;n=this.m_invIA;a=this.m_invIB;f=n*this.m_s1+a*this.m_s2;v=n+a;this.m_K.col1.Set(c+g+n*this.m_s1*this.m_s1+a*this.m_s2*this.m_s2,f,0);this.m_K.col2.Set(f,
-v,0);f=this.m_K.Solve22(new w,-s,-r);m.x=f.x;m.y=f.y;m.z=0}f=m.x*this.m_perp.x+m.z*this.m_axis.x;c=m.x*this.m_perp.y+m.z*this.m_axis.y;s=m.x*this.m_s1+m.y+m.z*this.m_a1;m=m.x*this.m_s2+m.y+m.z*this.m_a2;l.x-=this.m_invMassA*f;l.y-=this.m_invMassA*c;j-=this.m_invIA*s;o.x+=this.m_invMassB*f;o.y+=this.m_invMassB*c;q+=this.m_invIB*m;d.m_sweep.a=j;h.m_sweep.a=q;d.SynchronizeTransform();h.SynchronizeTransform();return b<=F.b2_linearSlop&&e<=F.b2_angularSlop};Box2D.inherit(O,Box2D.Dynamics.Joints.b2JointDef);
-O.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;O.b2PrismaticJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new w;this.localAnchorB=new w;this.localAxisA=new w};O.prototype.b2PrismaticJointDef=function(){this.__super.b2JointDef.call(this);this.type=I.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};O.prototype.Initialize=function(d,h,l,j){this.bodyA=d;this.bodyB=h;this.localAnchorA=this.bodyA.GetLocalPoint(l);this.localAnchorB=this.bodyB.GetLocalPoint(l);this.localAxisA=this.bodyA.GetLocalVector(j);this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()};Box2D.inherit(E,Box2D.Dynamics.Joints.b2Joint);E.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;E.b2PulleyJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_groundAnchor1=new w;this.m_groundAnchor2=
-new w;this.m_localAnchor1=new w;this.m_localAnchor2=new w;this.m_u1=new w;this.m_u2=new w};E.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};E.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};E.prototype.GetReactionForce=function(d){if(d===undefined)d=0;return new w(d*this.m_impulse*this.m_u2.x,d*this.m_impulse*this.m_u2.y)};E.prototype.GetReactionTorque=function(){return 0};E.prototype.GetGroundAnchorA=function(){var d=
-this.m_ground.m_xf.position.Copy();d.Add(this.m_groundAnchor1);return d};E.prototype.GetGroundAnchorB=function(){var d=this.m_ground.m_xf.position.Copy();d.Add(this.m_groundAnchor2);return d};E.prototype.GetLength1=function(){var d=this.m_bodyA.GetWorldPoint(this.m_localAnchor1),h=d.x-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x);d=d.y-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y);return Math.sqrt(h*h+d*d)};E.prototype.GetLength2=function(){var d=this.m_bodyB.GetWorldPoint(this.m_localAnchor2),
-h=d.x-(this.m_ground.m_xf.position.x+this.m_groundAnchor2.x);d=d.y-(this.m_ground.m_xf.position.y+this.m_groundAnchor2.y);return Math.sqrt(h*h+d*d)};E.prototype.GetRatio=function(){return this.m_ratio};E.prototype.b2PulleyJoint=function(d){this.__super.b2Joint.call(this,d);this.m_ground=this.m_bodyA.m_world.m_groundBody;this.m_groundAnchor1.x=d.groundAnchorA.x-this.m_ground.m_xf.position.x;this.m_groundAnchor1.y=d.groundAnchorA.y-this.m_ground.m_xf.position.y;this.m_groundAnchor2.x=d.groundAnchorB.x-
-this.m_ground.m_xf.position.x;this.m_groundAnchor2.y=d.groundAnchorB.y-this.m_ground.m_xf.position.y;this.m_localAnchor1.SetV(d.localAnchorA);this.m_localAnchor2.SetV(d.localAnchorB);this.m_ratio=d.ratio;this.m_constant=d.lengthA+this.m_ratio*d.lengthB;this.m_maxLength1=y.Min(d.maxLengthA,this.m_constant-this.m_ratio*E.b2_minPulleyLength);this.m_maxLength2=y.Min(d.maxLengthB,(this.m_constant-E.b2_minPulleyLength)/this.m_ratio);this.m_limitImpulse2=this.m_limitImpulse1=this.m_impulse=0};E.prototype.InitVelocityConstraints=
-function(d){var h=this.m_bodyA,l=this.m_bodyB,j;j=h.m_xf.R;var o=this.m_localAnchor1.x-h.m_sweep.localCenter.x,q=this.m_localAnchor1.y-h.m_sweep.localCenter.y,n=j.col1.x*o+j.col2.x*q;q=j.col1.y*o+j.col2.y*q;o=n;j=l.m_xf.R;var a=this.m_localAnchor2.x-l.m_sweep.localCenter.x,c=this.m_localAnchor2.y-l.m_sweep.localCenter.y;n=j.col1.x*a+j.col2.x*c;c=j.col1.y*a+j.col2.y*c;a=n;j=l.m_sweep.c.x+a;n=l.m_sweep.c.y+c;var g=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,b=this.m_ground.m_xf.position.y+
-this.m_groundAnchor2.y;this.m_u1.Set(h.m_sweep.c.x+o-(this.m_ground.m_xf.position.x+this.m_groundAnchor1.x),h.m_sweep.c.y+q-(this.m_ground.m_xf.position.y+this.m_groundAnchor1.y));this.m_u2.Set(j-g,n-b);j=this.m_u1.Length();n=this.m_u2.Length();j>F.b2_linearSlop?this.m_u1.Multiply(1/j):this.m_u1.SetZero();n>F.b2_linearSlop?this.m_u2.Multiply(1/n):this.m_u2.SetZero();if(this.m_constant-j-this.m_ratio*n>0){this.m_state=I.e_inactiveLimit;this.m_impulse=0}else this.m_state=I.e_atUpperLimit;if(j<this.m_maxLength1){this.m_limitState1=
-I.e_inactiveLimit;this.m_limitImpulse1=0}else this.m_limitState1=I.e_atUpperLimit;if(n<this.m_maxLength2){this.m_limitState2=I.e_inactiveLimit;this.m_limitImpulse2=0}else this.m_limitState2=I.e_atUpperLimit;j=o*this.m_u1.y-q*this.m_u1.x;n=a*this.m_u2.y-c*this.m_u2.x;this.m_limitMass1=h.m_invMass+h.m_invI*j*j;this.m_limitMass2=l.m_invMass+l.m_invI*n*n;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(d.warmStarting){this.m_impulse*=d.dtRatio;this.m_limitImpulse1*=d.dtRatio;this.m_limitImpulse2*=d.dtRatio;d=(-this.m_impulse-this.m_limitImpulse1)*this.m_u1.x;j=(-this.m_impulse-this.m_limitImpulse1)*this.m_u1.y;n=(-this.m_ratio*this.m_impulse-this.m_limitImpulse2)*this.m_u2.x;g=(-this.m_ratio*this.m_impulse-this.m_limitImpulse2)*this.m_u2.y;h.m_linearVelocity.x+=h.m_invMass*d;h.m_linearVelocity.y+=h.m_invMass*j;h.m_angularVelocity+=h.m_invI*(o*j-q*d);l.m_linearVelocity.x+=
-l.m_invMass*n;l.m_linearVelocity.y+=l.m_invMass*g;l.m_angularVelocity+=l.m_invI*(a*g-c*n)}else this.m_limitImpulse2=this.m_limitImpulse1=this.m_impulse=0};E.prototype.SolveVelocityConstraints=function(){var d=this.m_bodyA,h=this.m_bodyB,l;l=d.m_xf.R;var j=this.m_localAnchor1.x-d.m_sweep.localCenter.x,o=this.m_localAnchor1.y-d.m_sweep.localCenter.y,q=l.col1.x*j+l.col2.x*o;o=l.col1.y*j+l.col2.y*o;j=q;l=h.m_xf.R;var n=this.m_localAnchor2.x-h.m_sweep.localCenter.x,a=this.m_localAnchor2.y-h.m_sweep.localCenter.y;
-q=l.col1.x*n+l.col2.x*a;a=l.col1.y*n+l.col2.y*a;n=q;var c=q=l=0,g=0;l=g=l=g=c=q=l=0;if(this.m_state==I.e_atUpperLimit){l=d.m_linearVelocity.x+-d.m_angularVelocity*o;q=d.m_linearVelocity.y+d.m_angularVelocity*j;c=h.m_linearVelocity.x+-h.m_angularVelocity*a;g=h.m_linearVelocity.y+h.m_angularVelocity*n;l=-(this.m_u1.x*l+this.m_u1.y*q)-this.m_ratio*(this.m_u2.x*c+this.m_u2.y*g);g=this.m_pulleyMass*-l;l=this.m_impulse;this.m_impulse=y.Max(0,this.m_impulse+g);g=this.m_impulse-l;l=-g*this.m_u1.x;q=-g*this.m_u1.y;
-c=-this.m_ratio*g*this.m_u2.x;g=-this.m_ratio*g*this.m_u2.y;d.m_linearVelocity.x+=d.m_invMass*l;d.m_linearVelocity.y+=d.m_invMass*q;d.m_angularVelocity+=d.m_invI*(j*q-o*l);h.m_linearVelocity.x+=h.m_invMass*c;h.m_linearVelocity.y+=h.m_invMass*g;h.m_angularVelocity+=h.m_invI*(n*g-a*c)}if(this.m_limitState1==I.e_atUpperLimit){l=d.m_linearVelocity.x+-d.m_angularVelocity*o;q=d.m_linearVelocity.y+d.m_angularVelocity*j;l=-(this.m_u1.x*l+this.m_u1.y*q);g=-this.m_limitMass1*l;l=this.m_limitImpulse1;this.m_limitImpulse1=
-y.Max(0,this.m_limitImpulse1+g);g=this.m_limitImpulse1-l;l=-g*this.m_u1.x;q=-g*this.m_u1.y;d.m_linearVelocity.x+=d.m_invMass*l;d.m_linearVelocity.y+=d.m_invMass*q;d.m_angularVelocity+=d.m_invI*(j*q-o*l)}if(this.m_limitState2==I.e_atUpperLimit){c=h.m_linearVelocity.x+-h.m_angularVelocity*a;g=h.m_linearVelocity.y+h.m_angularVelocity*n;l=-(this.m_u2.x*c+this.m_u2.y*g);g=-this.m_limitMass2*l;l=this.m_limitImpulse2;this.m_limitImpulse2=y.Max(0,this.m_limitImpulse2+g);g=this.m_limitImpulse2-l;c=-g*this.m_u2.x;
-g=-g*this.m_u2.y;h.m_linearVelocity.x+=h.m_invMass*c;h.m_linearVelocity.y+=h.m_invMass*g;h.m_angularVelocity+=h.m_invI*(n*g-a*c)}};E.prototype.SolvePositionConstraints=function(){var d=this.m_bodyA,h=this.m_bodyB,l,j=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,o=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,q=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,n=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y,a=0,c=0,g=0,b=0,e=l=0,f=0,m=0,r=e=m=l=e=l=0;if(this.m_state==I.e_atUpperLimit){l=
-d.m_xf.R;a=this.m_localAnchor1.x-d.m_sweep.localCenter.x;c=this.m_localAnchor1.y-d.m_sweep.localCenter.y;e=l.col1.x*a+l.col2.x*c;c=l.col1.y*a+l.col2.y*c;a=e;l=h.m_xf.R;g=this.m_localAnchor2.x-h.m_sweep.localCenter.x;b=this.m_localAnchor2.y-h.m_sweep.localCenter.y;e=l.col1.x*g+l.col2.x*b;b=l.col1.y*g+l.col2.y*b;g=e;l=d.m_sweep.c.x+a;e=d.m_sweep.c.y+c;f=h.m_sweep.c.x+g;m=h.m_sweep.c.y+b;this.m_u1.Set(l-j,e-o);this.m_u2.Set(f-q,m-n);l=this.m_u1.Length();e=this.m_u2.Length();l>F.b2_linearSlop?this.m_u1.Multiply(1/
-l):this.m_u1.SetZero();e>F.b2_linearSlop?this.m_u2.Multiply(1/e):this.m_u2.SetZero();l=this.m_constant-l-this.m_ratio*e;r=y.Max(r,-l);l=y.Clamp(l+F.b2_linearSlop,-F.b2_maxLinearCorrection,0);m=-this.m_pulleyMass*l;l=-m*this.m_u1.x;e=-m*this.m_u1.y;f=-this.m_ratio*m*this.m_u2.x;m=-this.m_ratio*m*this.m_u2.y;d.m_sweep.c.x+=d.m_invMass*l;d.m_sweep.c.y+=d.m_invMass*e;d.m_sweep.a+=d.m_invI*(a*e-c*l);h.m_sweep.c.x+=h.m_invMass*f;h.m_sweep.c.y+=h.m_invMass*m;h.m_sweep.a+=h.m_invI*(g*m-b*f);d.SynchronizeTransform();
-h.SynchronizeTransform()}if(this.m_limitState1==I.e_atUpperLimit){l=d.m_xf.R;a=this.m_localAnchor1.x-d.m_sweep.localCenter.x;c=this.m_localAnchor1.y-d.m_sweep.localCenter.y;e=l.col1.x*a+l.col2.x*c;c=l.col1.y*a+l.col2.y*c;a=e;l=d.m_sweep.c.x+a;e=d.m_sweep.c.y+c;this.m_u1.Set(l-j,e-o);l=this.m_u1.Length();if(l>F.b2_linearSlop){this.m_u1.x*=1/l;this.m_u1.y*=1/l}else this.m_u1.SetZero();l=this.m_maxLength1-l;r=y.Max(r,-l);l=y.Clamp(l+F.b2_linearSlop,-F.b2_maxLinearCorrection,0);m=-this.m_limitMass1*l;
-l=-m*this.m_u1.x;e=-m*this.m_u1.y;d.m_sweep.c.x+=d.m_invMass*l;d.m_sweep.c.y+=d.m_invMass*e;d.m_sweep.a+=d.m_invI*(a*e-c*l);d.SynchronizeTransform()}if(this.m_limitState2==I.e_atUpperLimit){l=h.m_xf.R;g=this.m_localAnchor2.x-h.m_sweep.localCenter.x;b=this.m_localAnchor2.y-h.m_sweep.localCenter.y;e=l.col1.x*g+l.col2.x*b;b=l.col1.y*g+l.col2.y*b;g=e;f=h.m_sweep.c.x+g;m=h.m_sweep.c.y+b;this.m_u2.Set(f-q,m-n);e=this.m_u2.Length();if(e>F.b2_linearSlop){this.m_u2.x*=1/e;this.m_u2.y*=1/e}else this.m_u2.SetZero();
-l=this.m_maxLength2-e;r=y.Max(r,-l);l=y.Clamp(l+F.b2_linearSlop,-F.b2_maxLinearCorrection,0);m=-this.m_limitMass2*l;f=-m*this.m_u2.x;m=-m*this.m_u2.y;h.m_sweep.c.x+=h.m_invMass*f;h.m_sweep.c.y+=h.m_invMass*m;h.m_sweep.a+=h.m_invI*(g*m-b*f);h.SynchronizeTransform()}return r<F.b2_linearSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2PulleyJoint.b2_minPulleyLength=2});Box2D.inherit(R,Box2D.Dynamics.Joints.b2JointDef);R.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;R.b2PulleyJointDef=
-function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.groundAnchorA=new w;this.groundAnchorB=new w;this.localAnchorA=new w;this.localAnchorB=new w};R.prototype.b2PulleyJointDef=function(){this.__super.b2JointDef.call(this);this.type=I.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};R.prototype.Initialize=
-function(d,h,l,j,o,q,n){if(n===undefined)n=0;this.bodyA=d;this.bodyB=h;this.groundAnchorA.SetV(l);this.groundAnchorB.SetV(j);this.localAnchorA=this.bodyA.GetLocalPoint(o);this.localAnchorB=this.bodyB.GetLocalPoint(q);d=o.x-l.x;l=o.y-l.y;this.lengthA=Math.sqrt(d*d+l*l);l=q.x-j.x;j=q.y-j.y;this.lengthB=Math.sqrt(l*l+j*j);this.ratio=n;n=this.lengthA+this.ratio*this.lengthB;this.maxLengthA=n-this.ratio*E.b2_minPulleyLength;this.maxLengthB=(n-E.b2_minPulleyLength)/this.ratio};Box2D.inherit(N,Box2D.Dynamics.Joints.b2Joint);
-N.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;N.b2RevoluteJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.K=new G;this.K1=new G;this.K2=new G;this.K3=new G;this.impulse3=new A;this.impulse2=new w;this.reduced=new w;this.m_localAnchor1=new w;this.m_localAnchor2=new w;this.m_impulse=new A;this.m_mass=new K};N.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)};N.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)};
-N.prototype.GetReactionForce=function(d){if(d===undefined)d=0;return new w(d*this.m_impulse.x,d*this.m_impulse.y)};N.prototype.GetReactionTorque=function(d){if(d===undefined)d=0;return d*this.m_impulse.z};N.prototype.GetJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle};N.prototype.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity};N.prototype.IsLimitEnabled=function(){return this.m_enableLimit};N.prototype.EnableLimit=
-function(d){this.m_enableLimit=d};N.prototype.GetLowerLimit=function(){return this.m_lowerAngle};N.prototype.GetUpperLimit=function(){return this.m_upperAngle};N.prototype.SetLimits=function(d,h){if(d===undefined)d=0;if(h===undefined)h=0;this.m_lowerAngle=d;this.m_upperAngle=h};N.prototype.IsMotorEnabled=function(){this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);return this.m_enableMotor};N.prototype.EnableMotor=function(d){this.m_enableMotor=d};N.prototype.SetMotorSpeed=function(d){if(d===
-undefined)d=0;this.m_bodyA.SetAwake(true);this.m_bodyB.SetAwake(true);this.m_motorSpeed=d};N.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};N.prototype.SetMaxMotorTorque=function(d){if(d===undefined)d=0;this.m_maxMotorTorque=d};N.prototype.GetMotorTorque=function(){return this.m_maxMotorTorque};N.prototype.b2RevoluteJoint=function(d){this.__super.b2Joint.call(this,d);this.m_localAnchor1.SetV(d.localAnchorA);this.m_localAnchor2.SetV(d.localAnchorB);this.m_referenceAngle=d.referenceAngle;
-this.m_impulse.SetZero();this.m_motorImpulse=0;this.m_lowerAngle=d.lowerAngle;this.m_upperAngle=d.upperAngle;this.m_maxMotorTorque=d.maxMotorTorque;this.m_motorSpeed=d.motorSpeed;this.m_enableLimit=d.enableLimit;this.m_enableMotor=d.enableMotor;this.m_limitState=I.e_inactiveLimit};N.prototype.InitVelocityConstraints=function(d){var h=this.m_bodyA,l=this.m_bodyB,j,o=0;j=h.m_xf.R;var q=this.m_localAnchor1.x-h.m_sweep.localCenter.x,n=this.m_localAnchor1.y-h.m_sweep.localCenter.y;o=j.col1.x*q+j.col2.x*
-n;n=j.col1.y*q+j.col2.y*n;q=o;j=l.m_xf.R;var a=this.m_localAnchor2.x-l.m_sweep.localCenter.x,c=this.m_localAnchor2.y-l.m_sweep.localCenter.y;o=j.col1.x*a+j.col2.x*c;c=j.col1.y*a+j.col2.y*c;a=o;j=h.m_invMass;o=l.m_invMass;var g=h.m_invI,b=l.m_invI;this.m_mass.col1.x=j+o+n*n*g+c*c*b;this.m_mass.col2.x=-n*q*g-c*a*b;this.m_mass.col3.x=-n*g-c*b;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=j+o+q*q*g+a*a*b;this.m_mass.col3.y=q*g+a*b;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=g+b;this.m_motorMass=1/(g+b);if(this.m_enableMotor==false)this.m_motorImpulse=0;if(this.m_enableLimit){var e=l.m_sweep.a-h.m_sweep.a-this.m_referenceAngle;if(y.Abs(this.m_upperAngle-this.m_lowerAngle)<2*F.b2_angularSlop)this.m_limitState=I.e_equalLimits;else if(e<=this.m_lowerAngle){if(this.m_limitState!=I.e_atLowerLimit)this.m_impulse.z=0;this.m_limitState=I.e_atLowerLimit}else if(e>=this.m_upperAngle){if(this.m_limitState!=I.e_atUpperLimit)this.m_impulse.z=0;this.m_limitState=
-I.e_atUpperLimit}else{this.m_limitState=I.e_inactiveLimit;this.m_impulse.z=0}}else this.m_limitState=I.e_inactiveLimit;if(d.warmStarting){this.m_impulse.x*=d.dtRatio;this.m_impulse.y*=d.dtRatio;this.m_motorImpulse*=d.dtRatio;d=this.m_impulse.x;e=this.m_impulse.y;h.m_linearVelocity.x-=j*d;h.m_linearVelocity.y-=j*e;h.m_angularVelocity-=g*(q*e-n*d+this.m_motorImpulse+this.m_impulse.z);l.m_linearVelocity.x+=o*d;l.m_linearVelocity.y+=o*e;l.m_angularVelocity+=b*(a*e-c*d+this.m_motorImpulse+this.m_impulse.z)}else{this.m_impulse.SetZero();
-this.m_motorImpulse=0}};N.prototype.SolveVelocityConstraints=function(d){var h=this.m_bodyA,l=this.m_bodyB,j=0,o=j=0,q=0,n=0,a=0,c=h.m_linearVelocity,g=h.m_angularVelocity,b=l.m_linearVelocity,e=l.m_angularVelocity,f=h.m_invMass,m=l.m_invMass,r=h.m_invI,s=l.m_invI;if(this.m_enableMotor&&this.m_limitState!=I.e_equalLimits){o=this.m_motorMass*-(e-g-this.m_motorSpeed);q=this.m_motorImpulse;n=d.dt*this.m_maxMotorTorque;this.m_motorImpulse=y.Clamp(this.m_motorImpulse+o,-n,n);o=this.m_motorImpulse-q;g-=
-r*o;e+=s*o}if(this.m_enableLimit&&this.m_limitState!=I.e_inactiveLimit){d=h.m_xf.R;o=this.m_localAnchor1.x-h.m_sweep.localCenter.x;q=this.m_localAnchor1.y-h.m_sweep.localCenter.y;j=d.col1.x*o+d.col2.x*q;q=d.col1.y*o+d.col2.y*q;o=j;d=l.m_xf.R;n=this.m_localAnchor2.x-l.m_sweep.localCenter.x;a=this.m_localAnchor2.y-l.m_sweep.localCenter.y;j=d.col1.x*n+d.col2.x*a;a=d.col1.y*n+d.col2.y*a;n=j;d=b.x+-e*a-c.x- -g*q;var v=b.y+e*n-c.y-g*o;this.m_mass.Solve33(this.impulse3,-d,-v,-(e-g));if(this.m_limitState==
-I.e_equalLimits)this.m_impulse.Add(this.impulse3);else if(this.m_limitState==I.e_atLowerLimit){j=this.m_impulse.z+this.impulse3.z;if(j<0){this.m_mass.Solve22(this.reduced,-d,-v);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==I.e_atUpperLimit){j=this.m_impulse.z+this.impulse3.z;if(j>0){this.m_mass.Solve22(this.reduced,-d,-v);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}}c.x-=f*this.impulse3.x;c.y-=f*this.impulse3.y;g-=r*(o*this.impulse3.y-q*this.impulse3.x+this.impulse3.z);b.x+=m*this.impulse3.x;b.y+=m*this.impulse3.y;e+=s*(n*this.impulse3.y-a*this.impulse3.x+this.impulse3.z)}else{d=h.m_xf.R;o=this.m_localAnchor1.x-h.m_sweep.localCenter.x;q=this.m_localAnchor1.y-h.m_sweep.localCenter.y;j=d.col1.x*o+
-d.col2.x*q;q=d.col1.y*o+d.col2.y*q;o=j;d=l.m_xf.R;n=this.m_localAnchor2.x-l.m_sweep.localCenter.x;a=this.m_localAnchor2.y-l.m_sweep.localCenter.y;j=d.col1.x*n+d.col2.x*a;a=d.col1.y*n+d.col2.y*a;n=j;this.m_mass.Solve22(this.impulse2,-(b.x+-e*a-c.x- -g*q),-(b.y+e*n-c.y-g*o));this.m_impulse.x+=this.impulse2.x;this.m_impulse.y+=this.impulse2.y;c.x-=f*this.impulse2.x;c.y-=f*this.impulse2.y;g-=r*(o*this.impulse2.y-q*this.impulse2.x);b.x+=m*this.impulse2.x;b.y+=m*this.impulse2.y;e+=s*(n*this.impulse2.y-
-a*this.impulse2.x)}h.m_linearVelocity.SetV(c);h.m_angularVelocity=g;l.m_linearVelocity.SetV(b);l.m_angularVelocity=e};N.prototype.SolvePositionConstraints=function(){var d=0,h,l=this.m_bodyA,j=this.m_bodyB,o=0,q=h=0,n=0,a=0;if(this.m_enableLimit&&this.m_limitState!=I.e_inactiveLimit){d=j.m_sweep.a-l.m_sweep.a-this.m_referenceAngle;var c=0;if(this.m_limitState==I.e_equalLimits){d=y.Clamp(d-this.m_lowerAngle,-F.b2_maxAngularCorrection,F.b2_maxAngularCorrection);c=-this.m_motorMass*d;o=y.Abs(d)}else if(this.m_limitState==
-I.e_atLowerLimit){d=d-this.m_lowerAngle;o=-d;d=y.Clamp(d+F.b2_angularSlop,-F.b2_maxAngularCorrection,0);c=-this.m_motorMass*d}else if(this.m_limitState==I.e_atUpperLimit){o=d=d-this.m_upperAngle;d=y.Clamp(d-F.b2_angularSlop,0,F.b2_maxAngularCorrection);c=-this.m_motorMass*d}l.m_sweep.a-=l.m_invI*c;j.m_sweep.a+=j.m_invI*c;l.SynchronizeTransform();j.SynchronizeTransform()}h=l.m_xf.R;c=this.m_localAnchor1.x-l.m_sweep.localCenter.x;d=this.m_localAnchor1.y-l.m_sweep.localCenter.y;q=h.col1.x*c+h.col2.x*
-d;d=h.col1.y*c+h.col2.y*d;c=q;h=j.m_xf.R;var g=this.m_localAnchor2.x-j.m_sweep.localCenter.x,b=this.m_localAnchor2.y-j.m_sweep.localCenter.y;q=h.col1.x*g+h.col2.x*b;b=h.col1.y*g+h.col2.y*b;g=q;n=j.m_sweep.c.x+g-l.m_sweep.c.x-c;a=j.m_sweep.c.y+b-l.m_sweep.c.y-d;var e=n*n+a*a;h=Math.sqrt(e);q=l.m_invMass;var f=j.m_invMass,m=l.m_invI,r=j.m_invI,s=10*F.b2_linearSlop;if(e>s*s){e=1/(q+f);n=e*-n;a=e*-a;l.m_sweep.c.x-=0.5*q*n;l.m_sweep.c.y-=0.5*q*a;j.m_sweep.c.x+=0.5*f*n;j.m_sweep.c.y+=0.5*f*a;n=j.m_sweep.c.x+
-g-l.m_sweep.c.x-c;a=j.m_sweep.c.y+b-l.m_sweep.c.y-d}this.K1.col1.x=q+f;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=q+f;this.K2.col1.x=m*d*d;this.K2.col2.x=-m*c*d;this.K2.col1.y=-m*c*d;this.K2.col2.y=m*c*c;this.K3.col1.x=r*b*b;this.K3.col2.x=-r*g*b;this.K3.col1.y=-r*g*b;this.K3.col2.y=r*g*g;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.AddM(this.K3);this.K.Solve(N.tImpulse,-n,-a);n=N.tImpulse.x;a=N.tImpulse.y;l.m_sweep.c.x-=l.m_invMass*n;l.m_sweep.c.y-=l.m_invMass*a;l.m_sweep.a-=l.m_invI*(c*
-a-d*n);j.m_sweep.c.x+=j.m_invMass*n;j.m_sweep.c.y+=j.m_invMass*a;j.m_sweep.a+=j.m_invI*(g*a-b*n);l.SynchronizeTransform();j.SynchronizeTransform();return h<=F.b2_linearSlop&&o<=F.b2_angularSlop};Box2D.postDefs.push(function(){Box2D.Dynamics.Joints.b2RevoluteJoint.tImpulse=new w});Box2D.inherit(S,Box2D.Dynamics.Joints.b2JointDef);S.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;S.b2RevoluteJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=
-new w;this.localAnchorB=new w};S.prototype.b2RevoluteJointDef=function(){this.__super.b2JointDef.call(this);this.type=I.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};S.prototype.Initialize=function(d,h,l){this.bodyA=d;this.bodyB=h;this.localAnchorA=this.bodyA.GetLocalPoint(l);this.localAnchorB=this.bodyB.GetLocalPoint(l);this.referenceAngle=this.bodyB.GetAngle()-
-this.bodyA.GetAngle()};Box2D.inherit(aa,Box2D.Dynamics.Joints.b2Joint);aa.prototype.__super=Box2D.Dynamics.Joints.b2Joint.prototype;aa.b2WeldJoint=function(){Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this,arguments);this.m_localAnchorA=new w;this.m_localAnchorB=new w;this.m_impulse=new A;this.m_mass=new K};aa.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)};aa.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)};aa.prototype.GetReactionForce=
-function(d){if(d===undefined)d=0;return new w(d*this.m_impulse.x,d*this.m_impulse.y)};aa.prototype.GetReactionTorque=function(d){if(d===undefined)d=0;return d*this.m_impulse.z};aa.prototype.b2WeldJoint=function(d){this.__super.b2Joint.call(this,d);this.m_localAnchorA.SetV(d.localAnchorA);this.m_localAnchorB.SetV(d.localAnchorB);this.m_referenceAngle=d.referenceAngle;this.m_impulse.SetZero();this.m_mass=new K};aa.prototype.InitVelocityConstraints=function(d){var h,l=0,j=this.m_bodyA,o=this.m_bodyB;
-h=j.m_xf.R;var q=this.m_localAnchorA.x-j.m_sweep.localCenter.x,n=this.m_localAnchorA.y-j.m_sweep.localCenter.y;l=h.col1.x*q+h.col2.x*n;n=h.col1.y*q+h.col2.y*n;q=l;h=o.m_xf.R;var a=this.m_localAnchorB.x-o.m_sweep.localCenter.x,c=this.m_localAnchorB.y-o.m_sweep.localCenter.y;l=h.col1.x*a+h.col2.x*c;c=h.col1.y*a+h.col2.y*c;a=l;h=j.m_invMass;l=o.m_invMass;var g=j.m_invI,b=o.m_invI;this.m_mass.col1.x=h+l+n*n*g+c*c*b;this.m_mass.col2.x=-n*q*g-c*a*b;this.m_mass.col3.x=-n*g-c*b;this.m_mass.col1.y=this.m_mass.col2.x;
-this.m_mass.col2.y=h+l+q*q*g+a*a*b;this.m_mass.col3.y=q*g+a*b;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=g+b;if(d.warmStarting){this.m_impulse.x*=d.dtRatio;this.m_impulse.y*=d.dtRatio;this.m_impulse.z*=d.dtRatio;j.m_linearVelocity.x-=h*this.m_impulse.x;j.m_linearVelocity.y-=h*this.m_impulse.y;j.m_angularVelocity-=g*(q*this.m_impulse.y-n*this.m_impulse.x+this.m_impulse.z);o.m_linearVelocity.x+=l*this.m_impulse.x;o.m_linearVelocity.y+=l*this.m_impulse.y;
-o.m_angularVelocity+=b*(a*this.m_impulse.y-c*this.m_impulse.x+this.m_impulse.z)}else this.m_impulse.SetZero()};aa.prototype.SolveVelocityConstraints=function(){var d,h=0,l=this.m_bodyA,j=this.m_bodyB,o=l.m_linearVelocity,q=l.m_angularVelocity,n=j.m_linearVelocity,a=j.m_angularVelocity,c=l.m_invMass,g=j.m_invMass,b=l.m_invI,e=j.m_invI;d=l.m_xf.R;var f=this.m_localAnchorA.x-l.m_sweep.localCenter.x,m=this.m_localAnchorA.y-l.m_sweep.localCenter.y;h=d.col1.x*f+d.col2.x*m;m=d.col1.y*f+d.col2.y*m;f=h;d=
-j.m_xf.R;var r=this.m_localAnchorB.x-j.m_sweep.localCenter.x,s=this.m_localAnchorB.y-j.m_sweep.localCenter.y;h=d.col1.x*r+d.col2.x*s;s=d.col1.y*r+d.col2.y*s;r=h;d=n.x-a*s-o.x+q*m;h=n.y+a*r-o.y-q*f;var v=a-q,t=new A;this.m_mass.Solve33(t,-d,-h,-v);this.m_impulse.Add(t);o.x-=c*t.x;o.y-=c*t.y;q-=b*(f*t.y-m*t.x+t.z);n.x+=g*t.x;n.y+=g*t.y;a+=e*(r*t.y-s*t.x+t.z);l.m_angularVelocity=q;j.m_angularVelocity=a};aa.prototype.SolvePositionConstraints=function(){var d,h=0,l=this.m_bodyA,j=this.m_bodyB;d=l.m_xf.R;
-var o=this.m_localAnchorA.x-l.m_sweep.localCenter.x,q=this.m_localAnchorA.y-l.m_sweep.localCenter.y;h=d.col1.x*o+d.col2.x*q;q=d.col1.y*o+d.col2.y*q;o=h;d=j.m_xf.R;var n=this.m_localAnchorB.x-j.m_sweep.localCenter.x,a=this.m_localAnchorB.y-j.m_sweep.localCenter.y;h=d.col1.x*n+d.col2.x*a;a=d.col1.y*n+d.col2.y*a;n=h;d=l.m_invMass;h=j.m_invMass;var c=l.m_invI,g=j.m_invI,b=j.m_sweep.c.x+n-l.m_sweep.c.x-o,e=j.m_sweep.c.y+a-l.m_sweep.c.y-q,f=j.m_sweep.a-l.m_sweep.a-this.m_referenceAngle,m=10*F.b2_linearSlop,
-r=Math.sqrt(b*b+e*e),s=y.Abs(f);if(r>m){c*=1;g*=1}this.m_mass.col1.x=d+h+q*q*c+a*a*g;this.m_mass.col2.x=-q*o*c-a*n*g;this.m_mass.col3.x=-q*c-a*g;this.m_mass.col1.y=this.m_mass.col2.x;this.m_mass.col2.y=d+h+o*o*c+n*n*g;this.m_mass.col3.y=o*c+n*g;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=c+g;m=new A;this.m_mass.Solve33(m,-b,-e,-f);l.m_sweep.c.x-=d*m.x;l.m_sweep.c.y-=d*m.y;l.m_sweep.a-=c*(o*m.y-q*m.x+m.z);j.m_sweep.c.x+=h*m.x;j.m_sweep.c.y+=h*m.y;
-j.m_sweep.a+=g*(n*m.y-a*m.x+m.z);l.SynchronizeTransform();j.SynchronizeTransform();return r<=F.b2_linearSlop&&s<=F.b2_angularSlop};Box2D.inherit(Z,Box2D.Dynamics.Joints.b2JointDef);Z.prototype.__super=Box2D.Dynamics.Joints.b2JointDef.prototype;Z.b2WeldJointDef=function(){Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this,arguments);this.localAnchorA=new w;this.localAnchorB=new w};Z.prototype.b2WeldJointDef=function(){this.__super.b2JointDef.call(this);this.type=I.e_weldJoint;this.referenceAngle=
-0};Z.prototype.Initialize=function(d,h,l){this.bodyA=d;this.bodyB=h;this.localAnchorA.SetV(this.bodyA.GetLocalPoint(l));this.localAnchorB.SetV(this.bodyB.GetLocalPoint(l));this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()}})();
-(function(){var F=Box2D.Dynamics.b2DebugDraw;F.b2DebugDraw=function(){this.m_xformScale=this.m_fillAlpha=this.m_alpha=this.m_lineThickness=this.m_drawScale=1;var G=this;this.m_sprite={graphics:{clear:function(){G.m_ctx.clearRect(0,0,G.m_ctx.canvas.width,G.m_ctx.canvas.height)}}}};F.prototype._color=function(G,K){return"rgba("+((G&16711680)>>16)+","+((G&65280)>>8)+","+(G&255)+","+K+")"};F.prototype.b2DebugDraw=function(){this.m_drawFlags=0};F.prototype.SetFlags=function(G){if(G===undefined)G=0;this.m_drawFlags=
-G};F.prototype.GetFlags=function(){return this.m_drawFlags};F.prototype.AppendFlags=function(G){if(G===undefined)G=0;this.m_drawFlags|=G};F.prototype.ClearFlags=function(G){if(G===undefined)G=0;this.m_drawFlags&=~G};F.prototype.SetSprite=function(G){this.m_ctx=G};F.prototype.GetSprite=function(){return this.m_ctx};F.prototype.SetDrawScale=function(G){if(G===undefined)G=0;this.m_drawScale=G};F.prototype.GetDrawScale=function(){return this.m_drawScale};F.prototype.SetLineThickness=function(G){if(G===
-undefined)G=0;this.m_lineThickness=G;this.m_ctx.strokeWidth=G};F.prototype.GetLineThickness=function(){return this.m_lineThickness};F.prototype.SetAlpha=function(G){if(G===undefined)G=0;this.m_alpha=G};F.prototype.GetAlpha=function(){return this.m_alpha};F.prototype.SetFillAlpha=function(G){if(G===undefined)G=0;this.m_fillAlpha=G};F.prototype.GetFillAlpha=function(){return this.m_fillAlpha};F.prototype.SetXFormScale=function(G){if(G===undefined)G=0;this.m_xformScale=G};F.prototype.GetXFormScale=function(){return this.m_xformScale};
-F.prototype.DrawPolygon=function(G,K,y){if(K){var w=this.m_ctx,A=this.m_drawScale;w.beginPath();w.strokeStyle=this._color(y.color,this.m_alpha);w.moveTo(G[0].x*A,G[0].y*A);for(y=1;y<K;y++)w.lineTo(G[y].x*A,G[y].y*A);w.lineTo(G[0].x*A,G[0].y*A);w.closePath();w.stroke()}};F.prototype.DrawSolidPolygon=function(G,K,y){if(K){var w=this.m_ctx,A=this.m_drawScale;w.beginPath();w.strokeStyle=this._color(y.color,this.m_alpha);w.fillStyle=this._color(y.color,this.m_fillAlpha);w.moveTo(G[0].x*A,G[0].y*A);for(y=
-1;y<K;y++)w.lineTo(G[y].x*A,G[y].y*A);w.lineTo(G[0].x*A,G[0].y*A);w.closePath();w.fill();w.stroke()}};F.prototype.DrawCircle=function(G,K,y){if(K){var w=this.m_ctx,A=this.m_drawScale;w.beginPath();w.strokeStyle=this._color(y.color,this.m_alpha);w.arc(G.x*A,G.y*A,K*A,0,Math.PI*2,true);w.closePath();w.stroke()}};F.prototype.DrawSolidCircle=function(G,K,y,w){if(K){var A=this.m_ctx,U=this.m_drawScale,p=G.x*U,B=G.y*U;A.moveTo(0,0);A.beginPath();A.strokeStyle=this._color(w.color,this.m_alpha);A.fillStyle=
-this._color(w.color,this.m_fillAlpha);A.arc(p,B,K*U,0,Math.PI*2,true);A.moveTo(p,B);A.lineTo((G.x+y.x*K)*U,(G.y+y.y*K)*U);A.closePath();A.fill();A.stroke()}};F.prototype.DrawSegment=function(G,K,y){var w=this.m_ctx,A=this.m_drawScale;w.strokeStyle=this._color(y.color,this.m_alpha);w.beginPath();w.moveTo(G.x*A,G.y*A);w.lineTo(K.x*A,K.y*A);w.closePath();w.stroke()};F.prototype.DrawTransform=function(G){var K=this.m_ctx,y=this.m_drawScale;K.beginPath();K.strokeStyle=this._color(16711680,this.m_alpha);
-K.moveTo(G.position.x*y,G.position.y*y);K.lineTo((G.position.x+this.m_xformScale*G.R.col1.x)*y,(G.position.y+this.m_xformScale*G.R.col1.y)*y);K.strokeStyle=this._color(65280,this.m_alpha);K.moveTo(G.position.x*y,G.position.y*y);K.lineTo((G.position.x+this.m_xformScale*G.R.col2.x)*y,(G.position.y+this.m_xformScale*G.R.col2.y)*y);K.closePath();K.stroke()}})();var i;for(i=0;i<Box2D.postDefs.length;++i)Box2D.postDefs[i]();delete Box2D.postDefs;
--- a/integ/js/vs/lib/StreamPlayer/css/streamPlayer.css Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-.command {
- font-size: 1em;
- color: transparent; /* Fix for Firefox */
- /* border-style: none; */
- /* border-width: 0; */
- padding: 0 0 0 16px !important; /* Fix for Internet Explorer */
- text-align: left;
- width: 26px;
- height: 26px;
- line-height: 1 !important;
- background-image: url(../img/controls.png);
- overflow: hidden;
- cursor: pointer;
-}
-.play {
- background-position: -48px 0px;
-}
-.pause {
- background-position: -48px -24px;
-}
-.stop {
- background-position: -72px 0px;
-}
-.fb {
- background-position: 0px 0px;
-}
-.ff {
- background-position: -120px 0px;
-}
-.prev {
- background-position: -24px 0px;
-}
-.next {
- background-position: -96px 0px;
-}
-.soundon {
- background-position: -144px 0px;
-}
-.soundoff {
- background-position: -144px -24px;
-}
-.disabled {
- opacity:0.5;
-}
\ No newline at end of file
Binary file integ/js/vs/lib/StreamPlayer/img/controls.png has changed
--- a/integ/js/vs/lib/StreamPlayer/streamPlayer.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-/**
- * StreamPlayer 0.12
- * Romain Vuillemot
- */
-var StreamPlayer = function(player, options) {
- if(typeof(player) == 'string')
- player = document.getElementById(player);
-
- if(!player)
- return;
-
- var handle = player.getElementsByTagName('div')[0];
- this.init(player, handle, options || {});
- this.setup();
-};
-
-StreamPlayer.prototype.init = function(player, handle, options) {
- this.callback = options.callback || null;
- this.displayUpdate = options.displayUpdate || null;
- this.playCallback = options.playCallback || null;
- this.pauseCallback = options.pauseCallback || null;
- this.stopCallback = options.stopCallback || null;
- this.updateCallback = options.updateCallback || null;
- this.nextCallback = options.nextCallback || null;
- this.previousCallback = options.previousCallback || null;
- this.ffCallback = options.ffCallback || null;
- this.fbCallback = options.fbCallback || null;
- this.soundCallback = options.soundCallback || null;
-
- this.refreshCallback = options.refreshCallback || this.refreshCallback;
- this.current_time = options.current_time || null;
-
- this.play_mode = options.play_mode || "DATA_BY_DATA"; // "DATA_BY_TIME_INTERVAL"
- this.read_frequency = options.read_frequency || 1000; // "DATA_BY_TIME_INTERVAL"
- this.data_interval = options.data_interval || 1000; // "DATA_BY_TIME_INTERVAL"
-
- this.player = player;
- this.handle = handle;
- this.options = options;
-
- this.refreshIntervalId = null;
- this.buffer_count = 0;
- this.buffered_data = [];
- this.current_value = null;
-
- this.auto_start = this.getOption('auto_start', true);
- this.is_playing = this.auto_start;
-
- this.is_buffering = this.getOption('is_buffering', false);
- this.current_speed = this.getOption('current_speed', 1000);
- this.buffered_pause = true;
-
- this.addListeners();
-
- this.min_speed = options.min_speed || 4000;
- this.max_speed = options.max_speed || 100;
-
- this.min_time = options.min_time || 0;
- this.max_time = options.max_time || -1;
-
- self = this;
-}
-
-StreamPlayer.prototype.addListeners = function() {
-
- this.player.onclick = function(e) {
- if(e.target.className.search(/(^|\s)stop(\s|$)/) != -1 && typeof(self.stopCallback) == 'function') {
- self.stopCallback(self);
- self.update();
- } else if(e.target.className.search(/(^|\s)play(\s|$)/) != -1 && typeof(self.playCallback) == 'function') {
- self.playCallback(self);
- e.target.className = e.target.className.replace(/\s?play/g, '');
- e.target.className += " pause";
- self.is_buffering = false;
- self.is_playing = !self.is_playing;
- self.refreshIntervalId = setInterval(function () {
- self.updateCallback(self)
- self.update();
- }, self.current_speed);
- } else if(e.target.className.search(/(^|\s)pause(\s|$)/) != -1 && typeof(self.pauseCallback) == 'function') {
- self.pauseCallback();
- e.target.className = e.target.className.replace(/\s?pause/g, '');
- e.target.className += " play";
- clearInterval(self.refreshIntervalId);
- self.is_playing = !self.is_playing;
- self.update();
- } else if(e.target.className.search(/(^|\s)next(\s|$)/) != -1 && typeof(self.nextCallback) == 'function') {
- self.nextCallback(self);
- self.update();
- } else if(e.target.className.search(/(^|\s)prev(\s|$)/) != -1 && typeof(self.previousCallback) == 'function') {
- self.previousCallback(self);
- self.update();
- } else if(e.target.className.search(/(^|\s)ff(\s|$)/) != -1 && typeof(self.ffCallback) == 'function') {
- if(self.current_speed>self.max_speed) {
-
- if(self.play_mode=="DATA_BY_DATA")
- self.current_speed = self.current_speed/2 > self.max_speed ? self.current_speed/2 : self.max_speed;
-
- if(self.is_playing) {
- clearInterval(self.refreshIntervalId);
- self.refreshIntervalId = setInterval(function () {
- self.updateCallback(self);
- self.update();
- }, self.current_speed);
- }
-
- e.target.className.replace(/\s?disabled/g, '');
- self.ffCallback();
- document.getElementsByClassName("fb")[0].className = document.getElementsByClassName("fb")[0].className.replace(/\s?disabled/g, '');
- document.getElementsByClassName("fb")[0].disabled = false;
- }
- if(self.current_speed<=self.max_speed) {
- if(e.target.className.search(/(^|\s)disabled(\s|$)/) == -1) {
- e.target.className += " disabled";
- e.target.disabled = true;
- }
- }
- } else if(e.target.className.search(/(^|\s)fb(\s|$)/) != -1 && typeof(self.fbCallback) == 'function') {
-
- if(self.current_speed<self.min_speed) {
-
- self.current_speed = self.current_speed*2 < self.min_speed ? self.current_speed*2 : self.min_speed;
-
- if(self.is_playing) {
- clearInterval(self.refreshIntervalId);
- self.refreshIntervalId = setInterval(function () {
- self.updateCallback(self);
- self.update();
- return ;
- }, self.current_speed);
- }
- e.target.className.replace(/\s?disabled/g, '');
- self.fbCallback();
- document.getElementsByClassName("ff")[0].className = document.getElementsByClassName("ff")[0].className.replace(/\s?disabled/g, '');
- document.getElementsByClassName("ff")[0].disabled = false;
- }
-
- if(self.current_speed==self.min_speed) {
- if(e.target.className.search(/(^|\s)disabled(\s|$)/) == -1) {
- e.target.className += " disabled";
- e.target.disabled = true;
- }
- }
- } else if(e.target.className.search(/(^|\s)soundon(\s|$)/) != -1 && typeof(self.soundCallback) == 'function') {
- e.target.className = e.target.className.replace(/\s?soundon/g, '');
- e.target.className += " soundoff";
- self.soundCallback(false);
- } else if(e.target.className.search(/(^|\s)soundoff(\s|$)/) != -1 && typeof(self.pauseCallback) == 'function') {
- e.target.className = e.target.className.replace(/\s?soundoff/g, '');
- e.target.className += " soundon";
- self.soundCallback(true);
- self.update();
- }
- self.refreshCallback(self);
- }
-}
-
-StreamPlayer.prototype.setup = function() {
- this.addListeners();
- this.update();
- if((self.current_speed==self.min_speed) && document.getElementsByClassName("fb").length > 1 && document.getElementsByClassName("fb")[0].className.search(/(^|\s)disabled(\s|$)/) == -1) {
- document.getElementsByClassName("fb")[0].className += " disabled";
- document.getElementsByClassName("fb")[0].disabled = false;
- }
- if((self.current_speed==self.min_speed) && document.getElementsByClassName("fb").length > 1 && document.getElementsByClassName("fb")[0].className.search(/(^|\s)disabled(\s|$)/) == -1) {
- document.getElementsByClassName("fb")[0].className += " disabled";
- document.getElementsByClassName("fb")[0].disabled = false;
- }
- if(typeof(self.current_time) == 'function' && self.current_time()==0) {
- if(document.getElementsByClassName("prev").length>0 && document.getElementsByClassName("prev")[0].className.search(/(^|\s)disabled(\s|$)/) == -1) {
- document.getElementsByClassName("prev")[0].className += " disabled";
- document.getElementsByClassName("prev")[0].disabled = true;
- }
- } else {
- if(document.getElementsByClassName("prev").length>0 && document.getElementsByClassName("prev")[0].className.search(/(^|\s)disabled(\s|$)/) == 1) {
- document.getElementsByClassName("prev")[0].className.replace(/\s?disabled/g, '');
- document.getElementsByClassName("prev")[0].disabled = false;
- }
- }
-}
-
-StreamPlayer.prototype.getOption = function(name, defaultValue) {
- return this.options[name] !== undefined ? this.options[name] : defaultValue;
-}
-
-StreamPlayer.prototype.update = function() {
- if(self.auto_start && typeof(self.updateCallback) == 'function' && self.refreshIntervalId==null) {
- self.refreshIntervalId = setInterval(function () {
- self.updateCallback(self);
- self.update();
- return ;
- }, self.current_speed);
- }
- if(typeof(self.current_time) == 'function' && self.current_time()==self.min_time) {
- if(document.getElementsByClassName("prev").length>0 && document.getElementsByClassName("prev")[0].className.search(/(^|\s)disabled(\s|$)/) == -1) {
- document.getElementsByClassName("prev")[0].className += " disabled";
- document.getElementsByClassName("prev")[0].disabled = true;
- }
- } else {
- if(document.getElementsByClassName("prev").length>0 && document.getElementsByClassName("prev")[0].className.search(/(^|\s)disabled(\s|$)/)>0) {
- document.getElementsByClassName("prev")[0].className = document.getElementsByClassName("prev")[0].className.replace(/\s?disabled/g, '');
- document.getElementsByClassName("prev")[0].disabled = false;
- }
- }
- if(typeof(self.current_time) == 'function' && self.current_time()==self.max_time) {
- if(document.getElementsByClassName("next").length>0 && document.getElementsByClassName("next")[0].className.search(/(^|\s)disabled(\s|$)/) == -1) {
- document.getElementsByClassName("next")[0].className += " disabled";
- document.getElementsByClassName("next")[0].disabled = true;
- }
- if(self.is_playing) {
- self.pauseCallback();
- var el = document.getElementsByClassName("pause")[0];
- el.className = el.className.replace(/\s?pause/g, '');
- el.className += " play";
- clearInterval(self.refreshIntervalId);
- self.is_playing = !self.is_playing;
- self.update();
- }
- } else {
- if(document.getElementsByClassName("next").length>0 && document.getElementsByClassName("next")[0].className.search(/(^|\s)disabled(\s|$)/)>0) {
- document.getElementsByClassName("next")[0].className = document.getElementsByClassName("next")[0].className.replace(/\s?disabled/g, '');
- document.getElementsByClassName("next")[0].disabled = false;
- }
- }
- self.refreshCallback(self);
-}
-
-StreamPlayer.prototype.refreshCallback = function() {
- return;
-}
\ No newline at end of file
--- a/integ/js/vs/lib/bootstrap/css/bootstrap-responsive.css Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1109 +0,0 @@
-/*!
- * Bootstrap Responsive v2.3.0
- *
- * Copyright 2012 Twitter, Inc
- * Licensed under the Apache License v2.0
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Designed and built with all the love in the world @twitter by @mdo and @fat.
- */
-
-.clearfix {
- *zoom: 1;
-}
-
-.clearfix:before,
-.clearfix:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.clearfix:after {
- clear: both;
-}
-
-.hide-text {
- font: 0/0 a;
- color: transparent;
- text-shadow: none;
- background-color: transparent;
- border: 0;
-}
-
-.input-block-level {
- display: block;
- width: 100%;
- min-height: 30px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
-
-@-ms-viewport {
- width: device-width;
-}
-
-.hidden {
- display: none;
- visibility: hidden;
-}
-
-.visible-phone {
- display: none !important;
-}
-
-.visible-tablet {
- display: none !important;
-}
-
-.hidden-desktop {
- display: none !important;
-}
-
-.visible-desktop {
- display: inherit !important;
-}
-
-@media (min-width: 768px) and (max-width: 979px) {
- .hidden-desktop {
- display: inherit !important;
- }
- .visible-desktop {
- display: none !important ;
- }
- .visible-tablet {
- display: inherit !important;
- }
- .hidden-tablet {
- display: none !important;
- }
-}
-
-@media (max-width: 767px) {
- .hidden-desktop {
- display: inherit !important;
- }
- .visible-desktop {
- display: none !important;
- }
- .visible-phone {
- display: inherit !important;
- }
- .hidden-phone {
- display: none !important;
- }
-}
-
-.visible-print {
- display: none !important;
-}
-
-@media print {
- .visible-print {
- display: inherit !important;
- }
- .hidden-print {
- display: none !important;
- }
-}
-
-@media (min-width: 1200px) {
- .row {
- margin-left: -30px;
- *zoom: 1;
- }
- .row:before,
- .row:after {
- display: table;
- line-height: 0;
- content: "";
- }
- .row:after {
- clear: both;
- }
- [class*="span"] {
- float: left;
- min-height: 1px;
- margin-left: 30px;
- }
- .container,
- .navbar-static-top .container,
- .navbar-fixed-top .container,
- .navbar-fixed-bottom .container {
- width: 1170px;
- }
- .span12 {
- width: 1170px;
- }
- .span11 {
- width: 1070px;
- }
- .span10 {
- width: 970px;
- }
- .span9 {
- width: 870px;
- }
- .span8 {
- width: 770px;
- }
- .span7 {
- width: 670px;
- }
- .span6 {
- width: 570px;
- }
- .span5 {
- width: 470px;
- }
- .span4 {
- width: 370px;
- }
- .span3 {
- width: 270px;
- }
- .span2 {
- width: 170px;
- }
- .span1 {
- width: 70px;
- }
- .offset12 {
- margin-left: 1230px;
- }
- .offset11 {
- margin-left: 1130px;
- }
- .offset10 {
- margin-left: 1030px;
- }
- .offset9 {
- margin-left: 930px;
- }
- .offset8 {
- margin-left: 830px;
- }
- .offset7 {
- margin-left: 730px;
- }
- .offset6 {
- margin-left: 630px;
- }
- .offset5 {
- margin-left: 530px;
- }
- .offset4 {
- margin-left: 430px;
- }
- .offset3 {
- margin-left: 330px;
- }
- .offset2 {
- margin-left: 230px;
- }
- .offset1 {
- margin-left: 130px;
- }
- .row-fluid {
- width: 100%;
- *zoom: 1;
- }
- .row-fluid:before,
- .row-fluid:after {
- display: table;
- line-height: 0;
- content: "";
- }
- .row-fluid:after {
- clear: both;
- }
- .row-fluid [class*="span"] {
- display: block;
- float: left;
- width: 100%;
- min-height: 30px;
- margin-left: 2.564102564102564%;
- *margin-left: 2.5109110747408616%;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- .row-fluid [class*="span"]:first-child {
- margin-left: 0;
- }
- .row-fluid .controls-row [class*="span"] + [class*="span"] {
- margin-left: 2.564102564102564%;
- }
- .row-fluid .span12 {
- width: 100%;
- *width: 99.94680851063829%;
- }
- .row-fluid .span11 {
- width: 91.45299145299145%;
- *width: 91.39979996362975%;
- }
- .row-fluid .span10 {
- width: 82.90598290598291%;
- *width: 82.8527914166212%;
- }
- .row-fluid .span9 {
- width: 74.35897435897436%;
- *width: 74.30578286961266%;
- }
- .row-fluid .span8 {
- width: 65.81196581196582%;
- *width: 65.75877432260411%;
- }
- .row-fluid .span7 {
- width: 57.26495726495726%;
- *width: 57.21176577559556%;
- }
- .row-fluid .span6 {
- width: 48.717948717948715%;
- *width: 48.664757228587014%;
- }
- .row-fluid .span5 {
- width: 40.17094017094017%;
- *width: 40.11774868157847%;
- }
- .row-fluid .span4 {
- width: 31.623931623931625%;
- *width: 31.570740134569924%;
- }
- .row-fluid .span3 {
- width: 23.076923076923077%;
- *width: 23.023731587561375%;
- }
- .row-fluid .span2 {
- width: 14.52991452991453%;
- *width: 14.476723040552828%;
- }
- .row-fluid .span1 {
- width: 5.982905982905983%;
- *width: 5.929714493544281%;
- }
- .row-fluid .offset12 {
- margin-left: 105.12820512820512%;
- *margin-left: 105.02182214948171%;
- }
- .row-fluid .offset12:first-child {
- margin-left: 102.56410256410257%;
- *margin-left: 102.45771958537915%;
- }
- .row-fluid .offset11 {
- margin-left: 96.58119658119658%;
- *margin-left: 96.47481360247316%;
- }
- .row-fluid .offset11:first-child {
- margin-left: 94.01709401709402%;
- *margin-left: 93.91071103837061%;
- }
- .row-fluid .offset10 {
- margin-left: 88.03418803418803%;
- *margin-left: 87.92780505546462%;
- }
- .row-fluid .offset10:first-child {
- margin-left: 85.47008547008548%;
- *margin-left: 85.36370249136206%;
- }
- .row-fluid .offset9 {
- margin-left: 79.48717948717949%;
- *margin-left: 79.38079650845607%;
- }
- .row-fluid .offset9:first-child {
- margin-left: 76.92307692307693%;
- *margin-left: 76.81669394435352%;
- }
- .row-fluid .offset8 {
- margin-left: 70.94017094017094%;
- *margin-left: 70.83378796144753%;
- }
- .row-fluid .offset8:first-child {
- margin-left: 68.37606837606839%;
- *margin-left: 68.26968539734497%;
- }
- .row-fluid .offset7 {
- margin-left: 62.393162393162385%;
- *margin-left: 62.28677941443899%;
- }
- .row-fluid .offset7:first-child {
- margin-left: 59.82905982905982%;
- *margin-left: 59.72267685033642%;
- }
- .row-fluid .offset6 {
- margin-left: 53.84615384615384%;
- *margin-left: 53.739770867430444%;
- }
- .row-fluid .offset6:first-child {
- margin-left: 51.28205128205128%;
- *margin-left: 51.175668303327875%;
- }
- .row-fluid .offset5 {
- margin-left: 45.299145299145295%;
- *margin-left: 45.1927623204219%;
- }
- .row-fluid .offset5:first-child {
- margin-left: 42.73504273504273%;
- *margin-left: 42.62865975631933%;
- }
- .row-fluid .offset4 {
- margin-left: 36.75213675213675%;
- *margin-left: 36.645753773413354%;
- }
- .row-fluid .offset4:first-child {
- margin-left: 34.18803418803419%;
- *margin-left: 34.081651209310785%;
- }
- .row-fluid .offset3 {
- margin-left: 28.205128205128204%;
- *margin-left: 28.0987452264048%;
- }
- .row-fluid .offset3:first-child {
- margin-left: 25.641025641025642%;
- *margin-left: 25.53464266230224%;
- }
- .row-fluid .offset2 {
- margin-left: 19.65811965811966%;
- *margin-left: 19.551736679396257%;
- }
- .row-fluid .offset2:first-child {
- margin-left: 17.094017094017094%;
- *margin-left: 16.98763411529369%;
- }
- .row-fluid .offset1 {
- margin-left: 11.11111111111111%;
- *margin-left: 11.004728132387708%;
- }
- .row-fluid .offset1:first-child {
- margin-left: 8.547008547008547%;
- *margin-left: 8.440625568285142%;
- }
- input,
- textarea,
- .uneditable-input {
- margin-left: 0;
- }
- .controls-row [class*="span"] + [class*="span"] {
- margin-left: 30px;
- }
- input.span12,
- textarea.span12,
- .uneditable-input.span12 {
- width: 1156px;
- }
- input.span11,
- textarea.span11,
- .uneditable-input.span11 {
- width: 1056px;
- }
- input.span10,
- textarea.span10,
- .uneditable-input.span10 {
- width: 956px;
- }
- input.span9,
- textarea.span9,
- .uneditable-input.span9 {
- width: 856px;
- }
- input.span8,
- textarea.span8,
- .uneditable-input.span8 {
- width: 756px;
- }
- input.span7,
- textarea.span7,
- .uneditable-input.span7 {
- width: 656px;
- }
- input.span6,
- textarea.span6,
- .uneditable-input.span6 {
- width: 556px;
- }
- input.span5,
- textarea.span5,
- .uneditable-input.span5 {
- width: 456px;
- }
- input.span4,
- textarea.span4,
- .uneditable-input.span4 {
- width: 356px;
- }
- input.span3,
- textarea.span3,
- .uneditable-input.span3 {
- width: 256px;
- }
- input.span2,
- textarea.span2,
- .uneditable-input.span2 {
- width: 156px;
- }
- input.span1,
- textarea.span1,
- .uneditable-input.span1 {
- width: 56px;
- }
- .thumbnails {
- margin-left: -30px;
- }
- .thumbnails > li {
- margin-left: 30px;
- }
- .row-fluid .thumbnails {
- margin-left: 0;
- }
-}
-
-@media (min-width: 768px) and (max-width: 979px) {
- .row {
- margin-left: -20px;
- *zoom: 1;
- }
- .row:before,
- .row:after {
- display: table;
- line-height: 0;
- content: "";
- }
- .row:after {
- clear: both;
- }
- [class*="span"] {
- float: left;
- min-height: 1px;
- margin-left: 20px;
- }
- .container,
- .navbar-static-top .container,
- .navbar-fixed-top .container,
- .navbar-fixed-bottom .container {
- width: 724px;
- }
- .span12 {
- width: 724px;
- }
- .span11 {
- width: 662px;
- }
- .span10 {
- width: 600px;
- }
- .span9 {
- width: 538px;
- }
- .span8 {
- width: 476px;
- }
- .span7 {
- width: 414px;
- }
- .span6 {
- width: 352px;
- }
- .span5 {
- width: 290px;
- }
- .span4 {
- width: 228px;
- }
- .span3 {
- width: 166px;
- }
- .span2 {
- width: 104px;
- }
- .span1 {
- width: 42px;
- }
- .offset12 {
- margin-left: 764px;
- }
- .offset11 {
- margin-left: 702px;
- }
- .offset10 {
- margin-left: 640px;
- }
- .offset9 {
- margin-left: 578px;
- }
- .offset8 {
- margin-left: 516px;
- }
- .offset7 {
- margin-left: 454px;
- }
- .offset6 {
- margin-left: 392px;
- }
- .offset5 {
- margin-left: 330px;
- }
- .offset4 {
- margin-left: 268px;
- }
- .offset3 {
- margin-left: 206px;
- }
- .offset2 {
- margin-left: 144px;
- }
- .offset1 {
- margin-left: 82px;
- }
- .row-fluid {
- width: 100%;
- *zoom: 1;
- }
- .row-fluid:before,
- .row-fluid:after {
- display: table;
- line-height: 0;
- content: "";
- }
- .row-fluid:after {
- clear: both;
- }
- .row-fluid [class*="span"] {
- display: block;
- float: left;
- width: 100%;
- min-height: 30px;
- margin-left: 2.7624309392265194%;
- *margin-left: 2.709239449864817%;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- .row-fluid [class*="span"]:first-child {
- margin-left: 0;
- }
- .row-fluid .controls-row [class*="span"] + [class*="span"] {
- margin-left: 2.7624309392265194%;
- }
- .row-fluid .span12 {
- width: 100%;
- *width: 99.94680851063829%;
- }
- .row-fluid .span11 {
- width: 91.43646408839778%;
- *width: 91.38327259903608%;
- }
- .row-fluid .span10 {
- width: 82.87292817679558%;
- *width: 82.81973668743387%;
- }
- .row-fluid .span9 {
- width: 74.30939226519337%;
- *width: 74.25620077583166%;
- }
- .row-fluid .span8 {
- width: 65.74585635359117%;
- *width: 65.69266486422946%;
- }
- .row-fluid .span7 {
- width: 57.18232044198895%;
- *width: 57.12912895262725%;
- }
- .row-fluid .span6 {
- width: 48.61878453038674%;
- *width: 48.56559304102504%;
- }
- .row-fluid .span5 {
- width: 40.05524861878453%;
- *width: 40.00205712942283%;
- }
- .row-fluid .span4 {
- width: 31.491712707182323%;
- *width: 31.43852121782062%;
- }
- .row-fluid .span3 {
- width: 22.92817679558011%;
- *width: 22.87498530621841%;
- }
- .row-fluid .span2 {
- width: 14.3646408839779%;
- *width: 14.311449394616199%;
- }
- .row-fluid .span1 {
- width: 5.801104972375691%;
- *width: 5.747913483013988%;
- }
- .row-fluid .offset12 {
- margin-left: 105.52486187845304%;
- *margin-left: 105.41847889972962%;
- }
- .row-fluid .offset12:first-child {
- margin-left: 102.76243093922652%;
- *margin-left: 102.6560479605031%;
- }
- .row-fluid .offset11 {
- margin-left: 96.96132596685082%;
- *margin-left: 96.8549429881274%;
- }
- .row-fluid .offset11:first-child {
- margin-left: 94.1988950276243%;
- *margin-left: 94.09251204890089%;
- }
- .row-fluid .offset10 {
- margin-left: 88.39779005524862%;
- *margin-left: 88.2914070765252%;
- }
- .row-fluid .offset10:first-child {
- margin-left: 85.6353591160221%;
- *margin-left: 85.52897613729868%;
- }
- .row-fluid .offset9 {
- margin-left: 79.8342541436464%;
- *margin-left: 79.72787116492299%;
- }
- .row-fluid .offset9:first-child {
- margin-left: 77.07182320441989%;
- *margin-left: 76.96544022569647%;
- }
- .row-fluid .offset8 {
- margin-left: 71.2707182320442%;
- *margin-left: 71.16433525332079%;
- }
- .row-fluid .offset8:first-child {
- margin-left: 68.50828729281768%;
- *margin-left: 68.40190431409427%;
- }
- .row-fluid .offset7 {
- margin-left: 62.70718232044199%;
- *margin-left: 62.600799341718584%;
- }
- .row-fluid .offset7:first-child {
- margin-left: 59.94475138121547%;
- *margin-left: 59.838368402492065%;
- }
- .row-fluid .offset6 {
- margin-left: 54.14364640883978%;
- *margin-left: 54.037263430116376%;
- }
- .row-fluid .offset6:first-child {
- margin-left: 51.38121546961326%;
- *margin-left: 51.27483249088986%;
- }
- .row-fluid .offset5 {
- margin-left: 45.58011049723757%;
- *margin-left: 45.47372751851417%;
- }
- .row-fluid .offset5:first-child {
- margin-left: 42.81767955801105%;
- *margin-left: 42.71129657928765%;
- }
- .row-fluid .offset4 {
- margin-left: 37.01657458563536%;
- *margin-left: 36.91019160691196%;
- }
- .row-fluid .offset4:first-child {
- margin-left: 34.25414364640884%;
- *margin-left: 34.14776066768544%;
- }
- .row-fluid .offset3 {
- margin-left: 28.45303867403315%;
- *margin-left: 28.346655695309746%;
- }
- .row-fluid .offset3:first-child {
- margin-left: 25.69060773480663%;
- *margin-left: 25.584224756083227%;
- }
- .row-fluid .offset2 {
- margin-left: 19.88950276243094%;
- *margin-left: 19.783119783707537%;
- }
- .row-fluid .offset2:first-child {
- margin-left: 17.12707182320442%;
- *margin-left: 17.02068884448102%;
- }
- .row-fluid .offset1 {
- margin-left: 11.32596685082873%;
- *margin-left: 11.219583872105325%;
- }
- .row-fluid .offset1:first-child {
- margin-left: 8.56353591160221%;
- *margin-left: 8.457152932878806%;
- }
- input,
- textarea,
- .uneditable-input {
- margin-left: 0;
- }
- .controls-row [class*="span"] + [class*="span"] {
- margin-left: 20px;
- }
- input.span12,
- textarea.span12,
- .uneditable-input.span12 {
- width: 710px;
- }
- input.span11,
- textarea.span11,
- .uneditable-input.span11 {
- width: 648px;
- }
- input.span10,
- textarea.span10,
- .uneditable-input.span10 {
- width: 586px;
- }
- input.span9,
- textarea.span9,
- .uneditable-input.span9 {
- width: 524px;
- }
- input.span8,
- textarea.span8,
- .uneditable-input.span8 {
- width: 462px;
- }
- input.span7,
- textarea.span7,
- .uneditable-input.span7 {
- width: 400px;
- }
- input.span6,
- textarea.span6,
- .uneditable-input.span6 {
- width: 338px;
- }
- input.span5,
- textarea.span5,
- .uneditable-input.span5 {
- width: 276px;
- }
- input.span4,
- textarea.span4,
- .uneditable-input.span4 {
- width: 214px;
- }
- input.span3,
- textarea.span3,
- .uneditable-input.span3 {
- width: 152px;
- }
- input.span2,
- textarea.span2,
- .uneditable-input.span2 {
- width: 90px;
- }
- input.span1,
- textarea.span1,
- .uneditable-input.span1 {
- width: 28px;
- }
-}
-
-@media (max-width: 767px) {
- body {
- padding-right: 20px;
- padding-left: 20px;
- }
- .navbar-fixed-top,
- .navbar-fixed-bottom,
- .navbar-static-top {
- margin-right: -20px;
- margin-left: -20px;
- }
- .container-fluid {
- padding: 0;
- }
- .dl-horizontal dt {
- float: none;
- width: auto;
- clear: none;
- text-align: left;
- }
- .dl-horizontal dd {
- margin-left: 0;
- }
- .container {
- width: auto;
- }
- .row-fluid {
- width: 100%;
- }
- .row,
- .thumbnails {
- margin-left: 0;
- }
- .thumbnails > li {
- float: none;
- margin-left: 0;
- }
- [class*="span"],
- .uneditable-input[class*="span"],
- .row-fluid [class*="span"] {
- display: block;
- float: none;
- width: 100%;
- margin-left: 0;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- .span12,
- .row-fluid .span12 {
- width: 100%;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- .row-fluid [class*="offset"]:first-child {
- margin-left: 0;
- }
- .input-large,
- .input-xlarge,
- .input-xxlarge,
- input[class*="span"],
- select[class*="span"],
- textarea[class*="span"],
- .uneditable-input {
- display: block;
- width: 100%;
- min-height: 30px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- .input-prepend input,
- .input-append input,
- .input-prepend input[class*="span"],
- .input-append input[class*="span"] {
- display: inline-block;
- width: auto;
- }
- .controls-row [class*="span"] + [class*="span"] {
- margin-left: 0;
- }
- .modal {
- position: fixed;
- top: 20px;
- right: 20px;
- left: 20px;
- width: auto;
- margin: 0;
- }
- .modal.fade {
- top: -100px;
- }
- .modal.fade.in {
- top: 20px;
- }
-}
-
-@media (max-width: 480px) {
- .nav-collapse {
- -webkit-transform: translate3d(0, 0, 0);
- }
- .page-header h1 small {
- display: block;
- line-height: 20px;
- }
- input[type="checkbox"],
- input[type="radio"] {
- border: 1px solid #ccc;
- }
- .form-horizontal .control-label {
- float: none;
- width: auto;
- padding-top: 0;
- text-align: left;
- }
- .form-horizontal .controls {
- margin-left: 0;
- }
- .form-horizontal .control-list {
- padding-top: 0;
- }
- .form-horizontal .form-actions {
- padding-right: 10px;
- padding-left: 10px;
- }
- .media .pull-left,
- .media .pull-right {
- display: block;
- float: none;
- margin-bottom: 10px;
- }
- .media-object {
- margin-right: 0;
- margin-left: 0;
- }
- .modal {
- top: 10px;
- right: 10px;
- left: 10px;
- }
- .modal-header .close {
- padding: 10px;
- margin: -10px;
- }
- .carousel-caption {
- position: static;
- }
-}
-
-@media (max-width: 979px) {
- body {
- padding-top: 0;
- }
- .navbar-fixed-top,
- .navbar-fixed-bottom {
- position: static;
- }
- .navbar-fixed-top {
- margin-bottom: 20px;
- }
- .navbar-fixed-bottom {
- margin-top: 20px;
- }
- .navbar-fixed-top .navbar-inner,
- .navbar-fixed-bottom .navbar-inner {
- padding: 5px;
- }
- .navbar .container {
- width: auto;
- padding: 0;
- }
- .navbar .brand {
- padding-right: 10px;
- padding-left: 10px;
- margin: 0 0 0 -5px;
- }
- .nav-collapse {
- clear: both;
- }
- .nav-collapse .nav {
- float: none;
- margin: 0 0 10px;
- }
- .nav-collapse .nav > li {
- float: none;
- }
- .nav-collapse .nav > li > a {
- margin-bottom: 2px;
- }
- .nav-collapse .nav > .divider-vertical {
- display: none;
- }
- .nav-collapse .nav .nav-header {
- color: #777777;
- text-shadow: none;
- }
- .nav-collapse .nav > li > a,
- .nav-collapse .dropdown-menu a {
- padding: 9px 15px;
- font-weight: bold;
- color: #777777;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
- }
- .nav-collapse .btn {
- padding: 4px 10px 4px;
- font-weight: normal;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- }
- .nav-collapse .dropdown-menu li + li a {
- margin-bottom: 2px;
- }
- .nav-collapse .nav > li > a:hover,
- .nav-collapse .nav > li > a:focus,
- .nav-collapse .dropdown-menu a:hover,
- .nav-collapse .dropdown-menu a:focus {
- background-color: #f2f2f2;
- }
- .navbar-inverse .nav-collapse .nav > li > a,
- .navbar-inverse .nav-collapse .dropdown-menu a {
- color: #999999;
- }
- .navbar-inverse .nav-collapse .nav > li > a:hover,
- .navbar-inverse .nav-collapse .nav > li > a:focus,
- .navbar-inverse .nav-collapse .dropdown-menu a:hover,
- .navbar-inverse .nav-collapse .dropdown-menu a:focus {
- background-color: #111111;
- }
- .nav-collapse.in .btn-group {
- padding: 0;
- margin-top: 5px;
- }
- .nav-collapse .dropdown-menu {
- position: static;
- top: auto;
- left: auto;
- display: none;
- float: none;
- max-width: none;
- padding: 0;
- margin: 0 15px;
- background-color: transparent;
- border: none;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
- }
- .nav-collapse .open > .dropdown-menu {
- display: block;
- }
- .nav-collapse .dropdown-menu:before,
- .nav-collapse .dropdown-menu:after {
- display: none;
- }
- .nav-collapse .dropdown-menu .divider {
- display: none;
- }
- .nav-collapse .nav > li > .dropdown-menu:before,
- .nav-collapse .nav > li > .dropdown-menu:after {
- display: none;
- }
- .nav-collapse .navbar-form,
- .nav-collapse .navbar-search {
- float: none;
- padding: 10px 15px;
- margin: 10px 0;
- border-top: 1px solid #f2f2f2;
- border-bottom: 1px solid #f2f2f2;
- -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
- -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
- }
- .navbar-inverse .nav-collapse .navbar-form,
- .navbar-inverse .nav-collapse .navbar-search {
- border-top-color: #111111;
- border-bottom-color: #111111;
- }
- .navbar .nav-collapse .nav.pull-right {
- float: none;
- margin-left: 0;
- }
- .nav-collapse,
- .nav-collapse.collapse {
- height: 0;
- overflow: hidden;
- }
- .navbar .btn-navbar {
- display: block;
- }
- .navbar-static .navbar-inner {
- padding-right: 10px;
- padding-left: 10px;
- }
-}
-
-@media (min-width: 980px) {
- .nav-collapse.collapse {
- height: auto !important;
- overflow: visible !important;
- }
-}
--- a/integ/js/vs/lib/bootstrap/css/bootstrap-responsive.min.css Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-/*!
- * Bootstrap Responsive v2.3.0
- *
- * Copyright 2012 Twitter, Inc
- * Licensed under the Apache License v2.0
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Designed and built with all the love in the world @twitter by @mdo and @fat.
- */.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}@-ms-viewport{width:device-width}.hidden{display:none;visibility:hidden}.visible-phone{display:none!important}.visible-tablet{display:none!important}.hidden-desktop{display:none!important}.visible-desktop{display:inherit!important}@media(min-width:768px) and (max-width:979px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-tablet{display:inherit!important}.hidden-tablet{display:none!important}}@media(max-width:767px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-phone{display:inherit!important}.hidden-phone{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:inherit!important}.hidden-print{display:none!important}}@media(min-width:1200px){.row{margin-left:-30px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:30px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px}.span12{width:1170px}.span11{width:1070px}.span10{width:970px}.span9{width:870px}.span8{width:770px}.span7{width:670px}.span6{width:570px}.span5{width:470px}.span4{width:370px}.span3{width:270px}.span2{width:170px}.span1{width:70px}.offset12{margin-left:1230px}.offset11{margin-left:1130px}.offset10{margin-left:1030px}.offset9{margin-left:930px}.offset8{margin-left:830px}.offset7{margin-left:730px}.offset6{margin-left:630px}.offset5{margin-left:530px}.offset4{margin-left:430px}.offset3{margin-left:330px}.offset2{margin-left:230px}.offset1{margin-left:130px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.564102564102564%;*margin-left:2.5109110747408616%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.564102564102564%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.45299145299145%;*width:91.39979996362975%}.row-fluid .span10{width:82.90598290598291%;*width:82.8527914166212%}.row-fluid .span9{width:74.35897435897436%;*width:74.30578286961266%}.row-fluid .span8{width:65.81196581196582%;*width:65.75877432260411%}.row-fluid .span7{width:57.26495726495726%;*width:57.21176577559556%}.row-fluid .span6{width:48.717948717948715%;*width:48.664757228587014%}.row-fluid .span5{width:40.17094017094017%;*width:40.11774868157847%}.row-fluid .span4{width:31.623931623931625%;*width:31.570740134569924%}.row-fluid .span3{width:23.076923076923077%;*width:23.023731587561375%}.row-fluid .span2{width:14.52991452991453%;*width:14.476723040552828%}.row-fluid .span1{width:5.982905982905983%;*width:5.929714493544281%}.row-fluid .offset12{margin-left:105.12820512820512%;*margin-left:105.02182214948171%}.row-fluid .offset12:first-child{margin-left:102.56410256410257%;*margin-left:102.45771958537915%}.row-fluid .offset11{margin-left:96.58119658119658%;*margin-left:96.47481360247316%}.row-fluid .offset11:first-child{margin-left:94.01709401709402%;*margin-left:93.91071103837061%}.row-fluid .offset10{margin-left:88.03418803418803%;*margin-left:87.92780505546462%}.row-fluid .offset10:first-child{margin-left:85.47008547008548%;*margin-left:85.36370249136206%}.row-fluid .offset9{margin-left:79.48717948717949%;*margin-left:79.38079650845607%}.row-fluid .offset9:first-child{margin-left:76.92307692307693%;*margin-left:76.81669394435352%}.row-fluid .offset8{margin-left:70.94017094017094%;*margin-left:70.83378796144753%}.row-fluid .offset8:first-child{margin-left:68.37606837606839%;*margin-left:68.26968539734497%}.row-fluid .offset7{margin-left:62.393162393162385%;*margin-left:62.28677941443899%}.row-fluid .offset7:first-child{margin-left:59.82905982905982%;*margin-left:59.72267685033642%}.row-fluid .offset6{margin-left:53.84615384615384%;*margin-left:53.739770867430444%}.row-fluid .offset6:first-child{margin-left:51.28205128205128%;*margin-left:51.175668303327875%}.row-fluid .offset5{margin-left:45.299145299145295%;*margin-left:45.1927623204219%}.row-fluid .offset5:first-child{margin-left:42.73504273504273%;*margin-left:42.62865975631933%}.row-fluid .offset4{margin-left:36.75213675213675%;*margin-left:36.645753773413354%}.row-fluid .offset4:first-child{margin-left:34.18803418803419%;*margin-left:34.081651209310785%}.row-fluid .offset3{margin-left:28.205128205128204%;*margin-left:28.0987452264048%}.row-fluid .offset3:first-child{margin-left:25.641025641025642%;*margin-left:25.53464266230224%}.row-fluid .offset2{margin-left:19.65811965811966%;*margin-left:19.551736679396257%}.row-fluid .offset2:first-child{margin-left:17.094017094017094%;*margin-left:16.98763411529369%}.row-fluid .offset1{margin-left:11.11111111111111%;*margin-left:11.004728132387708%}.row-fluid .offset1:first-child{margin-left:8.547008547008547%;*margin-left:8.440625568285142%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:30px}input.span12,textarea.span12,.uneditable-input.span12{width:1156px}input.span11,textarea.span11,.uneditable-input.span11{width:1056px}input.span10,textarea.span10,.uneditable-input.span10{width:956px}input.span9,textarea.span9,.uneditable-input.span9{width:856px}input.span8,textarea.span8,.uneditable-input.span8{width:756px}input.span7,textarea.span7,.uneditable-input.span7{width:656px}input.span6,textarea.span6,.uneditable-input.span6{width:556px}input.span5,textarea.span5,.uneditable-input.span5{width:456px}input.span4,textarea.span4,.uneditable-input.span4{width:356px}input.span3,textarea.span3,.uneditable-input.span3{width:256px}input.span2,textarea.span2,.uneditable-input.span2{width:156px}input.span1,textarea.span1,.uneditable-input.span1{width:56px}.thumbnails{margin-left:-30px}.thumbnails>li{margin-left:30px}.row-fluid .thumbnails{margin-left:0}}@media(min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px}.span12{width:724px}.span11{width:662px}.span10{width:600px}.span9{width:538px}.span8{width:476px}.span7{width:414px}.span6{width:352px}.span5{width:290px}.span4{width:228px}.span3{width:166px}.span2{width:104px}.span1{width:42px}.offset12{margin-left:764px}.offset11{margin-left:702px}.offset10{margin-left:640px}.offset9{margin-left:578px}.offset8{margin-left:516px}.offset7{margin-left:454px}.offset6{margin-left:392px}.offset5{margin-left:330px}.offset4{margin-left:268px}.offset3{margin-left:206px}.offset2{margin-left:144px}.offset1{margin-left:82px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.7624309392265194%;*margin-left:2.709239449864817%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.7624309392265194%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.43646408839778%;*width:91.38327259903608%}.row-fluid .span10{width:82.87292817679558%;*width:82.81973668743387%}.row-fluid .span9{width:74.30939226519337%;*width:74.25620077583166%}.row-fluid .span8{width:65.74585635359117%;*width:65.69266486422946%}.row-fluid .span7{width:57.18232044198895%;*width:57.12912895262725%}.row-fluid .span6{width:48.61878453038674%;*width:48.56559304102504%}.row-fluid .span5{width:40.05524861878453%;*width:40.00205712942283%}.row-fluid .span4{width:31.491712707182323%;*width:31.43852121782062%}.row-fluid .span3{width:22.92817679558011%;*width:22.87498530621841%}.row-fluid .span2{width:14.3646408839779%;*width:14.311449394616199%}.row-fluid .span1{width:5.801104972375691%;*width:5.747913483013988%}.row-fluid .offset12{margin-left:105.52486187845304%;*margin-left:105.41847889972962%}.row-fluid .offset12:first-child{margin-left:102.76243093922652%;*margin-left:102.6560479605031%}.row-fluid .offset11{margin-left:96.96132596685082%;*margin-left:96.8549429881274%}.row-fluid .offset11:first-child{margin-left:94.1988950276243%;*margin-left:94.09251204890089%}.row-fluid .offset10{margin-left:88.39779005524862%;*margin-left:88.2914070765252%}.row-fluid .offset10:first-child{margin-left:85.6353591160221%;*margin-left:85.52897613729868%}.row-fluid .offset9{margin-left:79.8342541436464%;*margin-left:79.72787116492299%}.row-fluid .offset9:first-child{margin-left:77.07182320441989%;*margin-left:76.96544022569647%}.row-fluid .offset8{margin-left:71.2707182320442%;*margin-left:71.16433525332079%}.row-fluid .offset8:first-child{margin-left:68.50828729281768%;*margin-left:68.40190431409427%}.row-fluid .offset7{margin-left:62.70718232044199%;*margin-left:62.600799341718584%}.row-fluid .offset7:first-child{margin-left:59.94475138121547%;*margin-left:59.838368402492065%}.row-fluid .offset6{margin-left:54.14364640883978%;*margin-left:54.037263430116376%}.row-fluid .offset6:first-child{margin-left:51.38121546961326%;*margin-left:51.27483249088986%}.row-fluid .offset5{margin-left:45.58011049723757%;*margin-left:45.47372751851417%}.row-fluid .offset5:first-child{margin-left:42.81767955801105%;*margin-left:42.71129657928765%}.row-fluid .offset4{margin-left:37.01657458563536%;*margin-left:36.91019160691196%}.row-fluid .offset4:first-child{margin-left:34.25414364640884%;*margin-left:34.14776066768544%}.row-fluid .offset3{margin-left:28.45303867403315%;*margin-left:28.346655695309746%}.row-fluid .offset3:first-child{margin-left:25.69060773480663%;*margin-left:25.584224756083227%}.row-fluid .offset2{margin-left:19.88950276243094%;*margin-left:19.783119783707537%}.row-fluid .offset2:first-child{margin-left:17.12707182320442%;*margin-left:17.02068884448102%}.row-fluid .offset1{margin-left:11.32596685082873%;*margin-left:11.219583872105325%}.row-fluid .offset1:first-child{margin-left:8.56353591160221%;*margin-left:8.457152932878806%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:710px}input.span11,textarea.span11,.uneditable-input.span11{width:648px}input.span10,textarea.span10,.uneditable-input.span10{width:586px}input.span9,textarea.span9,.uneditable-input.span9{width:524px}input.span8,textarea.span8,.uneditable-input.span8{width:462px}input.span7,textarea.span7,.uneditable-input.span7{width:400px}input.span6,textarea.span6,.uneditable-input.span6{width:338px}input.span5,textarea.span5,.uneditable-input.span5{width:276px}input.span4,textarea.span4,.uneditable-input.span4{width:214px}input.span3,textarea.span3,.uneditable-input.span3{width:152px}input.span2,textarea.span2,.uneditable-input.span2{width:90px}input.span1,textarea.span1,.uneditable-input.span1{width:28px}}@media(max-width:767px){body{padding-right:20px;padding-left:20px}.navbar-fixed-top,.navbar-fixed-bottom,.navbar-static-top{margin-right:-20px;margin-left:-20px}.container-fluid{padding:0}.dl-horizontal dt{float:none;width:auto;clear:none;text-align:left}.dl-horizontal dd{margin-left:0}.container{width:auto}.row-fluid{width:100%}.row,.thumbnails{margin-left:0}.thumbnails>li{float:none;margin-left:0}[class*="span"],.uneditable-input[class*="span"],.row-fluid [class*="span"]{display:block;float:none;width:100%;margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.span12,.row-fluid .span12{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="offset"]:first-child{margin-left:0}.input-large,.input-xlarge,.input-xxlarge,input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.input-prepend input,.input-append input,.input-prepend input[class*="span"],.input-append input[class*="span"]{display:inline-block;width:auto}.controls-row [class*="span"]+[class*="span"]{margin-left:0}.modal{position:fixed;top:20px;right:20px;left:20px;width:auto;margin:0}.modal.fade{top:-100px}.modal.fade.in{top:20px}}@media(max-width:480px){.nav-collapse{-webkit-transform:translate3d(0,0,0)}.page-header h1 small{display:block;line-height:20px}input[type="checkbox"],input[type="radio"]{border:1px solid #ccc}.form-horizontal .control-label{float:none;width:auto;padding-top:0;text-align:left}.form-horizontal .controls{margin-left:0}.form-horizontal .control-list{padding-top:0}.form-horizontal .form-actions{padding-right:10px;padding-left:10px}.media .pull-left,.media .pull-right{display:block;float:none;margin-bottom:10px}.media-object{margin-right:0;margin-left:0}.modal{top:10px;right:10px;left:10px}.modal-header .close{padding:10px;margin:-10px}.carousel-caption{position:static}}@media(max-width:979px){body{padding-top:0}.navbar-fixed-top,.navbar-fixed-bottom{position:static}.navbar-fixed-top{margin-bottom:20px}.navbar-fixed-bottom{margin-top:20px}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding:5px}.navbar .container{width:auto;padding:0}.navbar .brand{padding-right:10px;padding-left:10px;margin:0 0 0 -5px}.nav-collapse{clear:both}.nav-collapse .nav{float:none;margin:0 0 10px}.nav-collapse .nav>li{float:none}.nav-collapse .nav>li>a{margin-bottom:2px}.nav-collapse .nav>.divider-vertical{display:none}.nav-collapse .nav .nav-header{color:#777;text-shadow:none}.nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{padding:9px 15px;font-weight:bold;color:#777;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.nav-collapse .btn{padding:4px 10px 4px;font-weight:normal;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.nav-collapse .dropdown-menu li+li a{margin-bottom:2px}.nav-collapse .nav>li>a:hover,.nav-collapse .nav>li>a:focus,.nav-collapse .dropdown-menu a:hover,.nav-collapse .dropdown-menu a:focus{background-color:#f2f2f2}.navbar-inverse .nav-collapse .nav>li>a,.navbar-inverse .nav-collapse .dropdown-menu a{color:#999}.navbar-inverse .nav-collapse .nav>li>a:hover,.navbar-inverse .nav-collapse .nav>li>a:focus,.navbar-inverse .nav-collapse .dropdown-menu a:hover,.navbar-inverse .nav-collapse .dropdown-menu a:focus{background-color:#111}.nav-collapse.in .btn-group{padding:0;margin-top:5px}.nav-collapse .dropdown-menu{position:static;top:auto;left:auto;display:none;float:none;max-width:none;padding:0;margin:0 15px;background-color:transparent;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.nav-collapse .open>.dropdown-menu{display:block}.nav-collapse .dropdown-menu:before,.nav-collapse .dropdown-menu:after{display:none}.nav-collapse .dropdown-menu .divider{display:none}.nav-collapse .nav>li>.dropdown-menu:before,.nav-collapse .nav>li>.dropdown-menu:after{display:none}.nav-collapse .navbar-form,.nav-collapse .navbar-search{float:none;padding:10px 15px;margin:10px 0;border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1)}.navbar-inverse .nav-collapse .navbar-form,.navbar-inverse .nav-collapse .navbar-search{border-top-color:#111;border-bottom-color:#111}.navbar .nav-collapse .nav.pull-right{float:none;margin-left:0}.nav-collapse,.nav-collapse.collapse{height:0;overflow:hidden}.navbar .btn-navbar{display:block}.navbar-static .navbar-inner{padding-right:10px;padding-left:10px}}@media(min-width:980px){.nav-collapse.collapse{height:auto!important;overflow:visible!important}}
--- a/integ/js/vs/lib/bootstrap/css/bootstrap.css Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6158 +0,0 @@
-/*!
- * Bootstrap v2.3.0
- *
- * Copyright 2012 Twitter, Inc
- * Licensed under the Apache License v2.0
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Designed and built with all the love in the world @twitter by @mdo and @fat.
- */
-
-.clearfix {
- *zoom: 1;
-}
-
-.clearfix:before,
-.clearfix:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.clearfix:after {
- clear: both;
-}
-
-.hide-text {
- font: 0/0 a;
- color: transparent;
- text-shadow: none;
- background-color: transparent;
- border: 0;
-}
-
-.input-block-level {
- display: block;
- width: 100%;
- min-height: 30px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
-
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-nav,
-section {
- display: block;
-}
-
-audio,
-canvas,
-video {
- display: inline-block;
- *display: inline;
- *zoom: 1;
-}
-
-audio:not([controls]) {
- display: none;
-}
-
-html {
- font-size: 100%;
- -webkit-text-size-adjust: 100%;
- -ms-text-size-adjust: 100%;
-}
-
-a:focus {
- outline: thin dotted #333;
- outline: 5px auto -webkit-focus-ring-color;
- outline-offset: -2px;
-}
-
-a:hover,
-a:active {
- outline: 0;
-}
-
-sub,
-sup {
- position: relative;
- font-size: 75%;
- line-height: 0;
- vertical-align: baseline;
-}
-
-sup {
- top: -0.5em;
-}
-
-sub {
- bottom: -0.25em;
-}
-
-img {
- width: auto\9;
- height: auto;
- max-width: 100%;
- vertical-align: middle;
- border: 0;
- -ms-interpolation-mode: bicubic;
-}
-
-#map_canvas img,
-.google-maps img {
- max-width: none;
-}
-
-button,
-input,
-select,
-textarea {
- margin: 0;
- font-size: 100%;
- vertical-align: middle;
-}
-
-button,
-input {
- *overflow: visible;
- line-height: normal;
-}
-
-button::-moz-focus-inner,
-input::-moz-focus-inner {
- padding: 0;
- border: 0;
-}
-
-button,
-html input[type="button"],
-input[type="reset"],
-input[type="submit"] {
- cursor: pointer;
- -webkit-appearance: button;
-}
-
-label,
-select,
-button,
-input[type="button"],
-input[type="reset"],
-input[type="submit"],
-input[type="radio"],
-input[type="checkbox"] {
- cursor: pointer;
-}
-
-input[type="search"] {
- -webkit-box-sizing: content-box;
- -moz-box-sizing: content-box;
- box-sizing: content-box;
- -webkit-appearance: textfield;
-}
-
-input[type="search"]::-webkit-search-decoration,
-input[type="search"]::-webkit-search-cancel-button {
- -webkit-appearance: none;
-}
-
-textarea {
- overflow: auto;
- vertical-align: top;
-}
-
-@media print {
- * {
- color: #000 !important;
- text-shadow: none !important;
- background: transparent !important;
- box-shadow: none !important;
- }
- a,
- a:visited {
- text-decoration: underline;
- }
- a[href]:after {
- content: " (" attr(href) ")";
- }
- abbr[title]:after {
- content: " (" attr(title) ")";
- }
- .ir a:after,
- a[href^="javascript:"]:after,
- a[href^="#"]:after {
- content: "";
- }
- pre,
- blockquote {
- border: 1px solid #999;
- page-break-inside: avoid;
- }
- thead {
- display: table-header-group;
- }
- tr,
- img {
- page-break-inside: avoid;
- }
- img {
- max-width: 100% !important;
- }
- @page {
- margin: 0.5cm;
- }
- p,
- h2,
- h3 {
- orphans: 3;
- widows: 3;
- }
- h2,
- h3 {
- page-break-after: avoid;
- }
-}
-
-body {
- margin: 0;
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
- font-size: 14px;
- line-height: 20px;
- color: #333333;
- background-color: #ffffff;
-}
-
-a {
- color: #0088cc;
- text-decoration: none;
-}
-
-a:hover,
-a:focus {
- color: #005580;
- text-decoration: underline;
-}
-
-.img-rounded {
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
-}
-
-.img-polaroid {
- padding: 4px;
- background-color: #fff;
- border: 1px solid #ccc;
- border: 1px solid rgba(0, 0, 0, 0.2);
- -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
- -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
-}
-
-.img-circle {
- -webkit-border-radius: 500px;
- -moz-border-radius: 500px;
- border-radius: 500px;
-}
-
-.row {
- margin-left: -20px;
- *zoom: 1;
-}
-
-.row:before,
-.row:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.row:after {
- clear: both;
-}
-
-[class*="span"] {
- float: left;
- min-height: 1px;
- margin-left: 20px;
-}
-
-.container,
-.navbar-static-top .container,
-.navbar-fixed-top .container,
-.navbar-fixed-bottom .container {
- width: 940px;
-}
-
-.span12 {
- width: 940px;
-}
-
-.span11 {
- width: 860px;
-}
-
-.span10 {
- width: 780px;
-}
-
-.span9 {
- width: 700px;
-}
-
-.span8 {
- width: 620px;
-}
-
-.span7 {
- width: 540px;
-}
-
-.span6 {
- width: 460px;
-}
-
-.span5 {
- width: 380px;
-}
-
-.span4 {
- width: 300px;
-}
-
-.span3 {
- width: 220px;
-}
-
-.span2 {
- width: 140px;
-}
-
-.span1 {
- width: 60px;
-}
-
-.offset12 {
- margin-left: 980px;
-}
-
-.offset11 {
- margin-left: 900px;
-}
-
-.offset10 {
- margin-left: 820px;
-}
-
-.offset9 {
- margin-left: 740px;
-}
-
-.offset8 {
- margin-left: 660px;
-}
-
-.offset7 {
- margin-left: 580px;
-}
-
-.offset6 {
- margin-left: 500px;
-}
-
-.offset5 {
- margin-left: 420px;
-}
-
-.offset4 {
- margin-left: 340px;
-}
-
-.offset3 {
- margin-left: 260px;
-}
-
-.offset2 {
- margin-left: 180px;
-}
-
-.offset1 {
- margin-left: 100px;
-}
-
-.row-fluid {
- width: 100%;
- *zoom: 1;
-}
-
-.row-fluid:before,
-.row-fluid:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.row-fluid:after {
- clear: both;
-}
-
-.row-fluid [class*="span"] {
- display: block;
- float: left;
- width: 100%;
- min-height: 30px;
- margin-left: 2.127659574468085%;
- *margin-left: 2.074468085106383%;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
-
-.row-fluid [class*="span"]:first-child {
- margin-left: 0;
-}
-
-.row-fluid .controls-row [class*="span"] + [class*="span"] {
- margin-left: 2.127659574468085%;
-}
-
-.row-fluid .span12 {
- width: 100%;
- *width: 99.94680851063829%;
-}
-
-.row-fluid .span11 {
- width: 91.48936170212765%;
- *width: 91.43617021276594%;
-}
-
-.row-fluid .span10 {
- width: 82.97872340425532%;
- *width: 82.92553191489361%;
-}
-
-.row-fluid .span9 {
- width: 74.46808510638297%;
- *width: 74.41489361702126%;
-}
-
-.row-fluid .span8 {
- width: 65.95744680851064%;
- *width: 65.90425531914893%;
-}
-
-.row-fluid .span7 {
- width: 57.44680851063829%;
- *width: 57.39361702127659%;
-}
-
-.row-fluid .span6 {
- width: 48.93617021276595%;
- *width: 48.88297872340425%;
-}
-
-.row-fluid .span5 {
- width: 40.42553191489362%;
- *width: 40.37234042553192%;
-}
-
-.row-fluid .span4 {
- width: 31.914893617021278%;
- *width: 31.861702127659576%;
-}
-
-.row-fluid .span3 {
- width: 23.404255319148934%;
- *width: 23.351063829787233%;
-}
-
-.row-fluid .span2 {
- width: 14.893617021276595%;
- *width: 14.840425531914894%;
-}
-
-.row-fluid .span1 {
- width: 6.382978723404255%;
- *width: 6.329787234042553%;
-}
-
-.row-fluid .offset12 {
- margin-left: 104.25531914893617%;
- *margin-left: 104.14893617021275%;
-}
-
-.row-fluid .offset12:first-child {
- margin-left: 102.12765957446808%;
- *margin-left: 102.02127659574467%;
-}
-
-.row-fluid .offset11 {
- margin-left: 95.74468085106382%;
- *margin-left: 95.6382978723404%;
-}
-
-.row-fluid .offset11:first-child {
- margin-left: 93.61702127659574%;
- *margin-left: 93.51063829787232%;
-}
-
-.row-fluid .offset10 {
- margin-left: 87.23404255319149%;
- *margin-left: 87.12765957446807%;
-}
-
-.row-fluid .offset10:first-child {
- margin-left: 85.1063829787234%;
- *margin-left: 84.99999999999999%;
-}
-
-.row-fluid .offset9 {
- margin-left: 78.72340425531914%;
- *margin-left: 78.61702127659572%;
-}
-
-.row-fluid .offset9:first-child {
- margin-left: 76.59574468085106%;
- *margin-left: 76.48936170212764%;
-}
-
-.row-fluid .offset8 {
- margin-left: 70.2127659574468%;
- *margin-left: 70.10638297872339%;
-}
-
-.row-fluid .offset8:first-child {
- margin-left: 68.08510638297872%;
- *margin-left: 67.9787234042553%;
-}
-
-.row-fluid .offset7 {
- margin-left: 61.70212765957446%;
- *margin-left: 61.59574468085106%;
-}
-
-.row-fluid .offset7:first-child {
- margin-left: 59.574468085106375%;
- *margin-left: 59.46808510638297%;
-}
-
-.row-fluid .offset6 {
- margin-left: 53.191489361702125%;
- *margin-left: 53.085106382978715%;
-}
-
-.row-fluid .offset6:first-child {
- margin-left: 51.063829787234035%;
- *margin-left: 50.95744680851063%;
-}
-
-.row-fluid .offset5 {
- margin-left: 44.68085106382979%;
- *margin-left: 44.57446808510638%;
-}
-
-.row-fluid .offset5:first-child {
- margin-left: 42.5531914893617%;
- *margin-left: 42.4468085106383%;
-}
-
-.row-fluid .offset4 {
- margin-left: 36.170212765957444%;
- *margin-left: 36.06382978723405%;
-}
-
-.row-fluid .offset4:first-child {
- margin-left: 34.04255319148936%;
- *margin-left: 33.93617021276596%;
-}
-
-.row-fluid .offset3 {
- margin-left: 27.659574468085104%;
- *margin-left: 27.5531914893617%;
-}
-
-.row-fluid .offset3:first-child {
- margin-left: 25.53191489361702%;
- *margin-left: 25.425531914893618%;
-}
-
-.row-fluid .offset2 {
- margin-left: 19.148936170212764%;
- *margin-left: 19.04255319148936%;
-}
-
-.row-fluid .offset2:first-child {
- margin-left: 17.02127659574468%;
- *margin-left: 16.914893617021278%;
-}
-
-.row-fluid .offset1 {
- margin-left: 10.638297872340425%;
- *margin-left: 10.53191489361702%;
-}
-
-.row-fluid .offset1:first-child {
- margin-left: 8.51063829787234%;
- *margin-left: 8.404255319148938%;
-}
-
-[class*="span"].hide,
-.row-fluid [class*="span"].hide {
- display: none;
-}
-
-[class*="span"].pull-right,
-.row-fluid [class*="span"].pull-right {
- float: right;
-}
-
-.container {
- margin-right: auto;
- margin-left: auto;
- *zoom: 1;
-}
-
-.container:before,
-.container:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.container:after {
- clear: both;
-}
-
-.container-fluid {
- padding-right: 20px;
- padding-left: 20px;
- *zoom: 1;
-}
-
-.container-fluid:before,
-.container-fluid:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.container-fluid:after {
- clear: both;
-}
-
-p {
- margin: 0 0 10px;
-}
-
-.lead {
- margin-bottom: 20px;
- font-size: 21px;
- font-weight: 200;
- line-height: 30px;
-}
-
-small {
- font-size: 85%;
-}
-
-strong {
- font-weight: bold;
-}
-
-em {
- font-style: italic;
-}
-
-cite {
- font-style: normal;
-}
-
-.muted {
- color: #999999;
-}
-
-a.muted:hover,
-a.muted:focus {
- color: #808080;
-}
-
-.text-warning {
- color: #c09853;
-}
-
-a.text-warning:hover,
-a.text-warning:focus {
- color: #a47e3c;
-}
-
-.text-error {
- color: #b94a48;
-}
-
-a.text-error:hover,
-a.text-error:focus {
- color: #953b39;
-}
-
-.text-info {
- color: #3a87ad;
-}
-
-a.text-info:hover,
-a.text-info:focus {
- color: #2d6987;
-}
-
-.text-success {
- color: #468847;
-}
-
-a.text-success:hover,
-a.text-success:focus {
- color: #356635;
-}
-
-.text-left {
- text-align: left;
-}
-
-.text-right {
- text-align: right;
-}
-
-.text-center {
- text-align: center;
-}
-
-h1,
-h2,
-h3,
-h4,
-h5,
-h6 {
- margin: 10px 0;
- font-family: inherit;
- font-weight: bold;
- line-height: 20px;
- color: inherit;
- text-rendering: optimizelegibility;
-}
-
-h1 small,
-h2 small,
-h3 small,
-h4 small,
-h5 small,
-h6 small {
- font-weight: normal;
- line-height: 1;
- color: #999999;
-}
-
-h1,
-h2,
-h3 {
- line-height: 40px;
-}
-
-h1 {
- font-size: 38.5px;
-}
-
-h2 {
- font-size: 31.5px;
-}
-
-h3 {
- font-size: 24.5px;
-}
-
-h4 {
- font-size: 17.5px;
-}
-
-h5 {
- font-size: 14px;
-}
-
-h6 {
- font-size: 11.9px;
-}
-
-h1 small {
- font-size: 24.5px;
-}
-
-h2 small {
- font-size: 17.5px;
-}
-
-h3 small {
- font-size: 14px;
-}
-
-h4 small {
- font-size: 14px;
-}
-
-.page-header {
- padding-bottom: 9px;
- margin: 20px 0 30px;
- border-bottom: 1px solid #eeeeee;
-}
-
-ul,
-ol {
- padding: 0;
- margin: 0 0 10px 25px;
-}
-
-ul ul,
-ul ol,
-ol ol,
-ol ul {
- margin-bottom: 0;
-}
-
-li {
- line-height: 20px;
-}
-
-ul.unstyled,
-ol.unstyled {
- margin-left: 0;
- list-style: none;
-}
-
-ul.inline,
-ol.inline {
- margin-left: 0;
- list-style: none;
-}
-
-ul.inline > li,
-ol.inline > li {
- display: inline-block;
- *display: inline;
- padding-right: 5px;
- padding-left: 5px;
- *zoom: 1;
-}
-
-dl {
- margin-bottom: 20px;
-}
-
-dt,
-dd {
- line-height: 20px;
-}
-
-dt {
- font-weight: bold;
-}
-
-dd {
- margin-left: 10px;
-}
-
-.dl-horizontal {
- *zoom: 1;
-}
-
-.dl-horizontal:before,
-.dl-horizontal:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.dl-horizontal:after {
- clear: both;
-}
-
-.dl-horizontal dt {
- float: left;
- width: 160px;
- overflow: hidden;
- clear: left;
- text-align: right;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.dl-horizontal dd {
- margin-left: 180px;
-}
-
-hr {
- margin: 20px 0;
- border: 0;
- border-top: 1px solid #eeeeee;
- border-bottom: 1px solid #ffffff;
-}
-
-abbr[title],
-abbr[data-original-title] {
- cursor: help;
- border-bottom: 1px dotted #999999;
-}
-
-abbr.initialism {
- font-size: 90%;
- text-transform: uppercase;
-}
-
-blockquote {
- padding: 0 0 0 15px;
- margin: 0 0 20px;
- border-left: 5px solid #eeeeee;
-}
-
-blockquote p {
- margin-bottom: 0;
- font-size: 17.5px;
- font-weight: 300;
- line-height: 1.25;
-}
-
-blockquote small {
- display: block;
- line-height: 20px;
- color: #999999;
-}
-
-blockquote small:before {
- content: '\2014 \00A0';
-}
-
-blockquote.pull-right {
- float: right;
- padding-right: 15px;
- padding-left: 0;
- border-right: 5px solid #eeeeee;
- border-left: 0;
-}
-
-blockquote.pull-right p,
-blockquote.pull-right small {
- text-align: right;
-}
-
-blockquote.pull-right small:before {
- content: '';
-}
-
-blockquote.pull-right small:after {
- content: '\00A0 \2014';
-}
-
-q:before,
-q:after,
-blockquote:before,
-blockquote:after {
- content: "";
-}
-
-address {
- display: block;
- margin-bottom: 20px;
- font-style: normal;
- line-height: 20px;
-}
-
-code,
-pre {
- padding: 0 3px 2px;
- font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
- font-size: 12px;
- color: #333333;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-code {
- padding: 2px 4px;
- color: #d14;
- white-space: nowrap;
- background-color: #f7f7f9;
- border: 1px solid #e1e1e8;
-}
-
-pre {
- display: block;
- padding: 9.5px;
- margin: 0 0 10px;
- font-size: 13px;
- line-height: 20px;
- word-break: break-all;
- word-wrap: break-word;
- white-space: pre;
- white-space: pre-wrap;
- background-color: #f5f5f5;
- border: 1px solid #ccc;
- border: 1px solid rgba(0, 0, 0, 0.15);
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-pre.prettyprint {
- margin-bottom: 20px;
-}
-
-pre code {
- padding: 0;
- color: inherit;
- white-space: pre;
- white-space: pre-wrap;
- background-color: transparent;
- border: 0;
-}
-
-.pre-scrollable {
- max-height: 340px;
- overflow-y: scroll;
-}
-
-form {
- margin: 0 0 20px;
-}
-
-fieldset {
- padding: 0;
- margin: 0;
- border: 0;
-}
-
-legend {
- display: block;
- width: 100%;
- padding: 0;
- margin-bottom: 20px;
- font-size: 21px;
- line-height: 40px;
- color: #333333;
- border: 0;
- border-bottom: 1px solid #e5e5e5;
-}
-
-legend small {
- font-size: 15px;
- color: #999999;
-}
-
-label,
-input,
-button,
-select,
-textarea {
- font-size: 14px;
- font-weight: normal;
- line-height: 20px;
-}
-
-input,
-button,
-select,
-textarea {
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
-}
-
-label {
- display: block;
- margin-bottom: 5px;
-}
-
-select,
-textarea,
-input[type="text"],
-input[type="password"],
-input[type="datetime"],
-input[type="datetime-local"],
-input[type="date"],
-input[type="month"],
-input[type="time"],
-input[type="week"],
-input[type="number"],
-input[type="email"],
-input[type="url"],
-input[type="search"],
-input[type="tel"],
-input[type="color"],
-.uneditable-input {
- display: inline-block;
- height: 20px;
- padding: 4px 6px;
- margin-bottom: 10px;
- font-size: 14px;
- line-height: 20px;
- color: #555555;
- vertical-align: middle;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-input,
-textarea,
-.uneditable-input {
- width: 206px;
-}
-
-textarea {
- height: auto;
-}
-
-textarea,
-input[type="text"],
-input[type="password"],
-input[type="datetime"],
-input[type="datetime-local"],
-input[type="date"],
-input[type="month"],
-input[type="time"],
-input[type="week"],
-input[type="number"],
-input[type="email"],
-input[type="url"],
-input[type="search"],
-input[type="tel"],
-input[type="color"],
-.uneditable-input {
- background-color: #ffffff;
- border: 1px solid #cccccc;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- -webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
- -moz-transition: border linear 0.2s, box-shadow linear 0.2s;
- -o-transition: border linear 0.2s, box-shadow linear 0.2s;
- transition: border linear 0.2s, box-shadow linear 0.2s;
-}
-
-textarea:focus,
-input[type="text"]:focus,
-input[type="password"]:focus,
-input[type="datetime"]:focus,
-input[type="datetime-local"]:focus,
-input[type="date"]:focus,
-input[type="month"]:focus,
-input[type="time"]:focus,
-input[type="week"]:focus,
-input[type="number"]:focus,
-input[type="email"]:focus,
-input[type="url"]:focus,
-input[type="search"]:focus,
-input[type="tel"]:focus,
-input[type="color"]:focus,
-.uneditable-input:focus {
- border-color: rgba(82, 168, 236, 0.8);
- outline: 0;
- outline: thin dotted \9;
- /* IE6-9 */
-
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
-}
-
-input[type="radio"],
-input[type="checkbox"] {
- margin: 4px 0 0;
- margin-top: 1px \9;
- *margin-top: 0;
- line-height: normal;
-}
-
-input[type="file"],
-input[type="image"],
-input[type="submit"],
-input[type="reset"],
-input[type="button"],
-input[type="radio"],
-input[type="checkbox"] {
- width: auto;
-}
-
-select,
-input[type="file"] {
- height: 30px;
- /* In IE7, the height of the select element cannot be changed by height, only font-size */
-
- *margin-top: 4px;
- /* For IE7, add top margin to align select with labels */
-
- line-height: 30px;
-}
-
-select {
- width: 220px;
- background-color: #ffffff;
- border: 1px solid #cccccc;
-}
-
-select[multiple],
-select[size] {
- height: auto;
-}
-
-select:focus,
-input[type="file"]:focus,
-input[type="radio"]:focus,
-input[type="checkbox"]:focus {
- outline: thin dotted #333;
- outline: 5px auto -webkit-focus-ring-color;
- outline-offset: -2px;
-}
-
-.uneditable-input,
-.uneditable-textarea {
- color: #999999;
- cursor: not-allowed;
- background-color: #fcfcfc;
- border-color: #cccccc;
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
- -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
-}
-
-.uneditable-input {
- overflow: hidden;
- white-space: nowrap;
-}
-
-.uneditable-textarea {
- width: auto;
- height: auto;
-}
-
-input:-moz-placeholder,
-textarea:-moz-placeholder {
- color: #999999;
-}
-
-input:-ms-input-placeholder,
-textarea:-ms-input-placeholder {
- color: #999999;
-}
-
-input::-webkit-input-placeholder,
-textarea::-webkit-input-placeholder {
- color: #999999;
-}
-
-.radio,
-.checkbox {
- min-height: 20px;
- padding-left: 20px;
-}
-
-.radio input[type="radio"],
-.checkbox input[type="checkbox"] {
- float: left;
- margin-left: -20px;
-}
-
-.controls > .radio:first-child,
-.controls > .checkbox:first-child {
- padding-top: 5px;
-}
-
-.radio.inline,
-.checkbox.inline {
- display: inline-block;
- padding-top: 5px;
- margin-bottom: 0;
- vertical-align: middle;
-}
-
-.radio.inline + .radio.inline,
-.checkbox.inline + .checkbox.inline {
- margin-left: 10px;
-}
-
-.input-mini {
- width: 60px;
-}
-
-.input-small {
- width: 90px;
-}
-
-.input-medium {
- width: 150px;
-}
-
-.input-large {
- width: 210px;
-}
-
-.input-xlarge {
- width: 270px;
-}
-
-.input-xxlarge {
- width: 530px;
-}
-
-input[class*="span"],
-select[class*="span"],
-textarea[class*="span"],
-.uneditable-input[class*="span"],
-.row-fluid input[class*="span"],
-.row-fluid select[class*="span"],
-.row-fluid textarea[class*="span"],
-.row-fluid .uneditable-input[class*="span"] {
- float: none;
- margin-left: 0;
-}
-
-.input-append input[class*="span"],
-.input-append .uneditable-input[class*="span"],
-.input-prepend input[class*="span"],
-.input-prepend .uneditable-input[class*="span"],
-.row-fluid input[class*="span"],
-.row-fluid select[class*="span"],
-.row-fluid textarea[class*="span"],
-.row-fluid .uneditable-input[class*="span"],
-.row-fluid .input-prepend [class*="span"],
-.row-fluid .input-append [class*="span"] {
- display: inline-block;
-}
-
-input,
-textarea,
-.uneditable-input {
- margin-left: 0;
-}
-
-.controls-row [class*="span"] + [class*="span"] {
- margin-left: 20px;
-}
-
-input.span12,
-textarea.span12,
-.uneditable-input.span12 {
- width: 926px;
-}
-
-input.span11,
-textarea.span11,
-.uneditable-input.span11 {
- width: 846px;
-}
-
-input.span10,
-textarea.span10,
-.uneditable-input.span10 {
- width: 766px;
-}
-
-input.span9,
-textarea.span9,
-.uneditable-input.span9 {
- width: 686px;
-}
-
-input.span8,
-textarea.span8,
-.uneditable-input.span8 {
- width: 606px;
-}
-
-input.span7,
-textarea.span7,
-.uneditable-input.span7 {
- width: 526px;
-}
-
-input.span6,
-textarea.span6,
-.uneditable-input.span6 {
- width: 446px;
-}
-
-input.span5,
-textarea.span5,
-.uneditable-input.span5 {
- width: 366px;
-}
-
-input.span4,
-textarea.span4,
-.uneditable-input.span4 {
- width: 286px;
-}
-
-input.span3,
-textarea.span3,
-.uneditable-input.span3 {
- width: 206px;
-}
-
-input.span2,
-textarea.span2,
-.uneditable-input.span2 {
- width: 126px;
-}
-
-input.span1,
-textarea.span1,
-.uneditable-input.span1 {
- width: 46px;
-}
-
-.controls-row {
- *zoom: 1;
-}
-
-.controls-row:before,
-.controls-row:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.controls-row:after {
- clear: both;
-}
-
-.controls-row [class*="span"],
-.row-fluid .controls-row [class*="span"] {
- float: left;
-}
-
-.controls-row .checkbox[class*="span"],
-.controls-row .radio[class*="span"] {
- padding-top: 5px;
-}
-
-input[disabled],
-select[disabled],
-textarea[disabled],
-input[readonly],
-select[readonly],
-textarea[readonly] {
- cursor: not-allowed;
- background-color: #eeeeee;
-}
-
-input[type="radio"][disabled],
-input[type="checkbox"][disabled],
-input[type="radio"][readonly],
-input[type="checkbox"][readonly] {
- background-color: transparent;
-}
-
-.control-group.warning .control-label,
-.control-group.warning .help-block,
-.control-group.warning .help-inline {
- color: #c09853;
-}
-
-.control-group.warning .checkbox,
-.control-group.warning .radio,
-.control-group.warning input,
-.control-group.warning select,
-.control-group.warning textarea {
- color: #c09853;
-}
-
-.control-group.warning input,
-.control-group.warning select,
-.control-group.warning textarea {
- border-color: #c09853;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-}
-
-.control-group.warning input:focus,
-.control-group.warning select:focus,
-.control-group.warning textarea:focus {
- border-color: #a47e3c;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
-}
-
-.control-group.warning .input-prepend .add-on,
-.control-group.warning .input-append .add-on {
- color: #c09853;
- background-color: #fcf8e3;
- border-color: #c09853;
-}
-
-.control-group.error .control-label,
-.control-group.error .help-block,
-.control-group.error .help-inline {
- color: #b94a48;
-}
-
-.control-group.error .checkbox,
-.control-group.error .radio,
-.control-group.error input,
-.control-group.error select,
-.control-group.error textarea {
- color: #b94a48;
-}
-
-.control-group.error input,
-.control-group.error select,
-.control-group.error textarea {
- border-color: #b94a48;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-}
-
-.control-group.error input:focus,
-.control-group.error select:focus,
-.control-group.error textarea:focus {
- border-color: #953b39;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
-}
-
-.control-group.error .input-prepend .add-on,
-.control-group.error .input-append .add-on {
- color: #b94a48;
- background-color: #f2dede;
- border-color: #b94a48;
-}
-
-.control-group.success .control-label,
-.control-group.success .help-block,
-.control-group.success .help-inline {
- color: #468847;
-}
-
-.control-group.success .checkbox,
-.control-group.success .radio,
-.control-group.success input,
-.control-group.success select,
-.control-group.success textarea {
- color: #468847;
-}
-
-.control-group.success input,
-.control-group.success select,
-.control-group.success textarea {
- border-color: #468847;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-}
-
-.control-group.success input:focus,
-.control-group.success select:focus,
-.control-group.success textarea:focus {
- border-color: #356635;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
-}
-
-.control-group.success .input-prepend .add-on,
-.control-group.success .input-append .add-on {
- color: #468847;
- background-color: #dff0d8;
- border-color: #468847;
-}
-
-.control-group.info .control-label,
-.control-group.info .help-block,
-.control-group.info .help-inline {
- color: #3a87ad;
-}
-
-.control-group.info .checkbox,
-.control-group.info .radio,
-.control-group.info input,
-.control-group.info select,
-.control-group.info textarea {
- color: #3a87ad;
-}
-
-.control-group.info input,
-.control-group.info select,
-.control-group.info textarea {
- border-color: #3a87ad;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-}
-
-.control-group.info input:focus,
-.control-group.info select:focus,
-.control-group.info textarea:focus {
- border-color: #2d6987;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3;
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3;
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7ab5d3;
-}
-
-.control-group.info .input-prepend .add-on,
-.control-group.info .input-append .add-on {
- color: #3a87ad;
- background-color: #d9edf7;
- border-color: #3a87ad;
-}
-
-input:focus:invalid,
-textarea:focus:invalid,
-select:focus:invalid {
- color: #b94a48;
- border-color: #ee5f5b;
-}
-
-input:focus:invalid:focus,
-textarea:focus:invalid:focus,
-select:focus:invalid:focus {
- border-color: #e9322d;
- -webkit-box-shadow: 0 0 6px #f8b9b7;
- -moz-box-shadow: 0 0 6px #f8b9b7;
- box-shadow: 0 0 6px #f8b9b7;
-}
-
-.form-actions {
- padding: 19px 20px 20px;
- margin-top: 20px;
- margin-bottom: 20px;
- background-color: #f5f5f5;
- border-top: 1px solid #e5e5e5;
- *zoom: 1;
-}
-
-.form-actions:before,
-.form-actions:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.form-actions:after {
- clear: both;
-}
-
-.help-block,
-.help-inline {
- color: #595959;
-}
-
-.help-block {
- display: block;
- margin-bottom: 10px;
-}
-
-.help-inline {
- display: inline-block;
- *display: inline;
- padding-left: 5px;
- vertical-align: middle;
- *zoom: 1;
-}
-
-.input-append,
-.input-prepend {
- display: inline-block;
- margin-bottom: 10px;
- font-size: 0;
- white-space: nowrap;
- vertical-align: middle;
-}
-
-.input-append input,
-.input-prepend input,
-.input-append select,
-.input-prepend select,
-.input-append .uneditable-input,
-.input-prepend .uneditable-input,
-.input-append .dropdown-menu,
-.input-prepend .dropdown-menu,
-.input-append .popover,
-.input-prepend .popover {
- font-size: 14px;
-}
-
-.input-append input,
-.input-prepend input,
-.input-append select,
-.input-prepend select,
-.input-append .uneditable-input,
-.input-prepend .uneditable-input {
- position: relative;
- margin-bottom: 0;
- *margin-left: 0;
- vertical-align: top;
- -webkit-border-radius: 0 4px 4px 0;
- -moz-border-radius: 0 4px 4px 0;
- border-radius: 0 4px 4px 0;
-}
-
-.input-append input:focus,
-.input-prepend input:focus,
-.input-append select:focus,
-.input-prepend select:focus,
-.input-append .uneditable-input:focus,
-.input-prepend .uneditable-input:focus {
- z-index: 2;
-}
-
-.input-append .add-on,
-.input-prepend .add-on {
- display: inline-block;
- width: auto;
- height: 20px;
- min-width: 16px;
- padding: 4px 5px;
- font-size: 14px;
- font-weight: normal;
- line-height: 20px;
- text-align: center;
- text-shadow: 0 1px 0 #ffffff;
- background-color: #eeeeee;
- border: 1px solid #ccc;
-}
-
-.input-append .add-on,
-.input-prepend .add-on,
-.input-append .btn,
-.input-prepend .btn,
-.input-append .btn-group > .dropdown-toggle,
-.input-prepend .btn-group > .dropdown-toggle {
- vertical-align: top;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.input-append .active,
-.input-prepend .active {
- background-color: #a9dba9;
- border-color: #46a546;
-}
-
-.input-prepend .add-on,
-.input-prepend .btn {
- margin-right: -1px;
-}
-
-.input-prepend .add-on:first-child,
-.input-prepend .btn:first-child {
- -webkit-border-radius: 4px 0 0 4px;
- -moz-border-radius: 4px 0 0 4px;
- border-radius: 4px 0 0 4px;
-}
-
-.input-append input,
-.input-append select,
-.input-append .uneditable-input {
- -webkit-border-radius: 4px 0 0 4px;
- -moz-border-radius: 4px 0 0 4px;
- border-radius: 4px 0 0 4px;
-}
-
-.input-append input + .btn-group .btn:last-child,
-.input-append select + .btn-group .btn:last-child,
-.input-append .uneditable-input + .btn-group .btn:last-child {
- -webkit-border-radius: 0 4px 4px 0;
- -moz-border-radius: 0 4px 4px 0;
- border-radius: 0 4px 4px 0;
-}
-
-.input-append .add-on,
-.input-append .btn,
-.input-append .btn-group {
- margin-left: -1px;
-}
-
-.input-append .add-on:last-child,
-.input-append .btn:last-child,
-.input-append .btn-group:last-child > .dropdown-toggle {
- -webkit-border-radius: 0 4px 4px 0;
- -moz-border-radius: 0 4px 4px 0;
- border-radius: 0 4px 4px 0;
-}
-
-.input-prepend.input-append input,
-.input-prepend.input-append select,
-.input-prepend.input-append .uneditable-input {
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.input-prepend.input-append input + .btn-group .btn,
-.input-prepend.input-append select + .btn-group .btn,
-.input-prepend.input-append .uneditable-input + .btn-group .btn {
- -webkit-border-radius: 0 4px 4px 0;
- -moz-border-radius: 0 4px 4px 0;
- border-radius: 0 4px 4px 0;
-}
-
-.input-prepend.input-append .add-on:first-child,
-.input-prepend.input-append .btn:first-child {
- margin-right: -1px;
- -webkit-border-radius: 4px 0 0 4px;
- -moz-border-radius: 4px 0 0 4px;
- border-radius: 4px 0 0 4px;
-}
-
-.input-prepend.input-append .add-on:last-child,
-.input-prepend.input-append .btn:last-child {
- margin-left: -1px;
- -webkit-border-radius: 0 4px 4px 0;
- -moz-border-radius: 0 4px 4px 0;
- border-radius: 0 4px 4px 0;
-}
-
-.input-prepend.input-append .btn-group:first-child {
- margin-left: 0;
-}
-
-input.search-query {
- padding-right: 14px;
- padding-right: 4px \9;
- padding-left: 14px;
- padding-left: 4px \9;
- /* IE7-8 doesn't have border-radius, so don't indent the padding */
-
- margin-bottom: 0;
- -webkit-border-radius: 15px;
- -moz-border-radius: 15px;
- border-radius: 15px;
-}
-
-/* Allow for input prepend/append in search forms */
-
-.form-search .input-append .search-query,
-.form-search .input-prepend .search-query {
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.form-search .input-append .search-query {
- -webkit-border-radius: 14px 0 0 14px;
- -moz-border-radius: 14px 0 0 14px;
- border-radius: 14px 0 0 14px;
-}
-
-.form-search .input-append .btn {
- -webkit-border-radius: 0 14px 14px 0;
- -moz-border-radius: 0 14px 14px 0;
- border-radius: 0 14px 14px 0;
-}
-
-.form-search .input-prepend .search-query {
- -webkit-border-radius: 0 14px 14px 0;
- -moz-border-radius: 0 14px 14px 0;
- border-radius: 0 14px 14px 0;
-}
-
-.form-search .input-prepend .btn {
- -webkit-border-radius: 14px 0 0 14px;
- -moz-border-radius: 14px 0 0 14px;
- border-radius: 14px 0 0 14px;
-}
-
-.form-search input,
-.form-inline input,
-.form-horizontal input,
-.form-search textarea,
-.form-inline textarea,
-.form-horizontal textarea,
-.form-search select,
-.form-inline select,
-.form-horizontal select,
-.form-search .help-inline,
-.form-inline .help-inline,
-.form-horizontal .help-inline,
-.form-search .uneditable-input,
-.form-inline .uneditable-input,
-.form-horizontal .uneditable-input,
-.form-search .input-prepend,
-.form-inline .input-prepend,
-.form-horizontal .input-prepend,
-.form-search .input-append,
-.form-inline .input-append,
-.form-horizontal .input-append {
- display: inline-block;
- *display: inline;
- margin-bottom: 0;
- vertical-align: middle;
- *zoom: 1;
-}
-
-.form-search .hide,
-.form-inline .hide,
-.form-horizontal .hide {
- display: none;
-}
-
-.form-search label,
-.form-inline label,
-.form-search .btn-group,
-.form-inline .btn-group {
- display: inline-block;
-}
-
-.form-search .input-append,
-.form-inline .input-append,
-.form-search .input-prepend,
-.form-inline .input-prepend {
- margin-bottom: 0;
-}
-
-.form-search .radio,
-.form-search .checkbox,
-.form-inline .radio,
-.form-inline .checkbox {
- padding-left: 0;
- margin-bottom: 0;
- vertical-align: middle;
-}
-
-.form-search .radio input[type="radio"],
-.form-search .checkbox input[type="checkbox"],
-.form-inline .radio input[type="radio"],
-.form-inline .checkbox input[type="checkbox"] {
- float: left;
- margin-right: 3px;
- margin-left: 0;
-}
-
-.control-group {
- margin-bottom: 10px;
-}
-
-legend + .control-group {
- margin-top: 20px;
- -webkit-margin-top-collapse: separate;
-}
-
-.form-horizontal .control-group {
- margin-bottom: 20px;
- *zoom: 1;
-}
-
-.form-horizontal .control-group:before,
-.form-horizontal .control-group:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.form-horizontal .control-group:after {
- clear: both;
-}
-
-.form-horizontal .control-label {
- float: left;
- width: 160px;
- padding-top: 5px;
- text-align: right;
-}
-
-.form-horizontal .controls {
- *display: inline-block;
- *padding-left: 20px;
- margin-left: 180px;
- *margin-left: 0;
-}
-
-.form-horizontal .controls:first-child {
- *padding-left: 180px;
-}
-
-.form-horizontal .help-block {
- margin-bottom: 0;
-}
-
-.form-horizontal input + .help-block,
-.form-horizontal select + .help-block,
-.form-horizontal textarea + .help-block,
-.form-horizontal .uneditable-input + .help-block,
-.form-horizontal .input-prepend + .help-block,
-.form-horizontal .input-append + .help-block {
- margin-top: 10px;
-}
-
-.form-horizontal .form-actions {
- padding-left: 180px;
-}
-
-table {
- max-width: 100%;
- background-color: transparent;
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-.table {
- width: 100%;
- margin-bottom: 20px;
-}
-
-.table th,
-.table td {
- padding: 8px;
- line-height: 20px;
- text-align: left;
- vertical-align: top;
- border-top: 1px solid #dddddd;
-}
-
-.table th {
- font-weight: bold;
-}
-
-.table thead th {
- vertical-align: bottom;
-}
-
-.table caption + thead tr:first-child th,
-.table caption + thead tr:first-child td,
-.table colgroup + thead tr:first-child th,
-.table colgroup + thead tr:first-child td,
-.table thead:first-child tr:first-child th,
-.table thead:first-child tr:first-child td {
- border-top: 0;
-}
-
-.table tbody + tbody {
- border-top: 2px solid #dddddd;
-}
-
-.table .table {
- background-color: #ffffff;
-}
-
-.table-condensed th,
-.table-condensed td {
- padding: 4px 5px;
-}
-
-.table-bordered {
- border: 1px solid #dddddd;
- border-collapse: separate;
- *border-collapse: collapse;
- border-left: 0;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.table-bordered th,
-.table-bordered td {
- border-left: 1px solid #dddddd;
-}
-
-.table-bordered caption + thead tr:first-child th,
-.table-bordered caption + tbody tr:first-child th,
-.table-bordered caption + tbody tr:first-child td,
-.table-bordered colgroup + thead tr:first-child th,
-.table-bordered colgroup + tbody tr:first-child th,
-.table-bordered colgroup + tbody tr:first-child td,
-.table-bordered thead:first-child tr:first-child th,
-.table-bordered tbody:first-child tr:first-child th,
-.table-bordered tbody:first-child tr:first-child td {
- border-top: 0;
-}
-
-.table-bordered thead:first-child tr:first-child > th:first-child,
-.table-bordered tbody:first-child tr:first-child > td:first-child,
-.table-bordered tbody:first-child tr:first-child > th:first-child {
- -webkit-border-top-left-radius: 4px;
- border-top-left-radius: 4px;
- -moz-border-radius-topleft: 4px;
-}
-
-.table-bordered thead:first-child tr:first-child > th:last-child,
-.table-bordered tbody:first-child tr:first-child > td:last-child,
-.table-bordered tbody:first-child tr:first-child > th:last-child {
- -webkit-border-top-right-radius: 4px;
- border-top-right-radius: 4px;
- -moz-border-radius-topright: 4px;
-}
-
-.table-bordered thead:last-child tr:last-child > th:first-child,
-.table-bordered tbody:last-child tr:last-child > td:first-child,
-.table-bordered tbody:last-child tr:last-child > th:first-child,
-.table-bordered tfoot:last-child tr:last-child > td:first-child,
-.table-bordered tfoot:last-child tr:last-child > th:first-child {
- -webkit-border-bottom-left-radius: 4px;
- border-bottom-left-radius: 4px;
- -moz-border-radius-bottomleft: 4px;
-}
-
-.table-bordered thead:last-child tr:last-child > th:last-child,
-.table-bordered tbody:last-child tr:last-child > td:last-child,
-.table-bordered tbody:last-child tr:last-child > th:last-child,
-.table-bordered tfoot:last-child tr:last-child > td:last-child,
-.table-bordered tfoot:last-child tr:last-child > th:last-child {
- -webkit-border-bottom-right-radius: 4px;
- border-bottom-right-radius: 4px;
- -moz-border-radius-bottomright: 4px;
-}
-
-.table-bordered tfoot + tbody:last-child tr:last-child td:first-child {
- -webkit-border-bottom-left-radius: 0;
- border-bottom-left-radius: 0;
- -moz-border-radius-bottomleft: 0;
-}
-
-.table-bordered tfoot + tbody:last-child tr:last-child td:last-child {
- -webkit-border-bottom-right-radius: 0;
- border-bottom-right-radius: 0;
- -moz-border-radius-bottomright: 0;
-}
-
-.table-bordered caption + thead tr:first-child th:first-child,
-.table-bordered caption + tbody tr:first-child td:first-child,
-.table-bordered colgroup + thead tr:first-child th:first-child,
-.table-bordered colgroup + tbody tr:first-child td:first-child {
- -webkit-border-top-left-radius: 4px;
- border-top-left-radius: 4px;
- -moz-border-radius-topleft: 4px;
-}
-
-.table-bordered caption + thead tr:first-child th:last-child,
-.table-bordered caption + tbody tr:first-child td:last-child,
-.table-bordered colgroup + thead tr:first-child th:last-child,
-.table-bordered colgroup + tbody tr:first-child td:last-child {
- -webkit-border-top-right-radius: 4px;
- border-top-right-radius: 4px;
- -moz-border-radius-topright: 4px;
-}
-
-.table-striped tbody > tr:nth-child(odd) > td,
-.table-striped tbody > tr:nth-child(odd) > th {
- background-color: #f9f9f9;
-}
-
-.table-hover tbody tr:hover > td,
-.table-hover tbody tr:hover > th {
- background-color: #f5f5f5;
-}
-
-table td[class*="span"],
-table th[class*="span"],
-.row-fluid table td[class*="span"],
-.row-fluid table th[class*="span"] {
- display: table-cell;
- float: none;
- margin-left: 0;
-}
-
-.table td.span1,
-.table th.span1 {
- float: none;
- width: 44px;
- margin-left: 0;
-}
-
-.table td.span2,
-.table th.span2 {
- float: none;
- width: 124px;
- margin-left: 0;
-}
-
-.table td.span3,
-.table th.span3 {
- float: none;
- width: 204px;
- margin-left: 0;
-}
-
-.table td.span4,
-.table th.span4 {
- float: none;
- width: 284px;
- margin-left: 0;
-}
-
-.table td.span5,
-.table th.span5 {
- float: none;
- width: 364px;
- margin-left: 0;
-}
-
-.table td.span6,
-.table th.span6 {
- float: none;
- width: 444px;
- margin-left: 0;
-}
-
-.table td.span7,
-.table th.span7 {
- float: none;
- width: 524px;
- margin-left: 0;
-}
-
-.table td.span8,
-.table th.span8 {
- float: none;
- width: 604px;
- margin-left: 0;
-}
-
-.table td.span9,
-.table th.span9 {
- float: none;
- width: 684px;
- margin-left: 0;
-}
-
-.table td.span10,
-.table th.span10 {
- float: none;
- width: 764px;
- margin-left: 0;
-}
-
-.table td.span11,
-.table th.span11 {
- float: none;
- width: 844px;
- margin-left: 0;
-}
-
-.table td.span12,
-.table th.span12 {
- float: none;
- width: 924px;
- margin-left: 0;
-}
-
-.table tbody tr.success > td {
- background-color: #dff0d8;
-}
-
-.table tbody tr.error > td {
- background-color: #f2dede;
-}
-
-.table tbody tr.warning > td {
- background-color: #fcf8e3;
-}
-
-.table tbody tr.info > td {
- background-color: #d9edf7;
-}
-
-.table-hover tbody tr.success:hover > td {
- background-color: #d0e9c6;
-}
-
-.table-hover tbody tr.error:hover > td {
- background-color: #ebcccc;
-}
-
-.table-hover tbody tr.warning:hover > td {
- background-color: #faf2cc;
-}
-
-.table-hover tbody tr.info:hover > td {
- background-color: #c4e3f3;
-}
-
-[class^="icon-"],
-[class*=" icon-"] {
- display: inline-block;
- width: 14px;
- height: 14px;
- margin-top: 1px;
- *margin-right: .3em;
- line-height: 14px;
- vertical-align: text-top;
- background-image: url("../img/glyphicons-halflings.png");
- background-position: 14px 14px;
- background-repeat: no-repeat;
-}
-
-/* White icons with optional class, or on hover/focus/active states of certain elements */
-
-.icon-white,
-.nav-pills > .active > a > [class^="icon-"],
-.nav-pills > .active > a > [class*=" icon-"],
-.nav-list > .active > a > [class^="icon-"],
-.nav-list > .active > a > [class*=" icon-"],
-.navbar-inverse .nav > .active > a > [class^="icon-"],
-.navbar-inverse .nav > .active > a > [class*=" icon-"],
-.dropdown-menu > li > a:hover > [class^="icon-"],
-.dropdown-menu > li > a:focus > [class^="icon-"],
-.dropdown-menu > li > a:hover > [class*=" icon-"],
-.dropdown-menu > li > a:focus > [class*=" icon-"],
-.dropdown-menu > .active > a > [class^="icon-"],
-.dropdown-menu > .active > a > [class*=" icon-"],
-.dropdown-submenu:hover > a > [class^="icon-"],
-.dropdown-submenu:focus > a > [class^="icon-"],
-.dropdown-submenu:hover > a > [class*=" icon-"],
-.dropdown-submenu:focus > a > [class*=" icon-"] {
- background-image: url("../img/glyphicons-halflings-white.png");
-}
-
-.icon-glass {
- background-position: 0 0;
-}
-
-.icon-music {
- background-position: -24px 0;
-}
-
-.icon-search {
- background-position: -48px 0;
-}
-
-.icon-envelope {
- background-position: -72px 0;
-}
-
-.icon-heart {
- background-position: -96px 0;
-}
-
-.icon-star {
- background-position: -120px 0;
-}
-
-.icon-star-empty {
- background-position: -144px 0;
-}
-
-.icon-user {
- background-position: -168px 0;
-}
-
-.icon-film {
- background-position: -192px 0;
-}
-
-.icon-th-large {
- background-position: -216px 0;
-}
-
-.icon-th {
- background-position: -240px 0;
-}
-
-.icon-th-list {
- background-position: -264px 0;
-}
-
-.icon-ok {
- background-position: -288px 0;
-}
-
-.icon-remove {
- background-position: -312px 0;
-}
-
-.icon-zoom-in {
- background-position: -336px 0;
-}
-
-.icon-zoom-out {
- background-position: -360px 0;
-}
-
-.icon-off {
- background-position: -384px 0;
-}
-
-.icon-signal {
- background-position: -408px 0;
-}
-
-.icon-cog {
- background-position: -432px 0;
-}
-
-.icon-trash {
- background-position: -456px 0;
-}
-
-.icon-home {
- background-position: 0 -24px;
-}
-
-.icon-file {
- background-position: -24px -24px;
-}
-
-.icon-time {
- background-position: -48px -24px;
-}
-
-.icon-road {
- background-position: -72px -24px;
-}
-
-.icon-download-alt {
- background-position: -96px -24px;
-}
-
-.icon-download {
- background-position: -120px -24px;
-}
-
-.icon-upload {
- background-position: -144px -24px;
-}
-
-.icon-inbox {
- background-position: -168px -24px;
-}
-
-.icon-play-circle {
- background-position: -192px -24px;
-}
-
-.icon-repeat {
- background-position: -216px -24px;
-}
-
-.icon-refresh {
- background-position: -240px -24px;
-}
-
-.icon-list-alt {
- background-position: -264px -24px;
-}
-
-.icon-lock {
- background-position: -287px -24px;
-}
-
-.icon-flag {
- background-position: -312px -24px;
-}
-
-.icon-headphones {
- background-position: -336px -24px;
-}
-
-.icon-volume-off {
- background-position: -360px -24px;
-}
-
-.icon-volume-down {
- background-position: -384px -24px;
-}
-
-.icon-volume-up {
- background-position: -408px -24px;
-}
-
-.icon-qrcode {
- background-position: -432px -24px;
-}
-
-.icon-barcode {
- background-position: -456px -24px;
-}
-
-.icon-tag {
- background-position: 0 -48px;
-}
-
-.icon-tags {
- background-position: -25px -48px;
-}
-
-.icon-book {
- background-position: -48px -48px;
-}
-
-.icon-bookmark {
- background-position: -72px -48px;
-}
-
-.icon-print {
- background-position: -96px -48px;
-}
-
-.icon-camera {
- background-position: -120px -48px;
-}
-
-.icon-font {
- background-position: -144px -48px;
-}
-
-.icon-bold {
- background-position: -167px -48px;
-}
-
-.icon-italic {
- background-position: -192px -48px;
-}
-
-.icon-text-height {
- background-position: -216px -48px;
-}
-
-.icon-text-width {
- background-position: -240px -48px;
-}
-
-.icon-align-left {
- background-position: -264px -48px;
-}
-
-.icon-align-center {
- background-position: -288px -48px;
-}
-
-.icon-align-right {
- background-position: -312px -48px;
-}
-
-.icon-align-justify {
- background-position: -336px -48px;
-}
-
-.icon-list {
- background-position: -360px -48px;
-}
-
-.icon-indent-left {
- background-position: -384px -48px;
-}
-
-.icon-indent-right {
- background-position: -408px -48px;
-}
-
-.icon-facetime-video {
- background-position: -432px -48px;
-}
-
-.icon-picture {
- background-position: -456px -48px;
-}
-
-.icon-pencil {
- background-position: 0 -72px;
-}
-
-.icon-map-marker {
- background-position: -24px -72px;
-}
-
-.icon-adjust {
- background-position: -48px -72px;
-}
-
-.icon-tint {
- background-position: -72px -72px;
-}
-
-.icon-edit {
- background-position: -96px -72px;
-}
-
-.icon-share {
- background-position: -120px -72px;
-}
-
-.icon-check {
- background-position: -144px -72px;
-}
-
-.icon-move {
- background-position: -168px -72px;
-}
-
-.icon-step-backward {
- background-position: -192px -72px;
-}
-
-.icon-fast-backward {
- background-position: -216px -72px;
-}
-
-.icon-backward {
- background-position: -240px -72px;
-}
-
-.icon-play {
- background-position: -264px -72px;
-}
-
-.icon-pause {
- background-position: -288px -72px;
-}
-
-.icon-stop {
- background-position: -312px -72px;
-}
-
-.icon-forward {
- background-position: -336px -72px;
-}
-
-.icon-fast-forward {
- background-position: -360px -72px;
-}
-
-.icon-step-forward {
- background-position: -384px -72px;
-}
-
-.icon-eject {
- background-position: -408px -72px;
-}
-
-.icon-chevron-left {
- background-position: -432px -72px;
-}
-
-.icon-chevron-right {
- background-position: -456px -72px;
-}
-
-.icon-plus-sign {
- background-position: 0 -96px;
-}
-
-.icon-minus-sign {
- background-position: -24px -96px;
-}
-
-.icon-remove-sign {
- background-position: -48px -96px;
-}
-
-.icon-ok-sign {
- background-position: -72px -96px;
-}
-
-.icon-question-sign {
- background-position: -96px -96px;
-}
-
-.icon-info-sign {
- background-position: -120px -96px;
-}
-
-.icon-screenshot {
- background-position: -144px -96px;
-}
-
-.icon-remove-circle {
- background-position: -168px -96px;
-}
-
-.icon-ok-circle {
- background-position: -192px -96px;
-}
-
-.icon-ban-circle {
- background-position: -216px -96px;
-}
-
-.icon-arrow-left {
- background-position: -240px -96px;
-}
-
-.icon-arrow-right {
- background-position: -264px -96px;
-}
-
-.icon-arrow-up {
- background-position: -289px -96px;
-}
-
-.icon-arrow-down {
- background-position: -312px -96px;
-}
-
-.icon-share-alt {
- background-position: -336px -96px;
-}
-
-.icon-resize-full {
- background-position: -360px -96px;
-}
-
-.icon-resize-small {
- background-position: -384px -96px;
-}
-
-.icon-plus {
- background-position: -408px -96px;
-}
-
-.icon-minus {
- background-position: -433px -96px;
-}
-
-.icon-asterisk {
- background-position: -456px -96px;
-}
-
-.icon-exclamation-sign {
- background-position: 0 -120px;
-}
-
-.icon-gift {
- background-position: -24px -120px;
-}
-
-.icon-leaf {
- background-position: -48px -120px;
-}
-
-.icon-fire {
- background-position: -72px -120px;
-}
-
-.icon-eye-open {
- background-position: -96px -120px;
-}
-
-.icon-eye-close {
- background-position: -120px -120px;
-}
-
-.icon-warning-sign {
- background-position: -144px -120px;
-}
-
-.icon-plane {
- background-position: -168px -120px;
-}
-
-.icon-calendar {
- background-position: -192px -120px;
-}
-
-.icon-random {
- width: 16px;
- background-position: -216px -120px;
-}
-
-.icon-comment {
- background-position: -240px -120px;
-}
-
-.icon-magnet {
- background-position: -264px -120px;
-}
-
-.icon-chevron-up {
- background-position: -288px -120px;
-}
-
-.icon-chevron-down {
- background-position: -313px -119px;
-}
-
-.icon-retweet {
- background-position: -336px -120px;
-}
-
-.icon-shopping-cart {
- background-position: -360px -120px;
-}
-
-.icon-folder-close {
- width: 16px;
- background-position: -384px -120px;
-}
-
-.icon-folder-open {
- width: 16px;
- background-position: -408px -120px;
-}
-
-.icon-resize-vertical {
- background-position: -432px -119px;
-}
-
-.icon-resize-horizontal {
- background-position: -456px -118px;
-}
-
-.icon-hdd {
- background-position: 0 -144px;
-}
-
-.icon-bullhorn {
- background-position: -24px -144px;
-}
-
-.icon-bell {
- background-position: -48px -144px;
-}
-
-.icon-certificate {
- background-position: -72px -144px;
-}
-
-.icon-thumbs-up {
- background-position: -96px -144px;
-}
-
-.icon-thumbs-down {
- background-position: -120px -144px;
-}
-
-.icon-hand-right {
- background-position: -144px -144px;
-}
-
-.icon-hand-left {
- background-position: -168px -144px;
-}
-
-.icon-hand-up {
- background-position: -192px -144px;
-}
-
-.icon-hand-down {
- background-position: -216px -144px;
-}
-
-.icon-circle-arrow-right {
- background-position: -240px -144px;
-}
-
-.icon-circle-arrow-left {
- background-position: -264px -144px;
-}
-
-.icon-circle-arrow-up {
- background-position: -288px -144px;
-}
-
-.icon-circle-arrow-down {
- background-position: -312px -144px;
-}
-
-.icon-globe {
- background-position: -336px -144px;
-}
-
-.icon-wrench {
- background-position: -360px -144px;
-}
-
-.icon-tasks {
- background-position: -384px -144px;
-}
-
-.icon-filter {
- background-position: -408px -144px;
-}
-
-.icon-briefcase {
- background-position: -432px -144px;
-}
-
-.icon-fullscreen {
- background-position: -456px -144px;
-}
-
-.dropup,
-.dropdown {
- position: relative;
-}
-
-.dropdown-toggle {
- *margin-bottom: -3px;
-}
-
-.dropdown-toggle:active,
-.open .dropdown-toggle {
- outline: 0;
-}
-
-.caret {
- display: inline-block;
- width: 0;
- height: 0;
- vertical-align: top;
- border-top: 4px solid #000000;
- border-right: 4px solid transparent;
- border-left: 4px solid transparent;
- content: "";
-}
-
-.dropdown .caret {
- margin-top: 8px;
- margin-left: 2px;
-}
-
-.dropdown-menu {
- position: absolute;
- top: 100%;
- left: 0;
- z-index: 1000;
- display: none;
- float: left;
- min-width: 160px;
- padding: 5px 0;
- margin: 2px 0 0;
- list-style: none;
- background-color: #ffffff;
- border: 1px solid #ccc;
- border: 1px solid rgba(0, 0, 0, 0.2);
- *border-right-width: 2px;
- *border-bottom-width: 2px;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
- -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- -webkit-background-clip: padding-box;
- -moz-background-clip: padding;
- background-clip: padding-box;
-}
-
-.dropdown-menu.pull-right {
- right: 0;
- left: auto;
-}
-
-.dropdown-menu .divider {
- *width: 100%;
- height: 1px;
- margin: 9px 1px;
- *margin: -5px 0 5px;
- overflow: hidden;
- background-color: #e5e5e5;
- border-bottom: 1px solid #ffffff;
-}
-
-.dropdown-menu > li > a {
- display: block;
- padding: 3px 20px;
- clear: both;
- font-weight: normal;
- line-height: 20px;
- color: #333333;
- white-space: nowrap;
-}
-
-.dropdown-menu > li > a:hover,
-.dropdown-menu > li > a:focus,
-.dropdown-submenu:hover > a,
-.dropdown-submenu:focus > a {
- color: #ffffff;
- text-decoration: none;
- background-color: #0081c2;
- background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
- background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
- background-image: -o-linear-gradient(top, #0088cc, #0077b3);
- background-image: linear-gradient(to bottom, #0088cc, #0077b3);
- background-repeat: repeat-x;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);
-}
-
-.dropdown-menu > .active > a,
-.dropdown-menu > .active > a:hover,
-.dropdown-menu > .active > a:focus {
- color: #ffffff;
- text-decoration: none;
- background-color: #0081c2;
- background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
- background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
- background-image: -o-linear-gradient(top, #0088cc, #0077b3);
- background-image: linear-gradient(to bottom, #0088cc, #0077b3);
- background-repeat: repeat-x;
- outline: 0;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);
-}
-
-.dropdown-menu > .disabled > a,
-.dropdown-menu > .disabled > a:hover,
-.dropdown-menu > .disabled > a:focus {
- color: #999999;
-}
-
-.dropdown-menu > .disabled > a:hover,
-.dropdown-menu > .disabled > a:focus {
- text-decoration: none;
- cursor: default;
- background-color: transparent;
- background-image: none;
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-}
-
-.open {
- *z-index: 1000;
-}
-
-.open > .dropdown-menu {
- display: block;
-}
-
-.pull-right > .dropdown-menu {
- right: 0;
- left: auto;
-}
-
-.dropup .caret,
-.navbar-fixed-bottom .dropdown .caret {
- border-top: 0;
- border-bottom: 4px solid #000000;
- content: "";
-}
-
-.dropup .dropdown-menu,
-.navbar-fixed-bottom .dropdown .dropdown-menu {
- top: auto;
- bottom: 100%;
- margin-bottom: 1px;
-}
-
-.dropdown-submenu {
- position: relative;
-}
-
-.dropdown-submenu > .dropdown-menu {
- top: 0;
- left: 100%;
- margin-top: -6px;
- margin-left: -1px;
- -webkit-border-radius: 0 6px 6px 6px;
- -moz-border-radius: 0 6px 6px 6px;
- border-radius: 0 6px 6px 6px;
-}
-
-.dropdown-submenu:hover > .dropdown-menu {
- display: block;
-}
-
-.dropup .dropdown-submenu > .dropdown-menu {
- top: auto;
- bottom: 0;
- margin-top: 0;
- margin-bottom: -2px;
- -webkit-border-radius: 5px 5px 5px 0;
- -moz-border-radius: 5px 5px 5px 0;
- border-radius: 5px 5px 5px 0;
-}
-
-.dropdown-submenu > a:after {
- display: block;
- float: right;
- width: 0;
- height: 0;
- margin-top: 5px;
- margin-right: -10px;
- border-color: transparent;
- border-left-color: #cccccc;
- border-style: solid;
- border-width: 5px 0 5px 5px;
- content: " ";
-}
-
-.dropdown-submenu:hover > a:after {
- border-left-color: #ffffff;
-}
-
-.dropdown-submenu.pull-left {
- float: none;
-}
-
-.dropdown-submenu.pull-left > .dropdown-menu {
- left: -100%;
- margin-left: 10px;
- -webkit-border-radius: 6px 0 6px 6px;
- -moz-border-radius: 6px 0 6px 6px;
- border-radius: 6px 0 6px 6px;
-}
-
-.dropdown .dropdown-menu .nav-header {
- padding-right: 20px;
- padding-left: 20px;
-}
-
-.typeahead {
- z-index: 1051;
- margin-top: 2px;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.well {
- min-height: 20px;
- padding: 19px;
- margin-bottom: 20px;
- background-color: #f5f5f5;
- border: 1px solid #e3e3e3;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-}
-
-.well blockquote {
- border-color: #ddd;
- border-color: rgba(0, 0, 0, 0.15);
-}
-
-.well-large {
- padding: 24px;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
-}
-
-.well-small {
- padding: 9px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-.fade {
- opacity: 0;
- -webkit-transition: opacity 0.15s linear;
- -moz-transition: opacity 0.15s linear;
- -o-transition: opacity 0.15s linear;
- transition: opacity 0.15s linear;
-}
-
-.fade.in {
- opacity: 1;
-}
-
-.collapse {
- position: relative;
- height: 0;
- overflow: hidden;
- -webkit-transition: height 0.35s ease;
- -moz-transition: height 0.35s ease;
- -o-transition: height 0.35s ease;
- transition: height 0.35s ease;
-}
-
-.collapse.in {
- height: auto;
-}
-
-.close {
- float: right;
- font-size: 20px;
- font-weight: bold;
- line-height: 20px;
- color: #000000;
- text-shadow: 0 1px 0 #ffffff;
- opacity: 0.2;
- filter: alpha(opacity=20);
-}
-
-.close:hover,
-.close:focus {
- color: #000000;
- text-decoration: none;
- cursor: pointer;
- opacity: 0.4;
- filter: alpha(opacity=40);
-}
-
-button.close {
- padding: 0;
- cursor: pointer;
- background: transparent;
- border: 0;
- -webkit-appearance: none;
-}
-
-.btn {
- display: inline-block;
- *display: inline;
- padding: 4px 12px;
- margin-bottom: 0;
- *margin-left: .3em;
- font-size: 14px;
- line-height: 20px;
- color: #333333;
- text-align: center;
- text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
- vertical-align: middle;
- cursor: pointer;
- background-color: #f5f5f5;
- *background-color: #e6e6e6;
- background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
- background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
- background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
- background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
- background-repeat: repeat-x;
- border: 1px solid #cccccc;
- *border: 0;
- border-color: #e6e6e6 #e6e6e6 #bfbfbf;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- border-bottom-color: #b3b3b3;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
- *zoom: 1;
- -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-
-.btn:hover,
-.btn:focus,
-.btn:active,
-.btn.active,
-.btn.disabled,
-.btn[disabled] {
- color: #333333;
- background-color: #e6e6e6;
- *background-color: #d9d9d9;
-}
-
-.btn:active,
-.btn.active {
- background-color: #cccccc \9;
-}
-
-.btn:first-child {
- *margin-left: 0;
-}
-
-.btn:hover,
-.btn:focus {
- color: #333333;
- text-decoration: none;
- background-position: 0 -15px;
- -webkit-transition: background-position 0.1s linear;
- -moz-transition: background-position 0.1s linear;
- -o-transition: background-position 0.1s linear;
- transition: background-position 0.1s linear;
-}
-
-.btn:focus {
- outline: thin dotted #333;
- outline: 5px auto -webkit-focus-ring-color;
- outline-offset: -2px;
-}
-
-.btn.active,
-.btn:active {
- background-image: none;
- outline: 0;
- -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
- box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-
-.btn.disabled,
-.btn[disabled] {
- cursor: default;
- background-image: none;
- opacity: 0.65;
- filter: alpha(opacity=65);
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
-}
-
-.btn-large {
- padding: 11px 19px;
- font-size: 17.5px;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
-}
-
-.btn-large [class^="icon-"],
-.btn-large [class*=" icon-"] {
- margin-top: 4px;
-}
-
-.btn-small {
- padding: 2px 10px;
- font-size: 11.9px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-.btn-small [class^="icon-"],
-.btn-small [class*=" icon-"] {
- margin-top: 0;
-}
-
-.btn-mini [class^="icon-"],
-.btn-mini [class*=" icon-"] {
- margin-top: -1px;
-}
-
-.btn-mini {
- padding: 0 6px;
- font-size: 10.5px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-.btn-block {
- display: block;
- width: 100%;
- padding-right: 0;
- padding-left: 0;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
-}
-
-.btn-block + .btn-block {
- margin-top: 5px;
-}
-
-input[type="submit"].btn-block,
-input[type="reset"].btn-block,
-input[type="button"].btn-block {
- width: 100%;
-}
-
-.btn-primary.active,
-.btn-warning.active,
-.btn-danger.active,
-.btn-success.active,
-.btn-info.active,
-.btn-inverse.active {
- color: rgba(255, 255, 255, 0.75);
-}
-
-.btn-primary {
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #006dcc;
- *background-color: #0044cc;
- background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
- background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
- background-image: -o-linear-gradient(top, #0088cc, #0044cc);
- background-image: linear-gradient(to bottom, #0088cc, #0044cc);
- background-repeat: repeat-x;
- border-color: #0044cc #0044cc #002a80;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-}
-
-.btn-primary:hover,
-.btn-primary:focus,
-.btn-primary:active,
-.btn-primary.active,
-.btn-primary.disabled,
-.btn-primary[disabled] {
- color: #ffffff;
- background-color: #0044cc;
- *background-color: #003bb3;
-}
-
-.btn-primary:active,
-.btn-primary.active {
- background-color: #003399 \9;
-}
-
-.btn-warning {
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #faa732;
- *background-color: #f89406;
- background-image: -moz-linear-gradient(top, #fbb450, #f89406);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));
- background-image: -webkit-linear-gradient(top, #fbb450, #f89406);
- background-image: -o-linear-gradient(top, #fbb450, #f89406);
- background-image: linear-gradient(to bottom, #fbb450, #f89406);
- background-repeat: repeat-x;
- border-color: #f89406 #f89406 #ad6704;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-}
-
-.btn-warning:hover,
-.btn-warning:focus,
-.btn-warning:active,
-.btn-warning.active,
-.btn-warning.disabled,
-.btn-warning[disabled] {
- color: #ffffff;
- background-color: #f89406;
- *background-color: #df8505;
-}
-
-.btn-warning:active,
-.btn-warning.active {
- background-color: #c67605 \9;
-}
-
-.btn-danger {
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #da4f49;
- *background-color: #bd362f;
- background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));
- background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f);
- background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
- background-image: linear-gradient(to bottom, #ee5f5b, #bd362f);
- background-repeat: repeat-x;
- border-color: #bd362f #bd362f #802420;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-}
-
-.btn-danger:hover,
-.btn-danger:focus,
-.btn-danger:active,
-.btn-danger.active,
-.btn-danger.disabled,
-.btn-danger[disabled] {
- color: #ffffff;
- background-color: #bd362f;
- *background-color: #a9302a;
-}
-
-.btn-danger:active,
-.btn-danger.active {
- background-color: #942a25 \9;
-}
-
-.btn-success {
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #5bb75b;
- *background-color: #51a351;
- background-image: -moz-linear-gradient(top, #62c462, #51a351);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));
- background-image: -webkit-linear-gradient(top, #62c462, #51a351);
- background-image: -o-linear-gradient(top, #62c462, #51a351);
- background-image: linear-gradient(to bottom, #62c462, #51a351);
- background-repeat: repeat-x;
- border-color: #51a351 #51a351 #387038;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0);
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-}
-
-.btn-success:hover,
-.btn-success:focus,
-.btn-success:active,
-.btn-success.active,
-.btn-success.disabled,
-.btn-success[disabled] {
- color: #ffffff;
- background-color: #51a351;
- *background-color: #499249;
-}
-
-.btn-success:active,
-.btn-success.active {
- background-color: #408140 \9;
-}
-
-.btn-info {
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #49afcd;
- *background-color: #2f96b4;
- background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4));
- background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4);
- background-image: -o-linear-gradient(top, #5bc0de, #2f96b4);
- background-image: linear-gradient(to bottom, #5bc0de, #2f96b4);
- background-repeat: repeat-x;
- border-color: #2f96b4 #2f96b4 #1f6377;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2f96b4', GradientType=0);
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-}
-
-.btn-info:hover,
-.btn-info:focus,
-.btn-info:active,
-.btn-info.active,
-.btn-info.disabled,
-.btn-info[disabled] {
- color: #ffffff;
- background-color: #2f96b4;
- *background-color: #2a85a0;
-}
-
-.btn-info:active,
-.btn-info.active {
- background-color: #24748c \9;
-}
-
-.btn-inverse {
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #363636;
- *background-color: #222222;
- background-image: -moz-linear-gradient(top, #444444, #222222);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#444444), to(#222222));
- background-image: -webkit-linear-gradient(top, #444444, #222222);
- background-image: -o-linear-gradient(top, #444444, #222222);
- background-image: linear-gradient(to bottom, #444444, #222222);
- background-repeat: repeat-x;
- border-color: #222222 #222222 #000000;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444', endColorstr='#ff222222', GradientType=0);
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-}
-
-.btn-inverse:hover,
-.btn-inverse:focus,
-.btn-inverse:active,
-.btn-inverse.active,
-.btn-inverse.disabled,
-.btn-inverse[disabled] {
- color: #ffffff;
- background-color: #222222;
- *background-color: #151515;
-}
-
-.btn-inverse:active,
-.btn-inverse.active {
- background-color: #080808 \9;
-}
-
-button.btn,
-input[type="submit"].btn {
- *padding-top: 3px;
- *padding-bottom: 3px;
-}
-
-button.btn::-moz-focus-inner,
-input[type="submit"].btn::-moz-focus-inner {
- padding: 0;
- border: 0;
-}
-
-button.btn.btn-large,
-input[type="submit"].btn.btn-large {
- *padding-top: 7px;
- *padding-bottom: 7px;
-}
-
-button.btn.btn-small,
-input[type="submit"].btn.btn-small {
- *padding-top: 3px;
- *padding-bottom: 3px;
-}
-
-button.btn.btn-mini,
-input[type="submit"].btn.btn-mini {
- *padding-top: 1px;
- *padding-bottom: 1px;
-}
-
-.btn-link,
-.btn-link:active,
-.btn-link[disabled] {
- background-color: transparent;
- background-image: none;
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
-}
-
-.btn-link {
- color: #0088cc;
- cursor: pointer;
- border-color: transparent;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.btn-link:hover,
-.btn-link:focus {
- color: #005580;
- text-decoration: underline;
- background-color: transparent;
-}
-
-.btn-link[disabled]:hover,
-.btn-link[disabled]:focus {
- color: #333333;
- text-decoration: none;
-}
-
-.btn-group {
- position: relative;
- display: inline-block;
- *display: inline;
- *margin-left: .3em;
- font-size: 0;
- white-space: nowrap;
- vertical-align: middle;
- *zoom: 1;
-}
-
-.btn-group:first-child {
- *margin-left: 0;
-}
-
-.btn-group + .btn-group {
- margin-left: 5px;
-}
-
-.btn-toolbar {
- margin-top: 10px;
- margin-bottom: 10px;
- font-size: 0;
-}
-
-.btn-toolbar > .btn + .btn,
-.btn-toolbar > .btn-group + .btn,
-.btn-toolbar > .btn + .btn-group {
- margin-left: 5px;
-}
-
-.btn-group > .btn {
- position: relative;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.btn-group > .btn + .btn {
- margin-left: -1px;
-}
-
-.btn-group > .btn,
-.btn-group > .dropdown-menu,
-.btn-group > .popover {
- font-size: 14px;
-}
-
-.btn-group > .btn-mini {
- font-size: 10.5px;
-}
-
-.btn-group > .btn-small {
- font-size: 11.9px;
-}
-
-.btn-group > .btn-large {
- font-size: 17.5px;
-}
-
-.btn-group > .btn:first-child {
- margin-left: 0;
- -webkit-border-bottom-left-radius: 4px;
- border-bottom-left-radius: 4px;
- -webkit-border-top-left-radius: 4px;
- border-top-left-radius: 4px;
- -moz-border-radius-bottomleft: 4px;
- -moz-border-radius-topleft: 4px;
-}
-
-.btn-group > .btn:last-child,
-.btn-group > .dropdown-toggle {
- -webkit-border-top-right-radius: 4px;
- border-top-right-radius: 4px;
- -webkit-border-bottom-right-radius: 4px;
- border-bottom-right-radius: 4px;
- -moz-border-radius-topright: 4px;
- -moz-border-radius-bottomright: 4px;
-}
-
-.btn-group > .btn.large:first-child {
- margin-left: 0;
- -webkit-border-bottom-left-radius: 6px;
- border-bottom-left-radius: 6px;
- -webkit-border-top-left-radius: 6px;
- border-top-left-radius: 6px;
- -moz-border-radius-bottomleft: 6px;
- -moz-border-radius-topleft: 6px;
-}
-
-.btn-group > .btn.large:last-child,
-.btn-group > .large.dropdown-toggle {
- -webkit-border-top-right-radius: 6px;
- border-top-right-radius: 6px;
- -webkit-border-bottom-right-radius: 6px;
- border-bottom-right-radius: 6px;
- -moz-border-radius-topright: 6px;
- -moz-border-radius-bottomright: 6px;
-}
-
-.btn-group > .btn:hover,
-.btn-group > .btn:focus,
-.btn-group > .btn:active,
-.btn-group > .btn.active {
- z-index: 2;
-}
-
-.btn-group .dropdown-toggle:active,
-.btn-group.open .dropdown-toggle {
- outline: 0;
-}
-
-.btn-group > .btn + .dropdown-toggle {
- *padding-top: 5px;
- padding-right: 8px;
- *padding-bottom: 5px;
- padding-left: 8px;
- -webkit-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
- box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-
-.btn-group > .btn-mini + .dropdown-toggle {
- *padding-top: 2px;
- padding-right: 5px;
- *padding-bottom: 2px;
- padding-left: 5px;
-}
-
-.btn-group > .btn-small + .dropdown-toggle {
- *padding-top: 5px;
- *padding-bottom: 4px;
-}
-
-.btn-group > .btn-large + .dropdown-toggle {
- *padding-top: 7px;
- padding-right: 12px;
- *padding-bottom: 7px;
- padding-left: 12px;
-}
-
-.btn-group.open .dropdown-toggle {
- background-image: none;
- -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
- box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-
-.btn-group.open .btn.dropdown-toggle {
- background-color: #e6e6e6;
-}
-
-.btn-group.open .btn-primary.dropdown-toggle {
- background-color: #0044cc;
-}
-
-.btn-group.open .btn-warning.dropdown-toggle {
- background-color: #f89406;
-}
-
-.btn-group.open .btn-danger.dropdown-toggle {
- background-color: #bd362f;
-}
-
-.btn-group.open .btn-success.dropdown-toggle {
- background-color: #51a351;
-}
-
-.btn-group.open .btn-info.dropdown-toggle {
- background-color: #2f96b4;
-}
-
-.btn-group.open .btn-inverse.dropdown-toggle {
- background-color: #222222;
-}
-
-.btn .caret {
- margin-top: 8px;
- margin-left: 0;
-}
-
-.btn-large .caret {
- margin-top: 6px;
-}
-
-.btn-large .caret {
- border-top-width: 5px;
- border-right-width: 5px;
- border-left-width: 5px;
-}
-
-.btn-mini .caret,
-.btn-small .caret {
- margin-top: 8px;
-}
-
-.dropup .btn-large .caret {
- border-bottom-width: 5px;
-}
-
-.btn-primary .caret,
-.btn-warning .caret,
-.btn-danger .caret,
-.btn-info .caret,
-.btn-success .caret,
-.btn-inverse .caret {
- border-top-color: #ffffff;
- border-bottom-color: #ffffff;
-}
-
-.btn-group-vertical {
- display: inline-block;
- *display: inline;
- /* IE7 inline-block hack */
-
- *zoom: 1;
-}
-
-.btn-group-vertical > .btn {
- display: block;
- float: none;
- max-width: 100%;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.btn-group-vertical > .btn + .btn {
- margin-top: -1px;
- margin-left: 0;
-}
-
-.btn-group-vertical > .btn:first-child {
- -webkit-border-radius: 4px 4px 0 0;
- -moz-border-radius: 4px 4px 0 0;
- border-radius: 4px 4px 0 0;
-}
-
-.btn-group-vertical > .btn:last-child {
- -webkit-border-radius: 0 0 4px 4px;
- -moz-border-radius: 0 0 4px 4px;
- border-radius: 0 0 4px 4px;
-}
-
-.btn-group-vertical > .btn-large:first-child {
- -webkit-border-radius: 6px 6px 0 0;
- -moz-border-radius: 6px 6px 0 0;
- border-radius: 6px 6px 0 0;
-}
-
-.btn-group-vertical > .btn-large:last-child {
- -webkit-border-radius: 0 0 6px 6px;
- -moz-border-radius: 0 0 6px 6px;
- border-radius: 0 0 6px 6px;
-}
-
-.alert {
- padding: 8px 35px 8px 14px;
- margin-bottom: 20px;
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
- background-color: #fcf8e3;
- border: 1px solid #fbeed5;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.alert,
-.alert h4 {
- color: #c09853;
-}
-
-.alert h4 {
- margin: 0;
-}
-
-.alert .close {
- position: relative;
- top: -2px;
- right: -21px;
- line-height: 20px;
-}
-
-.alert-success {
- color: #468847;
- background-color: #dff0d8;
- border-color: #d6e9c6;
-}
-
-.alert-success h4 {
- color: #468847;
-}
-
-.alert-danger,
-.alert-error {
- color: #b94a48;
- background-color: #f2dede;
- border-color: #eed3d7;
-}
-
-.alert-danger h4,
-.alert-error h4 {
- color: #b94a48;
-}
-
-.alert-info {
- color: #3a87ad;
- background-color: #d9edf7;
- border-color: #bce8f1;
-}
-
-.alert-info h4 {
- color: #3a87ad;
-}
-
-.alert-block {
- padding-top: 14px;
- padding-bottom: 14px;
-}
-
-.alert-block > p,
-.alert-block > ul {
- margin-bottom: 0;
-}
-
-.alert-block p + p {
- margin-top: 5px;
-}
-
-.nav {
- margin-bottom: 20px;
- margin-left: 0;
- list-style: none;
-}
-
-.nav > li > a {
- display: block;
-}
-
-.nav > li > a:hover,
-.nav > li > a:focus {
- text-decoration: none;
- background-color: #eeeeee;
-}
-
-.nav > li > a > img {
- max-width: none;
-}
-
-.nav > .pull-right {
- float: right;
-}
-
-.nav-header {
- display: block;
- padding: 3px 15px;
- font-size: 11px;
- font-weight: bold;
- line-height: 20px;
- color: #999999;
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
- text-transform: uppercase;
-}
-
-.nav li + .nav-header {
- margin-top: 9px;
-}
-
-.nav-list {
- padding-right: 15px;
- padding-left: 15px;
- margin-bottom: 0;
-}
-
-.nav-list > li > a,
-.nav-list .nav-header {
- margin-right: -15px;
- margin-left: -15px;
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
-}
-
-.nav-list > li > a {
- padding: 3px 15px;
-}
-
-.nav-list > .active > a,
-.nav-list > .active > a:hover,
-.nav-list > .active > a:focus {
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
- background-color: #0088cc;
-}
-
-.nav-list [class^="icon-"],
-.nav-list [class*=" icon-"] {
- margin-right: 2px;
-}
-
-.nav-list .divider {
- *width: 100%;
- height: 1px;
- margin: 9px 1px;
- *margin: -5px 0 5px;
- overflow: hidden;
- background-color: #e5e5e5;
- border-bottom: 1px solid #ffffff;
-}
-
-.nav-tabs,
-.nav-pills {
- *zoom: 1;
-}
-
-.nav-tabs:before,
-.nav-pills:before,
-.nav-tabs:after,
-.nav-pills:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.nav-tabs:after,
-.nav-pills:after {
- clear: both;
-}
-
-.nav-tabs > li,
-.nav-pills > li {
- float: left;
-}
-
-.nav-tabs > li > a,
-.nav-pills > li > a {
- padding-right: 12px;
- padding-left: 12px;
- margin-right: 2px;
- line-height: 14px;
-}
-
-.nav-tabs {
- border-bottom: 1px solid #ddd;
-}
-
-.nav-tabs > li {
- margin-bottom: -1px;
-}
-
-.nav-tabs > li > a {
- padding-top: 8px;
- padding-bottom: 8px;
- line-height: 20px;
- border: 1px solid transparent;
- -webkit-border-radius: 4px 4px 0 0;
- -moz-border-radius: 4px 4px 0 0;
- border-radius: 4px 4px 0 0;
-}
-
-.nav-tabs > li > a:hover,
-.nav-tabs > li > a:focus {
- border-color: #eeeeee #eeeeee #dddddd;
-}
-
-.nav-tabs > .active > a,
-.nav-tabs > .active > a:hover,
-.nav-tabs > .active > a:focus {
- color: #555555;
- cursor: default;
- background-color: #ffffff;
- border: 1px solid #ddd;
- border-bottom-color: transparent;
-}
-
-.nav-pills > li > a {
- padding-top: 8px;
- padding-bottom: 8px;
- margin-top: 2px;
- margin-bottom: 2px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
-}
-
-.nav-pills > .active > a,
-.nav-pills > .active > a:hover,
-.nav-pills > .active > a:focus {
- color: #ffffff;
- background-color: #0088cc;
-}
-
-.nav-stacked > li {
- float: none;
-}
-
-.nav-stacked > li > a {
- margin-right: 0;
-}
-
-.nav-tabs.nav-stacked {
- border-bottom: 0;
-}
-
-.nav-tabs.nav-stacked > li > a {
- border: 1px solid #ddd;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.nav-tabs.nav-stacked > li:first-child > a {
- -webkit-border-top-right-radius: 4px;
- border-top-right-radius: 4px;
- -webkit-border-top-left-radius: 4px;
- border-top-left-radius: 4px;
- -moz-border-radius-topright: 4px;
- -moz-border-radius-topleft: 4px;
-}
-
-.nav-tabs.nav-stacked > li:last-child > a {
- -webkit-border-bottom-right-radius: 4px;
- border-bottom-right-radius: 4px;
- -webkit-border-bottom-left-radius: 4px;
- border-bottom-left-radius: 4px;
- -moz-border-radius-bottomright: 4px;
- -moz-border-radius-bottomleft: 4px;
-}
-
-.nav-tabs.nav-stacked > li > a:hover,
-.nav-tabs.nav-stacked > li > a:focus {
- z-index: 2;
- border-color: #ddd;
-}
-
-.nav-pills.nav-stacked > li > a {
- margin-bottom: 3px;
-}
-
-.nav-pills.nav-stacked > li:last-child > a {
- margin-bottom: 1px;
-}
-
-.nav-tabs .dropdown-menu {
- -webkit-border-radius: 0 0 6px 6px;
- -moz-border-radius: 0 0 6px 6px;
- border-radius: 0 0 6px 6px;
-}
-
-.nav-pills .dropdown-menu {
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
-}
-
-.nav .dropdown-toggle .caret {
- margin-top: 6px;
- border-top-color: #0088cc;
- border-bottom-color: #0088cc;
-}
-
-.nav .dropdown-toggle:hover .caret,
-.nav .dropdown-toggle:focus .caret {
- border-top-color: #005580;
- border-bottom-color: #005580;
-}
-
-/* move down carets for tabs */
-
-.nav-tabs .dropdown-toggle .caret {
- margin-top: 8px;
-}
-
-.nav .active .dropdown-toggle .caret {
- border-top-color: #fff;
- border-bottom-color: #fff;
-}
-
-.nav-tabs .active .dropdown-toggle .caret {
- border-top-color: #555555;
- border-bottom-color: #555555;
-}
-
-.nav > .dropdown.active > a:hover,
-.nav > .dropdown.active > a:focus {
- cursor: pointer;
-}
-
-.nav-tabs .open .dropdown-toggle,
-.nav-pills .open .dropdown-toggle,
-.nav > li.dropdown.open.active > a:hover,
-.nav > li.dropdown.open.active > a:focus {
- color: #ffffff;
- background-color: #999999;
- border-color: #999999;
-}
-
-.nav li.dropdown.open .caret,
-.nav li.dropdown.open.active .caret,
-.nav li.dropdown.open a:hover .caret,
-.nav li.dropdown.open a:focus .caret {
- border-top-color: #ffffff;
- border-bottom-color: #ffffff;
- opacity: 1;
- filter: alpha(opacity=100);
-}
-
-.tabs-stacked .open > a:hover,
-.tabs-stacked .open > a:focus {
- border-color: #999999;
-}
-
-.tabbable {
- *zoom: 1;
-}
-
-.tabbable:before,
-.tabbable:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.tabbable:after {
- clear: both;
-}
-
-.tab-content {
- overflow: auto;
-}
-
-.tabs-below > .nav-tabs,
-.tabs-right > .nav-tabs,
-.tabs-left > .nav-tabs {
- border-bottom: 0;
-}
-
-.tab-content > .tab-pane,
-.pill-content > .pill-pane {
- display: none;
-}
-
-.tab-content > .active,
-.pill-content > .active {
- display: block;
-}
-
-.tabs-below > .nav-tabs {
- border-top: 1px solid #ddd;
-}
-
-.tabs-below > .nav-tabs > li {
- margin-top: -1px;
- margin-bottom: 0;
-}
-
-.tabs-below > .nav-tabs > li > a {
- -webkit-border-radius: 0 0 4px 4px;
- -moz-border-radius: 0 0 4px 4px;
- border-radius: 0 0 4px 4px;
-}
-
-.tabs-below > .nav-tabs > li > a:hover,
-.tabs-below > .nav-tabs > li > a:focus {
- border-top-color: #ddd;
- border-bottom-color: transparent;
-}
-
-.tabs-below > .nav-tabs > .active > a,
-.tabs-below > .nav-tabs > .active > a:hover,
-.tabs-below > .nav-tabs > .active > a:focus {
- border-color: transparent #ddd #ddd #ddd;
-}
-
-.tabs-left > .nav-tabs > li,
-.tabs-right > .nav-tabs > li {
- float: none;
-}
-
-.tabs-left > .nav-tabs > li > a,
-.tabs-right > .nav-tabs > li > a {
- min-width: 74px;
- margin-right: 0;
- margin-bottom: 3px;
-}
-
-.tabs-left > .nav-tabs {
- float: left;
- margin-right: 19px;
- border-right: 1px solid #ddd;
-}
-
-.tabs-left > .nav-tabs > li > a {
- margin-right: -1px;
- -webkit-border-radius: 4px 0 0 4px;
- -moz-border-radius: 4px 0 0 4px;
- border-radius: 4px 0 0 4px;
-}
-
-.tabs-left > .nav-tabs > li > a:hover,
-.tabs-left > .nav-tabs > li > a:focus {
- border-color: #eeeeee #dddddd #eeeeee #eeeeee;
-}
-
-.tabs-left > .nav-tabs .active > a,
-.tabs-left > .nav-tabs .active > a:hover,
-.tabs-left > .nav-tabs .active > a:focus {
- border-color: #ddd transparent #ddd #ddd;
- *border-right-color: #ffffff;
-}
-
-.tabs-right > .nav-tabs {
- float: right;
- margin-left: 19px;
- border-left: 1px solid #ddd;
-}
-
-.tabs-right > .nav-tabs > li > a {
- margin-left: -1px;
- -webkit-border-radius: 0 4px 4px 0;
- -moz-border-radius: 0 4px 4px 0;
- border-radius: 0 4px 4px 0;
-}
-
-.tabs-right > .nav-tabs > li > a:hover,
-.tabs-right > .nav-tabs > li > a:focus {
- border-color: #eeeeee #eeeeee #eeeeee #dddddd;
-}
-
-.tabs-right > .nav-tabs .active > a,
-.tabs-right > .nav-tabs .active > a:hover,
-.tabs-right > .nav-tabs .active > a:focus {
- border-color: #ddd #ddd #ddd transparent;
- *border-left-color: #ffffff;
-}
-
-.nav > .disabled > a {
- color: #999999;
-}
-
-.nav > .disabled > a:hover,
-.nav > .disabled > a:focus {
- text-decoration: none;
- cursor: default;
- background-color: transparent;
-}
-
-.navbar {
- *position: relative;
- *z-index: 2;
- margin-bottom: 20px;
- overflow: visible;
-}
-
-.navbar-inner {
- min-height: 40px;
- padding-right: 20px;
- padding-left: 20px;
- background-color: #fafafa;
- background-image: -moz-linear-gradient(top, #ffffff, #f2f2f2);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f2f2f2));
- background-image: -webkit-linear-gradient(top, #ffffff, #f2f2f2);
- background-image: -o-linear-gradient(top, #ffffff, #f2f2f2);
- background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);
- background-repeat: repeat-x;
- border: 1px solid #d4d4d4;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);
- *zoom: 1;
- -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
- -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
-}
-
-.navbar-inner:before,
-.navbar-inner:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.navbar-inner:after {
- clear: both;
-}
-
-.navbar .container {
- width: auto;
-}
-
-.nav-collapse.collapse {
- height: auto;
- overflow: visible;
-}
-
-.navbar .brand {
- display: block;
- float: left;
- padding: 10px 20px 10px;
- margin-left: -20px;
- font-size: 20px;
- font-weight: 200;
- color: #777777;
- text-shadow: 0 1px 0 #ffffff;
-}
-
-.navbar .brand:hover,
-.navbar .brand:focus {
- text-decoration: none;
-}
-
-.navbar-text {
- margin-bottom: 0;
- line-height: 40px;
- color: #777777;
-}
-
-.navbar-link {
- color: #777777;
-}
-
-.navbar-link:hover,
-.navbar-link:focus {
- color: #333333;
-}
-
-.navbar .divider-vertical {
- height: 40px;
- margin: 0 9px;
- border-right: 1px solid #ffffff;
- border-left: 1px solid #f2f2f2;
-}
-
-.navbar .btn,
-.navbar .btn-group {
- margin-top: 5px;
-}
-
-.navbar .btn-group .btn,
-.navbar .input-prepend .btn,
-.navbar .input-append .btn,
-.navbar .input-prepend .btn-group,
-.navbar .input-append .btn-group {
- margin-top: 0;
-}
-
-.navbar-form {
- margin-bottom: 0;
- *zoom: 1;
-}
-
-.navbar-form:before,
-.navbar-form:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.navbar-form:after {
- clear: both;
-}
-
-.navbar-form input,
-.navbar-form select,
-.navbar-form .radio,
-.navbar-form .checkbox {
- margin-top: 5px;
-}
-
-.navbar-form input,
-.navbar-form select,
-.navbar-form .btn {
- display: inline-block;
- margin-bottom: 0;
-}
-
-.navbar-form input[type="image"],
-.navbar-form input[type="checkbox"],
-.navbar-form input[type="radio"] {
- margin-top: 3px;
-}
-
-.navbar-form .input-append,
-.navbar-form .input-prepend {
- margin-top: 5px;
- white-space: nowrap;
-}
-
-.navbar-form .input-append input,
-.navbar-form .input-prepend input {
- margin-top: 0;
-}
-
-.navbar-search {
- position: relative;
- float: left;
- margin-top: 5px;
- margin-bottom: 0;
-}
-
-.navbar-search .search-query {
- padding: 4px 14px;
- margin-bottom: 0;
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
- font-size: 13px;
- font-weight: normal;
- line-height: 1;
- -webkit-border-radius: 15px;
- -moz-border-radius: 15px;
- border-radius: 15px;
-}
-
-.navbar-static-top {
- position: static;
- margin-bottom: 0;
-}
-
-.navbar-static-top .navbar-inner {
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.navbar-fixed-top,
-.navbar-fixed-bottom {
- position: fixed;
- right: 0;
- left: 0;
- z-index: 1030;
- margin-bottom: 0;
-}
-
-.navbar-fixed-top .navbar-inner,
-.navbar-static-top .navbar-inner {
- border-width: 0 0 1px;
-}
-
-.navbar-fixed-bottom .navbar-inner {
- border-width: 1px 0 0;
-}
-
-.navbar-fixed-top .navbar-inner,
-.navbar-fixed-bottom .navbar-inner {
- padding-right: 0;
- padding-left: 0;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
-}
-
-.navbar-static-top .container,
-.navbar-fixed-top .container,
-.navbar-fixed-bottom .container {
- width: 940px;
-}
-
-.navbar-fixed-top {
- top: 0;
-}
-
-.navbar-fixed-top .navbar-inner,
-.navbar-static-top .navbar-inner {
- -webkit-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
- -moz-box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
- box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
-}
-
-.navbar-fixed-bottom {
- bottom: 0;
-}
-
-.navbar-fixed-bottom .navbar-inner {
- -webkit-box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1);
- -moz-box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1);
- box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1);
-}
-
-.navbar .nav {
- position: relative;
- left: 0;
- display: block;
- float: left;
- margin: 0 10px 0 0;
-}
-
-.navbar .nav.pull-right {
- float: right;
- margin-right: 0;
-}
-
-.navbar .nav > li {
- float: left;
-}
-
-.navbar .nav > li > a {
- float: none;
- padding: 10px 15px 10px;
- color: #777777;
- text-decoration: none;
- text-shadow: 0 1px 0 #ffffff;
-}
-
-.navbar .nav .dropdown-toggle .caret {
- margin-top: 8px;
-}
-
-.navbar .nav > li > a:focus,
-.navbar .nav > li > a:hover {
- color: #333333;
- text-decoration: none;
- background-color: transparent;
-}
-
-.navbar .nav > .active > a,
-.navbar .nav > .active > a:hover,
-.navbar .nav > .active > a:focus {
- color: #555555;
- text-decoration: none;
- background-color: #e5e5e5;
- -webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
- -moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
- box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
-}
-
-.navbar .btn-navbar {
- display: none;
- float: right;
- padding: 7px 10px;
- margin-right: 5px;
- margin-left: 5px;
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #ededed;
- *background-color: #e5e5e5;
- background-image: -moz-linear-gradient(top, #f2f2f2, #e5e5e5);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f2f2f2), to(#e5e5e5));
- background-image: -webkit-linear-gradient(top, #f2f2f2, #e5e5e5);
- background-image: -o-linear-gradient(top, #f2f2f2, #e5e5e5);
- background-image: linear-gradient(to bottom, #f2f2f2, #e5e5e5);
- background-repeat: repeat-x;
- border-color: #e5e5e5 #e5e5e5 #bfbfbf;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffe5e5e5', GradientType=0);
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
- -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);
- -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);
-}
-
-.navbar .btn-navbar:hover,
-.navbar .btn-navbar:focus,
-.navbar .btn-navbar:active,
-.navbar .btn-navbar.active,
-.navbar .btn-navbar.disabled,
-.navbar .btn-navbar[disabled] {
- color: #ffffff;
- background-color: #e5e5e5;
- *background-color: #d9d9d9;
-}
-
-.navbar .btn-navbar:active,
-.navbar .btn-navbar.active {
- background-color: #cccccc \9;
-}
-
-.navbar .btn-navbar .icon-bar {
- display: block;
- width: 18px;
- height: 2px;
- background-color: #f5f5f5;
- -webkit-border-radius: 1px;
- -moz-border-radius: 1px;
- border-radius: 1px;
- -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
- -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
- box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
-}
-
-.btn-navbar .icon-bar + .icon-bar {
- margin-top: 3px;
-}
-
-.navbar .nav > li > .dropdown-menu:before {
- position: absolute;
- top: -7px;
- left: 9px;
- display: inline-block;
- border-right: 7px solid transparent;
- border-bottom: 7px solid #ccc;
- border-left: 7px solid transparent;
- border-bottom-color: rgba(0, 0, 0, 0.2);
- content: '';
-}
-
-.navbar .nav > li > .dropdown-menu:after {
- position: absolute;
- top: -6px;
- left: 10px;
- display: inline-block;
- border-right: 6px solid transparent;
- border-bottom: 6px solid #ffffff;
- border-left: 6px solid transparent;
- content: '';
-}
-
-.navbar-fixed-bottom .nav > li > .dropdown-menu:before {
- top: auto;
- bottom: -7px;
- border-top: 7px solid #ccc;
- border-bottom: 0;
- border-top-color: rgba(0, 0, 0, 0.2);
-}
-
-.navbar-fixed-bottom .nav > li > .dropdown-menu:after {
- top: auto;
- bottom: -6px;
- border-top: 6px solid #ffffff;
- border-bottom: 0;
-}
-
-.navbar .nav li.dropdown > a:hover .caret,
-.navbar .nav li.dropdown > a:focus .caret {
- border-top-color: #333333;
- border-bottom-color: #333333;
-}
-
-.navbar .nav li.dropdown.open > .dropdown-toggle,
-.navbar .nav li.dropdown.active > .dropdown-toggle,
-.navbar .nav li.dropdown.open.active > .dropdown-toggle {
- color: #555555;
- background-color: #e5e5e5;
-}
-
-.navbar .nav li.dropdown > .dropdown-toggle .caret {
- border-top-color: #777777;
- border-bottom-color: #777777;
-}
-
-.navbar .nav li.dropdown.open > .dropdown-toggle .caret,
-.navbar .nav li.dropdown.active > .dropdown-toggle .caret,
-.navbar .nav li.dropdown.open.active > .dropdown-toggle .caret {
- border-top-color: #555555;
- border-bottom-color: #555555;
-}
-
-.navbar .pull-right > li > .dropdown-menu,
-.navbar .nav > li > .dropdown-menu.pull-right {
- right: 0;
- left: auto;
-}
-
-.navbar .pull-right > li > .dropdown-menu:before,
-.navbar .nav > li > .dropdown-menu.pull-right:before {
- right: 12px;
- left: auto;
-}
-
-.navbar .pull-right > li > .dropdown-menu:after,
-.navbar .nav > li > .dropdown-menu.pull-right:after {
- right: 13px;
- left: auto;
-}
-
-.navbar .pull-right > li > .dropdown-menu .dropdown-menu,
-.navbar .nav > li > .dropdown-menu.pull-right .dropdown-menu {
- right: 100%;
- left: auto;
- margin-right: -1px;
- margin-left: 0;
- -webkit-border-radius: 6px 0 6px 6px;
- -moz-border-radius: 6px 0 6px 6px;
- border-radius: 6px 0 6px 6px;
-}
-
-.navbar-inverse .navbar-inner {
- background-color: #1b1b1b;
- background-image: -moz-linear-gradient(top, #222222, #111111);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111));
- background-image: -webkit-linear-gradient(top, #222222, #111111);
- background-image: -o-linear-gradient(top, #222222, #111111);
- background-image: linear-gradient(to bottom, #222222, #111111);
- background-repeat: repeat-x;
- border-color: #252525;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0);
-}
-
-.navbar-inverse .brand,
-.navbar-inverse .nav > li > a {
- color: #999999;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
-}
-
-.navbar-inverse .brand:hover,
-.navbar-inverse .nav > li > a:hover,
-.navbar-inverse .brand:focus,
-.navbar-inverse .nav > li > a:focus {
- color: #ffffff;
-}
-
-.navbar-inverse .brand {
- color: #999999;
-}
-
-.navbar-inverse .navbar-text {
- color: #999999;
-}
-
-.navbar-inverse .nav > li > a:focus,
-.navbar-inverse .nav > li > a:hover {
- color: #ffffff;
- background-color: transparent;
-}
-
-.navbar-inverse .nav .active > a,
-.navbar-inverse .nav .active > a:hover,
-.navbar-inverse .nav .active > a:focus {
- color: #ffffff;
- background-color: #111111;
-}
-
-.navbar-inverse .navbar-link {
- color: #999999;
-}
-
-.navbar-inverse .navbar-link:hover,
-.navbar-inverse .navbar-link:focus {
- color: #ffffff;
-}
-
-.navbar-inverse .divider-vertical {
- border-right-color: #222222;
- border-left-color: #111111;
-}
-
-.navbar-inverse .nav li.dropdown.open > .dropdown-toggle,
-.navbar-inverse .nav li.dropdown.active > .dropdown-toggle,
-.navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle {
- color: #ffffff;
- background-color: #111111;
-}
-
-.navbar-inverse .nav li.dropdown > a:hover .caret,
-.navbar-inverse .nav li.dropdown > a:focus .caret {
- border-top-color: #ffffff;
- border-bottom-color: #ffffff;
-}
-
-.navbar-inverse .nav li.dropdown > .dropdown-toggle .caret {
- border-top-color: #999999;
- border-bottom-color: #999999;
-}
-
-.navbar-inverse .nav li.dropdown.open > .dropdown-toggle .caret,
-.navbar-inverse .nav li.dropdown.active > .dropdown-toggle .caret,
-.navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle .caret {
- border-top-color: #ffffff;
- border-bottom-color: #ffffff;
-}
-
-.navbar-inverse .navbar-search .search-query {
- color: #ffffff;
- background-color: #515151;
- border-color: #111111;
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15);
- -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15);
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15);
- -webkit-transition: none;
- -moz-transition: none;
- -o-transition: none;
- transition: none;
-}
-
-.navbar-inverse .navbar-search .search-query:-moz-placeholder {
- color: #cccccc;
-}
-
-.navbar-inverse .navbar-search .search-query:-ms-input-placeholder {
- color: #cccccc;
-}
-
-.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder {
- color: #cccccc;
-}
-
-.navbar-inverse .navbar-search .search-query:focus,
-.navbar-inverse .navbar-search .search-query.focused {
- padding: 5px 15px;
- color: #333333;
- text-shadow: 0 1px 0 #ffffff;
- background-color: #ffffff;
- border: 0;
- outline: 0;
- -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
- -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
- box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
-}
-
-.navbar-inverse .btn-navbar {
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #0e0e0e;
- *background-color: #040404;
- background-image: -moz-linear-gradient(top, #151515, #040404);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#151515), to(#040404));
- background-image: -webkit-linear-gradient(top, #151515, #040404);
- background-image: -o-linear-gradient(top, #151515, #040404);
- background-image: linear-gradient(to bottom, #151515, #040404);
- background-repeat: repeat-x;
- border-color: #040404 #040404 #000000;
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff151515', endColorstr='#ff040404', GradientType=0);
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-}
-
-.navbar-inverse .btn-navbar:hover,
-.navbar-inverse .btn-navbar:focus,
-.navbar-inverse .btn-navbar:active,
-.navbar-inverse .btn-navbar.active,
-.navbar-inverse .btn-navbar.disabled,
-.navbar-inverse .btn-navbar[disabled] {
- color: #ffffff;
- background-color: #040404;
- *background-color: #000000;
-}
-
-.navbar-inverse .btn-navbar:active,
-.navbar-inverse .btn-navbar.active {
- background-color: #000000 \9;
-}
-
-.breadcrumb {
- padding: 8px 15px;
- margin: 0 0 20px;
- list-style: none;
- background-color: #f5f5f5;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.breadcrumb > li {
- display: inline-block;
- *display: inline;
- text-shadow: 0 1px 0 #ffffff;
- *zoom: 1;
-}
-
-.breadcrumb > li > .divider {
- padding: 0 5px;
- color: #ccc;
-}
-
-.breadcrumb > .active {
- color: #999999;
-}
-
-.pagination {
- margin: 20px 0;
-}
-
-.pagination ul {
- display: inline-block;
- *display: inline;
- margin-bottom: 0;
- margin-left: 0;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- *zoom: 1;
- -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
- -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
-}
-
-.pagination ul > li {
- display: inline;
-}
-
-.pagination ul > li > a,
-.pagination ul > li > span {
- float: left;
- padding: 4px 12px;
- line-height: 20px;
- text-decoration: none;
- background-color: #ffffff;
- border: 1px solid #dddddd;
- border-left-width: 0;
-}
-
-.pagination ul > li > a:hover,
-.pagination ul > li > a:focus,
-.pagination ul > .active > a,
-.pagination ul > .active > span {
- background-color: #f5f5f5;
-}
-
-.pagination ul > .active > a,
-.pagination ul > .active > span {
- color: #999999;
- cursor: default;
-}
-
-.pagination ul > .disabled > span,
-.pagination ul > .disabled > a,
-.pagination ul > .disabled > a:hover,
-.pagination ul > .disabled > a:focus {
- color: #999999;
- cursor: default;
- background-color: transparent;
-}
-
-.pagination ul > li:first-child > a,
-.pagination ul > li:first-child > span {
- border-left-width: 1px;
- -webkit-border-bottom-left-radius: 4px;
- border-bottom-left-radius: 4px;
- -webkit-border-top-left-radius: 4px;
- border-top-left-radius: 4px;
- -moz-border-radius-bottomleft: 4px;
- -moz-border-radius-topleft: 4px;
-}
-
-.pagination ul > li:last-child > a,
-.pagination ul > li:last-child > span {
- -webkit-border-top-right-radius: 4px;
- border-top-right-radius: 4px;
- -webkit-border-bottom-right-radius: 4px;
- border-bottom-right-radius: 4px;
- -moz-border-radius-topright: 4px;
- -moz-border-radius-bottomright: 4px;
-}
-
-.pagination-centered {
- text-align: center;
-}
-
-.pagination-right {
- text-align: right;
-}
-
-.pagination-large ul > li > a,
-.pagination-large ul > li > span {
- padding: 11px 19px;
- font-size: 17.5px;
-}
-
-.pagination-large ul > li:first-child > a,
-.pagination-large ul > li:first-child > span {
- -webkit-border-bottom-left-radius: 6px;
- border-bottom-left-radius: 6px;
- -webkit-border-top-left-radius: 6px;
- border-top-left-radius: 6px;
- -moz-border-radius-bottomleft: 6px;
- -moz-border-radius-topleft: 6px;
-}
-
-.pagination-large ul > li:last-child > a,
-.pagination-large ul > li:last-child > span {
- -webkit-border-top-right-radius: 6px;
- border-top-right-radius: 6px;
- -webkit-border-bottom-right-radius: 6px;
- border-bottom-right-radius: 6px;
- -moz-border-radius-topright: 6px;
- -moz-border-radius-bottomright: 6px;
-}
-
-.pagination-mini ul > li:first-child > a,
-.pagination-small ul > li:first-child > a,
-.pagination-mini ul > li:first-child > span,
-.pagination-small ul > li:first-child > span {
- -webkit-border-bottom-left-radius: 3px;
- border-bottom-left-radius: 3px;
- -webkit-border-top-left-radius: 3px;
- border-top-left-radius: 3px;
- -moz-border-radius-bottomleft: 3px;
- -moz-border-radius-topleft: 3px;
-}
-
-.pagination-mini ul > li:last-child > a,
-.pagination-small ul > li:last-child > a,
-.pagination-mini ul > li:last-child > span,
-.pagination-small ul > li:last-child > span {
- -webkit-border-top-right-radius: 3px;
- border-top-right-radius: 3px;
- -webkit-border-bottom-right-radius: 3px;
- border-bottom-right-radius: 3px;
- -moz-border-radius-topright: 3px;
- -moz-border-radius-bottomright: 3px;
-}
-
-.pagination-small ul > li > a,
-.pagination-small ul > li > span {
- padding: 2px 10px;
- font-size: 11.9px;
-}
-
-.pagination-mini ul > li > a,
-.pagination-mini ul > li > span {
- padding: 0 6px;
- font-size: 10.5px;
-}
-
-.pager {
- margin: 20px 0;
- text-align: center;
- list-style: none;
- *zoom: 1;
-}
-
-.pager:before,
-.pager:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.pager:after {
- clear: both;
-}
-
-.pager li {
- display: inline;
-}
-
-.pager li > a,
-.pager li > span {
- display: inline-block;
- padding: 5px 14px;
- background-color: #fff;
- border: 1px solid #ddd;
- -webkit-border-radius: 15px;
- -moz-border-radius: 15px;
- border-radius: 15px;
-}
-
-.pager li > a:hover,
-.pager li > a:focus {
- text-decoration: none;
- background-color: #f5f5f5;
-}
-
-.pager .next > a,
-.pager .next > span {
- float: right;
-}
-
-.pager .previous > a,
-.pager .previous > span {
- float: left;
-}
-
-.pager .disabled > a,
-.pager .disabled > a:hover,
-.pager .disabled > a:focus,
-.pager .disabled > span {
- color: #999999;
- cursor: default;
- background-color: #fff;
-}
-
-.modal-backdrop {
- position: fixed;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: 1040;
- background-color: #000000;
-}
-
-.modal-backdrop.fade {
- opacity: 0;
-}
-
-.modal-backdrop,
-.modal-backdrop.fade.in {
- opacity: 0.8;
- filter: alpha(opacity=80);
-}
-
-.modal {
- position: fixed;
- top: 10%;
- left: 50%;
- z-index: 1050;
- width: 560px;
- margin-left: -280px;
- background-color: #ffffff;
- border: 1px solid #999;
- border: 1px solid rgba(0, 0, 0, 0.3);
- *border: 1px solid #999;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
- outline: none;
- -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
- -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
- box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
- -webkit-background-clip: padding-box;
- -moz-background-clip: padding-box;
- background-clip: padding-box;
-}
-
-.modal.fade {
- top: -25%;
- -webkit-transition: opacity 0.3s linear, top 0.3s ease-out;
- -moz-transition: opacity 0.3s linear, top 0.3s ease-out;
- -o-transition: opacity 0.3s linear, top 0.3s ease-out;
- transition: opacity 0.3s linear, top 0.3s ease-out;
-}
-
-.modal.fade.in {
- top: 10%;
-}
-
-.modal-header {
- padding: 9px 15px;
- border-bottom: 1px solid #eee;
-}
-
-.modal-header .close {
- margin-top: 2px;
-}
-
-.modal-header h3 {
- margin: 0;
- line-height: 30px;
-}
-
-.modal-body {
- position: relative;
- max-height: 400px;
- padding: 15px;
- overflow-y: auto;
-}
-
-.modal-form {
- margin-bottom: 0;
-}
-
-.modal-footer {
- padding: 14px 15px 15px;
- margin-bottom: 0;
- text-align: right;
- background-color: #f5f5f5;
- border-top: 1px solid #ddd;
- -webkit-border-radius: 0 0 6px 6px;
- -moz-border-radius: 0 0 6px 6px;
- border-radius: 0 0 6px 6px;
- *zoom: 1;
- -webkit-box-shadow: inset 0 1px 0 #ffffff;
- -moz-box-shadow: inset 0 1px 0 #ffffff;
- box-shadow: inset 0 1px 0 #ffffff;
-}
-
-.modal-footer:before,
-.modal-footer:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.modal-footer:after {
- clear: both;
-}
-
-.modal-footer .btn + .btn {
- margin-bottom: 0;
- margin-left: 5px;
-}
-
-.modal-footer .btn-group .btn + .btn {
- margin-left: -1px;
-}
-
-.modal-footer .btn-block + .btn-block {
- margin-left: 0;
-}
-
-.tooltip {
- position: absolute;
- z-index: 1030;
- display: block;
- font-size: 11px;
- line-height: 1.4;
- opacity: 0;
- filter: alpha(opacity=0);
- visibility: visible;
-}
-
-.tooltip.in {
- opacity: 0.8;
- filter: alpha(opacity=80);
-}
-
-.tooltip.top {
- padding: 5px 0;
- margin-top: -3px;
-}
-
-.tooltip.right {
- padding: 0 5px;
- margin-left: 3px;
-}
-
-.tooltip.bottom {
- padding: 5px 0;
- margin-top: 3px;
-}
-
-.tooltip.left {
- padding: 0 5px;
- margin-left: -3px;
-}
-
-.tooltip-inner {
- max-width: 200px;
- padding: 8px;
- color: #ffffff;
- text-align: center;
- text-decoration: none;
- background-color: #000000;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.tooltip-arrow {
- position: absolute;
- width: 0;
- height: 0;
- border-color: transparent;
- border-style: solid;
-}
-
-.tooltip.top .tooltip-arrow {
- bottom: 0;
- left: 50%;
- margin-left: -5px;
- border-top-color: #000000;
- border-width: 5px 5px 0;
-}
-
-.tooltip.right .tooltip-arrow {
- top: 50%;
- left: 0;
- margin-top: -5px;
- border-right-color: #000000;
- border-width: 5px 5px 5px 0;
-}
-
-.tooltip.left .tooltip-arrow {
- top: 50%;
- right: 0;
- margin-top: -5px;
- border-left-color: #000000;
- border-width: 5px 0 5px 5px;
-}
-
-.tooltip.bottom .tooltip-arrow {
- top: 0;
- left: 50%;
- margin-left: -5px;
- border-bottom-color: #000000;
- border-width: 0 5px 5px;
-}
-
-.popover {
- position: absolute;
- top: 0;
- left: 0;
- z-index: 1010;
- display: none;
- max-width: 276px;
- padding: 1px;
- text-align: left;
- white-space: normal;
- background-color: #ffffff;
- border: 1px solid #ccc;
- border: 1px solid rgba(0, 0, 0, 0.2);
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
- -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- -webkit-background-clip: padding-box;
- -moz-background-clip: padding;
- background-clip: padding-box;
-}
-
-.popover.top {
- margin-top: -10px;
-}
-
-.popover.right {
- margin-left: 10px;
-}
-
-.popover.bottom {
- margin-top: 10px;
-}
-
-.popover.left {
- margin-left: -10px;
-}
-
-.popover-title {
- padding: 8px 14px;
- margin: 0;
- font-size: 14px;
- font-weight: normal;
- line-height: 18px;
- background-color: #f7f7f7;
- border-bottom: 1px solid #ebebeb;
- -webkit-border-radius: 5px 5px 0 0;
- -moz-border-radius: 5px 5px 0 0;
- border-radius: 5px 5px 0 0;
-}
-
-.popover-title:empty {
- display: none;
-}
-
-.popover-content {
- padding: 9px 14px;
-}
-
-.popover .arrow,
-.popover .arrow:after {
- position: absolute;
- display: block;
- width: 0;
- height: 0;
- border-color: transparent;
- border-style: solid;
-}
-
-.popover .arrow {
- border-width: 11px;
-}
-
-.popover .arrow:after {
- border-width: 10px;
- content: "";
-}
-
-.popover.top .arrow {
- bottom: -11px;
- left: 50%;
- margin-left: -11px;
- border-top-color: #999;
- border-top-color: rgba(0, 0, 0, 0.25);
- border-bottom-width: 0;
-}
-
-.popover.top .arrow:after {
- bottom: 1px;
- margin-left: -10px;
- border-top-color: #ffffff;
- border-bottom-width: 0;
-}
-
-.popover.right .arrow {
- top: 50%;
- left: -11px;
- margin-top: -11px;
- border-right-color: #999;
- border-right-color: rgba(0, 0, 0, 0.25);
- border-left-width: 0;
-}
-
-.popover.right .arrow:after {
- bottom: -10px;
- left: 1px;
- border-right-color: #ffffff;
- border-left-width: 0;
-}
-
-.popover.bottom .arrow {
- top: -11px;
- left: 50%;
- margin-left: -11px;
- border-bottom-color: #999;
- border-bottom-color: rgba(0, 0, 0, 0.25);
- border-top-width: 0;
-}
-
-.popover.bottom .arrow:after {
- top: 1px;
- margin-left: -10px;
- border-bottom-color: #ffffff;
- border-top-width: 0;
-}
-
-.popover.left .arrow {
- top: 50%;
- right: -11px;
- margin-top: -11px;
- border-left-color: #999;
- border-left-color: rgba(0, 0, 0, 0.25);
- border-right-width: 0;
-}
-
-.popover.left .arrow:after {
- right: 1px;
- bottom: -10px;
- border-left-color: #ffffff;
- border-right-width: 0;
-}
-
-.thumbnails {
- margin-left: -20px;
- list-style: none;
- *zoom: 1;
-}
-
-.thumbnails:before,
-.thumbnails:after {
- display: table;
- line-height: 0;
- content: "";
-}
-
-.thumbnails:after {
- clear: both;
-}
-
-.row-fluid .thumbnails {
- margin-left: 0;
-}
-
-.thumbnails > li {
- float: left;
- margin-bottom: 20px;
- margin-left: 20px;
-}
-
-.thumbnail {
- display: block;
- padding: 4px;
- line-height: 20px;
- border: 1px solid #ddd;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
- -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
- -webkit-transition: all 0.2s ease-in-out;
- -moz-transition: all 0.2s ease-in-out;
- -o-transition: all 0.2s ease-in-out;
- transition: all 0.2s ease-in-out;
-}
-
-a.thumbnail:hover,
-a.thumbnail:focus {
- border-color: #0088cc;
- -webkit-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
- -moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
- box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
-}
-
-.thumbnail > img {
- display: block;
- max-width: 100%;
- margin-right: auto;
- margin-left: auto;
-}
-
-.thumbnail .caption {
- padding: 9px;
- color: #555555;
-}
-
-.media,
-.media-body {
- overflow: hidden;
- *overflow: visible;
- zoom: 1;
-}
-
-.media,
-.media .media {
- margin-top: 15px;
-}
-
-.media:first-child {
- margin-top: 0;
-}
-
-.media-object {
- display: block;
-}
-
-.media-heading {
- margin: 0 0 5px;
-}
-
-.media > .pull-left {
- margin-right: 10px;
-}
-
-.media > .pull-right {
- margin-left: 10px;
-}
-
-.media-list {
- margin-left: 0;
- list-style: none;
-}
-
-.label,
-.badge {
- display: inline-block;
- padding: 2px 4px;
- font-size: 11.844px;
- font-weight: bold;
- line-height: 14px;
- color: #ffffff;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- white-space: nowrap;
- vertical-align: baseline;
- background-color: #999999;
-}
-
-.label {
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
-.badge {
- padding-right: 9px;
- padding-left: 9px;
- -webkit-border-radius: 9px;
- -moz-border-radius: 9px;
- border-radius: 9px;
-}
-
-.label:empty,
-.badge:empty {
- display: none;
-}
-
-a.label:hover,
-a.label:focus,
-a.badge:hover,
-a.badge:focus {
- color: #ffffff;
- text-decoration: none;
- cursor: pointer;
-}
-
-.label-important,
-.badge-important {
- background-color: #b94a48;
-}
-
-.label-important[href],
-.badge-important[href] {
- background-color: #953b39;
-}
-
-.label-warning,
-.badge-warning {
- background-color: #f89406;
-}
-
-.label-warning[href],
-.badge-warning[href] {
- background-color: #c67605;
-}
-
-.label-success,
-.badge-success {
- background-color: #468847;
-}
-
-.label-success[href],
-.badge-success[href] {
- background-color: #356635;
-}
-
-.label-info,
-.badge-info {
- background-color: #3a87ad;
-}
-
-.label-info[href],
-.badge-info[href] {
- background-color: #2d6987;
-}
-
-.label-inverse,
-.badge-inverse {
- background-color: #333333;
-}
-
-.label-inverse[href],
-.badge-inverse[href] {
- background-color: #1a1a1a;
-}
-
-.btn .label,
-.btn .badge {
- position: relative;
- top: -1px;
-}
-
-.btn-mini .label,
-.btn-mini .badge {
- top: 0;
-}
-
-@-webkit-keyframes progress-bar-stripes {
- from {
- background-position: 40px 0;
- }
- to {
- background-position: 0 0;
- }
-}
-
-@-moz-keyframes progress-bar-stripes {
- from {
- background-position: 40px 0;
- }
- to {
- background-position: 0 0;
- }
-}
-
-@-ms-keyframes progress-bar-stripes {
- from {
- background-position: 40px 0;
- }
- to {
- background-position: 0 0;
- }
-}
-
-@-o-keyframes progress-bar-stripes {
- from {
- background-position: 0 0;
- }
- to {
- background-position: 40px 0;
- }
-}
-
-@keyframes progress-bar-stripes {
- from {
- background-position: 40px 0;
- }
- to {
- background-position: 0 0;
- }
-}
-
-.progress {
- height: 20px;
- margin-bottom: 20px;
- overflow: hidden;
- background-color: #f7f7f7;
- background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9));
- background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9);
- background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9);
- background-image: linear-gradient(to bottom, #f5f5f5, #f9f9f9);
- background-repeat: repeat-x;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0);
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
- -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
-}
-
-.progress .bar {
- float: left;
- width: 0;
- height: 100%;
- font-size: 12px;
- color: #ffffff;
- text-align: center;
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
- background-color: #0e90d2;
- background-image: -moz-linear-gradient(top, #149bdf, #0480be);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be));
- background-image: -webkit-linear-gradient(top, #149bdf, #0480be);
- background-image: -o-linear-gradient(top, #149bdf, #0480be);
- background-image: linear-gradient(to bottom, #149bdf, #0480be);
- background-repeat: repeat-x;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0);
- -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
- -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
- box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- -webkit-transition: width 0.6s ease;
- -moz-transition: width 0.6s ease;
- -o-transition: width 0.6s ease;
- transition: width 0.6s ease;
-}
-
-.progress .bar + .bar {
- -webkit-box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.15);
- -moz-box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.15);
- box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.15);
-}
-
-.progress-striped .bar {
- background-color: #149bdf;
- background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
- background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- -webkit-background-size: 40px 40px;
- -moz-background-size: 40px 40px;
- -o-background-size: 40px 40px;
- background-size: 40px 40px;
-}
-
-.progress.active .bar {
- -webkit-animation: progress-bar-stripes 2s linear infinite;
- -moz-animation: progress-bar-stripes 2s linear infinite;
- -ms-animation: progress-bar-stripes 2s linear infinite;
- -o-animation: progress-bar-stripes 2s linear infinite;
- animation: progress-bar-stripes 2s linear infinite;
-}
-
-.progress-danger .bar,
-.progress .bar-danger {
- background-color: #dd514c;
- background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35));
- background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
- background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
- background-image: linear-gradient(to bottom, #ee5f5b, #c43c35);
- background-repeat: repeat-x;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffc43c35', GradientType=0);
-}
-
-.progress-danger.progress-striped .bar,
-.progress-striped .bar-danger {
- background-color: #ee5f5b;
- background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
- background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-}
-
-.progress-success .bar,
-.progress .bar-success {
- background-color: #5eb95e;
- background-image: -moz-linear-gradient(top, #62c462, #57a957);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957));
- background-image: -webkit-linear-gradient(top, #62c462, #57a957);
- background-image: -o-linear-gradient(top, #62c462, #57a957);
- background-image: linear-gradient(to bottom, #62c462, #57a957);
- background-repeat: repeat-x;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff57a957', GradientType=0);
-}
-
-.progress-success.progress-striped .bar,
-.progress-striped .bar-success {
- background-color: #62c462;
- background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
- background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-}
-
-.progress-info .bar,
-.progress .bar-info {
- background-color: #4bb1cf;
- background-image: -moz-linear-gradient(top, #5bc0de, #339bb9);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9));
- background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9);
- background-image: -o-linear-gradient(top, #5bc0de, #339bb9);
- background-image: linear-gradient(to bottom, #5bc0de, #339bb9);
- background-repeat: repeat-x;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff339bb9', GradientType=0);
-}
-
-.progress-info.progress-striped .bar,
-.progress-striped .bar-info {
- background-color: #5bc0de;
- background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
- background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-}
-
-.progress-warning .bar,
-.progress .bar-warning {
- background-color: #faa732;
- background-image: -moz-linear-gradient(top, #fbb450, #f89406);
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));
- background-image: -webkit-linear-gradient(top, #fbb450, #f89406);
- background-image: -o-linear-gradient(top, #fbb450, #f89406);
- background-image: linear-gradient(to bottom, #fbb450, #f89406);
- background-repeat: repeat-x;
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);
-}
-
-.progress-warning.progress-striped .bar,
-.progress-striped .bar-warning {
- background-color: #fbb450;
- background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
- background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
- background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-}
-
-.accordion {
- margin-bottom: 20px;
-}
-
-.accordion-group {
- margin-bottom: 2px;
- border: 1px solid #e5e5e5;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.accordion-heading {
- border-bottom: 0;
-}
-
-.accordion-heading .accordion-toggle {
- display: block;
- padding: 8px 15px;
-}
-
-.accordion-toggle {
- cursor: pointer;
-}
-
-.accordion-inner {
- padding: 9px 15px;
- border-top: 1px solid #e5e5e5;
-}
-
-.carousel {
- position: relative;
- margin-bottom: 20px;
- line-height: 1;
-}
-
-.carousel-inner {
- position: relative;
- width: 100%;
- overflow: hidden;
-}
-
-.carousel-inner > .item {
- position: relative;
- display: none;
- -webkit-transition: 0.6s ease-in-out left;
- -moz-transition: 0.6s ease-in-out left;
- -o-transition: 0.6s ease-in-out left;
- transition: 0.6s ease-in-out left;
-}
-
-.carousel-inner > .item > img,
-.carousel-inner > .item > a > img {
- display: block;
- line-height: 1;
-}
-
-.carousel-inner > .active,
-.carousel-inner > .next,
-.carousel-inner > .prev {
- display: block;
-}
-
-.carousel-inner > .active {
- left: 0;
-}
-
-.carousel-inner > .next,
-.carousel-inner > .prev {
- position: absolute;
- top: 0;
- width: 100%;
-}
-
-.carousel-inner > .next {
- left: 100%;
-}
-
-.carousel-inner > .prev {
- left: -100%;
-}
-
-.carousel-inner > .next.left,
-.carousel-inner > .prev.right {
- left: 0;
-}
-
-.carousel-inner > .active.left {
- left: -100%;
-}
-
-.carousel-inner > .active.right {
- left: 100%;
-}
-
-.carousel-control {
- position: absolute;
- top: 40%;
- left: 15px;
- width: 40px;
- height: 40px;
- margin-top: -20px;
- font-size: 60px;
- font-weight: 100;
- line-height: 30px;
- color: #ffffff;
- text-align: center;
- background: #222222;
- border: 3px solid #ffffff;
- -webkit-border-radius: 23px;
- -moz-border-radius: 23px;
- border-radius: 23px;
- opacity: 0.5;
- filter: alpha(opacity=50);
-}
-
-.carousel-control.right {
- right: 15px;
- left: auto;
-}
-
-.carousel-control:hover,
-.carousel-control:focus {
- color: #ffffff;
- text-decoration: none;
- opacity: 0.9;
- filter: alpha(opacity=90);
-}
-
-.carousel-indicators {
- position: absolute;
- top: 15px;
- right: 15px;
- z-index: 5;
- margin: 0;
- list-style: none;
-}
-
-.carousel-indicators li {
- display: block;
- float: left;
- width: 10px;
- height: 10px;
- margin-left: 5px;
- text-indent: -999px;
- background-color: #ccc;
- background-color: rgba(255, 255, 255, 0.25);
- border-radius: 5px;
-}
-
-.carousel-indicators .active {
- background-color: #fff;
-}
-
-.carousel-caption {
- position: absolute;
- right: 0;
- bottom: 0;
- left: 0;
- padding: 15px;
- background: #333333;
- background: rgba(0, 0, 0, 0.75);
-}
-
-.carousel-caption h4,
-.carousel-caption p {
- line-height: 20px;
- color: #ffffff;
-}
-
-.carousel-caption h4 {
- margin: 0 0 5px;
-}
-
-.carousel-caption p {
- margin-bottom: 0;
-}
-
-.hero-unit {
- padding: 60px;
- margin-bottom: 30px;
- font-size: 18px;
- font-weight: 200;
- line-height: 30px;
- color: inherit;
- background-color: #eeeeee;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
- border-radius: 6px;
-}
-
-.hero-unit h1 {
- margin-bottom: 0;
- font-size: 60px;
- line-height: 1;
- letter-spacing: -1px;
- color: inherit;
-}
-
-.hero-unit li {
- line-height: 30px;
-}
-
-.pull-right {
- float: right;
-}
-
-.pull-left {
- float: left;
-}
-
-.hide {
- display: none;
-}
-
-.show {
- display: block;
-}
-
-.invisible {
- visibility: hidden;
-}
-
-.affix {
- position: fixed;
-}
--- a/integ/js/vs/lib/bootstrap/css/bootstrap.min.css Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-/*!
- * Bootstrap v2.3.0
- *
- * Copyright 2012 Twitter, Inc
- * Licensed under the Apache License v2.0
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Designed and built with all the love in the world @twitter by @mdo and @fat.
- */.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}a:hover,a:active{outline:0}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{width:auto\9;height:auto;max-width:100%;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic}#map_canvas img,.google-maps img{max-width:none}button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle}button,input{*overflow:visible;line-height:normal}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}button,html input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button}label,select,button,input[type="button"],input[type="reset"],input[type="submit"],input[type="radio"],input[type="checkbox"]{cursor:pointer}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none}textarea{overflow:auto;vertical-align:top}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;color:#333;background-color:#fff}a{color:#08c;text-decoration:none}a:hover,a:focus{color:#005580;text-decoration:underline}.img-rounded{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.img-polaroid{padding:4px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.1);box-shadow:0 1px 3px rgba(0,0,0,0.1)}.img-circle{-webkit-border-radius:500px;-moz-border-radius:500px;border-radius:500px}.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.span12{width:940px}.span11{width:860px}.span10{width:780px}.span9{width:700px}.span8{width:620px}.span7{width:540px}.span6{width:460px}.span5{width:380px}.span4{width:300px}.span3{width:220px}.span2{width:140px}.span1{width:60px}.offset12{margin-left:980px}.offset11{margin-left:900px}.offset10{margin-left:820px}.offset9{margin-left:740px}.offset8{margin-left:660px}.offset7{margin-left:580px}.offset6{margin-left:500px}.offset5{margin-left:420px}.offset4{margin-left:340px}.offset3{margin-left:260px}.offset2{margin-left:180px}.offset1{margin-left:100px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.127659574468085%;*margin-left:2.074468085106383%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.127659574468085%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.48936170212765%;*width:91.43617021276594%}.row-fluid .span10{width:82.97872340425532%;*width:82.92553191489361%}.row-fluid .span9{width:74.46808510638297%;*width:74.41489361702126%}.row-fluid .span8{width:65.95744680851064%;*width:65.90425531914893%}.row-fluid .span7{width:57.44680851063829%;*width:57.39361702127659%}.row-fluid .span6{width:48.93617021276595%;*width:48.88297872340425%}.row-fluid .span5{width:40.42553191489362%;*width:40.37234042553192%}.row-fluid .span4{width:31.914893617021278%;*width:31.861702127659576%}.row-fluid .span3{width:23.404255319148934%;*width:23.351063829787233%}.row-fluid .span2{width:14.893617021276595%;*width:14.840425531914894%}.row-fluid .span1{width:6.382978723404255%;*width:6.329787234042553%}.row-fluid .offset12{margin-left:104.25531914893617%;*margin-left:104.14893617021275%}.row-fluid .offset12:first-child{margin-left:102.12765957446808%;*margin-left:102.02127659574467%}.row-fluid .offset11{margin-left:95.74468085106382%;*margin-left:95.6382978723404%}.row-fluid .offset11:first-child{margin-left:93.61702127659574%;*margin-left:93.51063829787232%}.row-fluid .offset10{margin-left:87.23404255319149%;*margin-left:87.12765957446807%}.row-fluid .offset10:first-child{margin-left:85.1063829787234%;*margin-left:84.99999999999999%}.row-fluid .offset9{margin-left:78.72340425531914%;*margin-left:78.61702127659572%}.row-fluid .offset9:first-child{margin-left:76.59574468085106%;*margin-left:76.48936170212764%}.row-fluid .offset8{margin-left:70.2127659574468%;*margin-left:70.10638297872339%}.row-fluid .offset8:first-child{margin-left:68.08510638297872%;*margin-left:67.9787234042553%}.row-fluid .offset7{margin-left:61.70212765957446%;*margin-left:61.59574468085106%}.row-fluid .offset7:first-child{margin-left:59.574468085106375%;*margin-left:59.46808510638297%}.row-fluid .offset6{margin-left:53.191489361702125%;*margin-left:53.085106382978715%}.row-fluid .offset6:first-child{margin-left:51.063829787234035%;*margin-left:50.95744680851063%}.row-fluid .offset5{margin-left:44.68085106382979%;*margin-left:44.57446808510638%}.row-fluid .offset5:first-child{margin-left:42.5531914893617%;*margin-left:42.4468085106383%}.row-fluid .offset4{margin-left:36.170212765957444%;*margin-left:36.06382978723405%}.row-fluid .offset4:first-child{margin-left:34.04255319148936%;*margin-left:33.93617021276596%}.row-fluid .offset3{margin-left:27.659574468085104%;*margin-left:27.5531914893617%}.row-fluid .offset3:first-child{margin-left:25.53191489361702%;*margin-left:25.425531914893618%}.row-fluid .offset2{margin-left:19.148936170212764%;*margin-left:19.04255319148936%}.row-fluid .offset2:first-child{margin-left:17.02127659574468%;*margin-left:16.914893617021278%}.row-fluid .offset1{margin-left:10.638297872340425%;*margin-left:10.53191489361702%}.row-fluid .offset1:first-child{margin-left:8.51063829787234%;*margin-left:8.404255319148938%}[class*="span"].hide,.row-fluid [class*="span"].hide{display:none}[class*="span"].pull-right,.row-fluid [class*="span"].pull-right{float:right}.container{margin-right:auto;margin-left:auto;*zoom:1}.container:before,.container:after{display:table;line-height:0;content:""}.container:after{clear:both}.container-fluid{padding-right:20px;padding-left:20px;*zoom:1}.container-fluid:before,.container-fluid:after{display:table;line-height:0;content:""}.container-fluid:after{clear:both}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px}small{font-size:85%}strong{font-weight:bold}em{font-style:italic}cite{font-style:normal}.muted{color:#999}a.muted:hover,a.muted:focus{color:#808080}.text-warning{color:#c09853}a.text-warning:hover,a.text-warning:focus{color:#a47e3c}.text-error{color:#b94a48}a.text-error:hover,a.text-error:focus{color:#953b39}.text-info{color:#3a87ad}a.text-info:hover,a.text-info:focus{color:#2d6987}.text-success{color:#468847}a.text-success:hover,a.text-success:focus{color:#356635}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:20px;color:inherit;text-rendering:optimizelegibility}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;line-height:1;color:#999}h1,h2,h3{line-height:40px}h1{font-size:38.5px}h2{font-size:31.5px}h3{font-size:24.5px}h4{font-size:17.5px}h5{font-size:14px}h6{font-size:11.9px}h1 small{font-size:24.5px}h2 small{font-size:17.5px}h3 small{font-size:14px}h4 small{font-size:14px}.page-header{padding-bottom:9px;margin:20px 0 30px;border-bottom:1px solid #eee}ul,ol{padding:0;margin:0 0 10px 25px}ul ul,ul ol,ol ol,ol ul{margin-bottom:0}li{line-height:20px}ul.unstyled,ol.unstyled{margin-left:0;list-style:none}ul.inline,ol.inline{margin-left:0;list-style:none}ul.inline>li,ol.inline>li{display:inline-block;*display:inline;padding-right:5px;padding-left:5px;*zoom:1}dl{margin-bottom:20px}dt,dd{line-height:20px}dt{font-weight:bold}dd{margin-left:10px}.dl-horizontal{*zoom:1}.dl-horizontal:before,.dl-horizontal:after{display:table;line-height:0;content:""}.dl-horizontal:after{clear:both}.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}hr{margin:20px 0;border:0;border-top:1px solid #eee;border-bottom:1px solid #fff}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999}abbr.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:0 0 0 15px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{margin-bottom:0;font-size:17.5px;font-weight:300;line-height:1.25}blockquote small{display:block;line-height:20px;color:#999}blockquote small:before{content:'\2014 \00A0'}blockquote.pull-right{float:right;padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right p,blockquote.pull-right small{text-align:right}blockquote.pull-right small:before{content:''}blockquote.pull-right small:after{content:'\00A0 \2014'}q:before,q:after,blockquote:before,blockquote:after{content:""}address{display:block;margin-bottom:20px;font-style:normal;line-height:20px}code,pre{padding:0 3px 2px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;color:#333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}code{padding:2px 4px;color:#d14;white-space:nowrap;background-color:#f7f7f9;border:1px solid #e1e1e8}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre;white-space:pre-wrap;background-color:#f5f5f5;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}pre.prettyprint{margin-bottom:20px}pre code{padding:0;color:inherit;white-space:pre;white-space:pre-wrap;background-color:transparent;border:0}.pre-scrollable{max-height:340px;overflow-y:scroll}form{margin:0 0 20px}fieldset{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #e5e5e5}legend small{font-size:15px;color:#999}label,input,button,select,textarea{font-size:14px;font-weight:normal;line-height:20px}input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}label{display:block;margin-bottom:5px}select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{display:inline-block;height:20px;padding:4px 6px;margin-bottom:10px;font-size:14px;line-height:20px;color:#555;vertical-align:middle;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}input,textarea,.uneditable-input{width:206px}textarea{height:auto}textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;-o-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus{border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;*margin-top:0;line-height:normal}input[type="file"],input[type="image"],input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"]{width:auto}select,input[type="file"]{height:30px;*margin-top:4px;line-height:30px}select{width:220px;background-color:#fff;border:1px solid #ccc}select[multiple],select[size]{height:auto}select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.uneditable-input,.uneditable-textarea{color:#999;cursor:not-allowed;background-color:#fcfcfc;border-color:#ccc;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);box-shadow:inset 0 1px 2px rgba(0,0,0,0.025)}.uneditable-input{overflow:hidden;white-space:nowrap}.uneditable-textarea{width:auto;height:auto}input:-moz-placeholder,textarea:-moz-placeholder{color:#999}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#999}input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#999}.radio,.checkbox{min-height:20px;padding-left:20px}.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-20px}.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px}.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle}.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px}.input-mini{width:60px}.input-small{width:90px}.input-medium{width:150px}.input-large{width:210px}.input-xlarge{width:270px}.input-xxlarge{width:530px}input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"]{float:none;margin-left:0}.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"]{display:inline-block}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:926px}input.span11,textarea.span11,.uneditable-input.span11{width:846px}input.span10,textarea.span10,.uneditable-input.span10{width:766px}input.span9,textarea.span9,.uneditable-input.span9{width:686px}input.span8,textarea.span8,.uneditable-input.span8{width:606px}input.span7,textarea.span7,.uneditable-input.span7{width:526px}input.span6,textarea.span6,.uneditable-input.span6{width:446px}input.span5,textarea.span5,.uneditable-input.span5{width:366px}input.span4,textarea.span4,.uneditable-input.span4{width:286px}input.span3,textarea.span3,.uneditable-input.span3{width:206px}input.span2,textarea.span2,.uneditable-input.span2{width:126px}input.span1,textarea.span1,.uneditable-input.span1{width:46px}.controls-row{*zoom:1}.controls-row:before,.controls-row:after{display:table;line-height:0;content:""}.controls-row:after{clear:both}.controls-row [class*="span"],.row-fluid .controls-row [class*="span"]{float:left}.controls-row .checkbox[class*="span"],.controls-row .radio[class*="span"]{padding-top:5px}input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#eee}input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly]{background-color:transparent}.control-group.warning .control-label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853}.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09853}.control-group.warning input,.control-group.warning select,.control-group.warning textarea{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e}.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853}.control-group.error .control-label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48}.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea{color:#b94a48}.control-group.error input,.control-group.error select,.control-group.error textarea{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392}.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48}.control-group.success .control-label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847}.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea{color:#468847}.control-group.success input,.control-group.success select,.control-group.success textarea{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847}.control-group.info .control-label,.control-group.info .help-block,.control-group.info .help-inline{color:#3a87ad}.control-group.info .checkbox,.control-group.info .radio,.control-group.info input,.control-group.info select,.control-group.info textarea{color:#3a87ad}.control-group.info input,.control-group.info select,.control-group.info textarea{border-color:#3a87ad;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.info input:focus,.control-group.info select:focus,.control-group.info textarea:focus{border-color:#2d6987;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3}.control-group.info .input-prepend .add-on,.control-group.info .input-append .add-on{color:#3a87ad;background-color:#d9edf7;border-color:#3a87ad}input:focus:invalid,textarea:focus:invalid,select:focus:invalid{color:#b94a48;border-color:#ee5f5b}input:focus:invalid:focus,textarea:focus:invalid:focus,select:focus:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7}.form-actions{padding:19px 20px 20px;margin-top:20px;margin-bottom:20px;background-color:#f5f5f5;border-top:1px solid #e5e5e5;*zoom:1}.form-actions:before,.form-actions:after{display:table;line-height:0;content:""}.form-actions:after{clear:both}.help-block,.help-inline{color:#595959}.help-block{display:block;margin-bottom:10px}.help-inline{display:inline-block;*display:inline;padding-left:5px;vertical-align:middle;*zoom:1}.input-append,.input-prepend{display:inline-block;margin-bottom:10px;font-size:0;white-space:nowrap;vertical-align:middle}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input,.input-append .dropdown-menu,.input-prepend .dropdown-menu,.input-append .popover,.input-prepend .popover{font-size:14px}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input{position:relative;margin-bottom:0;*margin-left:0;vertical-align:top;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-append input:focus,.input-prepend input:focus,.input-append select:focus,.input-prepend select:focus,.input-append .uneditable-input:focus,.input-prepend .uneditable-input:focus{z-index:2}.input-append .add-on,.input-prepend .add-on{display:inline-block;width:auto;height:20px;min-width:16px;padding:4px 5px;font-size:14px;font-weight:normal;line-height:20px;text-align:center;text-shadow:0 1px 0 #fff;background-color:#eee;border:1px solid #ccc}.input-append .add-on,.input-prepend .add-on,.input-append .btn,.input-prepend .btn,.input-append .btn-group>.dropdown-toggle,.input-prepend .btn-group>.dropdown-toggle{vertical-align:top;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-append .active,.input-prepend .active{background-color:#a9dba9;border-color:#46a546}.input-prepend .add-on,.input-prepend .btn{margin-right:-1px}.input-prepend .add-on:first-child,.input-prepend .btn:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-append input,.input-append select,.input-append .uneditable-input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-append input+.btn-group .btn:last-child,.input-append select+.btn-group .btn:last-child,.input-append .uneditable-input+.btn-group .btn:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-append .add-on,.input-append .btn,.input-append .btn-group{margin-left:-1px}.input-append .add-on:last-child,.input-append .btn:last-child,.input-append .btn-group:last-child>.dropdown-toggle{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-prepend.input-append input+.btn-group .btn,.input-prepend.input-append select+.btn-group .btn,.input-prepend.input-append .uneditable-input+.btn-group .btn{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append .btn-group:first-child{margin-left:0}input.search-query{padding-right:14px;padding-right:4px \9;padding-left:14px;padding-left:4px \9;margin-bottom:0;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.form-search .input-append .search-query,.form-search .input-prepend .search-query{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.form-search .input-append .search-query{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search .input-append .btn{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .search-query{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .btn{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append{display:inline-block;*display:inline;margin-bottom:0;vertical-align:middle;*zoom:1}.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none}.form-search label,.form-inline label,.form-search .btn-group,.form-inline .btn-group{display:inline-block}.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{margin-bottom:0}.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox{padding-left:0;margin-bottom:0;vertical-align:middle}.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:left;margin-right:3px;margin-left:0}.control-group{margin-bottom:10px}legend+.control-group{margin-top:20px;-webkit-margin-top-collapse:separate}.form-horizontal .control-group{margin-bottom:20px;*zoom:1}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;line-height:0;content:""}.form-horizontal .control-group:after{clear:both}.form-horizontal .control-label{float:left;width:160px;padding-top:5px;text-align:right}.form-horizontal .controls{*display:inline-block;*padding-left:20px;margin-left:180px;*margin-left:0}.form-horizontal .controls:first-child{*padding-left:180px}.form-horizontal .help-block{margin-bottom:0}.form-horizontal input+.help-block,.form-horizontal select+.help-block,.form-horizontal textarea+.help-block,.form-horizontal .uneditable-input+.help-block,.form-horizontal .input-prepend+.help-block,.form-horizontal .input-append+.help-block{margin-top:10px}.form-horizontal .form-actions{padding-left:180px}table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0}.table{width:100%;margin-bottom:20px}.table th,.table td{padding:8px;line-height:20px;text-align:left;vertical-align:top;border-top:1px solid #ddd}.table th{font-weight:bold}.table thead th{vertical-align:bottom}.table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0}.table tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed th,.table-condensed td{padding:4px 5px}.table-bordered{border:1px solid #ddd;border-collapse:separate;*border-collapse:collapse;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.table-bordered th,.table-bordered td{border-left:1px solid #ddd}.table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0}.table-bordered thead:first-child tr:first-child>th:first-child,.table-bordered tbody:first-child tr:first-child>td:first-child,.table-bordered tbody:first-child tr:first-child>th:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered thead:first-child tr:first-child>th:last-child,.table-bordered tbody:first-child tr:first-child>td:last-child,.table-bordered tbody:first-child tr:first-child>th:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px}.table-bordered thead:last-child tr:last-child>th:first-child,.table-bordered tbody:last-child tr:last-child>td:first-child,.table-bordered tbody:last-child tr:last-child>th:first-child,.table-bordered tfoot:last-child tr:last-child>td:first-child,.table-bordered tfoot:last-child tr:last-child>th:first-child{-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px}.table-bordered thead:last-child tr:last-child>th:last-child,.table-bordered tbody:last-child tr:last-child>td:last-child,.table-bordered tbody:last-child tr:last-child>th:last-child,.table-bordered tfoot:last-child tr:last-child>td:last-child,.table-bordered tfoot:last-child tr:last-child>th:last-child{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px}.table-bordered tfoot+tbody:last-child tr:last-child td:first-child{-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-moz-border-radius-bottomleft:0}.table-bordered tfoot+tbody:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;-moz-border-radius-bottomright:0}.table-bordered caption+thead tr:first-child th:first-child,.table-bordered caption+tbody tr:first-child td:first-child,.table-bordered colgroup+thead tr:first-child th:first-child,.table-bordered colgroup+tbody tr:first-child td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered caption+thead tr:first-child th:last-child,.table-bordered caption+tbody tr:first-child td:last-child,.table-bordered colgroup+thead tr:first-child th:last-child,.table-bordered colgroup+tbody tr:first-child td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px}.table-striped tbody>tr:nth-child(odd)>td,.table-striped tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover tbody tr:hover>td,.table-hover tbody tr:hover>th{background-color:#f5f5f5}table td[class*="span"],table th[class*="span"],.row-fluid table td[class*="span"],.row-fluid table th[class*="span"]{display:table-cell;float:none;margin-left:0}.table td.span1,.table th.span1{float:none;width:44px;margin-left:0}.table td.span2,.table th.span2{float:none;width:124px;margin-left:0}.table td.span3,.table th.span3{float:none;width:204px;margin-left:0}.table td.span4,.table th.span4{float:none;width:284px;margin-left:0}.table td.span5,.table th.span5{float:none;width:364px;margin-left:0}.table td.span6,.table th.span6{float:none;width:444px;margin-left:0}.table td.span7,.table th.span7{float:none;width:524px;margin-left:0}.table td.span8,.table th.span8{float:none;width:604px;margin-left:0}.table td.span9,.table th.span9{float:none;width:684px;margin-left:0}.table td.span10,.table th.span10{float:none;width:764px;margin-left:0}.table td.span11,.table th.span11{float:none;width:844px;margin-left:0}.table td.span12,.table th.span12{float:none;width:924px;margin-left:0}.table tbody tr.success>td{background-color:#dff0d8}.table tbody tr.error>td{background-color:#f2dede}.table tbody tr.warning>td{background-color:#fcf8e3}.table tbody tr.info>td{background-color:#d9edf7}.table-hover tbody tr.success:hover>td{background-color:#d0e9c6}.table-hover tbody tr.error:hover>td{background-color:#ebcccc}.table-hover tbody tr.warning:hover>td{background-color:#faf2cc}.table-hover tbody tr.info:hover>td{background-color:#c4e3f3}[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;margin-top:1px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat}.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:focus>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>li>a:focus>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:focus>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"],.dropdown-submenu:focus>a>[class*=" icon-"]{background-image:url("../img/glyphicons-halflings-white.png")}.icon-glass{background-position:0 0}.icon-music{background-position:-24px 0}.icon-search{background-position:-48px 0}.icon-envelope{background-position:-72px 0}.icon-heart{background-position:-96px 0}.icon-star{background-position:-120px 0}.icon-star-empty{background-position:-144px 0}.icon-user{background-position:-168px 0}.icon-film{background-position:-192px 0}.icon-th-large{background-position:-216px 0}.icon-th{background-position:-240px 0}.icon-th-list{background-position:-264px 0}.icon-ok{background-position:-288px 0}.icon-remove{background-position:-312px 0}.icon-zoom-in{background-position:-336px 0}.icon-zoom-out{background-position:-360px 0}.icon-off{background-position:-384px 0}.icon-signal{background-position:-408px 0}.icon-cog{background-position:-432px 0}.icon-trash{background-position:-456px 0}.icon-home{background-position:0 -24px}.icon-file{background-position:-24px -24px}.icon-time{background-position:-48px -24px}.icon-road{background-position:-72px -24px}.icon-download-alt{background-position:-96px -24px}.icon-download{background-position:-120px -24px}.icon-upload{background-position:-144px -24px}.icon-inbox{background-position:-168px -24px}.icon-play-circle{background-position:-192px -24px}.icon-repeat{background-position:-216px -24px}.icon-refresh{background-position:-240px -24px}.icon-list-alt{background-position:-264px -24px}.icon-lock{background-position:-287px -24px}.icon-flag{background-position:-312px -24px}.icon-headphones{background-position:-336px -24px}.icon-volume-off{background-position:-360px -24px}.icon-volume-down{background-position:-384px -24px}.icon-volume-up{background-position:-408px -24px}.icon-qrcode{background-position:-432px -24px}.icon-barcode{background-position:-456px -24px}.icon-tag{background-position:0 -48px}.icon-tags{background-position:-25px -48px}.icon-book{background-position:-48px -48px}.icon-bookmark{background-position:-72px -48px}.icon-print{background-position:-96px -48px}.icon-camera{background-position:-120px -48px}.icon-font{background-position:-144px -48px}.icon-bold{background-position:-167px -48px}.icon-italic{background-position:-192px -48px}.icon-text-height{background-position:-216px -48px}.icon-text-width{background-position:-240px -48px}.icon-align-left{background-position:-264px -48px}.icon-align-center{background-position:-288px -48px}.icon-align-right{background-position:-312px -48px}.icon-align-justify{background-position:-336px -48px}.icon-list{background-position:-360px -48px}.icon-indent-left{background-position:-384px -48px}.icon-indent-right{background-position:-408px -48px}.icon-facetime-video{background-position:-432px -48px}.icon-picture{background-position:-456px -48px}.icon-pencil{background-position:0 -72px}.icon-map-marker{background-position:-24px -72px}.icon-adjust{background-position:-48px -72px}.icon-tint{background-position:-72px -72px}.icon-edit{background-position:-96px -72px}.icon-share{background-position:-120px -72px}.icon-check{background-position:-144px -72px}.icon-move{background-position:-168px -72px}.icon-step-backward{background-position:-192px -72px}.icon-fast-backward{background-position:-216px -72px}.icon-backward{background-position:-240px -72px}.icon-play{background-position:-264px -72px}.icon-pause{background-position:-288px -72px}.icon-stop{background-position:-312px -72px}.icon-forward{background-position:-336px -72px}.icon-fast-forward{background-position:-360px -72px}.icon-step-forward{background-position:-384px -72px}.icon-eject{background-position:-408px -72px}.icon-chevron-left{background-position:-432px -72px}.icon-chevron-right{background-position:-456px -72px}.icon-plus-sign{background-position:0 -96px}.icon-minus-sign{background-position:-24px -96px}.icon-remove-sign{background-position:-48px -96px}.icon-ok-sign{background-position:-72px -96px}.icon-question-sign{background-position:-96px -96px}.icon-info-sign{background-position:-120px -96px}.icon-screenshot{background-position:-144px -96px}.icon-remove-circle{background-position:-168px -96px}.icon-ok-circle{background-position:-192px -96px}.icon-ban-circle{background-position:-216px -96px}.icon-arrow-left{background-position:-240px -96px}.icon-arrow-right{background-position:-264px -96px}.icon-arrow-up{background-position:-289px -96px}.icon-arrow-down{background-position:-312px -96px}.icon-share-alt{background-position:-336px -96px}.icon-resize-full{background-position:-360px -96px}.icon-resize-small{background-position:-384px -96px}.icon-plus{background-position:-408px -96px}.icon-minus{background-position:-433px -96px}.icon-asterisk{background-position:-456px -96px}.icon-exclamation-sign{background-position:0 -120px}.icon-gift{background-position:-24px -120px}.icon-leaf{background-position:-48px -120px}.icon-fire{background-position:-72px -120px}.icon-eye-open{background-position:-96px -120px}.icon-eye-close{background-position:-120px -120px}.icon-warning-sign{background-position:-144px -120px}.icon-plane{background-position:-168px -120px}.icon-calendar{background-position:-192px -120px}.icon-random{width:16px;background-position:-216px -120px}.icon-comment{background-position:-240px -120px}.icon-magnet{background-position:-264px -120px}.icon-chevron-up{background-position:-288px -120px}.icon-chevron-down{background-position:-313px -119px}.icon-retweet{background-position:-336px -120px}.icon-shopping-cart{background-position:-360px -120px}.icon-folder-close{width:16px;background-position:-384px -120px}.icon-folder-open{width:16px;background-position:-408px -120px}.icon-resize-vertical{background-position:-432px -119px}.icon-resize-horizontal{background-position:-456px -118px}.icon-hdd{background-position:0 -144px}.icon-bullhorn{background-position:-24px -144px}.icon-bell{background-position:-48px -144px}.icon-certificate{background-position:-72px -144px}.icon-thumbs-up{background-position:-96px -144px}.icon-thumbs-down{background-position:-120px -144px}.icon-hand-right{background-position:-144px -144px}.icon-hand-left{background-position:-168px -144px}.icon-hand-up{background-position:-192px -144px}.icon-hand-down{background-position:-216px -144px}.icon-circle-arrow-right{background-position:-240px -144px}.icon-circle-arrow-left{background-position:-264px -144px}.icon-circle-arrow-up{background-position:-288px -144px}.icon-circle-arrow-down{background-position:-312px -144px}.icon-globe{background-position:-336px -144px}.icon-wrench{background-position:-360px -144px}.icon-tasks{background-position:-384px -144px}.icon-filter{background-position:-408px -144px}.icon-briefcase{background-position:-432px -144px}.icon-fullscreen{background-position:-456px -144px}.dropup,.dropdown{position:relative}.dropdown-toggle{*margin-bottom:-3px}.dropdown-toggle:active,.open .dropdown-toggle{outline:0}.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.dropdown .caret{margin-top:8px;margin-left:2px}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:20px;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus,.dropdown-submenu:hover>a,.dropdown-submenu:focus>a{color:#fff;text-decoration:none;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;outline:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:default;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open{*z-index:1000}.open>.dropdown-menu{display:block}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropup .dropdown-submenu>.dropdown-menu{top:auto;bottom:0;margin-top:0;margin-bottom:-2px;-webkit-border-radius:5px 5px 5px 0;-moz-border-radius:5px 5px 5px 0;border-radius:5px 5px 5px 0}.dropdown-submenu>a:after{display:block;float:right;width:0;height:0;margin-top:5px;margin-right:-10px;border-color:transparent;border-left-color:#ccc;border-style:solid;border-width:5px 0 5px 5px;content:" "}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown-submenu.pull-left{float:none}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}.dropdown .dropdown-menu .nav-header{padding-right:20px;padding-left:20px}.typeahead{z-index:1051;margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-large{padding:24px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.well-small{padding:9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.fade{opacity:0;-webkit-transition:opacity .15s linear;-moz-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;-moz-transition:height .35s ease;-o-transition:height .35s ease;transition:height .35s ease}.collapse.in{height:auto}.close{float:right;font-size:20px;font-weight:bold;line-height:20px;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;opacity:.4;filter:alpha(opacity=40)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.btn{display:inline-block;*display:inline;padding:4px 12px;margin-bottom:0;*margin-left:.3em;font-size:14px;line-height:20px;color:#333;text-align:center;text-shadow:0 1px 1px rgba(255,255,255,0.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;*background-color:#e6e6e6;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #ccc;*border:0;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe6e6e6',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);*zoom:1;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn:hover,.btn:focus,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn:active,.btn.active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:hover,.btn:focus{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class^="icon-"],.btn-large [class*=" icon-"]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class^="icon-"],.btn-small [class*=" icon-"]{margin-top:0}.btn-mini [class^="icon-"],.btn-mini [class*=" icon-"]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-right:0;padding-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255,255,255,0.75)}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#006dcc;*background-color:#04c;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0044cc',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary:active,.btn-primary.active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#faa732;*background-color:#f89406;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning:active,.btn-warning.active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#da4f49;*background-color:#bd362f;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeat:repeat-x;border-color:#bd362f #bd362f #802420;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b',endColorstr='#ffbd362f',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{color:#fff;background-color:#bd362f;*background-color:#a9302a}.btn-danger:active,.btn-danger.active{background-color:#942a25 \9}.btn-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#5bb75b;*background-color:#51a351;background-image:-moz-linear-gradient(top,#62c462,#51a351);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#51a351));background-image:-webkit-linear-gradient(top,#62c462,#51a351);background-image:-o-linear-gradient(top,#62c462,#51a351);background-image:linear-gradient(to bottom,#62c462,#51a351);background-repeat:repeat-x;border-color:#51a351 #51a351 #387038;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462',endColorstr='#ff51a351',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{color:#fff;background-color:#51a351;*background-color:#499249}.btn-success:active,.btn-success.active{background-color:#408140 \9}.btn-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#49afcd;*background-color:#2f96b4;background-image:-moz-linear-gradient(top,#5bc0de,#2f96b4);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f96b4);background-image:-o-linear-gradient(top,#5bc0de,#2f96b4);background-image:linear-gradient(to bottom,#5bc0de,#2f96b4);background-repeat:repeat-x;border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff2f96b4',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{color:#fff;background-color:#2f96b4;*background-color:#2a85a0}.btn-info:active,.btn-info.active{background-color:#24748c \9}.btn-inverse{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#363636;*background-color:#222;background-image:-moz-linear-gradient(top,#444,#222);background-image:-webkit-gradient(linear,0 0,0 100%,from(#444),to(#222));background-image:-webkit-linear-gradient(top,#444,#222);background-image:-o-linear-gradient(top,#444,#222);background-image:linear-gradient(to bottom,#444,#222);background-repeat:repeat-x;border-color:#222 #222 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444',endColorstr='#ff222222',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-inverse:hover,.btn-inverse:focus,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{color:#fff;background-color:#222;*background-color:#151515}.btn-inverse:active,.btn-inverse.active{background-color:#080808 \9}button.btn,input[type="submit"].btn{*padding-top:3px;*padding-bottom:3px}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0}button.btn.btn-large,input[type="submit"].btn.btn-large{*padding-top:7px;*padding-bottom:7px}button.btn.btn-small,input[type="submit"].btn.btn-small{*padding-top:3px;*padding-bottom:3px}button.btn.btn-mini,input[type="submit"].btn.btn-mini{*padding-top:1px;*padding-bottom:1px}.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-link{color:#08c;cursor:pointer;border-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-link:hover,.btn-link:focus{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,.btn-link[disabled]:focus{color:#333;text-decoration:none}.btn-group{position:relative;display:inline-block;*display:inline;*margin-left:.3em;font-size:0;white-space:nowrap;vertical-align:middle;*zoom:1}.btn-group:first-child{*margin-left:0}.btn-group+.btn-group{margin-left:5px}.btn-toolbar{margin-top:10px;margin-bottom:10px;font-size:0}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group{margin-left:5px}.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group>.btn+.btn{margin-left:-1px}.btn-group>.btn,.btn-group>.dropdown-menu,.btn-group>.popover{font-size:14px}.btn-group>.btn-mini{font-size:10.5px}.btn-group>.btn-small{font-size:11.9px}.btn-group>.btn-large{font-size:17.5px}.btn-group>.btn:first-child{margin-left:0;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-topleft:4px}.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px}.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-topleft:6px}.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-bottom-right-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px}.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{*padding-top:5px;padding-right:8px;*padding-bottom:5px;padding-left:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn-group>.btn-mini+.dropdown-toggle{*padding-top:2px;padding-right:5px;*padding-bottom:2px;padding-left:5px}.btn-group>.btn-small+.dropdown-toggle{*padding-top:5px;*padding-bottom:4px}.btn-group>.btn-large+.dropdown-toggle{*padding-top:7px;padding-right:12px;*padding-bottom:7px;padding-left:12px}.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6}.btn-group.open .btn-primary.dropdown-toggle{background-color:#04c}.btn-group.open .btn-warning.dropdown-toggle{background-color:#f89406}.btn-group.open .btn-danger.dropdown-toggle{background-color:#bd362f}.btn-group.open .btn-success.dropdown-toggle{background-color:#51a351}.btn-group.open .btn-info.dropdown-toggle{background-color:#2f96b4}.btn-group.open .btn-inverse.dropdown-toggle{background-color:#222}.btn .caret{margin-top:8px;margin-left:0}.btn-large .caret{margin-top:6px}.btn-large .caret{border-top-width:5px;border-right-width:5px;border-left-width:5px}.btn-mini .caret,.btn-small .caret{margin-top:8px}.dropup .btn-large .caret{border-bottom-width:5px}.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#fff;border-bottom-color:#fff}.btn-group-vertical{display:inline-block;*display:inline;*zoom:1}.btn-group-vertical>.btn{display:block;float:none;max-width:100%;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group-vertical>.btn+.btn{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:first-child{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.btn-group-vertical>.btn:last-child{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.btn-group-vertical>.btn-large:first-child{-webkit-border-radius:6px 6px 0 0;-moz-border-radius:6px 6px 0 0;border-radius:6px 6px 0 0}.btn-group-vertical>.btn-large:last-child{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.alert{padding:8px 35px 8px 14px;margin-bottom:20px;text-shadow:0 1px 0 rgba(255,255,255,0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.alert,.alert h4{color:#c09853}.alert h4{margin:0}.alert .close{position:relative;top:-2px;right:-21px;line-height:20px}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-success h4{color:#468847}.alert-danger,.alert-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.alert-danger h4,.alert-error h4{color:#b94a48}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-info h4{color:#3a87ad}.alert-block{padding-top:14px;padding-bottom:14px}.alert-block>p,.alert-block>ul{margin-bottom:0}.alert-block p+p{margin-top:5px}.nav{margin-bottom:20px;margin-left:0;list-style:none}.nav>li>a{display:block}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li>a>img{max-width:none}.nav>.pull-right{float:right}.nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:20px;color:#999;text-shadow:0 1px 0 rgba(255,255,255,0.5);text-transform:uppercase}.nav li+.nav-header{margin-top:9px}.nav-list{padding-right:15px;padding-left:15px;margin-bottom:0}.nav-list>li>a,.nav-list .nav-header{margin-right:-15px;margin-left:-15px;text-shadow:0 1px 0 rgba(255,255,255,0.5)}.nav-list>li>a{padding:3px 15px}.nav-list>.active>a,.nav-list>.active>a:hover,.nav-list>.active>a:focus{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.2);background-color:#08c}.nav-list [class^="icon-"],.nav-list [class*=" icon-"]{margin-right:2px}.nav-list .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.nav-tabs,.nav-pills{*zoom:1}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;line-height:0;content:""}.nav-tabs:after,.nav-pills:after{clear:both}.nav-tabs>li,.nav-pills>li{float:left}.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{margin-bottom:-1px}.nav-tabs>li>a{padding-top:8px;padding-bottom:8px;line-height:20px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover,.nav-tabs>li>a:focus{border-color:#eee #eee #ddd}.nav-tabs>.active>a,.nav-tabs>.active>a:hover,.nav-tabs>.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.nav-pills>.active>a,.nav-pills>.active>a:hover,.nav-pills>.active>a:focus{color:#fff;background-color:#08c}.nav-stacked>li{float:none}.nav-stacked>li>a{margin-right:0}.nav-tabs.nav-stacked{border-bottom:0}.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-topleft:4px}.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-moz-border-radius-bottomleft:4px}.nav-tabs.nav-stacked>li>a:hover,.nav-tabs.nav-stacked>li>a:focus{z-index:2;border-color:#ddd}.nav-pills.nav-stacked>li>a{margin-bottom:3px}.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px}.nav-tabs .dropdown-menu{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.nav-pills .dropdown-menu{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.nav .dropdown-toggle .caret{margin-top:6px;border-top-color:#08c;border-bottom-color:#08c}.nav .dropdown-toggle:hover .caret,.nav .dropdown-toggle:focus .caret{border-top-color:#005580;border-bottom-color:#005580}.nav-tabs .dropdown-toggle .caret{margin-top:8px}.nav .active .dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.nav-tabs .active .dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.nav>.dropdown.active>a:hover,.nav>.dropdown.active>a:focus{cursor:pointer}.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover,.nav>li.dropdown.open.active>a:focus{color:#fff;background-color:#999;border-color:#999}.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret,.nav li.dropdown.open a:focus .caret{border-top-color:#fff;border-bottom-color:#fff;opacity:1;filter:alpha(opacity=100)}.tabs-stacked .open>a:hover,.tabs-stacked .open>a:focus{border-color:#999}.tabbable{*zoom:1}.tabbable:before,.tabbable:after{display:table;line-height:0;content:""}.tabbable:after{clear:both}.tab-content{overflow:auto}.tabs-below>.nav-tabs,.tabs-right>.nav-tabs,.tabs-left>.nav-tabs{border-bottom:0}.tab-content>.tab-pane,.pill-content>.pill-pane{display:none}.tab-content>.active,.pill-content>.active{display:block}.tabs-below>.nav-tabs{border-top:1px solid #ddd}.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0}.tabs-below>.nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.tabs-below>.nav-tabs>li>a:hover,.tabs-below>.nav-tabs>li>a:focus{border-top-color:#ddd;border-bottom-color:transparent}.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover,.tabs-below>.nav-tabs>.active>a:focus{border-color:transparent #ddd #ddd #ddd}.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li{float:none}.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px}.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd}.tabs-left>.nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.tabs-left>.nav-tabs>li>a:hover,.tabs-left>.nav-tabs>li>a:focus{border-color:#eee #ddd #eee #eee}.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:hover,.tabs-left>.nav-tabs .active>a:focus{border-color:#ddd transparent #ddd #ddd;*border-right-color:#fff}.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd}.tabs-right>.nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.tabs-right>.nav-tabs>li>a:hover,.tabs-right>.nav-tabs>li>a:focus{border-color:#eee #eee #eee #ddd}.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover,.tabs-right>.nav-tabs .active>a:focus{border-color:#ddd #ddd #ddd transparent;*border-left-color:#fff}.nav>.disabled>a{color:#999}.nav>.disabled>a:hover,.nav>.disabled>a:focus{text-decoration:none;cursor:default;background-color:transparent}.navbar{*position:relative;*z-index:2;margin-bottom:20px;overflow:visible}.navbar-inner{min-height:40px;padding-right:20px;padding-left:20px;background-color:#fafafa;background-image:-moz-linear-gradient(top,#fff,#f2f2f2);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#f2f2f2));background-image:-webkit-linear-gradient(top,#fff,#f2f2f2);background-image:-o-linear-gradient(top,#fff,#f2f2f2);background-image:linear-gradient(to bottom,#fff,#f2f2f2);background-repeat:repeat-x;border:1px solid #d4d4d4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff2f2f2',GradientType=0);*zoom:1;-webkit-box-shadow:0 1px 4px rgba(0,0,0,0.065);-moz-box-shadow:0 1px 4px rgba(0,0,0,0.065);box-shadow:0 1px 4px rgba(0,0,0,0.065)}.navbar-inner:before,.navbar-inner:after{display:table;line-height:0;content:""}.navbar-inner:after{clear:both}.navbar .container{width:auto}.nav-collapse.collapse{height:auto;overflow:visible}.navbar .brand{display:block;float:left;padding:10px 20px 10px;margin-left:-20px;font-size:20px;font-weight:200;color:#777;text-shadow:0 1px 0 #fff}.navbar .brand:hover,.navbar .brand:focus{text-decoration:none}.navbar-text{margin-bottom:0;line-height:40px;color:#777}.navbar-link{color:#777}.navbar-link:hover,.navbar-link:focus{color:#333}.navbar .divider-vertical{height:40px;margin:0 9px;border-right:1px solid #fff;border-left:1px solid #f2f2f2}.navbar .btn,.navbar .btn-group{margin-top:5px}.navbar .btn-group .btn,.navbar .input-prepend .btn,.navbar .input-append .btn,.navbar .input-prepend .btn-group,.navbar .input-append .btn-group{margin-top:0}.navbar-form{margin-bottom:0;*zoom:1}.navbar-form:before,.navbar-form:after{display:table;line-height:0;content:""}.navbar-form:after{clear:both}.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox{margin-top:5px}.navbar-form input,.navbar-form select,.navbar-form .btn{display:inline-block;margin-bottom:0}.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px}.navbar-form .input-append,.navbar-form .input-prepend{margin-top:5px;white-space:nowrap}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0}.navbar-search{position:relative;float:left;margin-top:5px;margin-bottom:0}.navbar-search .search-query{padding:4px 14px;margin-bottom:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:1;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.navbar-static-top{position:static;margin-bottom:0}.navbar-static-top .navbar-inner{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;margin-bottom:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{border-width:0 0 1px}.navbar-fixed-bottom .navbar-inner{border-width:1px 0 0}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding-right:0;padding-left:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.navbar-fixed-top{top:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{-webkit-box-shadow:0 1px 10px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 10px rgba(0,0,0,0.1);box-shadow:0 1px 10px rgba(0,0,0,0.1)}.navbar-fixed-bottom{bottom:0}.navbar-fixed-bottom .navbar-inner{-webkit-box-shadow:0 -1px 10px rgba(0,0,0,0.1);-moz-box-shadow:0 -1px 10px rgba(0,0,0,0.1);box-shadow:0 -1px 10px rgba(0,0,0,0.1)}.navbar .nav{position:relative;left:0;display:block;float:left;margin:0 10px 0 0}.navbar .nav.pull-right{float:right;margin-right:0}.navbar .nav>li{float:left}.navbar .nav>li>a{float:none;padding:10px 15px 10px;color:#777;text-decoration:none;text-shadow:0 1px 0 #fff}.navbar .nav .dropdown-toggle .caret{margin-top:8px}.navbar .nav>li>a:focus,.navbar .nav>li>a:hover{color:#333;text-decoration:none;background-color:transparent}.navbar .nav>.active>a,.navbar .nav>.active>a:hover,.navbar .nav>.active>a:focus{color:#555;text-decoration:none;background-color:#e5e5e5;-webkit-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);-moz-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);box-shadow:inset 0 3px 8px rgba(0,0,0,0.125)}.navbar .btn-navbar{display:none;float:right;padding:7px 10px;margin-right:5px;margin-left:5px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#ededed;*background-color:#e5e5e5;background-image:-moz-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#e5e5e5));background-image:-webkit-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:-o-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:linear-gradient(to bottom,#f2f2f2,#e5e5e5);background-repeat:repeat-x;border-color:#e5e5e5 #e5e5e5 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2',endColorstr='#ffe5e5e5',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075)}.navbar .btn-navbar:hover,.navbar .btn-navbar:focus,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled]{color:#fff;background-color:#e5e5e5;*background-color:#d9d9d9}.navbar .btn-navbar:active,.navbar .btn-navbar.active{background-color:#ccc \9}.navbar .btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.25);-moz-box-shadow:0 1px 0 rgba(0,0,0,0.25);box-shadow:0 1px 0 rgba(0,0,0,0.25)}.btn-navbar .icon-bar+.icon-bar{margin-top:3px}.navbar .nav>li>.dropdown-menu:before{position:absolute;top:-7px;left:9px;display:inline-block;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-left:7px solid transparent;border-bottom-color:rgba(0,0,0,0.2);content:''}.navbar .nav>li>.dropdown-menu:after{position:absolute;top:-6px;left:10px;display:inline-block;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent;content:''}.navbar-fixed-bottom .nav>li>.dropdown-menu:before{top:auto;bottom:-7px;border-top:7px solid #ccc;border-bottom:0;border-top-color:rgba(0,0,0,0.2)}.navbar-fixed-bottom .nav>li>.dropdown-menu:after{top:auto;bottom:-6px;border-top:6px solid #fff;border-bottom:0}.navbar .nav li.dropdown>a:hover .caret,.navbar .nav li.dropdown>a:focus .caret{border-top-color:#333;border-bottom-color:#333}.navbar .nav li.dropdown.open>.dropdown-toggle,.navbar .nav li.dropdown.active>.dropdown-toggle,.navbar .nav li.dropdown.open.active>.dropdown-toggle{color:#555;background-color:#e5e5e5}.navbar .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#777;border-bottom-color:#777}.navbar .nav li.dropdown.open>.dropdown-toggle .caret,.navbar .nav li.dropdown.active>.dropdown-toggle .caret,.navbar .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.navbar .pull-right>li>.dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right{right:0;left:auto}.navbar .pull-right>li>.dropdown-menu:before,.navbar .nav>li>.dropdown-menu.pull-right:before{right:12px;left:auto}.navbar .pull-right>li>.dropdown-menu:after,.navbar .nav>li>.dropdown-menu.pull-right:after{right:13px;left:auto}.navbar .pull-right>li>.dropdown-menu .dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right .dropdown-menu{right:100%;left:auto;margin-right:-1px;margin-left:0;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}.navbar-inverse .navbar-inner{background-color:#1b1b1b;background-image:-moz-linear-gradient(top,#222,#111);background-image:-webkit-gradient(linear,0 0,0 100%,from(#222),to(#111));background-image:-webkit-linear-gradient(top,#222,#111);background-image:-o-linear-gradient(top,#222,#111);background-image:linear-gradient(to bottom,#222,#111);background-repeat:repeat-x;border-color:#252525;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222',endColorstr='#ff111111',GradientType=0)}.navbar-inverse .brand,.navbar-inverse .nav>li>a{color:#999;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.navbar-inverse .brand:hover,.navbar-inverse .nav>li>a:hover,.navbar-inverse .brand:focus,.navbar-inverse .nav>li>a:focus{color:#fff}.navbar-inverse .brand{color:#999}.navbar-inverse .navbar-text{color:#999}.navbar-inverse .nav>li>a:focus,.navbar-inverse .nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .nav .active>a,.navbar-inverse .nav .active>a:hover,.navbar-inverse .nav .active>a:focus{color:#fff;background-color:#111}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover,.navbar-inverse .navbar-link:focus{color:#fff}.navbar-inverse .divider-vertical{border-right-color:#222;border-left-color:#111}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle{color:#fff;background-color:#111}.navbar-inverse .nav li.dropdown>a:hover .caret,.navbar-inverse .nav li.dropdown>a:focus .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#999;border-bottom-color:#999}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .navbar-search .search-query{color:#fff;background-color:#515151;border-color:#111;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.navbar-inverse .navbar-search .search-query:-moz-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:-ms-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:focus,.navbar-inverse .navbar-search .search-query.focused{padding:5px 15px;color:#333;text-shadow:0 1px 0 #fff;background-color:#fff;border:0;outline:0;-webkit-box-shadow:0 0 3px rgba(0,0,0,0.15);-moz-box-shadow:0 0 3px rgba(0,0,0,0.15);box-shadow:0 0 3px rgba(0,0,0,0.15)}.navbar-inverse .btn-navbar{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e0e0e;*background-color:#040404;background-image:-moz-linear-gradient(top,#151515,#040404);background-image:-webkit-gradient(linear,0 0,0 100%,from(#151515),to(#040404));background-image:-webkit-linear-gradient(top,#151515,#040404);background-image:-o-linear-gradient(top,#151515,#040404);background-image:linear-gradient(to bottom,#151515,#040404);background-repeat:repeat-x;border-color:#040404 #040404 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff151515',endColorstr='#ff040404',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.navbar-inverse .btn-navbar:hover,.navbar-inverse .btn-navbar:focus,.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active,.navbar-inverse .btn-navbar.disabled,.navbar-inverse .btn-navbar[disabled]{color:#fff;background-color:#040404;*background-color:#000}.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active{background-color:#000 \9}.breadcrumb{padding:8px 15px;margin:0 0 20px;list-style:none;background-color:#f5f5f5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.breadcrumb>li{display:inline-block;*display:inline;text-shadow:0 1px 0 #fff;*zoom:1}.breadcrumb>li>.divider{padding:0 5px;color:#ccc}.breadcrumb>.active{color:#999}.pagination{margin:20px 0}.pagination ul{display:inline-block;*display:inline;margin-bottom:0;margin-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*zoom:1;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.05);box-shadow:0 1px 2px rgba(0,0,0,0.05)}.pagination ul>li{display:inline}.pagination ul>li>a,.pagination ul>li>span{float:left;padding:4px 12px;line-height:20px;text-decoration:none;background-color:#fff;border:1px solid #ddd;border-left-width:0}.pagination ul>li>a:hover,.pagination ul>li>a:focus,.pagination ul>.active>a,.pagination ul>.active>span{background-color:#f5f5f5}.pagination ul>.active>a,.pagination ul>.active>span{color:#999;cursor:default}.pagination ul>.disabled>span,.pagination ul>.disabled>a,.pagination ul>.disabled>a:hover,.pagination ul>.disabled>a:focus{color:#999;cursor:default;background-color:transparent}.pagination ul>li:first-child>a,.pagination ul>li:first-child>span{border-left-width:1px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-topleft:4px}.pagination ul>li:last-child>a,.pagination ul>li:last-child>span{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px}.pagination-centered{text-align:center}.pagination-right{text-align:right}.pagination-large ul>li>a,.pagination-large ul>li>span{padding:11px 19px;font-size:17.5px}.pagination-large ul>li:first-child>a,.pagination-large ul>li:first-child>span{-webkit-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-topleft:6px}.pagination-large ul>li:last-child>a,.pagination-large ul>li:last-child>span{-webkit-border-top-right-radius:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-bottom-right-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px}.pagination-mini ul>li:first-child>a,.pagination-small ul>li:first-child>a,.pagination-mini ul>li:first-child>span,.pagination-small ul>li:first-child>span{-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-bottomleft:3px;-moz-border-radius-topleft:3px}.pagination-mini ul>li:last-child>a,.pagination-small ul>li:last-child>a,.pagination-mini ul>li:last-child>span,.pagination-small ul>li:last-child>span{-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px}.pagination-small ul>li>a,.pagination-small ul>li>span{padding:2px 10px;font-size:11.9px}.pagination-mini ul>li>a,.pagination-mini ul>li>span{padding:0 6px;font-size:10.5px}.pager{margin:20px 0;text-align:center;list-style:none;*zoom:1}.pager:before,.pager:after{display:table;line-height:0;content:""}.pager:after{clear:both}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#f5f5f5}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999;cursor:default;background-color:#fff}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop,.modal-backdrop.fade.in{opacity:.8;filter:alpha(opacity=80)}.modal{position:fixed;top:10%;left:50%;z-index:1050;width:560px;margin-left:-280px;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;outline:0;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,0.3);box-shadow:0 3px 7px rgba(0,0,0,0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box}.modal.fade{top:-25%;-webkit-transition:opacity .3s linear,top .3s ease-out;-moz-transition:opacity .3s linear,top .3s ease-out;-o-transition:opacity .3s linear,top .3s ease-out;transition:opacity .3s linear,top .3s ease-out}.modal.fade.in{top:10%}.modal-header{padding:9px 15px;border-bottom:1px solid #eee}.modal-header .close{margin-top:2px}.modal-header h3{margin:0;line-height:30px}.modal-body{position:relative;max-height:400px;padding:15px;overflow-y:auto}.modal-form{margin-bottom:0}.modal-footer{padding:14px 15px 15px;margin-bottom:0;text-align:right;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;*zoom:1;-webkit-box-shadow:inset 0 1px 0 #fff;-moz-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff}.modal-footer:before,.modal-footer:after{display:table;line-height:0;content:""}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.tooltip{position:absolute;z-index:1030;display:block;font-size:11px;line-height:1.4;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.8;filter:alpha(opacity=80)}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-right-color:#000;border-width:5px 5px 5px 0}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-left-color:#000;border-width:5px 0 5px 5px}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-color:#000;border-width:0 5px 5px}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.popover-title:empty{display:none}.popover-content{padding:9px 14px}.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow{border-width:11px}.popover .arrow:after{border-width:10px;content:""}.popover.top .arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,0.25);border-bottom-width:0}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-top-color:#fff;border-bottom-width:0}.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,0.25);border-left-width:0}.popover.right .arrow:after{bottom:-10px;left:1px;border-right-color:#fff;border-left-width:0}.popover.bottom .arrow{top:-11px;left:50%;margin-left:-11px;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,0.25);border-top-width:0}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-bottom-color:#fff;border-top-width:0}.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-left-color:#999;border-left-color:rgba(0,0,0,0.25);border-right-width:0}.popover.left .arrow:after{right:1px;bottom:-10px;border-left-color:#fff;border-right-width:0}.thumbnails{margin-left:-20px;list-style:none;*zoom:1}.thumbnails:before,.thumbnails:after{display:table;line-height:0;content:""}.thumbnails:after{clear:both}.row-fluid .thumbnails{margin-left:0}.thumbnails>li{float:left;margin-bottom:20px;margin-left:20px}.thumbnail{display:block;padding:4px;line-height:20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.055);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.055);box-shadow:0 1px 3px rgba(0,0,0,0.055);-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}a.thumbnail:hover,a.thumbnail:focus{border-color:#08c;-webkit-box-shadow:0 1px 4px rgba(0,105,214,0.25);-moz-box-shadow:0 1px 4px rgba(0,105,214,0.25);box-shadow:0 1px 4px rgba(0,105,214,0.25)}.thumbnail>img{display:block;max-width:100%;margin-right:auto;margin-left:auto}.thumbnail .caption{padding:9px;color:#555}.media,.media-body{overflow:hidden;*overflow:visible;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{margin-left:0;list-style:none}.label,.badge{display:inline-block;padding:2px 4px;font-size:11.844px;font-weight:bold;line-height:14px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);white-space:nowrap;vertical-align:baseline;background-color:#999}.label{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.badge{padding-right:9px;padding-left:9px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px}.label:empty,.badge:empty{display:none}a.label:hover,a.label:focus,a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}.label-important,.badge-important{background-color:#b94a48}.label-important[href],.badge-important[href]{background-color:#953b39}.label-warning,.badge-warning{background-color:#f89406}.label-warning[href],.badge-warning[href]{background-color:#c67605}.label-success,.badge-success{background-color:#468847}.label-success[href],.badge-success[href]{background-color:#356635}.label-info,.badge-info{background-color:#3a87ad}.label-info[href],.badge-info[href]{background-color:#2d6987}.label-inverse,.badge-inverse{background-color:#333}.label-inverse[href],.badge-inverse[href]{background-color:#1a1a1a}.btn .label,.btn .badge{position:relative;top:-1px}.btn-mini .label,.btn-mini .badge{top:0}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-ms-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:0 0}to{background-position:40px 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f7f7f7;background-image:-moz-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f5f5f5),to(#f9f9f9));background-image:-webkit-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:-o-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:linear-gradient(to bottom,#f5f5f5,#f9f9f9);background-repeat:repeat-x;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#fff9f9f9',GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress .bar{float:left;width:0;height:100%;font-size:12px;color:#fff;text-align:center;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e90d2;background-image:-moz-linear-gradient(top,#149bdf,#0480be);background-image:-webkit-gradient(linear,0 0,0 100%,from(#149bdf),to(#0480be));background-image:-webkit-linear-gradient(top,#149bdf,#0480be);background-image:-o-linear-gradient(top,#149bdf,#0480be);background-image:linear-gradient(to bottom,#149bdf,#0480be);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf',endColorstr='#ff0480be',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-moz-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width .6s ease;-moz-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress .bar+.bar{-webkit-box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15);-moz-box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15)}.progress-striped .bar{background-color:#149bdf;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;-moz-background-size:40px 40px;-o-background-size:40px 40px;background-size:40px 40px}.progress.active .bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-moz-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-danger .bar,.progress .bar-danger{background-color:#dd514c;background-image:-moz-linear-gradient(top,#ee5f5b,#c43c35);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#c43c35));background-image:-webkit-linear-gradient(top,#ee5f5b,#c43c35);background-image:-o-linear-gradient(top,#ee5f5b,#c43c35);background-image:linear-gradient(to bottom,#ee5f5b,#c43c35);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b',endColorstr='#ffc43c35',GradientType=0)}.progress-danger.progress-striped .bar,.progress-striped .bar-danger{background-color:#ee5f5b;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-success .bar,.progress .bar-success{background-color:#5eb95e;background-image:-moz-linear-gradient(top,#62c462,#57a957);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#57a957));background-image:-webkit-linear-gradient(top,#62c462,#57a957);background-image:-o-linear-gradient(top,#62c462,#57a957);background-image:linear-gradient(to bottom,#62c462,#57a957);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462',endColorstr='#ff57a957',GradientType=0)}.progress-success.progress-striped .bar,.progress-striped .bar-success{background-color:#62c462;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-info .bar,.progress .bar-info{background-color:#4bb1cf;background-image:-moz-linear-gradient(top,#5bc0de,#339bb9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#339bb9));background-image:-webkit-linear-gradient(top,#5bc0de,#339bb9);background-image:-o-linear-gradient(top,#5bc0de,#339bb9);background-image:linear-gradient(to bottom,#5bc0de,#339bb9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff339bb9',GradientType=0)}.progress-info.progress-striped .bar,.progress-striped .bar-info{background-color:#5bc0de;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-warning .bar,.progress .bar-warning{background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0)}.progress-warning.progress-striped .bar,.progress-striped .bar-warning{background-color:#fbb450;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.accordion{margin-bottom:20px}.accordion-group{margin-bottom:2px;border:1px solid #e5e5e5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.accordion-heading{border-bottom:0}.accordion-heading .accordion-toggle{display:block;padding:8px 15px}.accordion-toggle{cursor:pointer}.accordion-inner{padding:9px 15px;border-top:1px solid #e5e5e5}.carousel{position:relative;margin-bottom:20px;line-height:1}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-moz-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:40%;left:15px;width:40px;height:40px;margin-top:-20px;font-size:60px;font-weight:100;line-height:30px;color:#fff;text-align:center;background:#222;border:3px solid #fff;-webkit-border-radius:23px;-moz-border-radius:23px;border-radius:23px;opacity:.5;filter:alpha(opacity=50)}.carousel-control.right{right:15px;left:auto}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-indicators{position:absolute;top:15px;right:15px;z-index:5;margin:0;list-style:none}.carousel-indicators li{display:block;float:left;width:10px;height:10px;margin-left:5px;text-indent:-999px;background-color:#ccc;background-color:rgba(255,255,255,0.25);border-radius:5px}.carousel-indicators .active{background-color:#fff}.carousel-caption{position:absolute;right:0;bottom:0;left:0;padding:15px;background:#333;background:rgba(0,0,0,0.75)}.carousel-caption h4,.carousel-caption p{line-height:20px;color:#fff}.carousel-caption h4{margin:0 0 5px}.carousel-caption p{margin-bottom:0}.hero-unit{padding:60px;margin-bottom:30px;font-size:18px;font-weight:200;line-height:30px;color:inherit;background-color:#eee;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;letter-spacing:-1px;color:inherit}.hero-unit li{line-height:30px}.pull-right{float:right}.pull-left{float:left}.hide{display:none}.show{display:block}.invisible{visibility:hidden}.affix{position:fixed}
Binary file integ/js/vs/lib/bootstrap/img/glyphicons-halflings-white.png has changed
Binary file integ/js/vs/lib/bootstrap/img/glyphicons-halflings.png has changed
--- a/integ/js/vs/lib/bootstrap/js/bootstrap.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2268 +0,0 @@
-/* ===================================================
- * bootstrap-transition.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#transitions
- * ===================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
- * ======================================================= */
-
- $(function () {
-
- $.support.transition = (function () {
-
- var transitionEnd = (function () {
-
- var el = document.createElement('bootstrap')
- , transEndEventNames = {
- 'WebkitTransition' : 'webkitTransitionEnd'
- , 'MozTransition' : 'transitionend'
- , 'OTransition' : 'oTransitionEnd otransitionend'
- , 'transition' : 'transitionend'
- }
- , name
-
- for (name in transEndEventNames){
- if (el.style[name] !== undefined) {
- return transEndEventNames[name]
- }
- }
-
- }())
-
- return transitionEnd && {
- end: transitionEnd
- }
-
- })()
-
- })
-
-}(window.jQuery);/* ==========================================================
- * bootstrap-alert.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#alerts
- * ==========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* ALERT CLASS DEFINITION
- * ====================== */
-
- var dismiss = '[data-dismiss="alert"]'
- , Alert = function (el) {
- $(el).on('click', dismiss, this.close)
- }
-
- Alert.prototype.close = function (e) {
- var $this = $(this)
- , selector = $this.attr('data-target')
- , $parent
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
- }
-
- $parent = $(selector)
-
- e && e.preventDefault()
-
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
-
- $parent.trigger(e = $.Event('close'))
-
- if (e.isDefaultPrevented()) return
-
- $parent.removeClass('in')
-
- function removeElement() {
- $parent
- .trigger('closed')
- .remove()
- }
-
- $.support.transition && $parent.hasClass('fade') ?
- $parent.on($.support.transition.end, removeElement) :
- removeElement()
- }
-
-
- /* ALERT PLUGIN DEFINITION
- * ======================= */
-
- var old = $.fn.alert
-
- $.fn.alert = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('alert')
- if (!data) $this.data('alert', (data = new Alert(this)))
- if (typeof option == 'string') data[option].call($this)
- })
- }
-
- $.fn.alert.Constructor = Alert
-
-
- /* ALERT NO CONFLICT
- * ================= */
-
- $.fn.alert.noConflict = function () {
- $.fn.alert = old
- return this
- }
-
-
- /* ALERT DATA-API
- * ============== */
-
- $(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
-
-}(window.jQuery);/* ============================================================
- * bootstrap-button.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#buttons
- * ============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* BUTTON PUBLIC CLASS DEFINITION
- * ============================== */
-
- var Button = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, $.fn.button.defaults, options)
- }
-
- Button.prototype.setState = function (state) {
- var d = 'disabled'
- , $el = this.$element
- , data = $el.data()
- , val = $el.is('input') ? 'val' : 'html'
-
- state = state + 'Text'
- data.resetText || $el.data('resetText', $el[val]())
-
- $el[val](data[state] || this.options[state])
-
- // push to event loop to allow forms to submit
- setTimeout(function () {
- state == 'loadingText' ?
- $el.addClass(d).attr(d, d) :
- $el.removeClass(d).removeAttr(d)
- }, 0)
- }
-
- Button.prototype.toggle = function () {
- var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
-
- $parent && $parent
- .find('.active')
- .removeClass('active')
-
- this.$element.toggleClass('active')
- }
-
-
- /* BUTTON PLUGIN DEFINITION
- * ======================== */
-
- var old = $.fn.button
-
- $.fn.button = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('button')
- , options = typeof option == 'object' && option
- if (!data) $this.data('button', (data = new Button(this, options)))
- if (option == 'toggle') data.toggle()
- else if (option) data.setState(option)
- })
- }
-
- $.fn.button.defaults = {
- loadingText: 'loading...'
- }
-
- $.fn.button.Constructor = Button
-
-
- /* BUTTON NO CONFLICT
- * ================== */
-
- $.fn.button.noConflict = function () {
- $.fn.button = old
- return this
- }
-
-
- /* BUTTON DATA-API
- * =============== */
-
- $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
- var $btn = $(e.target)
- if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
- $btn.button('toggle')
- })
-
-}(window.jQuery);/* ==========================================================
- * bootstrap-carousel.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#carousel
- * ==========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* CAROUSEL CLASS DEFINITION
- * ========================= */
-
- var Carousel = function (element, options) {
- this.$element = $(element)
- this.$indicators = this.$element.find('.carousel-indicators')
- this.options = options
- this.options.pause == 'hover' && this.$element
- .on('mouseenter', $.proxy(this.pause, this))
- .on('mouseleave', $.proxy(this.cycle, this))
- }
-
- Carousel.prototype = {
-
- cycle: function (e) {
- if (!e) this.paused = false
- if (this.interval) clearInterval(this.interval);
- this.options.interval
- && !this.paused
- && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
- return this
- }
-
- , getActiveIndex: function () {
- this.$active = this.$element.find('.item.active')
- this.$items = this.$active.parent().children()
- return this.$items.index(this.$active)
- }
-
- , to: function (pos) {
- var activeIndex = this.getActiveIndex()
- , that = this
-
- if (pos > (this.$items.length - 1) || pos < 0) return
-
- if (this.sliding) {
- return this.$element.one('slid', function () {
- that.to(pos)
- })
- }
-
- if (activeIndex == pos) {
- return this.pause().cycle()
- }
-
- return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
- }
-
- , pause: function (e) {
- if (!e) this.paused = true
- if (this.$element.find('.next, .prev').length && $.support.transition.end) {
- this.$element.trigger($.support.transition.end)
- this.cycle()
- }
- clearInterval(this.interval)
- this.interval = null
- return this
- }
-
- , next: function () {
- if (this.sliding) return
- return this.slide('next')
- }
-
- , prev: function () {
- if (this.sliding) return
- return this.slide('prev')
- }
-
- , slide: function (type, next) {
- var $active = this.$element.find('.item.active')
- , $next = next || $active[type]()
- , isCycling = this.interval
- , direction = type == 'next' ? 'left' : 'right'
- , fallback = type == 'next' ? 'first' : 'last'
- , that = this
- , e
-
- this.sliding = true
-
- isCycling && this.pause()
-
- $next = $next.length ? $next : this.$element.find('.item')[fallback]()
-
- e = $.Event('slide', {
- relatedTarget: $next[0]
- , direction: direction
- })
-
- if ($next.hasClass('active')) return
-
- if (this.$indicators.length) {
- this.$indicators.find('.active').removeClass('active')
- this.$element.one('slid', function () {
- var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
- $nextIndicator && $nextIndicator.addClass('active')
- })
- }
-
- if ($.support.transition && this.$element.hasClass('slide')) {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $next.addClass(type)
- $next[0].offsetWidth // force reflow
- $active.addClass(direction)
- $next.addClass(direction)
- this.$element.one($.support.transition.end, function () {
- $next.removeClass([type, direction].join(' ')).addClass('active')
- $active.removeClass(['active', direction].join(' '))
- that.sliding = false
- setTimeout(function () { that.$element.trigger('slid') }, 0)
- })
- } else {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $active.removeClass('active')
- $next.addClass('active')
- this.sliding = false
- this.$element.trigger('slid')
- }
-
- isCycling && this.cycle()
-
- return this
- }
-
- }
-
-
- /* CAROUSEL PLUGIN DEFINITION
- * ========================== */
-
- var old = $.fn.carousel
-
- $.fn.carousel = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('carousel')
- , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
- , action = typeof option == 'string' ? option : options.slide
- if (!data) $this.data('carousel', (data = new Carousel(this, options)))
- if (typeof option == 'number') data.to(option)
- else if (action) data[action]()
- else if (options.interval) data.pause().cycle()
- })
- }
-
- $.fn.carousel.defaults = {
- interval: 5000
- , pause: 'hover'
- }
-
- $.fn.carousel.Constructor = Carousel
-
-
- /* CAROUSEL NO CONFLICT
- * ==================== */
-
- $.fn.carousel.noConflict = function () {
- $.fn.carousel = old
- return this
- }
-
- /* CAROUSEL DATA-API
- * ================= */
-
- $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
- var $this = $(this), href
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- , options = $.extend({}, $target.data(), $this.data())
- , slideIndex
-
- $target.carousel(options)
-
- if (slideIndex = $this.attr('data-slide-to')) {
- $target.data('carousel').pause().to(slideIndex).cycle()
- }
-
- e.preventDefault()
- })
-
-}(window.jQuery);/* =============================================================
- * bootstrap-collapse.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#collapse
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* COLLAPSE PUBLIC CLASS DEFINITION
- * ================================ */
-
- var Collapse = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, $.fn.collapse.defaults, options)
-
- if (this.options.parent) {
- this.$parent = $(this.options.parent)
- }
-
- this.options.toggle && this.toggle()
- }
-
- Collapse.prototype = {
-
- constructor: Collapse
-
- , dimension: function () {
- var hasWidth = this.$element.hasClass('width')
- return hasWidth ? 'width' : 'height'
- }
-
- , show: function () {
- var dimension
- , scroll
- , actives
- , hasData
-
- if (this.transitioning || this.$element.hasClass('in')) return
-
- dimension = this.dimension()
- scroll = $.camelCase(['scroll', dimension].join('-'))
- actives = this.$parent && this.$parent.find('> .accordion-group > .in')
-
- if (actives && actives.length) {
- hasData = actives.data('collapse')
- if (hasData && hasData.transitioning) return
- actives.collapse('hide')
- hasData || actives.data('collapse', null)
- }
-
- this.$element[dimension](0)
- this.transition('addClass', $.Event('show'), 'shown')
- $.support.transition && this.$element[dimension](this.$element[0][scroll])
- }
-
- , hide: function () {
- var dimension
- if (this.transitioning || !this.$element.hasClass('in')) return
- dimension = this.dimension()
- this.reset(this.$element[dimension]())
- this.transition('removeClass', $.Event('hide'), 'hidden')
- this.$element[dimension](0)
- }
-
- , reset: function (size) {
- var dimension = this.dimension()
-
- this.$element
- .removeClass('collapse')
- [dimension](size || 'auto')
- [0].offsetWidth
-
- this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
-
- return this
- }
-
- , transition: function (method, startEvent, completeEvent) {
- var that = this
- , complete = function () {
- if (startEvent.type == 'show') that.reset()
- that.transitioning = 0
- that.$element.trigger(completeEvent)
- }
-
- this.$element.trigger(startEvent)
-
- if (startEvent.isDefaultPrevented()) return
-
- this.transitioning = 1
-
- this.$element[method]('in')
-
- $.support.transition && this.$element.hasClass('collapse') ?
- this.$element.one($.support.transition.end, complete) :
- complete()
- }
-
- , toggle: function () {
- this[this.$element.hasClass('in') ? 'hide' : 'show']()
- }
-
- }
-
-
- /* COLLAPSE PLUGIN DEFINITION
- * ========================== */
-
- var old = $.fn.collapse
-
- $.fn.collapse = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('collapse')
- , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option)
- if (!data) $this.data('collapse', (data = new Collapse(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.collapse.defaults = {
- toggle: true
- }
-
- $.fn.collapse.Constructor = Collapse
-
-
- /* COLLAPSE NO CONFLICT
- * ==================== */
-
- $.fn.collapse.noConflict = function () {
- $.fn.collapse = old
- return this
- }
-
-
- /* COLLAPSE DATA-API
- * ================= */
-
- $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
- var $this = $(this), href
- , target = $this.attr('data-target')
- || e.preventDefault()
- || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
- , option = $(target).data('collapse') ? 'toggle' : $this.data()
- $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
- $(target).collapse(option)
- })
-
-}(window.jQuery);/* ============================================================
- * bootstrap-dropdown.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#dropdowns
- * ============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* DROPDOWN CLASS DEFINITION
- * ========================= */
-
- var toggle = '[data-toggle=dropdown]'
- , Dropdown = function (element) {
- var $el = $(element).on('click.dropdown.data-api', this.toggle)
- $('html').on('click.dropdown.data-api', function () {
- $el.parent().removeClass('open')
- })
- }
-
- Dropdown.prototype = {
-
- constructor: Dropdown
-
- , toggle: function (e) {
- var $this = $(this)
- , $parent
- , isActive
-
- if ($this.is('.disabled, :disabled')) return
-
- $parent = getParent($this)
-
- isActive = $parent.hasClass('open')
-
- clearMenus()
-
- if (!isActive) {
- $parent.toggleClass('open')
- }
-
- $this.focus()
-
- return false
- }
-
- , keydown: function (e) {
- var $this
- , $items
- , $active
- , $parent
- , isActive
- , index
-
- if (!/(38|40|27)/.test(e.keyCode)) return
-
- $this = $(this)
-
- e.preventDefault()
- e.stopPropagation()
-
- if ($this.is('.disabled, :disabled')) return
-
- $parent = getParent($this)
-
- isActive = $parent.hasClass('open')
-
- if (!isActive || (isActive && e.keyCode == 27)) {
- if (e.which == 27) $parent.find(toggle).focus()
- return $this.click()
- }
-
- $items = $('[role=menu] li:not(.divider):visible a', $parent)
-
- if (!$items.length) return
-
- index = $items.index($items.filter(':focus'))
-
- if (e.keyCode == 38 && index > 0) index-- // up
- if (e.keyCode == 40 && index < $items.length - 1) index++ // down
- if (!~index) index = 0
-
- $items
- .eq(index)
- .focus()
- }
-
- }
-
- function clearMenus() {
- $(toggle).each(function () {
- getParent($(this)).removeClass('open')
- })
- }
-
- function getParent($this) {
- var selector = $this.attr('data-target')
- , $parent
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
- }
-
- $parent = selector && $(selector)
-
- if (!$parent || !$parent.length) $parent = $this.parent()
-
- return $parent
- }
-
-
- /* DROPDOWN PLUGIN DEFINITION
- * ========================== */
-
- var old = $.fn.dropdown
-
- $.fn.dropdown = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('dropdown')
- if (!data) $this.data('dropdown', (data = new Dropdown(this)))
- if (typeof option == 'string') data[option].call($this)
- })
- }
-
- $.fn.dropdown.Constructor = Dropdown
-
-
- /* DROPDOWN NO CONFLICT
- * ==================== */
-
- $.fn.dropdown.noConflict = function () {
- $.fn.dropdown = old
- return this
- }
-
-
- /* APPLY TO STANDARD DROPDOWN ELEMENTS
- * =================================== */
-
- $(document)
- .on('click.dropdown.data-api', clearMenus)
- .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
- .on('.dropdown-menu', function (e) { e.stopPropagation() })
- .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
- .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
-
-}(window.jQuery);
-/* =========================================================
- * bootstrap-modal.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#modals
- * =========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================= */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* MODAL CLASS DEFINITION
- * ====================== */
-
- var Modal = function (element, options) {
- this.options = options
- this.$element = $(element)
- .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
- this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
- }
-
- Modal.prototype = {
-
- constructor: Modal
-
- , toggle: function () {
- return this[!this.isShown ? 'show' : 'hide']()
- }
-
- , show: function () {
- var that = this
- , e = $.Event('show')
-
- this.$element.trigger(e)
-
- if (this.isShown || e.isDefaultPrevented()) return
-
- this.isShown = true
-
- this.escape()
-
- this.backdrop(function () {
- var transition = $.support.transition && that.$element.hasClass('fade')
-
- if (!that.$element.parent().length) {
- that.$element.appendTo(document.body) //don't move modals dom position
- }
-
- that.$element.show()
-
- if (transition) {
- that.$element[0].offsetWidth // force reflow
- }
-
- that.$element
- .addClass('in')
- .attr('aria-hidden', false)
-
- that.enforceFocus()
-
- transition ?
- that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
- that.$element.focus().trigger('shown')
-
- })
- }
-
- , hide: function (e) {
- e && e.preventDefault()
-
- var that = this
-
- e = $.Event('hide')
-
- this.$element.trigger(e)
-
- if (!this.isShown || e.isDefaultPrevented()) return
-
- this.isShown = false
-
- this.escape()
-
- $(document).off('focusin.modal')
-
- this.$element
- .removeClass('in')
- .attr('aria-hidden', true)
-
- $.support.transition && this.$element.hasClass('fade') ?
- this.hideWithTransition() :
- this.hideModal()
- }
-
- , enforceFocus: function () {
- var that = this
- $(document).on('focusin.modal', function (e) {
- if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
- that.$element.focus()
- }
- })
- }
-
- , escape: function () {
- var that = this
- if (this.isShown && this.options.keyboard) {
- this.$element.on('keyup.dismiss.modal', function ( e ) {
- e.which == 27 && that.hide()
- })
- } else if (!this.isShown) {
- this.$element.off('keyup.dismiss.modal')
- }
- }
-
- , hideWithTransition: function () {
- var that = this
- , timeout = setTimeout(function () {
- that.$element.off($.support.transition.end)
- that.hideModal()
- }, 500)
-
- this.$element.one($.support.transition.end, function () {
- clearTimeout(timeout)
- that.hideModal()
- })
- }
-
- , hideModal: function () {
- var that = this
- this.$element.hide()
- this.backdrop(function () {
- that.removeBackdrop()
- that.$element.trigger('hidden')
- })
- }
-
- , removeBackdrop: function () {
- this.$backdrop.remove()
- this.$backdrop = null
- }
-
- , backdrop: function (callback) {
- var that = this
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
-
- if (this.isShown && this.options.backdrop) {
- var doAnimate = $.support.transition && animate
-
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
- .appendTo(document.body)
-
- this.$backdrop.click(
- this.options.backdrop == 'static' ?
- $.proxy(this.$element[0].focus, this.$element[0])
- : $.proxy(this.hide, this)
- )
-
- if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
-
- this.$backdrop.addClass('in')
-
- if (!callback) return
-
- doAnimate ?
- this.$backdrop.one($.support.transition.end, callback) :
- callback()
-
- } else if (!this.isShown && this.$backdrop) {
- this.$backdrop.removeClass('in')
-
- $.support.transition && this.$element.hasClass('fade')?
- this.$backdrop.one($.support.transition.end, callback) :
- callback()
-
- } else if (callback) {
- callback()
- }
- }
- }
-
-
- /* MODAL PLUGIN DEFINITION
- * ======================= */
-
- var old = $.fn.modal
-
- $.fn.modal = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('modal')
- , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
- if (!data) $this.data('modal', (data = new Modal(this, options)))
- if (typeof option == 'string') data[option]()
- else if (options.show) data.show()
- })
- }
-
- $.fn.modal.defaults = {
- backdrop: true
- , keyboard: true
- , show: true
- }
-
- $.fn.modal.Constructor = Modal
-
-
- /* MODAL NO CONFLICT
- * ================= */
-
- $.fn.modal.noConflict = function () {
- $.fn.modal = old
- return this
- }
-
-
- /* MODAL DATA-API
- * ============== */
-
- $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
- var $this = $(this)
- , href = $this.attr('href')
- , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
- , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
-
- e.preventDefault()
-
- $target
- .modal(option)
- .one('hide', function () {
- $this.focus()
- })
- })
-
-}(window.jQuery);
-/* ===========================================================
- * bootstrap-tooltip.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#tooltips
- * Inspired by the original jQuery.tipsy by Jason Frame
- * ===========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* TOOLTIP PUBLIC CLASS DEFINITION
- * =============================== */
-
- var Tooltip = function (element, options) {
- this.init('tooltip', element, options)
- }
-
- Tooltip.prototype = {
-
- constructor: Tooltip
-
- , init: function (type, element, options) {
- var eventIn
- , eventOut
- , triggers
- , trigger
- , i
-
- this.type = type
- this.$element = $(element)
- this.options = this.getOptions(options)
- this.enabled = true
-
- triggers = this.options.trigger.split(' ')
-
- for (i = triggers.length; i--;) {
- trigger = triggers[i]
- if (trigger == 'click') {
- this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
- } else if (trigger != 'manual') {
- eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
- eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
- this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
- this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
- }
- }
-
- this.options.selector ?
- (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
- this.fixTitle()
- }
-
- , getOptions: function (options) {
- options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
-
- if (options.delay && typeof options.delay == 'number') {
- options.delay = {
- show: options.delay
- , hide: options.delay
- }
- }
-
- return options
- }
-
- , enter: function (e) {
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
-
- if (!self.options.delay || !self.options.delay.show) return self.show()
-
- clearTimeout(this.timeout)
- self.hoverState = 'in'
- this.timeout = setTimeout(function() {
- if (self.hoverState == 'in') self.show()
- }, self.options.delay.show)
- }
-
- , leave: function (e) {
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
-
- if (this.timeout) clearTimeout(this.timeout)
- if (!self.options.delay || !self.options.delay.hide) return self.hide()
-
- self.hoverState = 'out'
- this.timeout = setTimeout(function() {
- if (self.hoverState == 'out') self.hide()
- }, self.options.delay.hide)
- }
-
- , show: function () {
- var $tip
- , pos
- , actualWidth
- , actualHeight
- , placement
- , tp
- , e = $.Event('show')
-
- if (this.hasContent() && this.enabled) {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $tip = this.tip()
- this.setContent()
-
- if (this.options.animation) {
- $tip.addClass('fade')
- }
-
- placement = typeof this.options.placement == 'function' ?
- this.options.placement.call(this, $tip[0], this.$element[0]) :
- this.options.placement
-
- $tip
- .detach()
- .css({ top: 0, left: 0, display: 'block' })
-
- this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
-
- pos = this.getPosition()
-
- actualWidth = $tip[0].offsetWidth
- actualHeight = $tip[0].offsetHeight
-
- switch (placement) {
- case 'bottom':
- tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
- break
- case 'top':
- tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
- break
- case 'left':
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
- break
- case 'right':
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
- break
- }
-
- this.applyPlacement(tp, placement)
- this.$element.trigger('shown')
- }
- }
-
- , applyPlacement: function(offset, placement){
- var $tip = this.tip()
- , width = $tip[0].offsetWidth
- , height = $tip[0].offsetHeight
- , actualWidth
- , actualHeight
- , delta
- , replace
-
- $tip
- .offset(offset)
- .addClass(placement)
- .addClass('in')
-
- actualWidth = $tip[0].offsetWidth
- actualHeight = $tip[0].offsetHeight
-
- if (placement == 'top' && actualHeight != height) {
- offset.top = offset.top + height - actualHeight
- replace = true
- }
-
- if (placement == 'bottom' || placement == 'top') {
- delta = 0
-
- if (offset.left < 0){
- delta = offset.left * -2
- offset.left = 0
- $tip.offset(offset)
- actualWidth = $tip[0].offsetWidth
- actualHeight = $tip[0].offsetHeight
- }
-
- this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
- } else {
- this.replaceArrow(actualHeight - height, actualHeight, 'top')
- }
-
- if (replace) $tip.offset(offset)
- }
-
- , replaceArrow: function(delta, dimension, position){
- this
- .arrow()
- .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
- }
-
- , setContent: function () {
- var $tip = this.tip()
- , title = this.getTitle()
-
- $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
- $tip.removeClass('fade in top bottom left right')
- }
-
- , hide: function () {
- var that = this
- , $tip = this.tip()
- , e = $.Event('hide')
-
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
-
- $tip.removeClass('in')
-
- function removeWithAnimation() {
- var timeout = setTimeout(function () {
- $tip.off($.support.transition.end).detach()
- }, 500)
-
- $tip.one($.support.transition.end, function () {
- clearTimeout(timeout)
- $tip.detach()
- })
- }
-
- $.support.transition && this.$tip.hasClass('fade') ?
- removeWithAnimation() :
- $tip.detach()
-
- this.$element.trigger('hidden')
-
- return this
- }
-
- , fixTitle: function () {
- var $e = this.$element
- if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
- $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
- }
- }
-
- , hasContent: function () {
- return this.getTitle()
- }
-
- , getPosition: function () {
- var el = this.$element[0]
- return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
- width: el.offsetWidth
- , height: el.offsetHeight
- }, this.$element.offset())
- }
-
- , getTitle: function () {
- var title
- , $e = this.$element
- , o = this.options
-
- title = $e.attr('data-original-title')
- || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
-
- return title
- }
-
- , tip: function () {
- return this.$tip = this.$tip || $(this.options.template)
- }
-
- , arrow: function(){
- return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
- }
-
- , validate: function () {
- if (!this.$element[0].parentNode) {
- this.hide()
- this.$element = null
- this.options = null
- }
- }
-
- , enable: function () {
- this.enabled = true
- }
-
- , disable: function () {
- this.enabled = false
- }
-
- , toggleEnabled: function () {
- this.enabled = !this.enabled
- }
-
- , toggle: function (e) {
- var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
- self.tip().hasClass('in') ? self.hide() : self.show()
- }
-
- , destroy: function () {
- this.hide().$element.off('.' + this.type).removeData(this.type)
- }
-
- }
-
-
- /* TOOLTIP PLUGIN DEFINITION
- * ========================= */
-
- var old = $.fn.tooltip
-
- $.fn.tooltip = function ( option ) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('tooltip')
- , options = typeof option == 'object' && option
- if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.tooltip.Constructor = Tooltip
-
- $.fn.tooltip.defaults = {
- animation: true
- , placement: 'top'
- , selector: false
- , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
- , trigger: 'hover focus'
- , title: ''
- , delay: 0
- , html: false
- , container: false
- }
-
-
- /* TOOLTIP NO CONFLICT
- * =================== */
-
- $.fn.tooltip.noConflict = function () {
- $.fn.tooltip = old
- return this
- }
-
-}(window.jQuery);
-/* ===========================================================
- * bootstrap-popover.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#popovers
- * ===========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * =========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* POPOVER PUBLIC CLASS DEFINITION
- * =============================== */
-
- var Popover = function (element, options) {
- this.init('popover', element, options)
- }
-
-
- /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
- ========================================== */
-
- Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
-
- constructor: Popover
-
- , setContent: function () {
- var $tip = this.tip()
- , title = this.getTitle()
- , content = this.getContent()
-
- $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
- $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
-
- $tip.removeClass('fade top bottom left right in')
- }
-
- , hasContent: function () {
- return this.getTitle() || this.getContent()
- }
-
- , getContent: function () {
- var content
- , $e = this.$element
- , o = this.options
-
- content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
- || $e.attr('data-content')
-
- return content
- }
-
- , tip: function () {
- if (!this.$tip) {
- this.$tip = $(this.options.template)
- }
- return this.$tip
- }
-
- , destroy: function () {
- this.hide().$element.off('.' + this.type).removeData(this.type)
- }
-
- })
-
-
- /* POPOVER PLUGIN DEFINITION
- * ======================= */
-
- var old = $.fn.popover
-
- $.fn.popover = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('popover')
- , options = typeof option == 'object' && option
- if (!data) $this.data('popover', (data = new Popover(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.popover.Constructor = Popover
-
- $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
- placement: 'right'
- , trigger: 'click'
- , content: ''
- , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
- })
-
-
- /* POPOVER NO CONFLICT
- * =================== */
-
- $.fn.popover.noConflict = function () {
- $.fn.popover = old
- return this
- }
-
-}(window.jQuery);
-/* =============================================================
- * bootstrap-scrollspy.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#scrollspy
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* SCROLLSPY CLASS DEFINITION
- * ========================== */
-
- function ScrollSpy(element, options) {
- var process = $.proxy(this.process, this)
- , $element = $(element).is('body') ? $(window) : $(element)
- , href
- this.options = $.extend({}, $.fn.scrollspy.defaults, options)
- this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
- this.selector = (this.options.target
- || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- || '') + ' .nav li > a'
- this.$body = $('body')
- this.refresh()
- this.process()
- }
-
- ScrollSpy.prototype = {
-
- constructor: ScrollSpy
-
- , refresh: function () {
- var self = this
- , $targets
-
- this.offsets = $([])
- this.targets = $([])
-
- $targets = this.$body
- .find(this.selector)
- .map(function () {
- var $el = $(this)
- , href = $el.data('target') || $el.attr('href')
- , $href = /^#\w/.test(href) && $(href)
- return ( $href
- && $href.length
- && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null
- })
- .sort(function (a, b) { return a[0] - b[0] })
- .each(function () {
- self.offsets.push(this[0])
- self.targets.push(this[1])
- })
- }
-
- , process: function () {
- var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
- , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
- , maxScroll = scrollHeight - this.$scrollElement.height()
- , offsets = this.offsets
- , targets = this.targets
- , activeTarget = this.activeTarget
- , i
-
- if (scrollTop >= maxScroll) {
- return activeTarget != (i = targets.last()[0])
- && this.activate ( i )
- }
-
- for (i = offsets.length; i--;) {
- activeTarget != targets[i]
- && scrollTop >= offsets[i]
- && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
- && this.activate( targets[i] )
- }
- }
-
- , activate: function (target) {
- var active
- , selector
-
- this.activeTarget = target
-
- $(this.selector)
- .parent('.active')
- .removeClass('active')
-
- selector = this.selector
- + '[data-target="' + target + '"],'
- + this.selector + '[href="' + target + '"]'
-
- active = $(selector)
- .parent('li')
- .addClass('active')
-
- if (active.parent('.dropdown-menu').length) {
- active = active.closest('li.dropdown').addClass('active')
- }
-
- active.trigger('activate')
- }
-
- }
-
-
- /* SCROLLSPY PLUGIN DEFINITION
- * =========================== */
-
- var old = $.fn.scrollspy
-
- $.fn.scrollspy = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('scrollspy')
- , options = typeof option == 'object' && option
- if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.scrollspy.Constructor = ScrollSpy
-
- $.fn.scrollspy.defaults = {
- offset: 10
- }
-
-
- /* SCROLLSPY NO CONFLICT
- * ===================== */
-
- $.fn.scrollspy.noConflict = function () {
- $.fn.scrollspy = old
- return this
- }
-
-
- /* SCROLLSPY DATA-API
- * ================== */
-
- $(window).on('load', function () {
- $('[data-spy="scroll"]').each(function () {
- var $spy = $(this)
- $spy.scrollspy($spy.data())
- })
- })
-
-}(window.jQuery);/* ========================================================
- * bootstrap-tab.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#tabs
- * ========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ======================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* TAB CLASS DEFINITION
- * ==================== */
-
- var Tab = function (element) {
- this.element = $(element)
- }
-
- Tab.prototype = {
-
- constructor: Tab
-
- , show: function () {
- var $this = this.element
- , $ul = $this.closest('ul:not(.dropdown-menu)')
- , selector = $this.attr('data-target')
- , previous
- , $target
- , e
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
- }
-
- if ( $this.parent('li').hasClass('active') ) return
-
- previous = $ul.find('.active:last a')[0]
-
- e = $.Event('show', {
- relatedTarget: previous
- })
-
- $this.trigger(e)
-
- if (e.isDefaultPrevented()) return
-
- $target = $(selector)
-
- this.activate($this.parent('li'), $ul)
- this.activate($target, $target.parent(), function () {
- $this.trigger({
- type: 'shown'
- , relatedTarget: previous
- })
- })
- }
-
- , activate: function ( element, container, callback) {
- var $active = container.find('> .active')
- , transition = callback
- && $.support.transition
- && $active.hasClass('fade')
-
- function next() {
- $active
- .removeClass('active')
- .find('> .dropdown-menu > .active')
- .removeClass('active')
-
- element.addClass('active')
-
- if (transition) {
- element[0].offsetWidth // reflow for transition
- element.addClass('in')
- } else {
- element.removeClass('fade')
- }
-
- if ( element.parent('.dropdown-menu') ) {
- element.closest('li.dropdown').addClass('active')
- }
-
- callback && callback()
- }
-
- transition ?
- $active.one($.support.transition.end, next) :
- next()
-
- $active.removeClass('in')
- }
- }
-
-
- /* TAB PLUGIN DEFINITION
- * ===================== */
-
- var old = $.fn.tab
-
- $.fn.tab = function ( option ) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('tab')
- if (!data) $this.data('tab', (data = new Tab(this)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.tab.Constructor = Tab
-
-
- /* TAB NO CONFLICT
- * =============== */
-
- $.fn.tab.noConflict = function () {
- $.fn.tab = old
- return this
- }
-
-
- /* TAB DATA-API
- * ============ */
-
- $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
- e.preventDefault()
- $(this).tab('show')
- })
-
-}(window.jQuery);/* =============================================================
- * bootstrap-typeahead.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#typeahead
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function($){
-
- "use strict"; // jshint ;_;
-
-
- /* TYPEAHEAD PUBLIC CLASS DEFINITION
- * ================================= */
-
- var Typeahead = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, $.fn.typeahead.defaults, options)
- this.matcher = this.options.matcher || this.matcher
- this.sorter = this.options.sorter || this.sorter
- this.highlighter = this.options.highlighter || this.highlighter
- this.updater = this.options.updater || this.updater
- this.source = this.options.source
- this.$menu = $(this.options.menu)
- this.shown = false
- this.listen()
- }
-
- Typeahead.prototype = {
-
- constructor: Typeahead
-
- , select: function () {
- var val = this.$menu.find('.active').attr('data-value')
- this.$element
- .val(this.updater(val))
- .change()
- return this.hide()
- }
-
- , updater: function (item) {
- return item
- }
-
- , show: function () {
- var pos = $.extend({}, this.$element.position(), {
- height: this.$element[0].offsetHeight
- })
-
- this.$menu
- .insertAfter(this.$element)
- .css({
- top: pos.top + pos.height
- , left: pos.left
- })
- .show()
-
- this.shown = true
- return this
- }
-
- , hide: function () {
- this.$menu.hide()
- this.shown = false
- return this
- }
-
- , lookup: function (event) {
- var items
-
- this.query = this.$element.val()
-
- if (!this.query || this.query.length < this.options.minLength) {
- return this.shown ? this.hide() : this
- }
-
- items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
-
- return items ? this.process(items) : this
- }
-
- , process: function (items) {
- var that = this
-
- items = $.grep(items, function (item) {
- return that.matcher(item)
- })
-
- items = this.sorter(items)
-
- if (!items.length) {
- return this.shown ? this.hide() : this
- }
-
- return this.render(items.slice(0, this.options.items)).show()
- }
-
- , matcher: function (item) {
- return ~item.toLowerCase().indexOf(this.query.toLowerCase())
- }
-
- , sorter: function (items) {
- var beginswith = []
- , caseSensitive = []
- , caseInsensitive = []
- , item
-
- while (item = items.shift()) {
- if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
- else if (~item.indexOf(this.query)) caseSensitive.push(item)
- else caseInsensitive.push(item)
- }
-
- return beginswith.concat(caseSensitive, caseInsensitive)
- }
-
- , highlighter: function (item) {
- var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
- return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
- return '<strong>' + match + '</strong>'
- })
- }
-
- , render: function (items) {
- var that = this
-
- items = $(items).map(function (i, item) {
- i = $(that.options.item).attr('data-value', item)
- i.find('a').html(that.highlighter(item))
- return i[0]
- })
-
- items.first().addClass('active')
- this.$menu.html(items)
- return this
- }
-
- , next: function (event) {
- var active = this.$menu.find('.active').removeClass('active')
- , next = active.next()
-
- if (!next.length) {
- next = $(this.$menu.find('li')[0])
- }
-
- next.addClass('active')
- }
-
- , prev: function (event) {
- var active = this.$menu.find('.active').removeClass('active')
- , prev = active.prev()
-
- if (!prev.length) {
- prev = this.$menu.find('li').last()
- }
-
- prev.addClass('active')
- }
-
- , listen: function () {
- this.$element
- .on('focus', $.proxy(this.focus, this))
- .on('blur', $.proxy(this.blur, this))
- .on('keypress', $.proxy(this.keypress, this))
- .on('keyup', $.proxy(this.keyup, this))
-
- if (this.eventSupported('keydown')) {
- this.$element.on('keydown', $.proxy(this.keydown, this))
- }
-
- this.$menu
- .on('click', $.proxy(this.click, this))
- .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
- .on('mouseleave', 'li', $.proxy(this.mouseleave, this))
- }
-
- , eventSupported: function(eventName) {
- var isSupported = eventName in this.$element
- if (!isSupported) {
- this.$element.setAttribute(eventName, 'return;')
- isSupported = typeof this.$element[eventName] === 'function'
- }
- return isSupported
- }
-
- , move: function (e) {
- if (!this.shown) return
-
- switch(e.keyCode) {
- case 9: // tab
- case 13: // enter
- case 27: // escape
- e.preventDefault()
- break
-
- case 38: // up arrow
- e.preventDefault()
- this.prev()
- break
-
- case 40: // down arrow
- e.preventDefault()
- this.next()
- break
- }
-
- e.stopPropagation()
- }
-
- , keydown: function (e) {
- this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
- this.move(e)
- }
-
- , keypress: function (e) {
- if (this.suppressKeyPressRepeat) return
- this.move(e)
- }
-
- , keyup: function (e) {
- switch(e.keyCode) {
- case 40: // down arrow
- case 38: // up arrow
- case 16: // shift
- case 17: // ctrl
- case 18: // alt
- break
-
- case 9: // tab
- case 13: // enter
- if (!this.shown) return
- this.select()
- break
-
- case 27: // escape
- if (!this.shown) return
- this.hide()
- break
-
- default:
- this.lookup()
- }
-
- e.stopPropagation()
- e.preventDefault()
- }
-
- , focus: function (e) {
- this.focused = true
- }
-
- , blur: function (e) {
- this.focused = false
- if (!this.mousedover && this.shown) this.hide()
- }
-
- , click: function (e) {
- e.stopPropagation()
- e.preventDefault()
- this.select()
- this.$element.focus()
- }
-
- , mouseenter: function (e) {
- this.mousedover = true
- this.$menu.find('.active').removeClass('active')
- $(e.currentTarget).addClass('active')
- }
-
- , mouseleave: function (e) {
- this.mousedover = false
- if (!this.focused && this.shown) this.hide()
- }
-
- }
-
-
- /* TYPEAHEAD PLUGIN DEFINITION
- * =========================== */
-
- var old = $.fn.typeahead
-
- $.fn.typeahead = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('typeahead')
- , options = typeof option == 'object' && option
- if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.typeahead.defaults = {
- source: []
- , items: 8
- , menu: '<ul class="typeahead dropdown-menu"></ul>'
- , item: '<li><a href="#"></a></li>'
- , minLength: 1
- }
-
- $.fn.typeahead.Constructor = Typeahead
-
-
- /* TYPEAHEAD NO CONFLICT
- * =================== */
-
- $.fn.typeahead.noConflict = function () {
- $.fn.typeahead = old
- return this
- }
-
-
- /* TYPEAHEAD DATA-API
- * ================== */
-
- $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
- var $this = $(this)
- if ($this.data('typeahead')) return
- $this.typeahead($this.data())
- })
-
-}(window.jQuery);
-/* ==========================================================
- * bootstrap-affix.js v2.3.0
- * http://twitter.github.com/bootstrap/javascript.html#affix
- * ==========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* AFFIX CLASS DEFINITION
- * ====================== */
-
- var Affix = function (element, options) {
- this.options = $.extend({}, $.fn.affix.defaults, options)
- this.$window = $(window)
- .on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
- .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
- this.$element = $(element)
- this.checkPosition()
- }
-
- Affix.prototype.checkPosition = function () {
- if (!this.$element.is(':visible')) return
-
- var scrollHeight = $(document).height()
- , scrollTop = this.$window.scrollTop()
- , position = this.$element.offset()
- , offset = this.options.offset
- , offsetBottom = offset.bottom
- , offsetTop = offset.top
- , reset = 'affix affix-top affix-bottom'
- , affix
-
- if (typeof offset != 'object') offsetBottom = offsetTop = offset
- if (typeof offsetTop == 'function') offsetTop = offset.top()
- if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
-
- affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
- false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
- 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
- 'top' : false
-
- if (this.affixed === affix) return
-
- this.affixed = affix
- this.unpin = affix == 'bottom' ? position.top - scrollTop : null
-
- this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
- }
-
-
- /* AFFIX PLUGIN DEFINITION
- * ======================= */
-
- var old = $.fn.affix
-
- $.fn.affix = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('affix')
- , options = typeof option == 'object' && option
- if (!data) $this.data('affix', (data = new Affix(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.affix.Constructor = Affix
-
- $.fn.affix.defaults = {
- offset: 0
- }
-
-
- /* AFFIX NO CONFLICT
- * ================= */
-
- $.fn.affix.noConflict = function () {
- $.fn.affix = old
- return this
- }
-
-
- /* AFFIX DATA-API
- * ============== */
-
- $(window).on('load', function () {
- $('[data-spy="affix"]').each(function () {
- var $spy = $(this)
- , data = $spy.data()
-
- data.offset = data.offset || {}
-
- data.offsetBottom && (data.offset.bottom = data.offsetBottom)
- data.offsetTop && (data.offset.top = data.offsetTop)
-
- $spy.affix(data)
- })
- })
-
-
-}(window.jQuery);
\ No newline at end of file
--- a/integ/js/vs/lib/bootstrap/js/bootstrap.min.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-/*!
-* Bootstrap.js by @fat & @mdo
-* Copyright 2012 Twitter, Inc.
-* http://www.apache.org/licenses/LICENSE-2.0.txt
-*/
-!function(e){"use strict";e(function(){e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("closed").remove()}var n=e(this),r=n.attr("data-target"),i;r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),i=e(r),t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()};var r=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("alert");i||r.data("alert",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.alert.data-api",t,n.prototype.close)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.data(),i=n.is("input")?"val":"html";e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(t){var n=this.getActiveIndex(),r=this;if(t>this.$items.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){r.to(t)}):n==t?this.pause().cycle():this.slide(t>n?"next":"prev",e(this.$items[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle()),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(t,n){var r=this.$element.find(".item.active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this,f;this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u](),f=e.Event("slide",{relatedTarget:i[0],direction:o});if(i.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var t=e(a.$indicators.children()[a.getActiveIndex()]);t&&t.addClass("active")}));if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var r=e(this),i=r.data("carousel"),s=e.extend({},e.fn.carousel.defaults,typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.pause().cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=e.extend({},i.data(),n.data()),o;i.carousel(s),(o=n.attr("data-slide-to"))&&i.data("carousel").pause().to(o).cycle(),t.preventDefault()})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning||this.$element.hasClass("in"))return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),e.support.transition&&this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning||!this.$element.hasClass("in"))return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var n=e.fn.collapse;e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=e.extend({},e.fn.collapse.defaults,r.data(),typeof n=="object"&&n);i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();n[e(i).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(i).collapse(s)})}(window.jQuery),!function(e){"use strict";function r(){e(t).each(function(){i(e(this)).removeClass("open")})}function i(t){var n=t.attr("data-target"),r;n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),r=n&&e(n);if(!r||!r.length)r=t.parent();return r}var t="[data-toggle=dropdown]",n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),s,o;if(n.is(".disabled, :disabled"))return;return s=i(n),o=s.hasClass("open"),r(),o||s.toggleClass("open"),n.focus(),!1},keydown:function(n){var r,s,o,u,a,f;if(!/(38|40|27)/.test(n.keyCode))return;r=e(this),n.preventDefault(),n.stopPropagation();if(r.is(".disabled, :disabled"))return;u=i(r),a=u.hasClass("open");if(!a||a&&n.keyCode==27)return n.which==27&&u.find(t).focus(),r.click();s=e("[role=menu] li:not(.divider):visible a",u);if(!s.length)return;f=s.index(s.filter(":focus")),n.keyCode==38&&f>0&&f--,n.keyCode==40&&f<s.length-1&&f++,~f||(f=0),s.eq(f).focus()}};var s=e.fn.dropdown;e.fn.dropdown=function(t){return this.each(function(){var r=e(this),i=r.data("dropdown");i||r.data("dropdown",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.dropdown.Constructor=n,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=s,this},e(document).on("click.dropdown.data-api",r).on("click.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on(".dropdown-menu",function(e){e.stopPropagation()}).on("click.dropdown.data-api",t,n.prototype.toggle).on("keydown.dropdown.data-api",t+", [role=menu]",n.prototype.keydown)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n);if(this.isShown||n.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.backdrop(function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),n?t.$element.one(e.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")})},hide:function(t){t&&t.preventDefault();var n=this;t=e.Event("hide"),this.$element.trigger(t);if(!this.isShown||t.isDefaultPrevented())return;this.isShown=!1,this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]!==e.target&&!t.$element.has(e.target).length&&t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){t.which==27&&e.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(){var e=this;this.$element.hide(),this.backdrop(function(){e.removeBackdrop(),e.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&r;this.$backdrop=e('<div class="modal-backdrop '+r+'" />').appendTo(document.body),this.$backdrop.click(this.options.backdrop=="static"?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!t)return;i?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,t):t()):t&&t()}};var n=e.fn.modal;e.fn.modal=function(n){return this.each(function(){var r=e(this),i=r.data("modal"),s=e.extend({},e.fn.modal.defaults,r.data(),typeof n=="object"&&n);i||r.data("modal",i=new t(this,s)),typeof n=="string"?i[n]():s.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r=n.attr("href"),i=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),s=i.data("modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},i.data(),n.data());t.preventDefault(),i.modal(s).one("hide",function(){n.focus()})})}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,s,o,u,a;this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.enabled=!0,o=this.options.trigger.split(" ");for(a=o.length;a--;)u=o[a],u=="click"?this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this)):u!="manual"&&(i=u=="hover"?"mouseenter":"focus",s=u=="hover"?"mouseleave":"blur",this.$element.on(i+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.leave,this)));this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,this.$element.data(),t),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);if(!n.options.delay||!n.options.delay.show)return n.show();clearTimeout(this.timeout),n.hoverState="in",this.timeout=setTimeout(function(){n.hoverState=="in"&&n.show()},n.options.delay.show)},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var t,n,r,i,s,o,u=e.Event("show");if(this.hasContent()&&this.enabled){this.$element.trigger(u);if(u.isDefaultPrevented())return;t=this.tip(),this.setContent(),this.options.animation&&t.addClass("fade"),s=typeof this.options.placement=="function"?this.options.placement.call(this,t[0],this.$element[0]):this.options.placement,t.detach().css({top:0,left:0,display:"block"}),this.options.container?t.appendTo(this.options.container):t.insertAfter(this.$element),n=this.getPosition(),r=t[0].offsetWidth,i=t[0].offsetHeight;switch(s){case"bottom":o={top:n.top+n.height,left:n.left+n.width/2-r/2};break;case"top":o={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":o={top:n.top+n.height/2-i/2,left:n.left-r};break;case"right":o={top:n.top+n.height/2-i/2,left:n.left+n.width}}this.applyPlacement(o,s),this.$element.trigger("shown")}},applyPlacement:function(e,t){var n=this.tip(),r=n[0].offsetWidth,i=n[0].offsetHeight,s,o,u,a;n.offset(e).addClass(t).addClass("in"),s=n[0].offsetWidth,o=n[0].offsetHeight,t=="top"&&o!=i&&(e.top=e.top+i-o,a=!0),t=="bottom"||t=="top"?(u=0,e.left<0&&(u=e.left*-2,e.left=0,n.offset(e),s=n[0].offsetWidth,o=n[0].offsetHeight),this.replaceArrow(u-r+s,s,"left")):this.replaceArrow(o-i,o,"top"),a&&n.offset(e)},replaceArrow:function(e,t,n){this.arrow().css(n,e?50*(1-e/t)+"%":"")},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function i(){var t=setTimeout(function(){n.off(e.support.transition.end).detach()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.detach()})}var t=this,n=this.tip(),r=e.Event("hide");this.$element.trigger(r);if(r.isDefaultPrevented())return;return n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?i():n.detach(),this.$element.trigger("hidden"),this},fixTitle:function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var t=this.$element[0];return e.extend({},typeof t.getBoundingClientRect=="function"?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},tip:function(){return this.$tip=this.$tip||e(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(t){var n=t?e(t.currentTarget)[this.type](this._options).data(this.type):this;n.tip().hasClass("in")?n.hide():n.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var n=e.fn.tooltip;e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},e.fn.tooltip.noConflict=function(){return e.fn.tooltip=n,this}}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=(typeof n.content=="function"?n.content.call(t[0]):n.content)||t.attr("data-content"),e},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var n=e.fn.popover;e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),s=typeof n=="object"&&n;i||r.data("popover",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),e.fn.popover.noConflict=function(){return e.fn.popover=n,this}}(window.jQuery),!function(e){"use strict";function t(t,n){var r=e.proxy(this.process,this),i=e(t).is("body")?e(window):e(t),s;this.options=e.extend({},e.fn.scrollspy.defaults,n),this.$scrollElement=i.on("scroll.scroll-spy.data-api",r),this.selector=(this.options.target||(s=e(t).attr("href"))&&s.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=e("body"),this.refresh(),this.process()}t.prototype={constructor:t,refresh:function(){var t=this,n;this.offsets=e([]),this.targets=e([]),n=this.$body.find(this.selector).map(function(){var n=e(this),r=n.data("target")||n.attr("href"),i=/^#\w/.test(r)&&e(r);return i&&i.length&&[[i.position().top+(!e.isWindow(t.$scrollElement.get(0))&&t.$scrollElement.scrollTop()),r]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},process:function(){var e=this.$scrollElement.scrollTop()+this.options.offset,t=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,n=t-this.$scrollElement.height(),r=this.offsets,i=this.targets,s=this.activeTarget,o;if(e>=n)return s!=(o=i.last()[0])&&this.activate(o);for(o=r.length;o--;)s!=i[o]&&e>=r[o]&&(!r[o+1]||e<=r[o+1])&&this.activate(i[o])},activate:function(t){var n,r;this.activeTarget=t,e(this.selector).parent(".active").removeClass("active"),r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',n=e(r).parent("li").addClass("active"),n.parent(".dropdown-menu").length&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate")}};var n=e.fn.scrollspy;e.fn.scrollspy=function(n){return this.each(function(){var r=e(this),i=r.data("scrollspy"),s=typeof n=="object"&&n;i||r.data("scrollspy",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.defaults={offset:10},e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=n,this},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(window.jQuery),!function(e){"use strict";var t=function(t){this.element=e(t)};t.prototype={constructor:t,show:function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.attr("data-target"),i,s,o;r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;i=n.find(".active:last a")[0],o=e.Event("show",{relatedTarget:i}),t.trigger(o);if(o.isDefaultPrevented())return;s=e(r),this.activate(t.parent("li"),n),this.activate(s,s.parent(),function(){t.trigger({type:"shown",relatedTarget:i})})},activate:function(t,n,r){function o(){i.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),r&&r()}var i=n.find("> .active"),s=r&&e.support.transition&&i.hasClass("fade");s?i.one(e.support.transition.end,o):o(),i.removeClass("in")}};var n=e.fn.tab;e.fn.tab=function(n){return this.each(function(){var r=e(this),i=r.data("tab");i||r.data("tab",i=new t(this)),typeof n=="string"&&i[n]()})},e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=n,this},e(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=e(this.options.menu),this.shown=!1,this.listen()};t.prototype={constructor:t,select:function(){var e=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(e)).change(),this.hide()},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(t){var n;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(n=e.isFunction(this.source)?this.source(this.query,e.proxy(this.process,this)):this.source,n?this.process(n):this)},process:function(t){var n=this;return t=e.grep(t,function(e){return n.matcher(e)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){var t=[],n=[],r=[],i;while(i=e.shift())i.toLowerCase().indexOf(this.query.toLowerCase())?~i.indexOf(this.query)?n.push(i):r.push(i):t.push(i);return t.concat(n,r)},highlighter:function(e){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return e.replace(new RegExp("("+t+")","ig"),function(e,t){return"<strong>"+t+"</strong>"})},render:function(t){var n=this;return t=e(t).map(function(t,r){return t=e(n.options.item).attr("data-value",r),t.find("a").html(n.highlighter(r)),t[0]}),t.first().addClass("active"),this.$menu.html(t),this},next:function(t){var n=this.$menu.find(".active").removeClass("active"),r=n.next();r.length||(r=e(this.$menu.find("li")[0])),r.addClass("active")},prev:function(e){var t=this.$menu.find(".active").removeClass("active"),n=t.prev();n.length||(n=this.$menu.find("li").last()),n.addClass("active")},listen:function(){this.$element.on("focus",e.proxy(this.focus,this)).on("blur",e.proxy(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this)).on("mouseleave","li",e.proxy(this.mouseleave,this))},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t=typeof this.$element[e]=="function"),t},move:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev();break;case 40:e.preventDefault(),this.next()}e.stopPropagation()},keydown:function(t){this.suppressKeyPressRepeat=~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){if(this.suppressKeyPressRepeat)return;this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation(),e.preventDefault()},focus:function(e){this.focused=!0},blur:function(e){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(e){e.stopPropagation(),e.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(t){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),e(t.currentTarget).addClass("active")},mouseleave:function(e){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var n=e.fn.typeahead;e.fn.typeahead=function(n){return this.each(function(){var r=e(this),i=r.data("typeahead"),s=typeof n=="object"&&n;i||r.data("typeahead",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},e.fn.typeahead.Constructor=t,e.fn.typeahead.noConflict=function(){return e.fn.typeahead=n,this},e(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(t){var n=e(this);if(n.data("typeahead"))return;n.typeahead(n.data())})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=e.extend({},e.fn.affix.defaults,n),this.$window=e(window).on("scroll.affix.data-api",e.proxy(this.checkPosition,this)).on("click.affix.data-api",e.proxy(function(){setTimeout(e.proxy(this.checkPosition,this),1)},this)),this.$element=e(t),this.checkPosition()};t.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var t=e(document).height(),n=this.$window.scrollTop(),r=this.$element.offset(),i=this.options.offset,s=i.bottom,o=i.top,u="affix affix-top affix-bottom",a;typeof i!="object"&&(s=o=i),typeof o=="function"&&(o=i.top()),typeof s=="function"&&(s=i.bottom()),a=this.unpin!=null&&n+this.unpin<=r.top?!1:s!=null&&r.top+this.$element.height()>=t-s?"bottom":o!=null&&n<=o?"top":!1;if(this.affixed===a)return;this.affixed=a,this.unpin=a=="bottom"?r.top-n:null,this.$element.removeClass(u).addClass("affix"+(a?"-"+a:""))};var n=e.fn.affix;e.fn.affix=function(n){return this.each(function(){var r=e(this),i=r.data("affix"),s=typeof n=="object"&&n;i||r.data("affix",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.affix.Constructor=t,e.fn.affix.defaults={offset:0},e.fn.affix.noConflict=function(){return e.fn.affix=n,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(window.jQuery);
\ No newline at end of file
--- a/integ/js/vs/lib/d3/d3.v2.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9342 +0,0 @@
-(function(){if (!Date.now) Date.now = function() {
- return +new Date;
-};
-try {
- document.createElement("div").style.setProperty("opacity", 0, "");
-} catch (error) {
- var d3_style_prototype = CSSStyleDeclaration.prototype,
- d3_style_setProperty = d3_style_prototype.setProperty;
- d3_style_prototype.setProperty = function(name, value, priority) {
- d3_style_setProperty.call(this, name, value + "", priority);
- };
-}
-d3 = {version: "2.8.1"}; // semver
-function d3_class(ctor, properties) {
- try {
- for (var key in properties) {
- Object.defineProperty(ctor.prototype, key, {
- value: properties[key],
- enumerable: false
- });
- }
- } catch (e) {
- ctor.prototype = properties;
- }
-}
-var d3_array = d3_arraySlice; // conversion for NodeLists
-
-function d3_arrayCopy(pseudoarray) {
- var i = -1, n = pseudoarray.length, array = [];
- while (++i < n) array.push(pseudoarray[i]);
- return array;
-}
-
-function d3_arraySlice(pseudoarray) {
- return Array.prototype.slice.call(pseudoarray);
-}
-
-try {
- d3_array(document.documentElement.childNodes)[0].nodeType;
-} catch(e) {
- d3_array = d3_arrayCopy;
-}
-
-var d3_arraySubclass = [].__proto__?
-
-// Until ECMAScript supports array subclassing, prototype injection works well.
-function(array, prototype) {
- array.__proto__ = prototype;
-}:
-
-// And if your browser doesn't support __proto__, we'll use direct extension.
-function(array, prototype) {
- for (var property in prototype) array[property] = prototype[property];
-};
-d3.map = function(object) {
- var map = new d3_Map;
- for (var key in object) map.set(key, object[key]);
- return map;
-};
-
-function d3_Map() {}
-
-d3_class(d3_Map, {
- has: function(key) {
- return d3_map_prefix + key in this;
- },
- get: function(key) {
- return this[d3_map_prefix + key];
- },
- set: function(key, value) {
- return this[d3_map_prefix + key] = value;
- },
- remove: function(key) {
- key = d3_map_prefix + key;
- return key in this && delete this[key];
- },
- keys: function() {
- var keys = [];
- this.forEach(function(key) { keys.push(key); });
- return keys;
- },
- values: function() {
- var values = [];
- this.forEach(function(key, value) { values.push(value); });
- return values;
- },
- entries: function() {
- var entries = [];
- this.forEach(function(key, value) { entries.push({key: key, value: value}); });
- return entries;
- },
- forEach: function(f) {
- for (var key in this) {
- if (key.charCodeAt(0) === d3_map_prefixCode) {
- f.call(this, key.substring(1), this[key]);
- }
- }
- }
-});
-
-var d3_map_prefix = "\0", // prevent collision with built-ins
- d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
-function d3_this() {
- return this;
-}
-d3.functor = function(v) {
- return typeof v === "function" ? v : function() { return v; };
-};
-// Copies a variable number of methods from source to target.
-d3.rebind = function(target, source) {
- var i = 1, n = arguments.length, method;
- while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
- return target;
-};
-
-// Method is assumed to be a standard D3 getter-setter:
-// If passed with no arguments, gets the value.
-// If passed with arguments, sets the value and returns the target.
-function d3_rebind(target, source, method) {
- return function() {
- var value = method.apply(source, arguments);
- return arguments.length ? target : value;
- };
-}
-d3.ascending = function(a, b) {
- return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
-};
-d3.descending = function(a, b) {
- return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
-};
-d3.mean = function(array, f) {
- var n = array.length,
- a,
- m = 0,
- i = -1,
- j = 0;
- if (arguments.length === 1) {
- while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
- } else {
- while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
- }
- return j ? m : undefined;
-};
-d3.median = function(array, f) {
- if (arguments.length > 1) array = array.map(f);
- array = array.filter(d3_number);
- return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
-};
-d3.min = function(array, f) {
- var i = -1,
- n = array.length,
- a,
- b;
- if (arguments.length === 1) {
- while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
- while (++i < n) if ((b = array[i]) != null && a > b) a = b;
- } else {
- while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
- while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
- }
- return a;
-};
-d3.max = function(array, f) {
- var i = -1,
- n = array.length,
- a,
- b;
- if (arguments.length === 1) {
- while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
- while (++i < n) if ((b = array[i]) != null && b > a) a = b;
- } else {
- while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
- while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
- }
- return a;
-};
-d3.extent = function(array, f) {
- var i = -1,
- n = array.length,
- a,
- b,
- c;
- if (arguments.length === 1) {
- while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
- while (++i < n) if ((b = array[i]) != null) {
- if (a > b) a = b;
- if (c < b) c = b;
- }
- } else {
- while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
- while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
- if (a > b) a = b;
- if (c < b) c = b;
- }
- }
- return [a, c];
-};
-d3.random = {
- normal: function(mean, deviation) {
- if (arguments.length < 2) deviation = 1;
- if (arguments.length < 1) mean = 0;
- return function() {
- var x, y, r;
- do {
- x = Math.random() * 2 - 1;
- y = Math.random() * 2 - 1;
- r = x * x + y * y;
- } while (!r || r > 1);
- return mean + deviation * x * Math.sqrt(-2 * Math.log(r) / r);
- };
- }
-};
-function d3_number(x) {
- return x != null && !isNaN(x);
-}
-d3.sum = function(array, f) {
- var s = 0,
- n = array.length,
- a,
- i = -1;
-
- if (arguments.length === 1) {
- while (++i < n) if (!isNaN(a = +array[i])) s += a;
- } else {
- while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
- }
-
- return s;
-};
-// R-7 per <http://en.wikipedia.org/wiki/Quantile>
-d3.quantile = function(values, p) {
- var H = (values.length - 1) * p + 1,
- h = Math.floor(H),
- v = values[h - 1],
- e = H - h;
- return e ? v + e * (values[h] - v) : v;
-};
-d3.transpose = function(matrix) {
- return d3.zip.apply(d3, matrix);
-};
-d3.zip = function() {
- if (!(n = arguments.length)) return [];
- for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) {
- for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n;) {
- zip[j] = arguments[j][i];
- }
- }
- return zips;
-};
-
-function d3_zipLength(d) {
- return d.length;
-}
-d3.bisector = function(f) {
- return {
- left: function(a, x, lo, hi) {
- if (arguments.length < 3) lo = 0;
- if (arguments.length < 4) hi = a.length;
- while (lo < hi) {
- var mid = lo + hi >> 1;
- if (f.call(a, a[mid], mid) < x) lo = mid + 1;
- else hi = mid;
- }
- return lo;
- },
- right: function(a, x, lo, hi) {
- if (arguments.length < 3) lo = 0;
- if (arguments.length < 4) hi = a.length;
- while (lo < hi) {
- var mid = lo + hi >> 1;
- if (x < f.call(a, a[mid], mid)) hi = mid;
- else lo = mid + 1;
- }
- return lo;
- }
- };
-};
-
-var d3_bisector = d3.bisector(function(d) { return d; });
-d3.bisectLeft = d3_bisector.left;
-d3.bisect = d3.bisectRight = d3_bisector.right;
-d3.first = function(array, f) {
- var i = 0,
- n = array.length,
- a = array[0],
- b;
- if (arguments.length === 1) f = d3.ascending;
- while (++i < n) {
- if (f.call(array, a, b = array[i]) > 0) {
- a = b;
- }
- }
- return a;
-};
-d3.last = function(array, f) {
- var i = 0,
- n = array.length,
- a = array[0],
- b;
- if (arguments.length === 1) f = d3.ascending;
- while (++i < n) {
- if (f.call(array, a, b = array[i]) <= 0) {
- a = b;
- }
- }
- return a;
-};
-d3.nest = function() {
- var nest = {},
- keys = [],
- sortKeys = [],
- sortValues,
- rollup;
-
- function map(array, depth) {
- if (depth >= keys.length) return rollup
- ? rollup.call(nest, array) : (sortValues
- ? array.sort(sortValues)
- : array);
-
- var i = -1,
- n = array.length,
- key = keys[depth++],
- keyValue,
- object,
- valuesByKey = new d3_Map,
- values,
- o = {};
-
- while (++i < n) {
- if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
- values.push(object);
- } else {
- valuesByKey.set(keyValue, [object]);
- }
- }
-
- valuesByKey.forEach(function(keyValue) {
- o[keyValue] = map(valuesByKey.get(keyValue), depth);
- });
-
- return o;
- }
-
- function entries(map, depth) {
- if (depth >= keys.length) return map;
-
- var a = [],
- sortKey = sortKeys[depth++],
- key;
-
- for (key in map) {
- a.push({key: key, values: entries(map[key], depth)});
- }
-
- if (sortKey) a.sort(function(a, b) {
- return sortKey(a.key, b.key);
- });
-
- return a;
- }
-
- nest.map = function(array) {
- return map(array, 0);
- };
-
- nest.entries = function(array) {
- return entries(map(array, 0), 0);
- };
-
- nest.key = function(d) {
- keys.push(d);
- return nest;
- };
-
- // Specifies the order for the most-recently specified key.
- // Note: only applies to entries. Map keys are unordered!
- nest.sortKeys = function(order) {
- sortKeys[keys.length - 1] = order;
- return nest;
- };
-
- // Specifies the order for leaf values.
- // Applies to both maps and entries array.
- nest.sortValues = function(order) {
- sortValues = order;
- return nest;
- };
-
- nest.rollup = function(f) {
- rollup = f;
- return nest;
- };
-
- return nest;
-};
-d3.keys = function(map) {
- var keys = [];
- for (var key in map) keys.push(key);
- return keys;
-};
-d3.values = function(map) {
- var values = [];
- for (var key in map) values.push(map[key]);
- return values;
-};
-d3.entries = function(map) {
- var entries = [];
- for (var key in map) entries.push({key: key, value: map[key]});
- return entries;
-};
-d3.permute = function(array, indexes) {
- var permutes = [],
- i = -1,
- n = indexes.length;
- while (++i < n) permutes[i] = array[indexes[i]];
- return permutes;
-};
-d3.merge = function(arrays) {
- return Array.prototype.concat.apply([], arrays);
-};
-d3.split = function(array, f) {
- var arrays = [],
- values = [],
- value,
- i = -1,
- n = array.length;
- if (arguments.length < 2) f = d3_splitter;
- while (++i < n) {
- if (f.call(values, value = array[i], i)) {
- values = [];
- } else {
- if (!values.length) arrays.push(values);
- values.push(value);
- }
- }
- return arrays;
-};
-
-function d3_splitter(d) {
- return d == null;
-}
-function d3_collapse(s) {
- return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " ");
-}
-d3.range = function(start, stop, step) {
- if (arguments.length < 3) {
- step = 1;
- if (arguments.length < 2) {
- stop = start;
- start = 0;
- }
- }
- if ((stop - start) / step === Infinity) throw new Error("infinite range");
- var range = [],
- k = d3_range_integerScale(Math.abs(step)),
- i = -1,
- j;
- start *= k, stop *= k, step *= k;
- if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k);
- else while ((j = start + step * ++i) < stop) range.push(j / k);
- return range;
-};
-
-function d3_range_integerScale(x) {
- var k = 1;
- while (x * k % 1) k *= 10;
- return k;
-}
-d3.requote = function(s) {
- return s.replace(d3_requote_re, "\\$&");
-};
-
-var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
-d3.round = function(x, n) {
- return n
- ? Math.round(x * (n = Math.pow(10, n))) / n
- : Math.round(x);
-};
-d3.xhr = function(url, mime, callback) {
- var req = new XMLHttpRequest;
- if (arguments.length < 3) callback = mime, mime = null;
- else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
- req.open("GET", url, true);
- if (mime) req.setRequestHeader("Accept", mime);
- req.onreadystatechange = function() {
- if (req.readyState === 4) callback(req.status < 300 ? req : null);
- };
- req.send(null);
-};
-d3.text = function(url, mime, callback) {
- function ready(req) {
- callback(req && req.responseText);
- }
- if (arguments.length < 3) {
- callback = mime;
- mime = null;
- }
- d3.xhr(url, mime, ready);
-};
-d3.json = function(url, callback) {
- d3.text(url, "application/json", function(text) {
- callback(text ? JSON.parse(text) : null);
- });
-};
-d3.html = function(url, callback) {
- d3.text(url, "text/html", function(text) {
- if (text != null) { // Treat empty string as valid HTML.
- var range = document.createRange();
- range.selectNode(document.body);
- text = range.createContextualFragment(text);
- }
- callback(text);
- });
-};
-d3.xml = function(url, mime, callback) {
- function ready(req) {
- callback(req && req.responseXML);
- }
- if (arguments.length < 3) {
- callback = mime;
- mime = null;
- }
- d3.xhr(url, mime, ready);
-};
-var d3_nsPrefix = {
- 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: d3_nsPrefix,
- qualify: function(name) {
- var i = name.indexOf(":"),
- prefix = name;
- if (i >= 0) {
- prefix = name.substring(0, i);
- name = name.substring(i + 1);
- }
- return d3_nsPrefix.hasOwnProperty(prefix)
- ? {space: d3_nsPrefix[prefix], local: name}
- : name;
- }
-};
-d3.dispatch = function() {
- var dispatch = new d3_dispatch,
- i = -1,
- n = arguments.length;
- while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
- return dispatch;
-};
-
-function d3_dispatch() {}
-
-d3_dispatch.prototype.on = function(type, listener) {
- var i = type.indexOf("."),
- name = "";
-
- // Extract optional namespace, e.g., "click.foo"
- if (i > 0) {
- name = type.substring(i + 1);
- type = type.substring(0, i);
- }
-
- return arguments.length < 2
- ? this[type].on(name)
- : this[type].on(name, listener);
-};
-
-function d3_dispatch_event(dispatch) {
- var listeners = [],
- listenerByName = new d3_Map;
-
- function event() {
- var z = listeners, // defensive reference
- i = -1,
- n = z.length,
- l;
- while (++i < n) if (l = z[i].on) l.apply(this, arguments);
- return dispatch;
- }
-
- event.on = function(name, listener) {
- var l = listenerByName.get(name),
- i;
-
- // return the current listener, if any
- if (arguments.length < 2) return l && l.on;
-
- // remove the old listener, if any (with copy-on-write)
- if (l) {
- l.on = null;
- listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
- listenerByName.remove(name);
- }
-
- // add the new listener, if any
- if (listener) listeners.push(listenerByName.set(name, {on: listener}));
-
- return dispatch;
- };
-
- return event;
-}
-// TODO align
-d3.format = function(specifier) {
- var match = d3_format_re.exec(specifier),
- fill = match[1] || " ",
- sign = match[3] || "",
- zfill = match[5],
- width = +match[6],
- comma = match[7],
- precision = match[8],
- type = match[9],
- scale = 1,
- suffix = "",
- integer = false;
-
- if (precision) precision = +precision.substring(1);
-
- if (zfill) {
- fill = "0"; // TODO align = "=";
- if (comma) width -= Math.floor((width - 1) / 4);
- }
-
- switch (type) {
- case "n": comma = true; type = "g"; break;
- case "%": scale = 100; suffix = "%"; type = "f"; break;
- case "p": scale = 100; suffix = "%"; type = "r"; break;
- case "d": integer = true; precision = 0; break;
- case "s": scale = -1; type = "r"; break;
- }
-
- // If no precision is specified for r, fallback to general notation.
- if (type == "r" && !precision) type = "g";
-
- type = d3_format_types.get(type) || d3_format_typeDefault;
-
- return function(value) {
-
- // Return the empty string for floats formatted as ints.
- if (integer && (value % 1)) return "";
-
- // Convert negative to positive, and record the sign prefix.
- var negative = (value < 0) && (value = -value) ? "\u2212" : sign;
-
- // Apply the scale, computing it from the value's exponent for si format.
- if (scale < 0) {
- var prefix = d3.formatPrefix(value, precision);
- value *= prefix.scale;
- suffix = prefix.symbol;
- } else {
- value *= scale;
- }
-
- // Convert to the desired precision.
- value = type(value, precision);
-
- // If the fill character is 0, the sign and group is applied after the fill.
- if (zfill) {
- var length = value.length + negative.length;
- if (length < width) value = new Array(width - length + 1).join(fill) + value;
- if (comma) value = d3_format_group(value);
- value = negative + value;
- }
-
- // Otherwise (e.g., space-filling), the sign and group is applied before.
- else {
- if (comma) value = d3_format_group(value);
- value = negative + value;
- var length = value.length;
- if (length < width) value = new Array(width - length + 1).join(fill) + value;
- }
-
- return value + suffix;
- };
-};
-
-// [[fill]align][sign][#][0][width][,][.precision][type]
-var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
-
-var d3_format_types = d3.map({
- g: function(x, p) { return x.toPrecision(p); },
- e: function(x, p) { return x.toExponential(p); },
- f: function(x, p) { return x.toFixed(p); },
- r: function(x, p) { return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p))); }
-});
-
-function d3_format_precision(x, p) {
- return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
-}
-
-function d3_format_typeDefault(x) {
- return x + "";
-}
-
-// Apply comma grouping for thousands.
-function d3_format_group(value) {
- var i = value.lastIndexOf("."),
- f = i >= 0 ? value.substring(i) : (i = value.length, ""),
- t = [];
- while (i > 0) t.push(value.substring(i -= 3, i + 3));
- return t.reverse().join(",") + f;
-}
-var d3_formatPrefixes = ["y","z","a","f","p","n","μ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);
-
-d3.formatPrefix = function(value, precision) {
- var i = 0;
- if (value) {
- if (value < 0) value *= -1;
- if (precision) value = d3.round(value, d3_format_precision(value, precision));
- i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
- i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
- }
- return d3_formatPrefixes[8 + i / 3];
-};
-
-function d3_formatPrefix(d, i) {
- return {
- scale: Math.pow(10, (8 - i) * 3),
- symbol: d
- };
-}
-
-/*
- * TERMS OF USE - EASING EQUATIONS
- *
- * Open source under the BSD License.
- *
- * Copyright 2001 Robert Penner
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * - Neither the name of the author nor the names of contributors may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-var d3_ease_quad = d3_ease_poly(2),
- d3_ease_cubic = d3_ease_poly(3),
- d3_ease_default = function() { return d3_ease_identity; };
-
-var d3_ease = d3.map({
- linear: d3_ease_default,
- poly: d3_ease_poly,
- quad: function() { return d3_ease_quad; },
- cubic: function() { return d3_ease_cubic; },
- sin: function() { return d3_ease_sin; },
- exp: function() { return d3_ease_exp; },
- circle: function() { return d3_ease_circle; },
- elastic: d3_ease_elastic,
- back: d3_ease_back,
- bounce: function() { return d3_ease_bounce; }
-});
-
-var d3_ease_mode = d3.map({
- "in": d3_ease_identity,
- "out": d3_ease_reverse,
- "in-out": d3_ease_reflect,
- "out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); }
-});
-
-d3.ease = function(name) {
- var i = name.indexOf("-"),
- t = i >= 0 ? name.substring(0, i) : name,
- m = i >= 0 ? name.substring(i + 1) : "in";
- t = d3_ease.get(t) || d3_ease_default;
- m = d3_ease_mode.get(m) || d3_ease_identity;
- return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
-};
-
-function d3_ease_clamp(f) {
- return function(t) {
- return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
- };
-}
-
-function d3_ease_reverse(f) {
- return function(t) {
- return 1 - f(1 - t);
- };
-}
-
-function d3_ease_reflect(f) {
- return function(t) {
- return .5 * (t < .5 ? f(2 * t) : (2 - f(2 - 2 * t)));
- };
-}
-
-function d3_ease_identity(t) {
- return t;
-}
-
-function d3_ease_poly(e) {
- return function(t) {
- return Math.pow(t, e);
- };
-}
-
-function d3_ease_sin(t) {
- return 1 - Math.cos(t * Math.PI / 2);
-}
-
-function d3_ease_exp(t) {
- return Math.pow(2, 10 * (t - 1));
-}
-
-function d3_ease_circle(t) {
- return 1 - Math.sqrt(1 - t * t);
-}
-
-function d3_ease_elastic(a, p) {
- var s;
- if (arguments.length < 2) p = 0.45;
- if (arguments.length < 1) { a = 1; s = p / 4; }
- else s = p / (2 * Math.PI) * Math.asin(1 / a);
- return function(t) {
- return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
- };
-}
-
-function d3_ease_back(s) {
- if (!s) s = 1.70158;
- return function(t) {
- return t * t * ((s + 1) * t - s);
- };
-}
-
-function d3_ease_bounce(t) {
- return t < 1 / 2.75 ? 7.5625 * t * t
- : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75
- : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375
- : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
-}
-d3.event = null;
-
-function d3_eventCancel() {
- d3.event.stopPropagation();
- d3.event.preventDefault();
-}
-
-function d3_eventSource() {
- var e = d3.event, s;
- while (s = e.sourceEvent) e = s;
- return e;
-}
-
-// Like d3.dispatch, but for custom events abstracting native UI events. These
-// events have a target component (such as a brush), a target element (such as
-// the svg:g element containing the brush) and the standard arguments `d` (the
-// target element's data) and `i` (the selection index of the target element).
-function d3_eventDispatch(target) {
- var dispatch = new d3_dispatch,
- i = 0,
- n = arguments.length;
-
- while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
-
- // Creates a dispatch context for the specified `thiz` (typically, the target
- // DOM element that received the source event) and `argumentz` (typically, the
- // data `d` and index `i` of the target element). The returned function can be
- // used to dispatch an event to any registered listeners; the function takes a
- // single argument as input, being the event to dispatch. The event must have
- // a "type" attribute which corresponds to a type registered in the
- // constructor. This context will automatically populate the "sourceEvent" and
- // "target" attributes of the event, as well as setting the `d3.event` global
- // for the duration of the notification.
- dispatch.of = function(thiz, argumentz) {
- return function(e1) {
- try {
- var e0 =
- e1.sourceEvent = d3.event;
- e1.target = target;
- d3.event = e1;
- dispatch[e1.type].apply(thiz, argumentz);
- } finally {
- d3.event = e0;
- }
- };
- };
-
- return dispatch;
-}
-d3.interpolate = function(a, b) {
- var i = d3.interpolators.length, f;
- while (--i >= 0 && !(f = d3.interpolators[i](a, b)));
- return f;
-};
-
-d3.interpolateNumber = function(a, b) {
- b -= a;
- return function(t) { return a + b * t; };
-};
-
-d3.interpolateRound = function(a, b) {
- b -= a;
- return function(t) { return Math.round(a + b * t); };
-};
-
-d3.interpolateString = function(a, b) {
- var m, // current match
- i, // current index
- j, // current index (for coallescing)
- s0 = 0, // start index of current string prefix
- s1 = 0, // end index of current string prefix
- s = [], // string constants and placeholders
- q = [], // number interpolators
- n, // q.length
- o;
-
- // Reset our regular expression!
- d3_interpolate_number.lastIndex = 0;
-
- // Find all numbers in b.
- for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
- if (m.index) s.push(b.substring(s0, s1 = m.index));
- q.push({i: s.length, x: m[0]});
- s.push(null);
- s0 = d3_interpolate_number.lastIndex;
- }
- if (s0 < b.length) s.push(b.substring(s0));
-
- // Find all numbers in a.
- for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
- o = q[i];
- if (o.x == m[0]) { // The numbers match, so coallesce.
- if (o.i) {
- if (s[o.i + 1] == null) { // This match is followed by another number.
- s[o.i - 1] += o.x;
- s.splice(o.i, 1);
- for (j = i + 1; j < n; ++j) q[j].i--;
- } else { // This match is followed by a string, so coallesce twice.
- s[o.i - 1] += o.x + s[o.i + 1];
- s.splice(o.i, 2);
- for (j = i + 1; j < n; ++j) q[j].i -= 2;
- }
- } else {
- if (s[o.i + 1] == null) { // This match is followed by another number.
- s[o.i] = o.x;
- } else { // This match is followed by a string, so coallesce twice.
- s[o.i] = o.x + s[o.i + 1];
- s.splice(o.i + 1, 1);
- for (j = i + 1; j < n; ++j) q[j].i--;
- }
- }
- q.splice(i, 1);
- n--;
- i--;
- } else {
- o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
- }
- }
-
- // Remove any numbers in b not found in a.
- while (i < n) {
- o = q.pop();
- if (s[o.i + 1] == null) { // This match is followed by another number.
- s[o.i] = o.x;
- } else { // This match is followed by a string, so coallesce twice.
- s[o.i] = o.x + s[o.i + 1];
- s.splice(o.i + 1, 1);
- }
- n--;
- }
-
- // Special optimization for only a single match.
- if (s.length === 1) {
- return s[0] == null ? q[0].x : function() { return b; };
- }
-
- // Otherwise, interpolate each of the numbers and rejoin the string.
- return function(t) {
- for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
- return s.join("");
- };
-};
-
-d3.interpolateTransform = function(a, b) {
- var s = [], // string constants and placeholders
- q = [], // number interpolators
- n,
- A = d3.transform(a),
- B = d3.transform(b),
- ta = A.translate,
- tb = B.translate,
- ra = A.rotate,
- rb = B.rotate,
- wa = A.skew,
- wb = B.skew,
- ka = A.scale,
- kb = B.scale;
-
- if (ta[0] != tb[0] || ta[1] != tb[1]) {
- s.push("translate(", null, ",", null, ")");
- q.push({i: 1, x: d3.interpolateNumber(ta[0], tb[0])}, {i: 3, x: d3.interpolateNumber(ta[1], tb[1])});
- } else if (tb[0] || tb[1]) {
- s.push("translate(" + tb + ")");
- } else {
- s.push("");
- }
-
- if (ra != rb) {
- q.push({i: s.push(s.pop() + "rotate(", null, ")") - 2, x: d3.interpolateNumber(ra, rb)});
- } else if (rb) {
- s.push(s.pop() + "rotate(" + rb + ")");
- }
-
- if (wa != wb) {
- q.push({i: s.push(s.pop() + "skewX(", null, ")") - 2, x: d3.interpolateNumber(wa, wb)});
- } else if (wb) {
- s.push(s.pop() + "skewX(" + wb + ")");
- }
-
- if (ka[0] != kb[0] || ka[1] != kb[1]) {
- n = s.push(s.pop() + "scale(", null, ",", null, ")");
- q.push({i: n - 4, x: d3.interpolateNumber(ka[0], kb[0])}, {i: n - 2, x: d3.interpolateNumber(ka[1], kb[1])});
- } else if (kb[0] != 1 || kb[1] != 1) {
- s.push(s.pop() + "scale(" + kb + ")");
- }
-
- n = q.length;
- return function(t) {
- var i = -1, o;
- while (++i < n) s[(o = q[i]).i] = o.x(t);
- return s.join("");
- };
-};
-
-d3.interpolateRgb = function(a, b) {
- a = d3.rgb(a);
- b = d3.rgb(b);
- var ar = a.r,
- ag = a.g,
- ab = a.b,
- br = b.r - ar,
- bg = b.g - ag,
- bb = b.b - ab;
- return function(t) {
- return "#"
- + d3_rgb_hex(Math.round(ar + br * t))
- + d3_rgb_hex(Math.round(ag + bg * t))
- + d3_rgb_hex(Math.round(ab + bb * t));
- };
-};
-
-// interpolates HSL space, but outputs RGB string (for compatibility)
-d3.interpolateHsl = function(a, b) {
- a = d3.hsl(a);
- b = d3.hsl(b);
- var h0 = a.h,
- s0 = a.s,
- l0 = a.l,
- h1 = b.h - h0,
- s1 = b.s - s0,
- l1 = b.l - l0;
- return function(t) {
- return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString();
- };
-};
-
-d3.interpolateArray = function(a, b) {
- var x = [],
- c = [],
- na = a.length,
- nb = b.length,
- n0 = Math.min(a.length, b.length),
- i;
- for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
- for (; i < na; ++i) c[i] = a[i];
- for (; i < nb; ++i) c[i] = b[i];
- return function(t) {
- for (i = 0; i < n0; ++i) c[i] = x[i](t);
- return c;
- };
-};
-
-d3.interpolateObject = function(a, b) {
- var i = {},
- c = {},
- k;
- for (k in a) {
- if (k in b) {
- i[k] = d3_interpolateByName(k)(a[k], b[k]);
- } else {
- c[k] = a[k];
- }
- }
- for (k in b) {
- if (!(k in a)) {
- c[k] = b[k];
- }
- }
- return function(t) {
- for (k in i) c[k] = i[k](t);
- return c;
- };
-}
-
-var d3_interpolate_number = /[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g;
-
-function d3_interpolateByName(n) {
- return n == "transform"
- ? d3.interpolateTransform
- : d3.interpolate;
-}
-
-d3.interpolators = [
- d3.interpolateObject,
- function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); },
- function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); },
- function(a, b) { return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); },
- function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); }
-];
-function d3_uninterpolateNumber(a, b) {
- b = b - (a = +a) ? 1 / (b - a) : 0;
- return function(x) { return (x - a) * b; };
-}
-
-function d3_uninterpolateClamp(a, b) {
- b = b - (a = +a) ? 1 / (b - a) : 0;
- return function(x) { return Math.max(0, Math.min(1, (x - a) * b)); };
-}
-d3.rgb = function(r, g, b) {
- return arguments.length === 1
- ? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b)
- : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb))
- : d3_rgb(~~r, ~~g, ~~b);
-};
-
-function d3_rgb(r, g, b) {
- return new d3_Rgb(r, g, b);
-}
-
-function d3_Rgb(r, g, b) {
- this.r = r;
- this.g = g;
- this.b = b;
-}
-
-d3_Rgb.prototype.brighter = function(k) {
- k = Math.pow(0.7, arguments.length ? k : 1);
- var r = this.r,
- g = this.g,
- b = this.b,
- i = 30;
- if (!r && !g && !b) return d3_rgb(i, i, i);
- if (r && r < i) r = i;
- if (g && g < i) g = i;
- if (b && b < i) b = i;
- return d3_rgb(
- Math.min(255, Math.floor(r / k)),
- Math.min(255, Math.floor(g / k)),
- Math.min(255, Math.floor(b / k)));
-};
-
-d3_Rgb.prototype.darker = function(k) {
- k = Math.pow(0.7, arguments.length ? k : 1);
- return d3_rgb(
- Math.floor(k * this.r),
- Math.floor(k * this.g),
- Math.floor(k * this.b));
-};
-
-d3_Rgb.prototype.hsl = function() {
- return d3_rgb_hsl(this.r, this.g, this.b);
-};
-
-d3_Rgb.prototype.toString = function() {
- return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
-};
-
-function d3_rgb_hex(v) {
- return v < 0x10
- ? "0" + Math.max(0, v).toString(16)
- : Math.min(255, v).toString(16);
-}
-
-function d3_rgb_parse(format, rgb, hsl) {
- var r = 0, // red channel; int in [0, 255]
- g = 0, // green channel; int in [0, 255]
- b = 0, // blue channel; int in [0, 255]
- m1, // CSS color specification match
- m2, // CSS color specification type (e.g., rgb)
- name;
-
- /* Handle hsl, rgb. */
- m1 = /([a-z]+)\((.*)\)/i.exec(format);
- if (m1) {
- m2 = m1[2].split(",");
- switch (m1[1]) {
- case "hsl": {
- return hsl(
- parseFloat(m2[0]), // degrees
- parseFloat(m2[1]) / 100, // percentage
- parseFloat(m2[2]) / 100 // percentage
- );
- }
- case "rgb": {
- return rgb(
- d3_rgb_parseNumber(m2[0]),
- d3_rgb_parseNumber(m2[1]),
- d3_rgb_parseNumber(m2[2])
- );
- }
- }
- }
-
- /* Named colors. */
- if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
-
- /* Hexadecimal colors: #rgb and #rrggbb. */
- if (format != null && format.charAt(0) === "#") {
- if (format.length === 4) {
- r = format.charAt(1); r += r;
- g = format.charAt(2); g += g;
- b = format.charAt(3); b += b;
- } else if (format.length === 7) {
- r = format.substring(1, 3);
- g = format.substring(3, 5);
- b = format.substring(5, 7);
- }
- r = parseInt(r, 16);
- g = parseInt(g, 16);
- b = parseInt(b, 16);
- }
-
- return rgb(r, g, b);
-}
-
-function d3_rgb_hsl(r, g, b) {
- var min = Math.min(r /= 255, g /= 255, b /= 255),
- max = Math.max(r, g, b),
- d = max - min,
- h,
- s,
- l = (max + min) / 2;
- if (d) {
- s = l < .5 ? d / (max + min) : d / (2 - max - min);
- if (r == max) h = (g - b) / d + (g < b ? 6 : 0);
- else if (g == max) h = (b - r) / d + 2;
- else h = (r - g) / d + 4;
- h *= 60;
- } else {
- s = h = 0;
- }
- return d3_hsl(h, s, l);
-}
-
-function d3_rgb_parseNumber(c) { // either integer or percentage
- var f = parseFloat(c);
- return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
-}
-
-var d3_rgb_names = 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"
-});
-
-d3_rgb_names.forEach(function(key, value) {
- d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
-});
-d3.hsl = function(h, s, l) {
- return arguments.length === 1
- ? (h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l)
- : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl))
- : d3_hsl(+h, +s, +l);
-};
-
-function d3_hsl(h, s, l) {
- return new d3_Hsl(h, s, l);
-}
-
-function d3_Hsl(h, s, l) {
- this.h = h;
- this.s = s;
- this.l = l;
-}
-
-d3_Hsl.prototype.brighter = function(k) {
- k = Math.pow(0.7, arguments.length ? k : 1);
- return d3_hsl(this.h, this.s, this.l / k);
-};
-
-d3_Hsl.prototype.darker = function(k) {
- k = Math.pow(0.7, arguments.length ? k : 1);
- return d3_hsl(this.h, this.s, k * this.l);
-};
-
-d3_Hsl.prototype.rgb = function() {
- return d3_hsl_rgb(this.h, this.s, this.l);
-};
-
-d3_Hsl.prototype.toString = function() {
- return this.rgb().toString();
-};
-
-function d3_hsl_rgb(h, s, l) {
- var m1,
- m2;
-
- /* Some simple corrections for h, s and l. */
- h = h % 360; if (h < 0) h += 360;
- s = s < 0 ? 0 : s > 1 ? 1 : s;
- l = l < 0 ? 0 : l > 1 ? 1 : l;
-
- /* From FvD 13.37, CSS Color Module Level 3 */
- m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
- m1 = 2 * l - m2;
-
- function v(h) {
- if (h > 360) h -= 360;
- else if (h < 0) h += 360;
- if (h < 60) return m1 + (m2 - m1) * h / 60;
- if (h < 180) return m2;
- if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
- return m1;
- }
-
- function vv(h) {
- return Math.round(v(h) * 255);
- }
-
- return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
-}
-function d3_selection(groups) {
- d3_arraySubclass(groups, d3_selectionPrototype);
- return groups;
-}
-
-var d3_select = function(s, n) { return n.querySelector(s); },
- d3_selectAll = function(s, n) { return n.querySelectorAll(s); },
- d3_selectRoot = document.documentElement,
- d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector,
- d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); };
-
-// Prefer Sizzle, if available.
-if (typeof Sizzle === "function") {
- d3_select = function(s, n) { return Sizzle(s, n)[0]; };
- d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); };
- d3_selectMatches = Sizzle.matchesSelector;
-}
-
-var d3_selectionPrototype = [];
-
-d3.selection = function() {
- return d3_selectionRoot;
-};
-
-d3.selection.prototype = d3_selectionPrototype;
-d3_selectionPrototype.select = function(selector) {
- var subgroups = [],
- subgroup,
- subnode,
- group,
- node;
-
- if (typeof selector !== "function") selector = d3_selection_selector(selector);
-
- for (var j = -1, m = this.length; ++j < m;) {
- subgroups.push(subgroup = []);
- subgroup.parentNode = (group = this[j]).parentNode;
- for (var i = -1, n = group.length; ++i < n;) {
- if (node = group[i]) {
- subgroup.push(subnode = selector.call(node, node.__data__, i));
- if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
- } else {
- subgroup.push(null);
- }
- }
- }
-
- return d3_selection(subgroups);
-};
-
-function d3_selection_selector(selector) {
- return function() {
- return d3_select(selector, this);
- };
-}
-d3_selectionPrototype.selectAll = function(selector) {
- var subgroups = [],
- subgroup,
- node;
-
- if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
-
- for (var j = -1, m = this.length; ++j < m;) {
- for (var group = this[j], i = -1, n = group.length; ++i < n;) {
- if (node = group[i]) {
- subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
- subgroup.parentNode = node;
- }
- }
- }
-
- return d3_selection(subgroups);
-};
-
-function d3_selection_selectorAll(selector) {
- return function() {
- return d3_selectAll(selector, this);
- };
-}
-d3_selectionPrototype.attr = function(name, value) {
- name = d3.ns.qualify(name);
-
- // If no value is specified, return the first value.
- if (arguments.length < 2) {
- var node = this.node();
- return name.local
- ? node.getAttributeNS(name.space, name.local)
- : node.getAttribute(name);
- }
-
- function attrNull() {
- this.removeAttribute(name);
- }
-
- function attrNullNS() {
- this.removeAttributeNS(name.space, name.local);
- }
-
- function attrConstant() {
- this.setAttribute(name, value);
- }
-
- function attrConstantNS() {
- this.setAttributeNS(name.space, name.local, value);
- }
-
- function attrFunction() {
- var x = value.apply(this, arguments);
- if (x == null) this.removeAttribute(name);
- else this.setAttribute(name, x);
- }
-
- function attrFunctionNS() {
- var x = value.apply(this, arguments);
- if (x == null) this.removeAttributeNS(name.space, name.local);
- else this.setAttributeNS(name.space, name.local, x);
- }
-
- return this.each(value == null
- ? (name.local ? attrNullNS : attrNull) : (typeof value === "function"
- ? (name.local ? attrFunctionNS : attrFunction)
- : (name.local ? attrConstantNS : attrConstant)));
-};
-d3_selectionPrototype.classed = function(name, value) {
- var names = name.split(d3_selection_classedWhitespace),
- n = names.length,
- i = -1;
- if (arguments.length > 1) {
- while (++i < n) d3_selection_classed.call(this, names[i], value);
- return this;
- } else {
- while (++i < n) if (!d3_selection_classed.call(this, names[i])) return false;
- return true;
- }
-};
-
-var d3_selection_classedWhitespace = /\s+/g;
-
-function d3_selection_classed(name, value) {
- var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g");
-
- // If no value is specified, return the first value.
- if (arguments.length < 2) {
- var node = this.node();
- if (c = node.classList) return c.contains(name);
- var c = node.className;
- re.lastIndex = 0;
- return re.test(c.baseVal != null ? c.baseVal : c);
- }
-
- function classedAdd() {
- if (c = this.classList) return c.add(name);
- var c = this.className,
- cb = c.baseVal != null,
- cv = cb ? c.baseVal : c;
- re.lastIndex = 0;
- if (!re.test(cv)) {
- cv = d3_collapse(cv + " " + name);
- if (cb) c.baseVal = cv;
- else this.className = cv;
- }
- }
-
- function classedRemove() {
- if (c = this.classList) return c.remove(name);
- var c = this.className,
- cb = c.baseVal != null,
- cv = cb ? c.baseVal : c;
- cv = d3_collapse(cv.replace(re, " "));
- if (cb) c.baseVal = cv;
- else this.className = cv;
- }
-
- function classedFunction() {
- (value.apply(this, arguments)
- ? classedAdd
- : classedRemove).call(this);
- }
-
- return this.each(typeof value === "function"
- ? classedFunction : value
- ? classedAdd
- : classedRemove);
-}
-d3_selectionPrototype.style = function(name, value, priority) {
- if (arguments.length < 3) priority = "";
-
- // If no value is specified, return the first value.
- if (arguments.length < 2) return window
- .getComputedStyle(this.node(), null)
- .getPropertyValue(name);
-
- function styleNull() {
- this.style.removeProperty(name);
- }
-
- function styleConstant() {
- this.style.setProperty(name, value, priority);
- }
-
- function styleFunction() {
- var x = value.apply(this, arguments);
- if (x == null) this.style.removeProperty(name);
- else this.style.setProperty(name, x, priority);
- }
-
- return this.each(value == null
- ? styleNull : (typeof value === "function"
- ? styleFunction : styleConstant));
-};
-d3_selectionPrototype.property = function(name, value) {
-
- // If no value is specified, return the first value.
- if (arguments.length < 2) return this.node()[name];
-
- function propertyNull() {
- delete this[name];
- }
-
- function propertyConstant() {
- this[name] = value;
- }
-
- function propertyFunction() {
- var x = value.apply(this, arguments);
- if (x == null) delete this[name];
- else this[name] = x;
- }
-
- return this.each(value == null
- ? propertyNull : (typeof value === "function"
- ? propertyFunction : propertyConstant));
-};
-d3_selectionPrototype.text = function(value) {
- return arguments.length < 1
- ? this.node().textContent : this.each(typeof value === "function"
- ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null
- ? function() { this.textContent = ""; }
- : function() { this.textContent = value; });
-};
-d3_selectionPrototype.html = function(value) {
- return arguments.length < 1
- ? this.node().innerHTML : this.each(typeof value === "function"
- ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null
- ? function() { this.innerHTML = ""; }
- : function() { this.innerHTML = value; });
-};
-// TODO append(node)?
-// TODO append(function)?
-d3_selectionPrototype.append = function(name) {
- name = d3.ns.qualify(name);
-
- function append() {
- return this.appendChild(document.createElementNS(this.namespaceURI, name));
- }
-
- function appendNS() {
- return this.appendChild(document.createElementNS(name.space, name.local));
- }
-
- return this.select(name.local ? appendNS : append);
-};
-// TODO insert(node, function)?
-// TODO insert(function, string)?
-// TODO insert(function, function)?
-d3_selectionPrototype.insert = function(name, before) {
- name = d3.ns.qualify(name);
-
- function insert() {
- return this.insertBefore(
- document.createElementNS(this.namespaceURI, name),
- d3_select(before, this));
- }
-
- function insertNS() {
- return this.insertBefore(
- document.createElementNS(name.space, name.local),
- d3_select(before, this));
- }
-
- return this.select(name.local ? insertNS : insert);
-};
-// TODO remove(selector)?
-// TODO remove(node)?
-// TODO remove(function)?
-d3_selectionPrototype.remove = function() {
- return this.each(function() {
- var parent = this.parentNode;
- if (parent) parent.removeChild(this);
- });
-};
-d3_selectionPrototype.data = function(value, key) {
- var i = -1,
- n = this.length,
- group,
- node;
-
- // If no value is specified, return the first value.
- if (!arguments.length) {
- value = new Array(n = (group = this[0]).length);
- while (++i < n) {
- if (node = group[i]) {
- value[i] = node.__data__;
- }
- }
- return value;
- }
-
- function bind(group, groupData) {
- var i,
- n = group.length,
- m = groupData.length,
- n0 = Math.min(n, m),
- n1 = Math.max(n, m),
- updateNodes = [],
- enterNodes = [],
- exitNodes = [],
- node,
- nodeData;
-
- if (key) {
- var nodeByKeyValue = new d3_Map,
- keyValues = [],
- keyValue,
- j = groupData.length;
-
- for (i = -1; ++i < n;) {
- keyValue = key.call(node = group[i], node.__data__, i);
- if (nodeByKeyValue.has(keyValue)) {
- exitNodes[j++] = node; // duplicate key
- } else {
- nodeByKeyValue.set(keyValue, node);
- }
- keyValues.push(keyValue);
- }
-
- for (i = -1; ++i < m;) {
- keyValue = key.call(groupData, nodeData = groupData[i], i)
- if (nodeByKeyValue.has(keyValue)) {
- updateNodes[i] = node = nodeByKeyValue.get(keyValue);
- node.__data__ = nodeData;
- enterNodes[i] = exitNodes[i] = null;
- } else {
- enterNodes[i] = d3_selection_dataNode(nodeData);
- updateNodes[i] = exitNodes[i] = null;
- }
- nodeByKeyValue.remove(keyValue);
- }
-
- for (i = -1; ++i < n;) {
- if (nodeByKeyValue.has(keyValues[i])) {
- exitNodes[i] = group[i];
- }
- }
- } else {
- for (i = -1; ++i < n0;) {
- node = group[i];
- nodeData = groupData[i];
- if (node) {
- node.__data__ = nodeData;
- updateNodes[i] = node;
- enterNodes[i] = exitNodes[i] = null;
- } else {
- enterNodes[i] = d3_selection_dataNode(nodeData);
- updateNodes[i] = exitNodes[i] = null;
- }
- }
- for (; i < m; ++i) {
- enterNodes[i] = d3_selection_dataNode(groupData[i]);
- updateNodes[i] = exitNodes[i] = null;
- }
- for (; i < n1; ++i) {
- exitNodes[i] = group[i];
- enterNodes[i] = updateNodes[i] = null;
- }
- }
-
- enterNodes.update
- = updateNodes;
-
- enterNodes.parentNode
- = updateNodes.parentNode
- = exitNodes.parentNode
- = group.parentNode;
-
- enter.push(enterNodes);
- update.push(updateNodes);
- exit.push(exitNodes);
- }
-
- var enter = d3_selection_enter([]),
- update = d3_selection([]),
- exit = d3_selection([]);
-
- if (typeof value === "function") {
- while (++i < n) {
- bind(group = this[i], value.call(group, group.parentNode.__data__, i));
- }
- } else {
- while (++i < n) {
- bind(group = this[i], value);
- }
- }
-
- update.enter = function() { return enter; };
- update.exit = function() { return exit; };
- return update;
-};
-
-function d3_selection_dataNode(data) {
- return {__data__: data};
-}
-d3_selectionPrototype.datum =
-d3_selectionPrototype.map = function(value) {
- return arguments.length < 1
- ? this.property("__data__")
- : this.property("__data__", value);
-};
-d3_selectionPrototype.filter = function(filter) {
- var subgroups = [],
- subgroup,
- group,
- node;
-
- if (typeof filter !== "function") filter = d3_selection_filter(filter);
-
- for (var j = 0, m = this.length; j < m; j++) {
- subgroups.push(subgroup = []);
- subgroup.parentNode = (group = this[j]).parentNode;
- for (var i = 0, n = group.length; i < n; i++) {
- if ((node = group[i]) && filter.call(node, node.__data__, i)) {
- subgroup.push(node);
- }
- }
- }
-
- return d3_selection(subgroups);
-};
-
-function d3_selection_filter(selector) {
- return function() {
- return d3_selectMatches(this, selector);
- };
-}
-d3_selectionPrototype.order = function() {
- for (var j = -1, m = this.length; ++j < m;) {
- for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
- if (node = group[i]) {
- if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
- next = node;
- }
- }
- }
- return this;
-};
-d3_selectionPrototype.sort = function(comparator) {
- comparator = d3_selection_sortComparator.apply(this, arguments);
- for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator);
- return this.order();
-};
-
-function d3_selection_sortComparator(comparator) {
- if (!arguments.length) comparator = d3.ascending;
- return function(a, b) {
- return comparator(a && a.__data__, b && b.__data__);
- };
-}
-// type can be namespaced, e.g., "click.foo"
-// listener can be null for removal
-d3_selectionPrototype.on = function(type, listener, capture) {
- if (arguments.length < 3) capture = false;
-
- // parse the type specifier
- var name = "__on" + type, i = type.indexOf(".");
- if (i > 0) type = type.substring(0, i);
-
- // if called with only one argument, return the current listener
- if (arguments.length < 2) return (i = this.node()[name]) && i._;
-
- // remove the old event listener, and add the new event listener
- return this.each(function(d, i) {
- var node = this,
- o = node[name];
-
- // remove the old listener, if any (using the previously-set capture)
- if (o) {
- node.removeEventListener(type, o, o.$);
- delete node[name];
- }
-
- // add the new listener, if any (remembering the capture flag)
- if (listener) {
- node.addEventListener(type, node[name] = l, l.$ = capture);
- l._ = listener; // stash the unwrapped listener for get
- }
-
- // wrapped event listener that preserves i
- function l(e) {
- var o = d3.event; // Events can be reentrant (e.g., focus).
- d3.event = e;
- try {
- listener.call(node, node.__data__, i);
- } finally {
- d3.event = o;
- }
- }
- });
-};
-d3_selectionPrototype.each = function(callback) {
- for (var j = -1, m = this.length; ++j < m;) {
- for (var group = this[j], i = -1, n = group.length; ++i < n;) {
- var node = group[i];
- if (node) callback.call(node, node.__data__, i, j);
- }
- }
- return this;
-};
-//
-// Note: assigning to the arguments array simultaneously changes the value of
-// the corresponding argument!
-//
-// TODO The `this` argument probably shouldn't be the first argument to the
-// callback, anyway, since it's redundant. However, that will require a major
-// version bump due to backwards compatibility, so I'm not changing it right
-// away.
-//
-d3_selectionPrototype.call = function(callback) {
- callback.apply(this, (arguments[0] = this, arguments));
- return this;
-};
-d3_selectionPrototype.empty = function() {
- return !this.node();
-};
-d3_selectionPrototype.node = function(callback) {
- for (var j = 0, m = this.length; j < m; j++) {
- for (var group = this[j], i = 0, n = group.length; i < n; i++) {
- var node = group[i];
- if (node) return node;
- }
- }
- return null;
-};
-d3_selectionPrototype.transition = function() {
- var subgroups = [],
- subgroup,
- node;
-
- for (var j = -1, m = this.length; ++j < m;) {
- subgroups.push(subgroup = []);
- for (var group = this[j], i = -1, n = group.length; ++i < n;) {
- subgroup.push((node = group[i]) ? {node: node, delay: d3_transitionDelay, duration: d3_transitionDuration} : null);
- }
- }
-
- return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now());
-};
-var d3_selectionRoot = d3_selection([[document]]);
-
-d3_selectionRoot[0].parentNode = d3_selectRoot;
-
-// TODO fast singleton implementation!
-// TODO select(function)
-d3.select = function(selector) {
- return typeof selector === "string"
- ? d3_selectionRoot.select(selector)
- : d3_selection([[selector]]); // assume node
-};
-
-// TODO selectAll(function)
-d3.selectAll = function(selector) {
- return typeof selector === "string"
- ? d3_selectionRoot.selectAll(selector)
- : d3_selection([d3_array(selector)]); // assume node[]
-};
-function d3_selection_enter(selection) {
- d3_arraySubclass(selection, d3_selection_enterPrototype);
- return selection;
-}
-
-var d3_selection_enterPrototype = [];
-
-d3.selection.enter = d3_selection_enter;
-d3.selection.enter.prototype = d3_selection_enterPrototype;
-
-d3_selection_enterPrototype.append = d3_selectionPrototype.append;
-d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
-d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
-d3_selection_enterPrototype.node = d3_selectionPrototype.node;
-d3_selection_enterPrototype.select = function(selector) {
- var subgroups = [],
- subgroup,
- subnode,
- upgroup,
- group,
- node;
-
- for (var j = -1, m = this.length; ++j < m;) {
- upgroup = (group = this[j]).update;
- subgroups.push(subgroup = []);
- subgroup.parentNode = group.parentNode;
- for (var i = -1, n = group.length; ++i < n;) {
- if (node = group[i]) {
- subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
- subnode.__data__ = node.__data__;
- } else {
- subgroup.push(null);
- }
- }
- }
-
- return d3_selection(subgroups);
-};
-function d3_transition(groups, id, time) {
- d3_arraySubclass(groups, d3_transitionPrototype);
-
- var tweens = new d3_Map,
- event = d3.dispatch("start", "end"),
- ease = d3_transitionEase;
-
- groups.id = id;
-
- groups.time = time;
-
- groups.tween = function(name, tween) {
- if (arguments.length < 2) return tweens.get(name);
- if (tween == null) tweens.remove(name);
- else tweens.set(name, tween);
- return groups;
- };
-
- groups.ease = function(value) {
- if (!arguments.length) return ease;
- ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);
- return groups;
- };
-
- groups.each = function(type, listener) {
- if (arguments.length < 2) return d3_transition_each.call(groups, type);
- event.on(type, listener);
- return groups;
- };
-
- d3.timer(function(elapsed) {
- groups.each(function(d, i, j) {
- var tweened = [],
- node = this,
- delay = groups[j][i].delay,
- duration = groups[j][i].duration,
- lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0});
-
- ++lock.count;
-
- delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);
-
- function start(elapsed) {
- if (lock.active > id) return stop();
- lock.active = id;
-
- tweens.forEach(function(key, value) {
- if (tween = value.call(node, d, i)) {
- tweened.push(tween);
- }
- });
-
- event.start.call(node, d, i);
- if (!tick(elapsed)) d3.timer(tick, 0, time);
- return 1;
- }
-
- function tick(elapsed) {
- if (lock.active !== id) return stop();
-
- var t = (elapsed - delay) / duration,
- e = ease(t),
- n = tweened.length;
-
- while (n > 0) {
- tweened[--n].call(node, e);
- }
-
- if (t >= 1) {
- stop();
- d3_transitionId = id;
- event.end.call(node, d, i);
- d3_transitionId = 0;
- return 1;
- }
- }
-
- function stop() {
- if (!--lock.count) delete node.__transition__;
- return 1;
- }
- });
- return 1;
- }, 0, time);
-
- return groups;
-}
-
-var d3_transitionRemove = {};
-
-function d3_transitionNull(d, i, a) {
- return a != "" && d3_transitionRemove;
-}
-
-function d3_transitionTween(name, b) {
- var interpolate = d3_interpolateByName(name);
-
- function transitionFunction(d, i, a) {
- var v = b.call(this, d, i);
- return v == null
- ? a != "" && d3_transitionRemove
- : a != v && interpolate(a, v);
- }
-
- function transitionString(d, i, a) {
- return a != b && interpolate(a, b);
- }
-
- return typeof b === "function" ? transitionFunction
- : b == null ? d3_transitionNull
- : (b += "", transitionString);
-}
-
-var d3_transitionPrototype = [],
- d3_transitionNextId = 0,
- d3_transitionId = 0,
- d3_transitionDefaultDelay = 0,
- d3_transitionDefaultDuration = 250,
- d3_transitionDefaultEase = d3.ease("cubic-in-out"),
- d3_transitionDelay = d3_transitionDefaultDelay,
- d3_transitionDuration = d3_transitionDefaultDuration,
- d3_transitionEase = d3_transitionDefaultEase;
-
-d3_transitionPrototype.call = d3_selectionPrototype.call;
-
-d3.transition = function(selection) {
- return arguments.length
- ? (d3_transitionId ? selection.transition() : selection)
- : d3_selectionRoot.transition();
-};
-
-d3.transition.prototype = d3_transitionPrototype;
-d3_transitionPrototype.select = function(selector) {
- var subgroups = [],
- subgroup,
- subnode,
- node;
-
- if (typeof selector !== "function") selector = d3_selection_selector(selector);
-
- for (var j = -1, m = this.length; ++j < m;) {
- subgroups.push(subgroup = []);
- for (var group = this[j], i = -1, n = group.length; ++i < n;) {
- if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {
- if ("__data__" in node.node) subnode.__data__ = node.node.__data__;
- subgroup.push({node: subnode, delay: node.delay, duration: node.duration});
- } else {
- subgroup.push(null);
- }
- }
- }
-
- return d3_transition(subgroups, this.id, this.time).ease(this.ease());
-};
-d3_transitionPrototype.selectAll = function(selector) {
- var subgroups = [],
- subgroup,
- subnodes,
- node;
-
- if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
-
- for (var j = -1, m = this.length; ++j < m;) {
- for (var group = this[j], i = -1, n = group.length; ++i < n;) {
- if (node = group[i]) {
- subnodes = selector.call(node.node, node.node.__data__, i);
- subgroups.push(subgroup = []);
- for (var k = -1, o = subnodes.length; ++k < o;) {
- subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration});
- }
- }
- }
- }
-
- return d3_transition(subgroups, this.id, this.time).ease(this.ease());
-};
-d3_transitionPrototype.attr = function(name, value) {
- return this.attrTween(name, d3_transitionTween(name, value));
-};
-
-d3_transitionPrototype.attrTween = function(nameNS, tween) {
- var name = d3.ns.qualify(nameNS);
-
- function attrTween(d, i) {
- var f = tween.call(this, d, i, this.getAttribute(name));
- return f === d3_transitionRemove
- ? (this.removeAttribute(name), null)
- : f && function(t) { this.setAttribute(name, f(t)); };
- }
-
- function attrTweenNS(d, i) {
- var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
- return f === d3_transitionRemove
- ? (this.removeAttributeNS(name.space, name.local), null)
- : f && function(t) { this.setAttributeNS(name.space, name.local, f(t)); };
- }
-
- return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
-};
-d3_transitionPrototype.style = function(name, value, priority) {
- if (arguments.length < 3) priority = "";
- return this.styleTween(name, d3_transitionTween(name, value), priority);
-};
-
-d3_transitionPrototype.styleTween = function(name, tween, priority) {
- if (arguments.length < 3) priority = "";
- return this.tween("style." + name, function(d, i) {
- var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
- return f === d3_transitionRemove
- ? (this.style.removeProperty(name), null)
- : f && function(t) { this.style.setProperty(name, f(t), priority); };
- });
-};
-d3_transitionPrototype.text = function(value) {
- return this.tween("text", function(d, i) {
- this.textContent = typeof value === "function"
- ? value.call(this, d, i)
- : value;
- });
-};
-d3_transitionPrototype.remove = function() {
- return this.each("end.transition", function() {
- var p;
- if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
- });
-};
-d3_transitionPrototype.delay = function(value) {
- var groups = this;
- return groups.each(typeof value === "function"
- ? function(d, i, j) { groups[j][i].delay = value.apply(this, arguments) | 0; }
- : (value = value | 0, function(d, i, j) { groups[j][i].delay = value; }));
-};
-d3_transitionPrototype.duration = function(value) {
- var groups = this;
- return groups.each(typeof value === "function"
- ? function(d, i, j) { groups[j][i].duration = Math.max(1, value.apply(this, arguments) | 0); }
- : (value = Math.max(1, value | 0), function(d, i, j) { groups[j][i].duration = value; }));
-};
-function d3_transition_each(callback) {
- var id = d3_transitionId,
- ease = d3_transitionEase,
- delay = d3_transitionDelay,
- duration = d3_transitionDuration;
-
- d3_transitionId = this.id;
- d3_transitionEase = this.ease();
- for (var j = 0, m = this.length; j < m; j++) {
- for (var group = this[j], i = 0, n = group.length; i < n; i++) {
- var node = group[i];
- if (node) {
- d3_transitionDelay = this[j][i].delay;
- d3_transitionDuration = this[j][i].duration;
- callback.call(node = node.node, node.__data__, i, j);
- }
- }
- }
-
- d3_transitionId = id;
- d3_transitionEase = ease;
- d3_transitionDelay = delay;
- d3_transitionDuration = duration;
- return this;
-}
-d3_transitionPrototype.transition = function() {
- return this.select(d3_this);
-};
-var d3_timer_queue = null,
- d3_timer_interval, // is an interval (or frame) active?
- d3_timer_timeout; // is a timeout active?
-
-// The timer will continue to fire until callback returns true.
-d3.timer = function(callback, delay, then) {
- var found = false,
- t0,
- t1 = d3_timer_queue;
-
- if (arguments.length < 3) {
- if (arguments.length < 2) delay = 0;
- else if (!isFinite(delay)) return;
- then = Date.now();
- }
-
- // See if the callback's already in the queue.
- while (t1) {
- if (t1.callback === callback) {
- t1.then = then;
- t1.delay = delay;
- found = true;
- break;
- }
- t0 = t1;
- t1 = t1.next;
- }
-
- // Otherwise, add the callback to the queue.
- if (!found) d3_timer_queue = {
- callback: callback,
- then: then,
- delay: delay,
- next: d3_timer_queue
- };
-
- // Start animatin'!
- if (!d3_timer_interval) {
- d3_timer_timeout = clearTimeout(d3_timer_timeout);
- d3_timer_interval = 1;
- d3_timer_frame(d3_timer_step);
- }
-}
-
-function d3_timer_step() {
- var elapsed,
- now = Date.now(),
- t1 = d3_timer_queue;
-
- while (t1) {
- elapsed = now - t1.then;
- if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
- t1 = t1.next;
- }
-
- var delay = d3_timer_flush() - now;
- if (delay > 24) {
- if (isFinite(delay)) {
- clearTimeout(d3_timer_timeout);
- d3_timer_timeout = setTimeout(d3_timer_step, delay);
- }
- d3_timer_interval = 0;
- } else {
- d3_timer_interval = 1;
- d3_timer_frame(d3_timer_step);
- }
-}
-
-d3.timer.flush = function() {
- var elapsed,
- now = Date.now(),
- t1 = d3_timer_queue;
-
- while (t1) {
- elapsed = now - t1.then;
- if (!t1.delay) t1.flush = t1.callback(elapsed);
- t1 = t1.next;
- }
-
- d3_timer_flush();
-};
-
-// Flush after callbacks, to avoid concurrent queue modification.
-function d3_timer_flush() {
- var t0 = null,
- t1 = d3_timer_queue,
- then = Infinity;
- while (t1) {
- if (t1.flush) {
- t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
- } else {
- then = Math.min(then, t1.then + t1.delay);
- t1 = (t0 = t1).next;
- }
- }
- return then;
-}
-
-var d3_timer_frame = window.requestAnimationFrame
- || window.webkitRequestAnimationFrame
- || window.mozRequestAnimationFrame
- || window.oRequestAnimationFrame
- || window.msRequestAnimationFrame
- || function(callback) { setTimeout(callback, 17); };
-d3.transform = function(string) {
- var g = document.createElementNS(d3.ns.prefix.svg, "g"),
- identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0};
- return (d3.transform = function(string) {
- g.setAttribute("transform", string);
- var t = g.transform.baseVal.consolidate();
- return new d3_transform(t ? t.matrix : identity);
- })(string);
-};
-
-// Compute x-scale and normalize the first row.
-// Compute shear and make second row orthogonal to first.
-// Compute y-scale and normalize the second row.
-// Finally, compute the rotation.
-function d3_transform(m) {
- var r0 = [m.a, m.b],
- r1 = [m.c, m.d],
- kx = d3_transformNormalize(r0),
- kz = d3_transformDot(r0, r1),
- ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
- if (r0[0] * r1[1] < r1[0] * r0[1]) {
- r0[0] *= -1;
- r0[1] *= -1;
- kx *= -1;
- kz *= -1;
- }
- this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
- this.translate = [m.e, m.f];
- this.scale = [kx, ky];
- this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
-};
-
-d3_transform.prototype.toString = function() {
- return "translate(" + this.translate
- + ")rotate(" + this.rotate
- + ")skewX(" + this.skew
- + ")scale(" + this.scale
- + ")";
-};
-
-function d3_transformDot(a, b) {
- return a[0] * b[0] + a[1] * b[1];
-}
-
-function d3_transformNormalize(a) {
- var k = Math.sqrt(d3_transformDot(a, a));
- if (k) {
- a[0] /= k;
- a[1] /= k;
- }
- return k;
-}
-
-function d3_transformCombine(a, b, k) {
- a[0] += k * b[0];
- a[1] += k * b[1];
- return a;
-}
-
-var d3_transformDegrees = 180 / Math.PI;
-d3.mouse = function(container) {
- return d3_mousePoint(container, d3_eventSource());
-};
-
-// https://bugs.webkit.org/show_bug.cgi?id=44083
-var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
-
-function d3_mousePoint(container, e) {
- var svg = container.ownerSVGElement || container;
- if (svg.createSVGPoint) {
- var point = svg.createSVGPoint();
- if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) {
- svg = d3.select(document.body)
- .append("svg")
- .style("position", "absolute")
- .style("top", 0)
- .style("left", 0);
- var ctm = svg[0][0].getScreenCTM();
- d3_mouse_bug44083 = !(ctm.f || ctm.e);
- svg.remove();
- }
- if (d3_mouse_bug44083) {
- point.x = e.pageX;
- point.y = e.pageY;
- } else {
- point.x = e.clientX;
- point.y = e.clientY;
- }
- point = point.matrixTransform(container.getScreenCTM().inverse());
- return [point.x, point.y];
- }
- var rect = container.getBoundingClientRect();
- return [e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop];
-};
-d3.touches = function(container, touches) {
- if (arguments.length < 2) touches = d3_eventSource().touches;
- return touches ? d3_array(touches).map(function(touch) {
- var point = d3_mousePoint(container, touch);
- point.identifier = touch.identifier;
- return point;
- }) : [];
-};
-function d3_noop() {}
-d3.scale = {};
-
-function d3_scaleExtent(domain) {
- var start = domain[0], stop = domain[domain.length - 1];
- return start < stop ? [start, stop] : [stop, start];
-}
-
-function d3_scaleRange(scale) {
- return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
-}
-function d3_scale_nice(domain, nice) {
- var i0 = 0,
- i1 = domain.length - 1,
- x0 = domain[i0],
- x1 = domain[i1],
- dx;
-
- if (x1 < x0) {
- dx = i0; i0 = i1; i1 = dx;
- dx = x0; x0 = x1; x1 = dx;
- }
-
- if (dx = x1 - x0) {
- nice = nice(dx);
- domain[i0] = nice.floor(x0);
- domain[i1] = nice.ceil(x1);
- }
-
- return domain;
-}
-
-function d3_scale_niceDefault() {
- return Math;
-}
-d3.scale.linear = function() {
- return d3_scale_linear([0, 1], [0, 1], d3.interpolate, false);
-};
-
-function d3_scale_linear(domain, range, interpolate, clamp) {
- var output,
- input;
-
- function rescale() {
- var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear,
- uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
- output = linear(domain, range, uninterpolate, interpolate);
- input = linear(range, domain, uninterpolate, d3.interpolate);
- return scale;
- }
-
- function scale(x) {
- return output(x);
- }
-
- // Note: requires range is coercible to number!
- scale.invert = function(y) {
- return input(y);
- };
-
- scale.domain = function(x) {
- if (!arguments.length) return domain;
- domain = x.map(Number);
- return rescale();
- };
-
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- return rescale();
- };
-
- scale.rangeRound = function(x) {
- return scale.range(x).interpolate(d3.interpolateRound);
- };
-
- scale.clamp = function(x) {
- if (!arguments.length) return clamp;
- clamp = x;
- return rescale();
- };
-
- scale.interpolate = function(x) {
- if (!arguments.length) return interpolate;
- interpolate = x;
- return rescale();
- };
-
- scale.ticks = function(m) {
- return d3_scale_linearTicks(domain, m);
- };
-
- scale.tickFormat = function(m) {
- return d3_scale_linearTickFormat(domain, m);
- };
-
- scale.nice = function() {
- d3_scale_nice(domain, d3_scale_linearNice);
- return rescale();
- };
-
- scale.copy = function() {
- return d3_scale_linear(domain, range, interpolate, clamp);
- };
-
- return rescale();
-}
-
-function d3_scale_linearRebind(scale, linear) {
- return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
-}
-
-function d3_scale_linearNice(dx) {
- dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
- return {
- floor: function(x) { return Math.floor(x / dx) * dx; },
- ceil: function(x) { return Math.ceil(x / dx) * dx; }
- };
-}
-
-function d3_scale_linearTickRange(domain, m) {
- var extent = d3_scaleExtent(domain),
- span = extent[1] - extent[0],
- step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)),
- err = m / span * step;
-
- // Filter ticks to get closer to the desired count.
- if (err <= .15) step *= 10;
- else if (err <= .35) step *= 5;
- else if (err <= .75) step *= 2;
-
- // Round start and stop values to step interval.
- extent[0] = Math.ceil(extent[0] / step) * step;
- extent[1] = Math.floor(extent[1] / step) * step + step * .5; // inclusive
- extent[2] = step;
- return extent;
-}
-
-function d3_scale_linearTicks(domain, m) {
- return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
-}
-
-function d3_scale_linearTickFormat(domain, m) {
- return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
-}
-function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
- var u = uninterpolate(domain[0], domain[1]),
- i = interpolate(range[0], range[1]);
- return function(x) {
- return i(u(x));
- };
-}
-function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
- var u = [],
- i = [],
- j = 0,
- k = Math.min(domain.length, range.length) - 1;
-
- // Handle descending domains.
- if (domain[k] < domain[0]) {
- domain = domain.slice().reverse();
- range = range.slice().reverse();
- }
-
- while (++j <= k) {
- u.push(uninterpolate(domain[j - 1], domain[j]));
- i.push(interpolate(range[j - 1], range[j]));
- }
-
- return function(x) {
- var j = d3.bisect(domain, x, 1, k) - 1;
- return i[j](u[j](x));
- };
-}
-d3.scale.log = function() {
- return d3_scale_log(d3.scale.linear(), d3_scale_logp);
-};
-
-function d3_scale_log(linear, log) {
- var pow = log.pow;
-
- function scale(x) {
- return linear(log(x));
- }
-
- scale.invert = function(x) {
- return pow(linear.invert(x));
- };
-
- scale.domain = function(x) {
- if (!arguments.length) return linear.domain().map(pow);
- log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
- pow = log.pow;
- linear.domain(x.map(log));
- return scale;
- };
-
- scale.nice = function() {
- linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
- return scale;
- };
-
- scale.ticks = function() {
- var extent = d3_scaleExtent(linear.domain()),
- ticks = [];
- if (extent.every(isFinite)) {
- var i = Math.floor(extent[0]),
- j = Math.ceil(extent[1]),
- u = pow(extent[0]),
- v = pow(extent[1]);
- if (log === d3_scale_logn) {
- ticks.push(pow(i));
- for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
- } else {
- for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
- ticks.push(pow(i));
- }
- for (i = 0; ticks[i] < u; i++) {} // strip small values
- for (j = ticks.length; ticks[j - 1] > v; j--) {} // strip big values
- ticks = ticks.slice(i, j);
- }
- return ticks;
- };
-
- scale.tickFormat = function(n, format) {
- if (arguments.length < 2) format = d3_scale_logFormat;
- if (arguments.length < 1) return format;
- var k = n / scale.ticks().length,
- f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil),
- e;
- return function(d) {
- return d / pow(f(log(d) + e)) < k ? format(d) : "";
- };
- };
-
- scale.copy = function() {
- return d3_scale_log(linear.copy(), log);
- };
-
- return d3_scale_linearRebind(scale, linear);
-}
-
-var d3_scale_logFormat = d3.format(".0e");
-
-function d3_scale_logp(x) {
- return Math.log(x < 0 ? 0 : x) / Math.LN10;
-}
-
-function d3_scale_logn(x) {
- return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
-}
-
-d3_scale_logp.pow = function(x) {
- return Math.pow(10, x);
-};
-
-d3_scale_logn.pow = function(x) {
- return -Math.pow(10, -x);
-};
-d3.scale.pow = function() {
- return d3_scale_pow(d3.scale.linear(), 1);
-};
-
-function d3_scale_pow(linear, exponent) {
- var powp = d3_scale_powPow(exponent),
- powb = d3_scale_powPow(1 / exponent);
-
- function scale(x) {
- return linear(powp(x));
- }
-
- scale.invert = function(x) {
- return powb(linear.invert(x));
- };
-
- scale.domain = function(x) {
- if (!arguments.length) return linear.domain().map(powb);
- linear.domain(x.map(powp));
- return scale;
- };
-
- scale.ticks = function(m) {
- return d3_scale_linearTicks(scale.domain(), m);
- };
-
- scale.tickFormat = function(m) {
- return d3_scale_linearTickFormat(scale.domain(), m);
- };
-
- scale.nice = function() {
- return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
- };
-
- scale.exponent = function(x) {
- if (!arguments.length) return exponent;
- var domain = scale.domain();
- powp = d3_scale_powPow(exponent = x);
- powb = d3_scale_powPow(1 / exponent);
- return scale.domain(domain);
- };
-
- scale.copy = function() {
- return d3_scale_pow(linear.copy(), exponent);
- };
-
- return d3_scale_linearRebind(scale, linear);
-}
-
-function d3_scale_powPow(e) {
- return function(x) {
- return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
- };
-}
-d3.scale.sqrt = function() {
- return d3.scale.pow().exponent(.5);
-};
-d3.scale.ordinal = function() {
- return d3_scale_ordinal([], {t: "range", x: []});
-};
-
-function d3_scale_ordinal(domain, ranger) {
- var index,
- range,
- rangeBand;
-
- function scale(x) {
- return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
- }
-
- function steps(start, step) {
- return d3.range(domain.length).map(function(i) { return start + step * i; });
- }
-
- scale.domain = function(x) {
- if (!arguments.length) return domain;
- domain = [];
- index = new d3_Map;
- var i = -1, n = x.length, xi;
- while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
- return scale[ranger.t](ranger.x, ranger.p);
- };
-
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- rangeBand = 0;
- ranger = {t: "range", x: x};
- return scale;
- };
-
- scale.rangePoints = function(x, padding) {
- if (arguments.length < 2) padding = 0;
- var start = x[0],
- stop = x[1],
- step = (stop - start) / (domain.length - 1 + padding);
- range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
- rangeBand = 0;
- ranger = {t: "rangePoints", x: x, p: padding};
- return scale;
- };
-
- scale.rangeBands = function(x, padding) {
- if (arguments.length < 2) padding = 0;
- var reverse = x[1] < x[0],
- start = x[reverse - 0],
- stop = x[1 - reverse],
- step = (stop - start) / (domain.length + padding);
- range = steps(start + step * padding, step);
- if (reverse) range.reverse();
- rangeBand = step * (1 - padding);
- ranger = {t: "rangeBands", x: x, p: padding};
- return scale;
- };
-
- scale.rangeRoundBands = function(x, padding) {
- if (arguments.length < 2) padding = 0;
- var reverse = x[1] < x[0],
- start = x[reverse - 0],
- stop = x[1 - reverse],
- step = Math.floor((stop - start) / (domain.length + padding)),
- error = stop - start - (domain.length - padding) * step;
- range = steps(start + Math.round(error / 2), step);
- if (reverse) range.reverse();
- rangeBand = Math.round(step * (1 - padding));
- ranger = {t: "rangeRoundBands", x: x, p: padding};
- return scale;
- };
-
- scale.rangeBand = function() {
- return rangeBand;
- };
-
- scale.rangeExtent = function() {
- return d3_scaleExtent(ranger.x);
- };
-
- scale.copy = function() {
- return d3_scale_ordinal(domain, ranger);
- };
-
- return scale.domain(domain);
-}
-/*
- * This product includes color specifications and designs developed by Cynthia
- * Brewer (http://colorbrewer.org/). See lib/colorbrewer for more information.
- */
-
-d3.scale.category10 = function() {
- return d3.scale.ordinal().range(d3_category10);
-};
-
-d3.scale.category20 = function() {
- return d3.scale.ordinal().range(d3_category20);
-};
-
-d3.scale.category20b = function() {
- return d3.scale.ordinal().range(d3_category20b);
-};
-
-d3.scale.category20c = function() {
- return d3.scale.ordinal().range(d3_category20c);
-};
-
-var d3_category10 = [
- "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
- "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"
-];
-
-var d3_category20 = [
- "#1f77b4", "#aec7e8",
- "#ff7f0e", "#ffbb78",
- "#2ca02c", "#98df8a",
- "#d62728", "#ff9896",
- "#9467bd", "#c5b0d5",
- "#8c564b", "#c49c94",
- "#e377c2", "#f7b6d2",
- "#7f7f7f", "#c7c7c7",
- "#bcbd22", "#dbdb8d",
- "#17becf", "#9edae5"
-];
-
-var d3_category20b = [
- "#393b79", "#5254a3", "#6b6ecf", "#9c9ede",
- "#637939", "#8ca252", "#b5cf6b", "#cedb9c",
- "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94",
- "#843c39", "#ad494a", "#d6616b", "#e7969c",
- "#7b4173", "#a55194", "#ce6dbd", "#de9ed6"
-];
-
-var d3_category20c = [
- "#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 d3_scale_quantile([], []);
-};
-
-function d3_scale_quantile(domain, range) {
- var thresholds;
-
- function rescale() {
- var k = 0,
- n = domain.length,
- q = range.length;
- thresholds = [];
- while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
- return scale;
- }
-
- function scale(x) {
- if (isNaN(x = +x)) return NaN;
- return range[d3.bisect(thresholds, x)];
- }
-
- scale.domain = function(x) {
- if (!arguments.length) return domain;
- domain = x.filter(function(d) { return !isNaN(d); }).sort(d3.ascending);
- return rescale();
- };
-
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- return rescale();
- };
-
- scale.quantiles = function() {
- return thresholds;
- };
-
- scale.copy = function() {
- return d3_scale_quantile(domain, range); // copy on write!
- };
-
- return rescale();
-}
-d3.scale.quantize = function() {
- return d3_scale_quantize(0, 1, [0, 1]);
-};
-
-function d3_scale_quantize(x0, x1, range) {
- var kx, i;
-
- function scale(x) {
- return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
- }
-
- function rescale() {
- kx = range.length / (x1 - x0);
- i = range.length - 1;
- return scale;
- }
-
- scale.domain = function(x) {
- if (!arguments.length) return [x0, x1];
- x0 = +x[0];
- x1 = +x[x.length - 1];
- return rescale();
- };
-
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- return rescale();
- };
-
- scale.copy = function() {
- return d3_scale_quantize(x0, x1, range); // copy on write
- };
-
- return rescale();
-}
-d3.scale.identity = function() {
- return d3_scale_identity([0, 1]);
-};
-
-function d3_scale_identity(domain) {
-
- function identity(x) { return +x; }
-
- identity.invert = identity;
-
- identity.domain = identity.range = function(x) {
- if (!arguments.length) return domain;
- domain = x.map(identity);
- return identity;
- };
-
- identity.ticks = function(m) {
- return d3_scale_linearTicks(domain, m);
- };
-
- identity.tickFormat = function(m) {
- return d3_scale_linearTickFormat(domain, m);
- };
-
- identity.copy = function() {
- return d3_scale_identity(domain);
- };
-
- return identity;
-}
-d3.svg = {};
-d3.svg.arc = function() {
- var innerRadius = d3_svg_arcInnerRadius,
- outerRadius = d3_svg_arcOuterRadius,
- startAngle = d3_svg_arcStartAngle,
- endAngle = d3_svg_arcEndAngle;
-
- function arc() {
- var r0 = innerRadius.apply(this, arguments),
- r1 = outerRadius.apply(this, arguments),
- a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset,
- a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset,
- da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0),
- df = da < Math.PI ? "0" : "1",
- c0 = Math.cos(a0),
- s0 = Math.sin(a0),
- c1 = Math.cos(a1),
- s1 = Math.sin(a1);
- return da >= d3_svg_arcMax
- ? (r0
- ? "M0," + r1
- + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
- + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
- + "M0," + r0
- + "A" + r0 + "," + r0 + " 0 1,0 0," + (-r0)
- + "A" + r0 + "," + r0 + " 0 1,0 0," + r0
- + "Z"
- : "M0," + r1
- + "A" + r1 + "," + r1 + " 0 1,1 0," + (-r1)
- + "A" + r1 + "," + r1 + " 0 1,1 0," + r1
- + "Z")
- : (r0
- ? "M" + r1 * c0 + "," + r1 * s0
- + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
- + "L" + r0 * c1 + "," + r0 * s1
- + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0
- + "Z"
- : "M" + r1 * c0 + "," + r1 * s0
- + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1
- + "L0,0"
- + "Z");
- }
-
- arc.innerRadius = function(v) {
- if (!arguments.length) return innerRadius;
- innerRadius = d3.functor(v);
- return arc;
- };
-
- arc.outerRadius = function(v) {
- if (!arguments.length) return outerRadius;
- outerRadius = d3.functor(v);
- return arc;
- };
-
- arc.startAngle = function(v) {
- if (!arguments.length) return startAngle;
- startAngle = d3.functor(v);
- return arc;
- };
-
- arc.endAngle = function(v) {
- if (!arguments.length) return endAngle;
- endAngle = d3.functor(v);
- return arc;
- };
-
- arc.centroid = function() {
- var r = (innerRadius.apply(this, arguments)
- + outerRadius.apply(this, arguments)) / 2,
- a = (startAngle.apply(this, arguments)
- + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
- return [Math.cos(a) * r, Math.sin(a) * r];
- };
-
- return arc;
-};
-
-var d3_svg_arcOffset = -Math.PI / 2,
- d3_svg_arcMax = 2 * Math.PI - 1e-6;
-
-function d3_svg_arcInnerRadius(d) {
- return d.innerRadius;
-}
-
-function d3_svg_arcOuterRadius(d) {
- return d.outerRadius;
-}
-
-function d3_svg_arcStartAngle(d) {
- return d.startAngle;
-}
-
-function d3_svg_arcEndAngle(d) {
- return d.endAngle;
-}
-function d3_svg_line(projection) {
- var x = d3_svg_lineX,
- y = d3_svg_lineY,
- interpolate = d3_svg_lineInterpolatorDefault,
- interpolator = d3_svg_lineInterpolators.get(interpolate),
- tension = .7;
-
- function line(d) {
- return d.length < 1 ? null : "M" + interpolator(projection(d3_svg_linePoints(this, d, x, y)), tension);
- }
-
- line.x = function(v) {
- if (!arguments.length) return x;
- x = v;
- return line;
- };
-
- line.y = function(v) {
- if (!arguments.length) return y;
- y = v;
- return line;
- };
-
- line.interpolate = function(v) {
- if (!arguments.length) return interpolate;
- if (!d3_svg_lineInterpolators.has(v += "")) v = d3_svg_lineInterpolatorDefault;
- interpolator = d3_svg_lineInterpolators.get(interpolate = v);
- return line;
- };
-
- line.tension = function(v) {
- if (!arguments.length) return tension;
- tension = v;
- return line;
- };
-
- return line;
-}
-
-d3.svg.line = function() {
- return d3_svg_line(Object);
-};
-
-// Converts the specified array of data into an array of points
-// (x-y tuples), by evaluating the specified `x` and `y` functions on each
-// data point. The `this` context of the evaluated functions is the specified
-// "self" object; each function is passed the current datum and index.
-function d3_svg_linePoints(self, d, x, y) {
- var points = [],
- i = -1,
- n = d.length,
- fx = typeof x === "function",
- fy = typeof y === "function",
- value;
- if (fx && fy) {
- while (++i < n) points.push([
- x.call(self, value = d[i], i),
- y.call(self, value, i)
- ]);
- } else if (fx) {
- while (++i < n) points.push([x.call(self, d[i], i), y]);
- } else if (fy) {
- while (++i < n) points.push([x, y.call(self, d[i], i)]);
- } else {
- while (++i < n) points.push([x, y]);
- }
- return points;
-}
-
-// The default `x` property, which references d[0].
-function d3_svg_lineX(d) {
- return d[0];
-}
-
-// The default `y` property, which references d[1].
-function d3_svg_lineY(d) {
- return d[1];
-}
-
-var d3_svg_lineInterpolatorDefault = "linear";
-
-// The various interpolators supported by the `line` class.
-var d3_svg_lineInterpolators = d3.map({
- "linear": d3_svg_lineLinear,
- "step-before": d3_svg_lineStepBefore,
- "step-after": d3_svg_lineStepAfter,
- "basis": d3_svg_lineBasis,
- "basis-open": d3_svg_lineBasisOpen,
- "basis-closed": d3_svg_lineBasisClosed,
- "bundle": d3_svg_lineBundle,
- "cardinal": d3_svg_lineCardinal,
- "cardinal-open": d3_svg_lineCardinalOpen,
- "cardinal-closed": d3_svg_lineCardinalClosed,
- "monotone": d3_svg_lineMonotone
-});
-
-// Linear interpolation; generates "L" commands.
-function d3_svg_lineLinear(points) {
- var i = 0,
- n = points.length,
- p = points[0],
- path = [p[0], ",", p[1]];
- while (++i < n) path.push("L", (p = points[i])[0], ",", p[1]);
- return path.join("");
-}
-
-// Step interpolation; generates "H" and "V" commands.
-function d3_svg_lineStepBefore(points) {
- var i = 0,
- n = points.length,
- p = points[0],
- path = [p[0], ",", p[1]];
- while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
- return path.join("");
-}
-
-// Step interpolation; generates "H" and "V" commands.
-function d3_svg_lineStepAfter(points) {
- var i = 0,
- n = points.length,
- p = points[0],
- path = [p[0], ",", p[1]];
- while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
- return path.join("");
-}
-
-// Open cardinal spline interpolation; generates "C" commands.
-function d3_svg_lineCardinalOpen(points, tension) {
- return points.length < 4
- ? d3_svg_lineLinear(points)
- : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1),
- d3_svg_lineCardinalTangents(points, tension));
-}
-
-// Closed cardinal spline interpolation; generates "C" commands.
-function d3_svg_lineCardinalClosed(points, tension) {
- return points.length < 3
- ? d3_svg_lineLinear(points)
- : points[0] + d3_svg_lineHermite((points.push(points[0]), points),
- d3_svg_lineCardinalTangents([points[points.length - 2]]
- .concat(points, [points[1]]), tension));
-}
-
-// Cardinal spline interpolation; generates "C" commands.
-function d3_svg_lineCardinal(points, tension, closed) {
- return points.length < 3
- ? d3_svg_lineLinear(points)
- : points[0] + d3_svg_lineHermite(points,
- d3_svg_lineCardinalTangents(points, tension));
-}
-
-// Hermite spline construction; generates "C" commands.
-function d3_svg_lineHermite(points, tangents) {
- if (tangents.length < 1
- || (points.length != tangents.length
- && points.length != tangents.length + 2)) {
- return d3_svg_lineLinear(points);
- }
-
- var quad = points.length != tangents.length,
- path = "",
- p0 = points[0],
- p = points[1],
- t0 = tangents[0],
- t = t0,
- pi = 1;
-
- if (quad) {
- path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3)
- + "," + p[0] + "," + p[1];
- p0 = points[1];
- pi = 2;
- }
-
- if (tangents.length > 1) {
- t = tangents[1];
- p = points[pi];
- pi++;
- path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1])
- + "," + (p[0] - t[0]) + "," + (p[1] - t[1])
- + "," + p[0] + "," + p[1];
- for (var i = 2; i < tangents.length; i++, pi++) {
- p = points[pi];
- t = tangents[i];
- path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1])
- + "," + p[0] + "," + p[1];
- }
- }
-
- if (quad) {
- var lp = points[pi];
- path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3)
- + "," + lp[0] + "," + lp[1];
- }
-
- return path;
-}
-
-// Generates tangents for a cardinal spline.
-function d3_svg_lineCardinalTangents(points, tension) {
- var tangents = [],
- a = (1 - tension) / 2,
- p0,
- p1 = points[0],
- p2 = points[1],
- i = 1,
- n = points.length;
- while (++i < n) {
- p0 = p1;
- p1 = p2;
- p2 = points[i];
- tangents.push([a * (p2[0] - p0[0]), a * (p2[1] - p0[1])]);
- }
- return tangents;
-}
-
-// B-spline interpolation; generates "C" commands.
-function d3_svg_lineBasis(points) {
- if (points.length < 3) return d3_svg_lineLinear(points);
- var i = 1,
- n = points.length,
- pi = points[0],
- x0 = pi[0],
- y0 = pi[1],
- px = [x0, x0, x0, (pi = points[1])[0]],
- py = [y0, y0, y0, pi[1]],
- path = [x0, ",", y0];
- d3_svg_lineBasisBezier(path, px, py);
- while (++i < n) {
- pi = points[i];
- px.shift(); px.push(pi[0]);
- py.shift(); py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- i = -1;
- while (++i < 2) {
- px.shift(); px.push(pi[0]);
- py.shift(); py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- return path.join("");
-}
-
-// Open B-spline interpolation; generates "C" commands.
-function d3_svg_lineBasisOpen(points) {
- if (points.length < 4) return d3_svg_lineLinear(points);
- var path = [],
- i = -1,
- n = points.length,
- pi,
- px = [0],
- py = [0];
- while (++i < 3) {
- pi = points[i];
- px.push(pi[0]);
- py.push(pi[1]);
- }
- path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px)
- + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
- --i; while (++i < n) {
- pi = points[i];
- px.shift(); px.push(pi[0]);
- py.shift(); py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- return path.join("");
-}
-
-// Closed B-spline interpolation; generates "C" commands.
-function d3_svg_lineBasisClosed(points) {
- var path,
- i = -1,
- n = points.length,
- m = n + 4,
- pi,
- px = [],
- py = [];
- while (++i < 4) {
- pi = points[i % n];
- px.push(pi[0]);
- py.push(pi[1]);
- }
- path = [
- d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",",
- d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)
- ];
- --i; while (++i < m) {
- pi = points[i % n];
- px.shift(); px.push(pi[0]);
- py.shift(); py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- return path.join("");
-}
-
-function d3_svg_lineBundle(points, tension) {
- var n = points.length - 1,
- x0 = points[0][0],
- y0 = points[0][1],
- dx = points[n][0] - x0,
- dy = points[n][1] - y0,
- i = -1,
- p,
- t;
- while (++i <= n) {
- p = points[i];
- t = i / n;
- p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
- p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
- }
- return d3_svg_lineBasis(points);
-}
-
-// Returns the dot product of the given four-element vectors.
-function d3_svg_lineDot4(a, b) {
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
-}
-
-// Matrix to transform basis (b-spline) control points to bezier
-// control points. Derived from FvD 11.2.8.
-var d3_svg_lineBasisBezier1 = [0, 2/3, 1/3, 0],
- d3_svg_lineBasisBezier2 = [0, 1/3, 2/3, 0],
- d3_svg_lineBasisBezier3 = [0, 1/6, 2/3, 1/6];
-
-// Pushes a "C" BƩzier curve onto the specified path array, given the
-// two specified four-element arrays which define the control points.
-function d3_svg_lineBasisBezier(path, x, y) {
- path.push(
- "C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x),
- ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y),
- ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x),
- ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y),
- ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x),
- ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
-}
-
-// Computes the slope from points p0 to p1.
-function d3_svg_lineSlope(p0, p1) {
- return (p1[1] - p0[1]) / (p1[0] - p0[0]);
-}
-
-// Compute three-point differences for the given points.
-// http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference
-function d3_svg_lineFiniteDifferences(points) {
- var i = 0,
- j = points.length - 1,
- m = [],
- p0 = points[0],
- p1 = points[1],
- d = m[0] = d3_svg_lineSlope(p0, p1);
- while (++i < j) {
- m[i] = d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]));
- }
- m[i] = d;
- return m;
-}
-
-// Interpolates the given points using Fritsch-Carlson Monotone cubic Hermite
-// interpolation. Returns an array of tangent vectors. For details, see
-// http://en.wikipedia.org/wiki/Monotone_cubic_interpolation
-function d3_svg_lineMonotoneTangents(points) {
- var tangents = [],
- d,
- a,
- b,
- s,
- m = d3_svg_lineFiniteDifferences(points),
- i = -1,
- j = points.length - 1;
-
- // The first two steps are done by computing finite-differences:
- // 1. Compute the slopes of the secant lines between successive points.
- // 2. Initialize the tangents at every point as the average of the secants.
-
- // Then, for each segmentā¦
- while (++i < j) {
- d = d3_svg_lineSlope(points[i], points[i + 1]);
-
- // 3. If two successive yk = y{k + 1} are equal (i.e., d is zero), then set
- // mk = m{k + 1} = 0 as the spline connecting these points must be flat to
- // preserve monotonicity. Ignore step 4 and 5 for those k.
-
- if (Math.abs(d) < 1e-6) {
- m[i] = m[i + 1] = 0;
- } else {
- // 4. Let ak = mk / dk and bk = m{k + 1} / dk.
- a = m[i] / d;
- b = m[i + 1] / d;
-
- // 5. Prevent overshoot and ensure monotonicity by restricting the
- // magnitude of vector <ak, bk> to a circle of radius 3.
- s = a * a + b * b;
- if (s > 9) {
- s = d * 3 / Math.sqrt(s);
- m[i] = s * a;
- m[i + 1] = s * b;
- }
- }
- }
-
- // Compute the normalized tangent vector from the slopes. Note that if x is
- // not monotonic, it's possible that the slope will be infinite, so we protect
- // against NaN by setting the coordinate to zero.
- i = -1; while (++i <= j) {
- s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0])
- / (6 * (1 + m[i] * m[i]));
- tangents.push([s || 0, m[i] * s || 0]);
- }
-
- return tangents;
-}
-
-function d3_svg_lineMonotone(points) {
- return points.length < 3
- ? d3_svg_lineLinear(points)
- : points[0] +
- d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
-}
-d3.svg.line.radial = function() {
- var line = d3_svg_line(d3_svg_lineRadial);
- line.radius = line.x, delete line.x;
- line.angle = line.y, delete line.y;
- return line;
-};
-
-function d3_svg_lineRadial(points) {
- var point,
- i = -1,
- n = points.length,
- r,
- a;
- while (++i < n) {
- point = points[i];
- r = point[0];
- a = point[1] + d3_svg_arcOffset;
- point[0] = r * Math.cos(a);
- point[1] = r * Math.sin(a);
- }
- return points;
-}
-function d3_svg_area(projection) {
- var x0 = d3_svg_lineX,
- x1 = d3_svg_lineX,
- y0 = 0,
- y1 = d3_svg_lineY,
- interpolate,
- i0,
- i1,
- tension = .7;
-
- function area(d) {
- if (d.length < 1) return null;
- var points0 = d3_svg_linePoints(this, d, x0, y0),
- points1 = d3_svg_linePoints(this, d, x0 === x1 ? d3_svg_areaX(points0) : x1, y0 === y1 ? d3_svg_areaY(points0) : y1);
- return "M" + i0(projection(points1), tension)
- + "L" + i1(projection(points0.reverse()), tension)
- + "Z";
- }
-
- area.x = function(x) {
- if (!arguments.length) return x1;
- x0 = x1 = x;
- return area;
- };
-
- area.x0 = function(x) {
- if (!arguments.length) return x0;
- x0 = x;
- return area;
- };
-
- area.x1 = function(x) {
- if (!arguments.length) return x1;
- x1 = x;
- return area;
- };
-
- area.y = function(y) {
- if (!arguments.length) return y1;
- y0 = y1 = y;
- return area;
- };
-
- area.y0 = function(y) {
- if (!arguments.length) return y0;
- y0 = y;
- return area;
- };
-
- area.y1 = function(y) {
- if (!arguments.length) return y1;
- y1 = y;
- return area;
- };
-
- area.interpolate = function(x) {
- if (!arguments.length) return interpolate;
- if (!d3_svg_lineInterpolators.has(x += "")) x = d3_svg_lineInterpolatorDefault;
- i0 = d3_svg_lineInterpolators.get(interpolate = x);
- i1 = i0.reverse || i0;
- return area;
- };
-
- area.tension = function(x) {
- if (!arguments.length) return tension;
- tension = x;
- return area;
- };
-
- return area.interpolate("linear");
-}
-
-d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
-d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
-
-d3.svg.area = function() {
- return d3_svg_area(Object);
-};
-
-function d3_svg_areaX(points) {
- return function(d, i) {
- return points[i][0];
- };
-}
-
-function d3_svg_areaY(points) {
- return function(d, i) {
- return points[i][1];
- };
-}
-d3.svg.area.radial = function() {
- var area = d3_svg_area(d3_svg_lineRadial);
- area.radius = area.x, delete area.x;
- area.innerRadius = area.x0, delete area.x0;
- area.outerRadius = area.x1, delete area.x1;
- area.angle = area.y, delete area.y;
- area.startAngle = area.y0, delete area.y0;
- area.endAngle = area.y1, delete area.y1;
- return area;
-};
-d3.svg.chord = function() {
- var source = d3_svg_chordSource,
- target = d3_svg_chordTarget,
- radius = d3_svg_chordRadius,
- startAngle = d3_svg_arcStartAngle,
- endAngle = d3_svg_arcEndAngle;
-
- // TODO Allow control point to be customized.
-
- function chord(d, i) {
- var s = subgroup(this, source, d, i),
- t = subgroup(this, target, d, i);
- return "M" + s.p0
- + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t)
- ? curve(s.r, s.p1, s.r, s.p0)
- : curve(s.r, s.p1, t.r, t.p0)
- + arc(t.r, t.p1, t.a1 - t.a0)
- + curve(t.r, t.p1, s.r, s.p0))
- + "Z";
- }
-
- function subgroup(self, f, d, i) {
- var subgroup = f.call(self, d, i),
- r = radius.call(self, subgroup, i),
- a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset,
- a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
- return {
- r: r,
- a0: a0,
- a1: a1,
- p0: [r * Math.cos(a0), r * Math.sin(a0)],
- p1: [r * Math.cos(a1), r * Math.sin(a1)]
- };
- }
-
- function equals(a, b) {
- return a.a0 == b.a0 && a.a1 == b.a1;
- }
-
- function arc(r, p, a) {
- return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
- }
-
- function curve(r0, p0, r1, p1) {
- return "Q 0,0 " + p1;
- }
-
- chord.radius = function(v) {
- if (!arguments.length) return radius;
- radius = d3.functor(v);
- return chord;
- };
-
- chord.source = function(v) {
- if (!arguments.length) return source;
- source = d3.functor(v);
- return chord;
- };
-
- chord.target = function(v) {
- if (!arguments.length) return target;
- target = d3.functor(v);
- return chord;
- };
-
- chord.startAngle = function(v) {
- if (!arguments.length) return startAngle;
- startAngle = d3.functor(v);
- return chord;
- };
-
- chord.endAngle = function(v) {
- if (!arguments.length) return endAngle;
- endAngle = d3.functor(v);
- return chord;
- };
-
- return chord;
-};
-
-function d3_svg_chordSource(d) {
- return d.source;
-}
-
-function d3_svg_chordTarget(d) {
- return d.target;
-}
-
-function d3_svg_chordRadius(d) {
- return d.radius;
-}
-
-function d3_svg_chordStartAngle(d) {
- return d.startAngle;
-}
-
-function d3_svg_chordEndAngle(d) {
- return d.endAngle;
-}
-d3.svg.diagonal = function() {
- var source = d3_svg_chordSource,
- target = d3_svg_chordTarget,
- projection = d3_svg_diagonalProjection;
-
- function diagonal(d, i) {
- var p0 = source.call(this, d, i),
- p3 = target.call(this, d, i),
- m = (p0.y + p3.y) / 2,
- p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3];
- p = p.map(projection);
- return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
- }
-
- diagonal.source = function(x) {
- if (!arguments.length) return source;
- source = d3.functor(x);
- return diagonal;
- };
-
- diagonal.target = function(x) {
- if (!arguments.length) return target;
- target = d3.functor(x);
- return diagonal;
- };
-
- diagonal.projection = function(x) {
- if (!arguments.length) return projection;
- projection = x;
- return diagonal;
- };
-
- return diagonal;
-};
-
-function d3_svg_diagonalProjection(d) {
- return [d.x, d.y];
-}
-d3.svg.diagonal.radial = function() {
- var diagonal = d3.svg.diagonal(),
- projection = d3_svg_diagonalProjection,
- projection_ = diagonal.projection;
-
- diagonal.projection = function(x) {
- return arguments.length
- ? projection_(d3_svg_diagonalRadialProjection(projection = x))
- : projection;
- };
-
- return diagonal;
-};
-
-function d3_svg_diagonalRadialProjection(projection) {
- return function() {
- var d = projection.apply(this, arguments),
- r = d[0],
- a = d[1] + d3_svg_arcOffset;
- return [r * Math.cos(a), r * Math.sin(a)];
- };
-}
-d3.svg.mouse = d3.mouse;
-d3.svg.touches = d3.touches;
-d3.svg.symbol = function() {
- var type = d3_svg_symbolType,
- size = d3_svg_symbolSize;
-
- function symbol(d, i) {
- return (d3_svg_symbols.get(type.call(this, d, i))
- || d3_svg_symbolCircle)
- (size.call(this, d, i));
- }
-
- symbol.type = function(x) {
- if (!arguments.length) return type;
- type = d3.functor(x);
- return symbol;
- };
-
- // size of symbol in square pixels
- symbol.size = function(x) {
- if (!arguments.length) return size;
- size = d3.functor(x);
- return symbol;
- };
-
- return symbol;
-};
-
-function d3_svg_symbolSize() {
- return 64;
-}
-
-function d3_svg_symbolType() {
- return "circle";
-}
-
-function d3_svg_symbolCircle(size) {
- var r = Math.sqrt(size / Math.PI);
- return "M0," + r
- + "A" + r + "," + r + " 0 1,1 0," + (-r)
- + "A" + r + "," + r + " 0 1,1 0," + r
- + "Z";
-}
-
-// TODO cross-diagonal?
-var d3_svg_symbols = d3.map({
- "circle": d3_svg_symbolCircle,
- "cross": function(size) {
- var r = Math.sqrt(size / 5) / 2;
- return "M" + -3 * r + "," + -r
- + "H" + -r
- + "V" + -3 * r
- + "H" + r
- + "V" + -r
- + "H" + 3 * r
- + "V" + r
- + "H" + r
- + "V" + 3 * r
- + "H" + -r
- + "V" + r
- + "H" + -3 * r
- + "Z";
- },
- "diamond": function(size) {
- var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)),
- rx = ry * d3_svg_symbolTan30;
- return "M0," + -ry
- + "L" + rx + ",0"
- + " 0," + ry
- + " " + -rx + ",0"
- + "Z";
- },
- "square": function(size) {
- var r = Math.sqrt(size) / 2;
- return "M" + -r + "," + -r
- + "L" + r + "," + -r
- + " " + r + "," + r
- + " " + -r + "," + r
- + "Z";
- },
- "triangle-down": function(size) {
- var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
- ry = rx * d3_svg_symbolSqrt3 / 2;
- return "M0," + ry
- + "L" + rx +"," + -ry
- + " " + -rx + "," + -ry
- + "Z";
- },
- "triangle-up": function(size) {
- var rx = Math.sqrt(size / d3_svg_symbolSqrt3),
- ry = rx * d3_svg_symbolSqrt3 / 2;
- return "M0," + -ry
- + "L" + rx +"," + ry
- + " " + -rx + "," + ry
- + "Z";
- }
-});
-
-d3.svg.symbolTypes = d3_svg_symbols.keys();
-
-var d3_svg_symbolSqrt3 = Math.sqrt(3),
- d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
-d3.svg.axis = function() {
- var scale = d3.scale.linear(),
- orient = "bottom",
- tickMajorSize = 6,
- tickMinorSize = 6,
- tickEndSize = 6,
- tickPadding = 3,
- tickArguments_ = [10],
- tickValues = null,
- tickFormat_,
- tickSubdivide = 0;
-
- function axis(g) {
- g.each(function() {
- var g = d3.select(this);
-
- // Ticks, or domain values for ordinal scales.
- var ticks = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain()) : tickValues,
- tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_;
-
- // Minor ticks.
- var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide),
- subtick = g.selectAll(".minor").data(subticks, String),
- subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6),
- subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(),
- subtickUpdate = d3.transition(subtick).style("opacity", 1);
-
- // Major ticks.
- var tick = g.selectAll("g").data(ticks, String),
- tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6),
- tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(),
- tickUpdate = d3.transition(tick).style("opacity", 1),
- tickTransform;
-
- // Domain.
- var range = d3_scaleRange(scale),
- path = g.selectAll(".domain").data([0]),
- pathEnter = path.enter().append("path").attr("class", "domain"),
- pathUpdate = d3.transition(path);
-
- // Stash a snapshot of the new scale, and retrieve the old snapshot.
- var scale1 = scale.copy(),
- scale0 = this.__chart__ || scale1;
- this.__chart__ = scale1;
-
- tickEnter.append("line").attr("class", "tick");
- tickEnter.append("text");
- tickUpdate.select("text").text(tickFormat);
-
- switch (orient) {
- case "bottom": {
- tickTransform = d3_svg_axisX;
- subtickEnter.attr("y2", tickMinorSize);
- subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
- tickEnter.select("line").attr("y2", tickMajorSize);
- tickEnter.select("text").attr("y", Math.max(tickMajorSize, 0) + tickPadding);
- tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize);
- tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle");
- pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
- break;
- }
- case "top": {
- tickTransform = d3_svg_axisX;
- subtickEnter.attr("y2", -tickMinorSize);
- subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
- tickEnter.select("line").attr("y2", -tickMajorSize);
- tickEnter.select("text").attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
- tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize);
- tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle");
- pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
- break;
- }
- case "left": {
- tickTransform = d3_svg_axisY;
- subtickEnter.attr("x2", -tickMinorSize);
- subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
- tickEnter.select("line").attr("x2", -tickMajorSize);
- tickEnter.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
- tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0);
- tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end");
- pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
- break;
- }
- case "right": {
- tickTransform = d3_svg_axisY;
- subtickEnter.attr("x2", tickMinorSize);
- subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
- tickEnter.select("line").attr("x2", tickMajorSize);
- tickEnter.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding);
- tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0);
- tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start");
- pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
- break;
- }
- }
-
- // For quantitative scales:
- // - enter new ticks from the old scale
- // - exit old ticks to the new scale
- if (scale.ticks) {
- tickEnter.call(tickTransform, scale0);
- tickUpdate.call(tickTransform, scale1);
- tickExit.call(tickTransform, scale1);
- subtickEnter.call(tickTransform, scale0);
- subtickUpdate.call(tickTransform, scale1);
- subtickExit.call(tickTransform, scale1);
- }
-
- // For ordinal scales:
- // - any entering ticks are undefined in the old scale
- // - any exiting ticks are undefined in the new scale
- // Therefore, we only need to transition updating ticks.
- else {
- var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; };
- tickEnter.call(tickTransform, x);
- tickUpdate.call(tickTransform, x);
- }
- });
- }
-
- axis.scale = function(x) {
- if (!arguments.length) return scale;
- scale = x;
- return axis;
- };
-
- axis.orient = function(x) {
- if (!arguments.length) return orient;
- orient = x;
- return axis;
- };
-
- axis.ticks = function() {
- if (!arguments.length) return tickArguments_;
- tickArguments_ = arguments;
- return axis;
- };
-
- axis.tickValues = function(x) {
- if (!arguments.length) return tickValues;
- tickValues = x;
- return axis;
- };
-
- axis.tickFormat = function(x) {
- if (!arguments.length) return tickFormat_;
- tickFormat_ = x;
- return axis;
- };
-
- axis.tickSize = function(x, y, z) {
- if (!arguments.length) return tickMajorSize;
- var n = arguments.length - 1;
- tickMajorSize = +x;
- tickMinorSize = n > 1 ? +y : tickMajorSize;
- tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
- return axis;
- };
-
- axis.tickPadding = function(x) {
- if (!arguments.length) return tickPadding;
- tickPadding = +x;
- return axis;
- };
-
- axis.tickSubdivide = function(x) {
- if (!arguments.length) return tickSubdivide;
- tickSubdivide = +x;
- return axis;
- };
-
- return axis;
-};
-
-function d3_svg_axisX(selection, x) {
- selection.attr("transform", function(d) { return "translate(" + x(d) + ",0)"; });
-}
-
-function d3_svg_axisY(selection, y) {
- selection.attr("transform", function(d) { return "translate(0," + y(d) + ")"; });
-}
-
-function d3_svg_axisSubdivide(scale, ticks, m) {
- subticks = [];
- if (m && ticks.length > 1) {
- var extent = d3_scaleExtent(scale.domain()),
- subticks,
- i = -1,
- n = ticks.length,
- d = (ticks[1] - ticks[0]) / ++m,
- j,
- v;
- while (++i < n) {
- for (j = m; --j > 0;) {
- if ((v = +ticks[i] - j * d) >= extent[0]) {
- subticks.push(v);
- }
- }
- }
- for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) {
- subticks.push(v);
- }
- }
- return subticks;
-}
-d3.svg.brush = function() {
- var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"),
- x = null, // x-scale, optional
- y = null, // y-scale, optional
- resizes = d3_svg_brushResizes[0],
- extent = [[0, 0], [0, 0]], // [x0, y0], [x1, y1], in pixels (integers)
- extentDomain; // the extent in data space, lazily created
-
- function brush(g) {
- g.each(function() {
- var g = d3.select(this),
- bg = g.selectAll(".background").data([0]),
- fg = g.selectAll(".extent").data([0]),
- tz = g.selectAll(".resize").data(resizes, String),
- e;
-
- // Prepare the brush container for events.
- g
- .style("pointer-events", "all")
- .on("mousedown.brush", brushstart)
- .on("touchstart.brush", brushstart);
-
- // An invisible, mouseable area for starting a new brush.
- bg.enter().append("rect")
- .attr("class", "background")
- .style("visibility", "hidden")
- .style("cursor", "crosshair");
-
- // The visible brush extent; style this as you like!
- fg.enter().append("rect")
- .attr("class", "extent")
- .style("cursor", "move");
-
- // More invisible rects for resizing the extent.
- tz.enter().append("g")
- .attr("class", function(d) { return "resize " + d; })
- .style("cursor", function(d) { return d3_svg_brushCursor[d]; })
- .append("rect")
- .attr("x", function(d) { return /[ew]$/.test(d) ? -3 : null; })
- .attr("y", function(d) { return /^[ns]/.test(d) ? -3 : null; })
- .attr("width", 6)
- .attr("height", 6)
- .style("visibility", "hidden");
-
- // Show or hide the resizers.
- tz.style("display", brush.empty() ? "none" : null);
-
- // Remove any superfluous resizers.
- tz.exit().remove();
-
- // Initialize the background to fill the defined range.
- // If the range isn't defined, you can post-process.
- if (x) {
- e = d3_scaleRange(x);
- bg.attr("x", e[0]).attr("width", e[1] - e[0]);
- redrawX(g);
- }
- if (y) {
- e = d3_scaleRange(y);
- bg.attr("y", e[0]).attr("height", e[1] - e[0]);
- redrawY(g);
- }
- redraw(g);
- });
- }
-
- function redraw(g) {
- g.selectAll(".resize").attr("transform", function(d) {
- return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
- });
- }
-
- function redrawX(g) {
- g.select(".extent").attr("x", extent[0][0]);
- g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
- }
-
- function redrawY(g) {
- g.select(".extent").attr("y", extent[0][1]);
- g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
- }
-
- function brushstart() {
- var target = this,
- eventTarget = d3.select(d3.event.target),
- event_ = event.of(target, arguments),
- g = d3.select(target),
- resizing = eventTarget.datum(),
- resizingX = !/^(n|s)$/.test(resizing) && x,
- resizingY = !/^(e|w)$/.test(resizing) && y,
- dragging = eventTarget.classed("extent"),
- center,
- origin = mouse(),
- offset;
-
- var w = d3.select(window)
- .on("mousemove.brush", brushmove)
- .on("mouseup.brush", brushend)
- .on("touchmove.brush", brushmove)
- .on("touchend.brush", brushend)
- .on("keydown.brush", keydown)
- .on("keyup.brush", keyup);
-
- // If the extent was clicked on, drag rather than brush;
- // store the point between the mouse and extent origin instead.
- if (dragging) {
- origin[0] = extent[0][0] - origin[0];
- origin[1] = extent[0][1] - origin[1];
- }
-
- // If a resizer was clicked on, record which side is to be resized.
- // Also, set the origin to the opposite side.
- else if (resizing) {
- var ex = +/w$/.test(resizing),
- ey = +/^n/.test(resizing);
- offset = [extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1]];
- origin[0] = extent[ex][0];
- origin[1] = extent[ey][1];
- }
-
- // If the ALT key is down when starting a brush, the center is at the mouse.
- else if (d3.event.altKey) center = origin.slice();
-
- // Propagate the active cursor to the body for the drag duration.
- g.style("pointer-events", "none").selectAll(".resize").style("display", null);
- d3.select("body").style("cursor", eventTarget.style("cursor"));
-
- // Notify listeners.
- event_({type: "brushstart"});
- brushmove();
- d3_eventCancel();
-
- function mouse() {
- var touches = d3.event.changedTouches;
- return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
- }
-
- function keydown() {
- if (d3.event.keyCode == 32) {
- if (!dragging) {
- center = null;
- origin[0] -= extent[1][0];
- origin[1] -= extent[1][1];
- dragging = 2;
- }
- d3_eventCancel();
- }
- }
-
- function keyup() {
- if (d3.event.keyCode == 32 && dragging == 2) {
- origin[0] += extent[1][0];
- origin[1] += extent[1][1];
- dragging = 0;
- d3_eventCancel();
- }
- }
-
- function brushmove() {
- var point = mouse(),
- moved = false;
-
- // Preserve the offset for thick resizers.
- if (offset) {
- point[0] += offset[0];
- point[1] += offset[1];
- }
-
- if (!dragging) {
-
- // If needed, determine the center from the current extent.
- if (d3.event.altKey) {
- if (!center) center = [(extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2];
-
- // Update the origin, for when the ALT key is released.
- origin[0] = extent[+(point[0] < center[0])][0];
- origin[1] = extent[+(point[1] < center[1])][1];
- }
-
- // When the ALT key is released, we clear the center.
- else center = null;
- }
-
- // Update the brush extent for each dimension.
- if (resizingX && move1(point, x, 0)) {
- redrawX(g);
- moved = true;
- }
- if (resizingY && move1(point, y, 1)) {
- redrawY(g);
- moved = true;
- }
-
- // Final redraw and notify listeners.
- if (moved) {
- redraw(g);
- event_({type: "brush", mode: dragging ? "move" : "resize"});
- }
- }
-
- function move1(point, scale, i) {
- var range = d3_scaleRange(scale),
- r0 = range[0],
- r1 = range[1],
- position = origin[i],
- size = extent[1][i] - extent[0][i],
- min,
- max;
-
- // When dragging, reduce the range by the extent size and position.
- if (dragging) {
- r0 -= position;
- r1 -= size + position;
- }
-
- // Clamp the point so that the extent fits within the range extent.
- min = Math.max(r0, Math.min(r1, point[i]));
-
- // Compute the new extent bounds.
- if (dragging) {
- max = (min += position) + size;
- } else {
-
- // If the ALT key is pressed, then preserve the center of the extent.
- if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
-
- // Compute the min and max of the position and point.
- if (position < min) {
- max = min;
- min = position;
- } else {
- max = position;
- }
- }
-
- // Update the stored bounds.
- if (extent[0][i] !== min || extent[1][i] !== max) {
- extentDomain = null;
- extent[0][i] = min;
- extent[1][i] = max;
- return true;
- }
- }
-
- function brushend() {
- brushmove();
-
- // reset the cursor styles
- g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
- d3.select("body").style("cursor", null);
-
- w .on("mousemove.brush", null)
- .on("mouseup.brush", null)
- .on("touchmove.brush", null)
- .on("touchend.brush", null)
- .on("keydown.brush", null)
- .on("keyup.brush", null);
-
- event_({type: "brushend"});
- d3_eventCancel();
- }
- }
-
- brush.x = function(z) {
- if (!arguments.length) return x;
- x = z;
- resizes = d3_svg_brushResizes[!x << 1 | !y]; // fore!
- return brush;
- };
-
- brush.y = function(z) {
- if (!arguments.length) return y;
- y = z;
- resizes = d3_svg_brushResizes[!x << 1 | !y]; // fore!
- return brush;
- };
-
- brush.extent = function(z) {
- var x0, x1, y0, y1, t;
-
- // Invert the pixel extent to data-space.
- if (!arguments.length) {
- z = extentDomain || extent;
- if (x) {
- x0 = z[0][0], x1 = z[1][0];
- if (!extentDomain) {
- x0 = extent[0][0], x1 = extent[1][0];
- if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
- if (x1 < x0) t = x0, x0 = x1, x1 = t;
- }
- }
- if (y) {
- y0 = z[0][1], y1 = z[1][1];
- if (!extentDomain) {
- y0 = extent[0][1], y1 = extent[1][1];
- if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
- if (y1 < y0) t = y0, y0 = y1, y1 = t;
- }
- }
- return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1];
- }
-
- // Scale the data-space extent to pixels.
- extentDomain = [[0, 0], [0, 0]];
- if (x) {
- x0 = z[0], x1 = z[1];
- if (y) x0 = x0[0], x1 = x1[0];
- extentDomain[0][0] = x0, extentDomain[1][0] = x1;
- if (x.invert) x0 = x(x0), x1 = x(x1);
- if (x1 < x0) t = x0, x0 = x1, x1 = t;
- extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
- }
- if (y) {
- y0 = z[0], y1 = z[1];
- if (x) y0 = y0[1], y1 = y1[1];
- extentDomain[0][1] = y0, extentDomain[1][1] = y1;
- if (y.invert) y0 = y(y0), y1 = y(y1);
- if (y1 < y0) t = y0, y0 = y1, y1 = t;
- extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
- }
-
- return brush;
- };
-
- brush.clear = function() {
- extentDomain = null;
- extent[0][0] =
- extent[0][1] =
- extent[1][0] =
- extent[1][1] = 0;
- return brush;
- };
-
- brush.empty = function() {
- return (x && extent[0][0] === extent[1][0])
- || (y && extent[0][1] === extent[1][1]);
- };
-
- return d3.rebind(brush, event, "on");
-};
-
-var d3_svg_brushCursor = {
- 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 d3_svg_brushResizes = [
- ["n", "e", "s", "w", "nw", "ne", "se", "sw"],
- ["e", "w"],
- ["n", "s"],
- []
-];
-d3.behavior = {};
-// TODO Track touch points by identifier.
-
-d3.behavior.drag = function() {
- var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"),
- origin = null;
-
- function drag() {
- this.on("mousedown.drag", mousedown)
- .on("touchstart.drag", mousedown);
- }
-
- function mousedown() {
- var target = this,
- event_ = event.of(target, arguments),
- eventTarget = d3.event.target,
- offset,
- origin_ = point(),
- moved = 0;
-
- var w = d3.select(window)
- .on("mousemove.drag", dragmove)
- .on("touchmove.drag", dragmove)
- .on("mouseup.drag", dragend, true)
- .on("touchend.drag", dragend, true);
-
- if (origin) {
- offset = origin.apply(target, arguments);
- offset = [offset.x - origin_[0], offset.y - origin_[1]];
- } else {
- offset = [0, 0];
- }
-
- event_({type: "dragstart"});
-
- function point() {
- var p = target.parentNode,
- t = d3.event.changedTouches;
- return t ? d3.touches(p, t)[0] : d3.mouse(p);
- }
-
- function dragmove() {
- if (!target.parentNode) return dragend(); // target removed from DOM
-
- var p = point(),
- dx = p[0] - origin_[0],
- dy = p[1] - origin_[1];
-
- moved |= dx | dy;
- origin_ = p;
- d3_eventCancel();
-
- event_({type: "drag", x: p[0] + offset[0], y: p[1] + offset[1], dx: dx, dy: dy});
- }
-
- function dragend() {
- event_({type: "dragend"});
-
- // if moved, prevent the mouseup (and possibly click) from propagating
- if (moved) {
- d3_eventCancel();
- if (d3.event.target === eventTarget) w.on("click.drag", click, true);
- }
-
- w .on("mousemove.drag", null)
- .on("touchmove.drag", null)
- .on("mouseup.drag", null)
- .on("touchend.drag", null);
- }
-
- // prevent the subsequent click from propagating (e.g., for anchors)
- function click() {
- d3_eventCancel();
- w.on("click.drag", null);
- }
- }
-
- drag.origin = function(x) {
- if (!arguments.length) return origin;
- origin = x;
- return drag;
- };
-
- return d3.rebind(drag, event, "on");
-};
-d3.behavior.zoom = function() {
- var translate = [0, 0],
- translate0, // translate when we started zooming (to avoid drift)
- scale = 1,
- scale0, // scale when we started touching
- scaleExtent = d3_behavior_zoomInfinity,
- event = d3_eventDispatch(zoom, "zoom"),
- x0,
- x1,
- y0,
- y1,
- touchtime; // time of last touchstart (to detect double-tap)
-
- function zoom() {
- this
- .on("mousedown.zoom", mousedown)
- .on("mousewheel.zoom", mousewheel)
- .on("mousemove.zoom", mousemove)
- .on("DOMMouseScroll.zoom", mousewheel)
- .on("dblclick.zoom", dblclick)
- .on("touchstart.zoom", touchstart)
- .on("touchmove.zoom", touchmove)
- .on("touchend.zoom", touchstart);
- }
-
- zoom.translate = function(x) {
- if (!arguments.length) return translate;
- translate = x.map(Number);
- return zoom;
- };
-
- zoom.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return zoom;
- };
-
- zoom.scaleExtent = function(x) {
- if (!arguments.length) return scaleExtent;
- scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
- return zoom;
- };
-
- zoom.x = function(z) {
- if (!arguments.length) return x1;
- x1 = z;
- x0 = z.copy();
- return zoom;
- };
-
- zoom.y = function(z) {
- if (!arguments.length) return y1;
- y1 = z;
- y0 = z.copy();
- return zoom;
- };
-
- function location(p) {
- return [(p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale];
- }
-
- function point(l) {
- return [l[0] * scale + translate[0], l[1] * scale + translate[1]];
- }
-
- function scaleTo(s) {
- scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
- }
-
- function translateTo(p, l) {
- l = point(l);
- translate[0] += p[0] - l[0];
- translate[1] += p[1] - l[1];
- }
-
- function dispatch(event) {
- if (x1) x1.domain(x0.range().map(function(x) { return (x - translate[0]) / scale; }).map(x0.invert));
- if (y1) y1.domain(y0.range().map(function(y) { return (y - translate[1]) / scale; }).map(y0.invert));
- d3.event.preventDefault();
- event({type: "zoom", scale: scale, translate: translate});
- }
-
- function mousedown() {
- var target = this,
- event_ = event.of(target, arguments),
- eventTarget = d3.event.target,
- moved = 0,
- w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup),
- l = location(d3.mouse(target));
-
- window.focus();
- d3_eventCancel();
-
- function mousemove() {
- moved = 1;
- translateTo(d3.mouse(target), l);
- dispatch(event_);
- }
-
- function mouseup() {
- if (moved) d3_eventCancel();
- w.on("mousemove.zoom", null).on("mouseup.zoom", null);
- if (moved && d3.event.target === eventTarget) w.on("click.zoom", click);
- }
-
- function click() {
- d3_eventCancel();
- w.on("click.zoom", null);
- }
- }
-
- function mousewheel() {
- if (!translate0) translate0 = location(d3.mouse(this));
- scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
- translateTo(d3.mouse(this), translate0);
- dispatch(event.of(this, arguments));
- }
-
- function mousemove() {
- translate0 = null;
- }
-
- function dblclick() {
- var p = d3.mouse(this), l = location(p);
- scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2);
- translateTo(p, l);
- dispatch(event.of(this, arguments));
- }
-
- function touchstart() {
- var touches = d3.touches(this),
- now = Date.now();
-
- scale0 = scale;
- translate0 = {};
- touches.forEach(function(t) { translate0[t.identifier] = location(t); });
- d3_eventCancel();
-
- if ((touches.length === 1) && (now - touchtime < 500)) { // dbltap
- var p = touches[0], l = location(touches[0]);
- scaleTo(scale * 2);
- translateTo(p, l);
- dispatch(event.of(this, arguments));
- }
- touchtime = now;
- }
-
- function touchmove() {
- var touches = d3.touches(this),
- p0 = touches[0],
- l0 = translate0[p0.identifier];
- if (p1 = touches[1]) {
- var p1, l1 = translate0[p1.identifier];
- p0 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
- l0 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
- scaleTo(d3.event.scale * scale0);
- }
- translateTo(p0, l0);
- dispatch(event.of(this, arguments));
- }
-
- return d3.rebind(zoom, event, "on");
-};
-
-var d3_behavior_zoomDiv, // for interpreting mousewheel events
- d3_behavior_zoomInfinity = [0, Infinity]; // default scale extent
-
-function d3_behavior_zoomDelta() {
-
- // mousewheel events are totally broken!
- // https://bugs.webkit.org/show_bug.cgi?id=40441
- // not only that, but Chrome and Safari differ in re. to acceleration!
- if (!d3_behavior_zoomDiv) {
- d3_behavior_zoomDiv = 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 e = d3.event, delta;
- try {
- d3_behavior_zoomDiv.scrollTop = 1000;
- d3_behavior_zoomDiv.dispatchEvent(e);
- delta = 1000 - d3_behavior_zoomDiv.scrollTop;
- } catch (error) {
- delta = e.wheelDelta || (-e.detail * 5);
- }
-
- return delta;
-}
-d3.layout = {};
-// Implements hierarchical edge bundling using Holten's algorithm. For each
-// input link, a path is computed that travels through the tree, up the parent
-// hierarchy to the least common ancestor, and then back down to the destination
-// node. Each path is simply an array of nodes.
-d3.layout.bundle = function() {
- return function(links) {
- var paths = [],
- i = -1,
- n = links.length;
- while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
- return paths;
- };
-};
-
-function d3_layout_bundlePath(link) {
- var start = link.source,
- end = link.target,
- lca = d3_layout_bundleLeastCommonAncestor(start, end),
- points = [start];
- while (start !== lca) {
- start = start.parent;
- points.push(start);
- }
- var k = points.length;
- while (end !== lca) {
- points.splice(k, 0, end);
- end = end.parent;
- }
- return points;
-}
-
-function d3_layout_bundleAncestors(node) {
- var ancestors = [],
- parent = node.parent;
- while (parent != null) {
- ancestors.push(node);
- node = parent;
- parent = parent.parent;
- }
- ancestors.push(node);
- return ancestors;
-}
-
-function d3_layout_bundleLeastCommonAncestor(a, b) {
- if (a === b) return a;
- var aNodes = d3_layout_bundleAncestors(a),
- bNodes = d3_layout_bundleAncestors(b),
- aNode = aNodes.pop(),
- bNode = bNodes.pop(),
- sharedNode = null;
- while (aNode === bNode) {
- sharedNode = aNode;
- aNode = aNodes.pop();
- bNode = bNodes.pop();
- }
- return sharedNode;
-}
-d3.layout.chord = function() {
- var chord = {},
- chords,
- groups,
- matrix,
- n,
- padding = 0,
- sortGroups,
- sortSubgroups,
- sortChords;
-
- function relayout() {
- var subgroups = {},
- groupSums = [],
- groupIndex = d3.range(n),
- subgroupIndex = [],
- k,
- x,
- x0,
- i,
- j;
-
- chords = [];
- groups = [];
-
- // Compute the sum.
- k = 0, i = -1; while (++i < n) {
- x = 0, j = -1; while (++j < n) {
- x += matrix[i][j];
- }
- groupSums.push(x);
- subgroupIndex.push(d3.range(n));
- k += x;
- }
-
- // Sort groupsā¦
- if (sortGroups) {
- groupIndex.sort(function(a, b) {
- return sortGroups(groupSums[a], groupSums[b]);
- });
- }
-
- // Sort subgroupsā¦
- if (sortSubgroups) {
- subgroupIndex.forEach(function(d, i) {
- d.sort(function(a, b) {
- return sortSubgroups(matrix[i][a], matrix[i][b]);
- });
- });
- }
-
- // Convert the sum to scaling factor for [0, 2pi].
- // TODO Allow start and end angle to be specified.
- // TODO Allow padding to be specified as percentage?
- k = (2 * Math.PI - padding * n) / k;
-
- // Compute the start and end angle for each group and subgroup.
- // Note: Opera has a bug reordering object literal properties!
- x = 0, i = -1; while (++i < n) {
- x0 = x, j = -1; while (++j < n) {
- var di = groupIndex[i],
- dj = subgroupIndex[di][j],
- v = matrix[di][dj],
- a0 = x,
- a1 = x += v * k;
- subgroups[di + "-" + dj] = {
- index: di,
- subindex: dj,
- startAngle: a0,
- endAngle: a1,
- value: v
- };
- }
- groups.push({
- index: di,
- startAngle: x0,
- endAngle: x,
- value: (x - x0) / k
- });
- x += padding;
- }
-
- // Generate chords for each (non-empty) subgroup-subgroup link.
- i = -1; while (++i < n) {
- j = i - 1; while (++j < n) {
- var source = subgroups[i + "-" + j],
- target = subgroups[j + "-" + i];
- if (source.value || target.value) {
- chords.push(source.value < target.value
- ? {source: target, target: source}
- : {source: source, target: target});
- }
- }
- }
-
- if (sortChords) resort();
- }
-
- function resort() {
- chords.sort(function(a, b) {
- return sortChords(
- (a.source.value + a.target.value) / 2,
- (b.source.value + b.target.value) / 2);
- });
- }
-
- chord.matrix = function(x) {
- if (!arguments.length) return matrix;
- n = (matrix = x) && matrix.length;
- chords = groups = null;
- return chord;
- };
-
- chord.padding = function(x) {
- if (!arguments.length) return padding;
- padding = x;
- chords = groups = null;
- return chord;
- };
-
- chord.sortGroups = function(x) {
- if (!arguments.length) return sortGroups;
- sortGroups = x;
- chords = groups = null;
- return chord;
- };
-
- chord.sortSubgroups = function(x) {
- if (!arguments.length) return sortSubgroups;
- sortSubgroups = x;
- chords = null;
- return chord;
- };
-
- chord.sortChords = function(x) {
- if (!arguments.length) return sortChords;
- sortChords = x;
- if (chords) resort();
- return chord;
- };
-
- chord.chords = function() {
- if (!chords) relayout();
- return chords;
- };
-
- chord.groups = function() {
- if (!groups) relayout();
- return groups;
- };
-
- return chord;
-};
-// A rudimentary force layout using Gauss-Seidel.
-d3.layout.force = function() {
- var force = {},
- event = d3.dispatch("start", "tick", "end"),
- size = [1, 1],
- drag,
- alpha,
- friction = .9,
- linkDistance = d3_layout_forceLinkDistance,
- linkStrength = d3_layout_forceLinkStrength,
- charge = -30,
- gravity = .1,
- theta = .8,
- interval,
- nodes = [],
- links = [],
- distances,
- strengths,
- charges;
-
- function repulse(node) {
- return function(quad, x1, y1, x2, y2) {
- if (quad.point !== node) {
- var dx = quad.cx - node.x,
- dy = quad.cy - node.y,
- dn = 1 / Math.sqrt(dx * dx + dy * dy);
-
- /* Barnes-Hut criterion. */
- if ((x2 - x1) * dn < theta) {
- var k = quad.charge * dn * dn;
- node.px -= dx * k;
- node.py -= dy * k;
- return true;
- }
-
- if (quad.point && isFinite(dn)) {
- var k = quad.pointCharge * dn * dn;
- node.px -= dx * k;
- node.py -= dy * k;
- }
- }
- return !quad.charge;
- };
- }
-
- force.tick = function() {
- // simulated annealing, basically
- if ((alpha *= .99) < .005) {
- event.end({type: "end", alpha: alpha = 0});
- return true;
- }
-
- var n = nodes.length,
- m = links.length,
- q,
- i, // current index
- o, // current object
- s, // current source
- t, // current target
- l, // current distance
- k, // current force
- x, // x-distance
- y; // y-distance
-
- // gauss-seidel relaxation for links
- for (i = 0; i < m; ++i) {
- o = links[i];
- s = o.source;
- t = o.target;
- x = t.x - s.x;
- y = t.y - s.y;
- if (l = (x * x + y * y)) {
- l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
- x *= l;
- y *= l;
- t.x -= x * (k = s.weight / (t.weight + s.weight));
- t.y -= y * k;
- s.x += x * (k = 1 - k);
- s.y += y * k;
- }
- }
-
- // apply gravity forces
- if (k = alpha * gravity) {
- x = size[0] / 2;
- y = size[1] / 2;
- i = -1; if (k) while (++i < n) {
- o = nodes[i];
- o.x += (x - o.x) * k;
- o.y += (y - o.y) * k;
- }
- }
-
- // compute quadtree center of mass and apply charge forces
- if (charge) {
- d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
- i = -1; while (++i < n) {
- if (!(o = nodes[i]).fixed) {
- q.visit(repulse(o));
- }
- }
- }
-
- // position verlet integration
- i = -1; while (++i < n) {
- o = nodes[i];
- if (o.fixed) {
- o.x = o.px;
- o.y = o.py;
- } else {
- o.x -= (o.px - (o.px = o.x)) * friction;
- o.y -= (o.py - (o.py = o.y)) * friction;
- }
- }
-
- event.tick({type: "tick", alpha: alpha});
- };
-
- force.nodes = function(x) {
- if (!arguments.length) return nodes;
- nodes = x;
- return force;
- };
-
- force.links = function(x) {
- if (!arguments.length) return links;
- links = x;
- return force;
- };
-
- force.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return force;
- };
-
- force.linkDistance = function(x) {
- if (!arguments.length) return linkDistance;
- linkDistance = d3.functor(x);
- return force;
- };
-
- // For backwards-compatibility.
- force.distance = force.linkDistance;
-
- force.linkStrength = function(x) {
- if (!arguments.length) return linkStrength;
- linkStrength = d3.functor(x);
- return force;
- };
-
- force.friction = function(x) {
- if (!arguments.length) return friction;
- friction = x;
- return force;
- };
-
- force.charge = function(x) {
- if (!arguments.length) return charge;
- charge = typeof x === "function" ? x : +x;
- return force;
- };
-
- force.gravity = function(x) {
- if (!arguments.length) return gravity;
- gravity = x;
- return force;
- };
-
- force.theta = function(x) {
- if (!arguments.length) return theta;
- theta = x;
- return force;
- };
-
- force.alpha = function(x) {
- if (!arguments.length) return alpha;
-
- if (alpha) { // if we're already running
- if (x > 0) alpha = x; // we might keep it hot
- else alpha = 0; // or, next tick will dispatch "end"
- } else if (x > 0) { // otherwise, fire it up!
- event.start({type: "start", alpha: alpha = x});
- d3.timer(force.tick);
- }
-
- return force;
- };
-
- force.start = function() {
- var i,
- j,
- n = nodes.length,
- m = links.length,
- w = size[0],
- h = size[1],
- neighbors,
- o;
-
- for (i = 0; i < n; ++i) {
- (o = nodes[i]).index = i;
- o.weight = 0;
- }
-
- distances = [];
- strengths = [];
- for (i = 0; i < m; ++i) {
- o = links[i];
- if (typeof o.source == "number") o.source = nodes[o.source];
- if (typeof o.target == "number") o.target = nodes[o.target];
- distances[i] = linkDistance.call(this, o, i);
- strengths[i] = linkStrength.call(this, o, i);
- ++o.source.weight;
- ++o.target.weight;
- }
-
- for (i = 0; i < n; ++i) {
- o = nodes[i];
- if (isNaN(o.x)) o.x = position("x", w);
- if (isNaN(o.y)) o.y = position("y", h);
- if (isNaN(o.px)) o.px = o.x;
- if (isNaN(o.py)) o.py = o.y;
- }
-
- charges = [];
- if (typeof charge === "function") {
- for (i = 0; i < n; ++i) {
- charges[i] = +charge.call(this, nodes[i], i);
- }
- } else {
- for (i = 0; i < n; ++i) {
- charges[i] = charge;
- }
- }
-
- // initialize node position based on first neighbor
- function position(dimension, size) {
- var neighbors = neighbor(i),
- j = -1,
- m = neighbors.length,
- x;
- while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
- return Math.random() * size;
- }
-
- // initialize neighbors lazily
- function neighbor() {
- if (!neighbors) {
- neighbors = [];
- for (j = 0; j < n; ++j) {
- neighbors[j] = [];
- }
- for (j = 0; j < m; ++j) {
- var o = links[j];
- neighbors[o.source.index].push(o.target);
- neighbors[o.target.index].push(o.source);
- }
- }
- return neighbors[i];
- }
-
- return force.resume();
- };
-
- force.resume = function() {
- return force.alpha(.1);
- };
-
- force.stop = function() {
- return force.alpha(0);
- };
-
- // use `node.call(force.drag)` to make nodes draggable
- force.drag = function() {
- if (!drag) drag = d3.behavior.drag()
- .origin(Object)
- .on("dragstart", dragstart)
- .on("drag", d3_layout_forceDrag)
- .on("dragend", d3_layout_forceDragEnd);
-
- this.on("mouseover.force", d3_layout_forceDragOver)
- .on("mouseout.force", d3_layout_forceDragOut)
- .call(drag);
- };
-
- function dragstart(d) {
- d3_layout_forceDragOver(d3_layout_forceDragNode = d);
- d3_layout_forceDragForce = force;
- }
-
- return d3.rebind(force, event, "on");
-};
-
-var d3_layout_forceDragForce,
- d3_layout_forceDragNode;
-
-function d3_layout_forceDragOver(d) {
- d.fixed |= 2;
-}
-
-function d3_layout_forceDragOut(d) {
- if (d !== d3_layout_forceDragNode) d.fixed &= 1;
-}
-
-function d3_layout_forceDragEnd() {
- d3_layout_forceDragNode.fixed &= 1;
- d3_layout_forceDragForce = d3_layout_forceDragNode = null;
-}
-
-function d3_layout_forceDrag() {
- d3_layout_forceDragNode.px = d3.event.x;
- d3_layout_forceDragNode.py = d3.event.y;
- d3_layout_forceDragForce.resume(); // restart annealing
-}
-
-function d3_layout_forceAccumulate(quad, alpha, charges) {
- var cx = 0,
- cy = 0;
- quad.charge = 0;
- if (!quad.leaf) {
- var nodes = quad.nodes,
- n = nodes.length,
- i = -1,
- c;
- while (++i < n) {
- c = nodes[i];
- if (c == null) continue;
- d3_layout_forceAccumulate(c, alpha, charges);
- quad.charge += c.charge;
- cx += c.charge * c.cx;
- cy += c.charge * c.cy;
- }
- }
- if (quad.point) {
- // jitter internal nodes that are coincident
- if (!quad.leaf) {
- quad.point.x += Math.random() - .5;
- quad.point.y += Math.random() - .5;
- }
- var k = alpha * charges[quad.point.index];
- quad.charge += quad.pointCharge = k;
- cx += k * quad.point.x;
- cy += k * quad.point.y;
- }
- quad.cx = cx / quad.charge;
- quad.cy = cy / quad.charge;
-}
-
-function d3_layout_forceLinkDistance(link) {
- return 20;
-}
-
-function d3_layout_forceLinkStrength(link) {
- return 1;
-}
-d3.layout.partition = function() {
- var hierarchy = d3.layout.hierarchy(),
- size = [1, 1]; // width, height
-
- function position(node, x, dx, dy) {
- var children = node.children;
- node.x = x;
- node.y = node.depth * dy;
- node.dx = dx;
- node.dy = dy;
- if (children && (n = children.length)) {
- var i = -1,
- n,
- c,
- d;
- dx = node.value ? dx / node.value : 0;
- while (++i < n) {
- position(c = children[i], x, d = c.value * dx, dy);
- x += d;
- }
- }
- }
-
- function depth(node) {
- var children = node.children,
- d = 0;
- if (children && (n = children.length)) {
- var i = -1,
- n;
- while (++i < n) d = Math.max(d, depth(children[i]));
- }
- return 1 + d;
- }
-
- function partition(d, i) {
- var nodes = hierarchy.call(this, d, i);
- position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
- return nodes;
- }
-
- partition.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return partition;
- };
-
- return d3_layout_hierarchyRebind(partition, hierarchy);
-};
-d3.layout.pie = function() {
- var value = Number,
- sort = d3_layout_pieSortByValue,
- startAngle = 0,
- endAngle = 2 * Math.PI;
-
- function pie(data, i) {
-
- // Compute the numeric values for each data element.
- var values = data.map(function(d, i) { return +value.call(pie, d, i); });
-
- // Compute the start angle.
- var a = +(typeof startAngle === "function"
- ? startAngle.apply(this, arguments)
- : startAngle);
-
- // Compute the angular scale factor: from value to radians.
- var k = ((typeof endAngle === "function"
- ? endAngle.apply(this, arguments)
- : endAngle) - startAngle)
- / d3.sum(values);
-
- // Optionally sort the data.
- var index = d3.range(data.length);
- if (sort != null) index.sort(sort === d3_layout_pieSortByValue
- ? function(i, j) { return values[j] - values[i]; }
- : function(i, j) { return sort(data[i], data[j]); });
-
- // Compute the arcs!
- // They are stored in the original data's order.
- var arcs = [];
- index.forEach(function(i) {
- arcs[i] = {
- data: data[i],
- value: d = values[i],
- startAngle: a,
- endAngle: a += d * k
- };
- });
- return arcs;
- }
-
- /**
- * Specifies the value function *x*, which returns a nonnegative numeric value
- * for each datum. The default value function is `Number`. The value function
- * is passed two arguments: the current datum and the current index.
- */
- pie.value = function(x) {
- if (!arguments.length) return value;
- value = x;
- return pie;
- };
-
- /**
- * Specifies a sort comparison operator *x*. The comparator is passed two data
- * elements from the data array, a and b; it returns a negative value if a is
- * less than b, a positive value if a is greater than b, and zero if a equals
- * b.
- */
- pie.sort = function(x) {
- if (!arguments.length) return sort;
- sort = x;
- return pie;
- };
-
- /**
- * Specifies the overall start angle of the pie chart. Defaults to 0. The
- * start angle can be specified either as a constant or as a function; in the
- * case of a function, it is evaluated once per array (as opposed to per
- * element).
- */
- pie.startAngle = function(x) {
- if (!arguments.length) return startAngle;
- startAngle = x;
- return pie;
- };
-
- /**
- * Specifies the overall end angle of the pie chart. Defaults to 2Ļ. The
- * end angle can be specified either as a constant or as a function; in the
- * case of a function, it is evaluated once per array (as opposed to per
- * element).
- */
- pie.endAngle = function(x) {
- if (!arguments.length) return endAngle;
- endAngle = x;
- return pie;
- };
-
- return pie;
-};
-
-var d3_layout_pieSortByValue = {};
-// data is two-dimensional array of x,y; we populate y0
-d3.layout.stack = function() {
- var values = Object,
- order = d3_layout_stackOrderDefault,
- offset = d3_layout_stackOffsetZero,
- out = d3_layout_stackOut,
- x = d3_layout_stackX,
- y = d3_layout_stackY;
-
- function stack(data, index) {
-
- // Convert series to canonical two-dimensional representation.
- var series = data.map(function(d, i) {
- return values.call(stack, d, i);
- });
-
- // Convert each series to canonical [[x,y]] representation.
- var points = series.map(function(d, i) {
- return d.map(function(v, i) {
- return [x.call(stack, v, i), y.call(stack, v, i)];
- });
- });
-
- // Compute the order of series, and permute them.
- var orders = order.call(stack, points, index);
- series = d3.permute(series, orders);
- points = d3.permute(points, orders);
-
- // Compute the baselineā¦
- var offsets = offset.call(stack, points, index);
-
- // And propagate it to other series.
- var n = series.length,
- m = series[0].length,
- i,
- j,
- o;
- for (j = 0; j < m; ++j) {
- out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
- for (i = 1; i < n; ++i) {
- out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
- }
- }
-
- return data;
- }
-
- stack.values = function(x) {
- if (!arguments.length) return values;
- values = x;
- return stack;
- };
-
- stack.order = function(x) {
- if (!arguments.length) return order;
- order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
- return stack;
- };
-
- stack.offset = function(x) {
- if (!arguments.length) return offset;
- offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
- return stack;
- };
-
- stack.x = function(z) {
- if (!arguments.length) return x;
- x = z;
- return stack;
- };
-
- stack.y = function(z) {
- if (!arguments.length) return y;
- y = z;
- return stack;
- };
-
- stack.out = function(z) {
- if (!arguments.length) return out;
- out = z;
- return stack;
- };
-
- return stack;
-}
-
-function d3_layout_stackX(d) {
- return d.x;
-}
-
-function d3_layout_stackY(d) {
- return d.y;
-}
-
-function d3_layout_stackOut(d, y0, y) {
- d.y0 = y0;
- d.y = y;
-}
-
-var d3_layout_stackOrders = d3.map({
-
- "inside-out": function(data) {
- var n = data.length,
- i,
- j,
- max = data.map(d3_layout_stackMaxIndex),
- sums = data.map(d3_layout_stackReduceSum),
- index = d3.range(n).sort(function(a, b) { return max[a] - max[b]; }),
- top = 0,
- bottom = 0,
- tops = [],
- bottoms = [];
- for (i = 0; i < n; ++i) {
- j = index[i];
- if (top < bottom) {
- top += sums[j];
- tops.push(j);
- } else {
- bottom += sums[j];
- bottoms.push(j);
- }
- }
- return bottoms.reverse().concat(tops);
- },
-
- "reverse": function(data) {
- return d3.range(data.length).reverse();
- },
-
- "default": d3_layout_stackOrderDefault
-
-});
-
-var d3_layout_stackOffsets = d3.map({
-
- "silhouette": function(data) {
- var n = data.length,
- m = data[0].length,
- sums = [],
- max = 0,
- i,
- j,
- o,
- y0 = [];
- for (j = 0; j < m; ++j) {
- for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
- if (o > max) max = o;
- sums.push(o);
- }
- for (j = 0; j < m; ++j) {
- y0[j] = (max - sums[j]) / 2;
- }
- return y0;
- },
-
- "wiggle": function(data) {
- var n = data.length,
- x = data[0],
- m = x.length,
- max = 0,
- i,
- j,
- k,
- s1,
- s2,
- s3,
- dx,
- o,
- o0,
- y0 = [];
- y0[0] = o = o0 = 0;
- for (j = 1; j < m; ++j) {
- for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
- for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
- for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
- s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
- }
- s2 += s3 * data[i][j][1];
- }
- y0[j] = o -= s1 ? s2 / s1 * dx : 0;
- if (o < o0) o0 = o;
- }
- for (j = 0; j < m; ++j) y0[j] -= o0;
- return y0;
- },
-
- "expand": function(data) {
- var n = data.length,
- m = data[0].length,
- k = 1 / n,
- i,
- j,
- o,
- y0 = [];
- for (j = 0; j < m; ++j) {
- for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
- if (o) for (i = 0; i < n; i++) data[i][j][1] /= o;
- else for (i = 0; i < n; i++) data[i][j][1] = k;
- }
- for (j = 0; j < m; ++j) y0[j] = 0;
- return y0;
- },
-
- "zero": d3_layout_stackOffsetZero
-
-});
-
-function d3_layout_stackOrderDefault(data) {
- return d3.range(data.length);
-}
-
-function d3_layout_stackOffsetZero(data) {
- var j = -1,
- m = data[0].length,
- y0 = [];
- while (++j < m) y0[j] = 0;
- return y0;
-}
-
-function d3_layout_stackMaxIndex(array) {
- var i = 1,
- j = 0,
- v = array[0][1],
- k,
- n = array.length;
- for (; i < n; ++i) {
- if ((k = array[i][1]) > v) {
- j = i;
- v = k;
- }
- }
- return j;
-}
-
-function d3_layout_stackReduceSum(d) {
- return d.reduce(d3_layout_stackSum, 0);
-}
-
-function d3_layout_stackSum(p, d) {
- return p + d[1];
-}
-d3.layout.histogram = function() {
- var frequency = true,
- valuer = Number,
- ranger = d3_layout_histogramRange,
- binner = d3_layout_histogramBinSturges;
-
- function histogram(data, i) {
- var bins = [],
- values = data.map(valuer, this),
- range = ranger.call(this, values, i),
- thresholds = binner.call(this, range, values, i),
- bin,
- i = -1,
- n = values.length,
- m = thresholds.length - 1,
- k = frequency ? 1 : 1 / n,
- x;
-
- // Initialize the bins.
- while (++i < m) {
- bin = bins[i] = [];
- bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
- bin.y = 0;
- }
-
- // Fill the bins, ignoring values outside the range.
- i = -1; while(++i < n) {
- x = values[i];
- if ((x >= range[0]) && (x <= range[1])) {
- bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
- bin.y += k;
- bin.push(data[i]);
- }
- }
-
- return bins;
- }
-
- // Specifies how to extract a value from the associated data. The default
- // value function is `Number`, which is equivalent to the identity function.
- histogram.value = function(x) {
- if (!arguments.length) return valuer;
- valuer = x;
- return histogram;
- };
-
- // Specifies the range of the histogram. Values outside the specified range
- // will be ignored. The argument `x` may be specified either as a two-element
- // array representing the minimum and maximum value of the range, or as a
- // function that returns the range given the array of values and the current
- // index `i`. The default range is the extent (minimum and maximum) of the
- // values.
- histogram.range = function(x) {
- if (!arguments.length) return ranger;
- ranger = d3.functor(x);
- return histogram;
- };
-
- // Specifies how to bin values in the histogram. The argument `x` may be
- // specified as a number, in which case the range of values will be split
- // uniformly into the given number of bins. Or, `x` may be an array of
- // threshold values, defining the bins; the specified array must contain the
- // rightmost (upper) value, thus specifying n + 1 values for n bins. Or, `x`
- // may be a function which is evaluated, being passed the range, the array of
- // values, and the current index `i`, returning an array of thresholds. The
- // default bin function will divide the values into uniform bins using
- // Sturges' formula.
- histogram.bins = function(x) {
- if (!arguments.length) return binner;
- binner = typeof x === "number"
- ? function(range) { return d3_layout_histogramBinFixed(range, x); }
- : d3.functor(x);
- return histogram;
- };
-
- // Specifies whether the histogram's `y` value is a count (frequency) or a
- // probability (density). The default value is true.
- histogram.frequency = function(x) {
- if (!arguments.length) return frequency;
- frequency = !!x;
- return histogram;
- };
-
- return histogram;
-};
-
-function d3_layout_histogramBinSturges(range, values) {
- return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
-}
-
-function d3_layout_histogramBinFixed(range, n) {
- var x = -1,
- b = +range[0],
- m = (range[1] - b) / n,
- f = [];
- while (++x <= n) f[x] = m * x + b;
- return f;
-}
-
-function d3_layout_histogramRange(values) {
- return [d3.min(values), d3.max(values)];
-}
-d3.layout.hierarchy = function() {
- var sort = d3_layout_hierarchySort,
- children = d3_layout_hierarchyChildren,
- value = d3_layout_hierarchyValue;
-
- // Recursively compute the node depth and value.
- // Also converts the data representation into a standard hierarchy structure.
- function recurse(data, depth, nodes) {
- var childs = children.call(hierarchy, data, depth),
- node = d3_layout_hierarchyInline ? data : {data: data};
- node.depth = depth;
- nodes.push(node);
- if (childs && (n = childs.length)) {
- var i = -1,
- n,
- c = node.children = [],
- v = 0,
- j = depth + 1;
- while (++i < n) {
- d = recurse(childs[i], j, nodes);
- d.parent = node;
- c.push(d);
- v += d.value;
- }
- if (sort) c.sort(sort);
- if (value) node.value = v;
- } else if (value) {
- node.value = +value.call(hierarchy, data, depth) || 0;
- }
- return node;
- }
-
- // Recursively re-evaluates the node value.
- function revalue(node, depth) {
- var children = node.children,
- v = 0;
- if (children && (n = children.length)) {
- var i = -1,
- n,
- j = depth + 1;
- while (++i < n) v += revalue(children[i], j);
- } else if (value) {
- v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;
- }
- if (value) node.value = v;
- return v;
- }
-
- function hierarchy(d) {
- var nodes = [];
- recurse(d, 0, nodes);
- return nodes;
- }
-
- hierarchy.sort = function(x) {
- if (!arguments.length) return sort;
- sort = x;
- return hierarchy;
- };
-
- hierarchy.children = function(x) {
- if (!arguments.length) return children;
- children = x;
- return hierarchy;
- };
-
- hierarchy.value = function(x) {
- if (!arguments.length) return value;
- value = x;
- return hierarchy;
- };
-
- // Re-evaluates the `value` property for the specified hierarchy.
- hierarchy.revalue = function(root) {
- revalue(root, 0);
- return root;
- };
-
- return hierarchy;
-};
-
-// A method assignment helper for hierarchy subclasses.
-function d3_layout_hierarchyRebind(object, hierarchy) {
- d3.rebind(object, hierarchy, "sort", "children", "value");
-
- // Add an alias for links, for convenience.
- object.links = d3_layout_hierarchyLinks;
-
- // If the new API is used, enabling inlining.
- object.nodes = function(d) {
- d3_layout_hierarchyInline = true;
- return (object.nodes = object)(d);
- };
-
- return object;
-}
-
-function d3_layout_hierarchyChildren(d) {
- return d.children;
-}
-
-function d3_layout_hierarchyValue(d) {
- return d.value;
-}
-
-function d3_layout_hierarchySort(a, b) {
- return b.value - a.value;
-}
-
-// Returns an array source+target objects for the specified nodes.
-function d3_layout_hierarchyLinks(nodes) {
- return d3.merge(nodes.map(function(parent) {
- return (parent.children || []).map(function(child) {
- return {source: parent, target: child};
- });
- }));
-}
-
-// For backwards-compatibility, don't enable inlining by default.
-var d3_layout_hierarchyInline = false;
-d3.layout.pack = function() {
- var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort),
- size = [1, 1];
-
- function pack(d, i) {
- var nodes = hierarchy.call(this, d, i),
- root = nodes[0];
-
- // Recursively compute the layout.
- root.x = 0;
- root.y = 0;
- d3_layout_packTree(root);
-
- // Scale the layout to fit the requested size.
- var w = size[0],
- h = size[1],
- k = 1 / Math.max(2 * root.r / w, 2 * root.r / h);
- d3_layout_packTransform(root, w / 2, h / 2, k);
-
- return nodes;
- }
-
- pack.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return pack;
- };
-
- return d3_layout_hierarchyRebind(pack, hierarchy);
-};
-
-function d3_layout_packSort(a, b) {
- return a.value - b.value;
-}
-
-function d3_layout_packInsert(a, b) {
- var c = a._pack_next;
- a._pack_next = b;
- b._pack_prev = a;
- b._pack_next = c;
- c._pack_prev = b;
-}
-
-function d3_layout_packSplice(a, b) {
- a._pack_next = b;
- b._pack_prev = a;
-}
-
-function d3_layout_packIntersects(a, b) {
- var dx = b.x - a.x,
- dy = b.y - a.y,
- dr = a.r + b.r;
- return dr * dr - dx * dx - dy * dy > .001; // within epsilon
-}
-
-function d3_layout_packCircle(nodes) {
- var xMin = Infinity,
- xMax = -Infinity,
- yMin = Infinity,
- yMax = -Infinity,
- n = nodes.length,
- a, b, c, j, k;
-
- function bound(node) {
- xMin = Math.min(node.x - node.r, xMin);
- xMax = Math.max(node.x + node.r, xMax);
- yMin = Math.min(node.y - node.r, yMin);
- yMax = Math.max(node.y + node.r, yMax);
- }
-
- // Create node links.
- nodes.forEach(d3_layout_packLink);
-
- // Create first node.
- a = nodes[0];
- a.x = -a.r;
- a.y = 0;
- bound(a);
-
- // Create second node.
- if (n > 1) {
- b = nodes[1];
- b.x = b.r;
- b.y = 0;
- bound(b);
-
- // Create third node and build chain.
- if (n > 2) {
- c = nodes[2];
- d3_layout_packPlace(a, b, c);
- bound(c);
- d3_layout_packInsert(a, c);
- a._pack_prev = c;
- d3_layout_packInsert(c, b);
- b = a._pack_next;
-
- // Now iterate through the rest.
- for (var i = 3; i < n; i++) {
- d3_layout_packPlace(a, b, c = nodes[i]);
-
- // Search for the closest intersection.
- var isect = 0, s1 = 1, s2 = 1;
- for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
- if (d3_layout_packIntersects(j, c)) {
- isect = 1;
- break;
- }
- }
- if (isect == 1) {
- for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
- if (d3_layout_packIntersects(k, c)) {
- break;
- }
- }
- }
-
- // Update node chain.
- if (isect) {
- if (s1 < s2 || (s1 == s2 && b.r < a.r)) d3_layout_packSplice(a, b = j);
- else d3_layout_packSplice(a = k, b);
- i--;
- } else {
- d3_layout_packInsert(a, c);
- b = c;
- bound(c);
- }
- }
- }
- }
-
- // Re-center the circles and return the encompassing radius.
- var cx = (xMin + xMax) / 2,
- cy = (yMin + yMax) / 2,
- cr = 0;
- for (var i = 0; i < n; i++) {
- var node = nodes[i];
- node.x -= cx;
- node.y -= cy;
- cr = Math.max(cr, node.r + Math.sqrt(node.x * node.x + node.y * node.y));
- }
-
- // Remove node links.
- nodes.forEach(d3_layout_packUnlink);
-
- return cr;
-}
-
-function d3_layout_packLink(node) {
- node._pack_next = node._pack_prev = node;
-}
-
-function d3_layout_packUnlink(node) {
- delete node._pack_next;
- delete node._pack_prev;
-}
-
-function d3_layout_packTree(node) {
- var children = node.children;
- if (children && children.length) {
- children.forEach(d3_layout_packTree);
- node.r = d3_layout_packCircle(children);
- } else {
- node.r = Math.sqrt(node.value);
- }
-}
-
-function d3_layout_packTransform(node, x, y, k) {
- var children = node.children;
- node.x = (x += k * node.x);
- node.y = (y += k * node.y);
- node.r *= k;
- if (children) {
- var i = -1, n = children.length;
- while (++i < n) d3_layout_packTransform(children[i], x, y, k);
- }
-}
-
-function d3_layout_packPlace(a, b, c) {
- var db = a.r + c.r,
- dx = b.x - a.x,
- dy = b.y - a.y;
- if (db && (dx || dy)) {
- var da = b.r + c.r,
- dc = Math.sqrt(dx * dx + dy * dy),
- cos = Math.max(-1, Math.min(1, (db * db + dc * dc - da * da) / (2 * db * dc))),
- theta = Math.acos(cos),
- x = cos * (db /= dc),
- y = Math.sin(theta) * db;
- c.x = a.x + x * dx + y * dy;
- c.y = a.y + x * dy - y * dx;
- } else {
- c.x = a.x + db;
- c.y = a.y;
- }
-}
-// Implements a hierarchical layout using the cluster (or dendrogram)
-// algorithm.
-d3.layout.cluster = function() {
- var hierarchy = d3.layout.hierarchy().sort(null).value(null),
- separation = d3_layout_treeSeparation,
- size = [1, 1]; // width, height
-
- function cluster(d, i) {
- var nodes = hierarchy.call(this, d, i),
- root = nodes[0],
- previousNode,
- x = 0,
- kx,
- ky;
-
- // First walk, computing the initial x & y values.
- d3_layout_treeVisitAfter(root, function(node) {
- var children = node.children;
- if (children && children.length) {
- node.x = d3_layout_clusterX(children);
- node.y = d3_layout_clusterY(children);
- } else {
- node.x = previousNode ? x += separation(node, previousNode) : 0;
- node.y = 0;
- previousNode = node;
- }
- });
-
- // Compute the left-most, right-most, and depth-most nodes for extents.
- var left = d3_layout_clusterLeft(root),
- right = d3_layout_clusterRight(root),
- x0 = left.x - separation(left, right) / 2,
- x1 = right.x + separation(right, left) / 2;
-
- // Second walk, normalizing x & y to the desired size.
- d3_layout_treeVisitAfter(root, function(node) {
- node.x = (node.x - x0) / (x1 - x0) * size[0];
- node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
- });
-
- return nodes;
- }
-
- cluster.separation = function(x) {
- if (!arguments.length) return separation;
- separation = x;
- return cluster;
- };
-
- cluster.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return cluster;
- };
-
- return d3_layout_hierarchyRebind(cluster, hierarchy);
-};
-
-function d3_layout_clusterY(children) {
- return 1 + d3.max(children, function(child) {
- return child.y;
- });
-}
-
-function d3_layout_clusterX(children) {
- return children.reduce(function(x, child) {
- return x + child.x;
- }, 0) / children.length;
-}
-
-function d3_layout_clusterLeft(node) {
- var children = node.children;
- return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
-}
-
-function d3_layout_clusterRight(node) {
- var children = node.children, n;
- return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
-}
-// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
-d3.layout.tree = function() {
- var hierarchy = d3.layout.hierarchy().sort(null).value(null),
- separation = d3_layout_treeSeparation,
- size = [1, 1]; // width, height
-
- function tree(d, i) {
- var nodes = hierarchy.call(this, d, i),
- root = nodes[0];
-
- function firstWalk(node, previousSibling) {
- var children = node.children,
- layout = node._tree;
- if (children && (n = children.length)) {
- var n,
- firstChild = children[0],
- previousChild,
- ancestor = firstChild,
- child,
- i = -1;
- while (++i < n) {
- child = children[i];
- firstWalk(child, previousChild);
- ancestor = apportion(child, previousChild, ancestor);
- previousChild = child;
- }
- d3_layout_treeShift(node);
- var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
- if (previousSibling) {
- layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
- layout.mod = layout.prelim - midpoint;
- } else {
- layout.prelim = midpoint;
- }
- } else {
- if (previousSibling) {
- layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
- }
- }
- }
-
- function secondWalk(node, x) {
- node.x = node._tree.prelim + x;
- var children = node.children;
- if (children && (n = children.length)) {
- var i = -1,
- n;
- x += node._tree.mod;
- while (++i < n) {
- secondWalk(children[i], x);
- }
- }
- }
-
- function apportion(node, previousSibling, ancestor) {
- if (previousSibling) {
- var vip = node,
- vop = node,
- vim = previousSibling,
- vom = node.parent.children[0],
- sip = vip._tree.mod,
- sop = vop._tree.mod,
- sim = vim._tree.mod,
- som = vom._tree.mod,
- shift;
- while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
- vom = d3_layout_treeLeft(vom);
- vop = d3_layout_treeRight(vop);
- vop._tree.ancestor = node;
- shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
- if (shift > 0) {
- d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
- sip += shift;
- sop += shift;
- }
- sim += vim._tree.mod;
- sip += vip._tree.mod;
- som += vom._tree.mod;
- sop += vop._tree.mod;
- }
- if (vim && !d3_layout_treeRight(vop)) {
- vop._tree.thread = vim;
- vop._tree.mod += sim - sop;
- }
- if (vip && !d3_layout_treeLeft(vom)) {
- vom._tree.thread = vip;
- vom._tree.mod += sip - som;
- ancestor = node;
- }
- }
- return ancestor;
- }
-
- // Initialize temporary layout variables.
- d3_layout_treeVisitAfter(root, function(node, previousSibling) {
- node._tree = {
- ancestor: node,
- prelim: 0,
- mod: 0,
- change: 0,
- shift: 0,
- number: previousSibling ? previousSibling._tree.number + 1 : 0
- };
- });
-
- // Compute the layout using Buchheim et al.'s algorithm.
- firstWalk(root);
- secondWalk(root, -root._tree.prelim);
-
- // Compute the left-most, right-most, and depth-most nodes for extents.
- var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost),
- right = d3_layout_treeSearch(root, d3_layout_treeRightmost),
- deep = d3_layout_treeSearch(root, d3_layout_treeDeepest),
- x0 = left.x - separation(left, right) / 2,
- x1 = right.x + separation(right, left) / 2,
- y1 = deep.depth || 1;
-
- // Clear temporary layout variables; transform x and y.
- d3_layout_treeVisitAfter(root, function(node) {
- node.x = (node.x - x0) / (x1 - x0) * size[0];
- node.y = node.depth / y1 * size[1];
- delete node._tree;
- });
-
- return nodes;
- }
-
- tree.separation = function(x) {
- if (!arguments.length) return separation;
- separation = x;
- return tree;
- };
-
- tree.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return tree;
- };
-
- return d3_layout_hierarchyRebind(tree, hierarchy);
-};
-
-function d3_layout_treeSeparation(a, b) {
- return a.parent == b.parent ? 1 : 2;
-}
-
-// function d3_layout_treeSeparationRadial(a, b) {
-// return (a.parent == b.parent ? 1 : 2) / a.depth;
-// }
-
-function d3_layout_treeLeft(node) {
- var children = node.children;
- return children && children.length ? children[0] : node._tree.thread;
-}
-
-function d3_layout_treeRight(node) {
- var children = node.children,
- n;
- return children && (n = children.length) ? children[n - 1] : node._tree.thread;
-}
-
-function d3_layout_treeSearch(node, compare) {
- var children = node.children;
- if (children && (n = children.length)) {
- var child,
- n,
- i = -1;
- while (++i < n) {
- if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
- node = child;
- }
- }
- }
- return node;
-}
-
-function d3_layout_treeRightmost(a, b) {
- return a.x - b.x;
-}
-
-function d3_layout_treeLeftmost(a, b) {
- return b.x - a.x;
-}
-
-function d3_layout_treeDeepest(a, b) {
- return a.depth - b.depth;
-}
-
-function d3_layout_treeVisitAfter(node, callback) {
- function visit(node, previousSibling) {
- var children = node.children;
- if (children && (n = children.length)) {
- var child,
- previousChild = null,
- i = -1,
- n;
- while (++i < n) {
- child = children[i];
- visit(child, previousChild);
- previousChild = child;
- }
- }
- callback(node, previousSibling);
- }
- visit(node, null);
-}
-
-function d3_layout_treeShift(node) {
- var shift = 0,
- change = 0,
- children = node.children,
- i = children.length,
- child;
- while (--i >= 0) {
- child = children[i]._tree;
- child.prelim += shift;
- child.mod += shift;
- shift += child.shift + (change += child.change);
- }
-}
-
-function d3_layout_treeMove(ancestor, node, shift) {
- ancestor = ancestor._tree;
- node = node._tree;
- var change = shift / (node.number - ancestor.number);
- ancestor.change += change;
- node.change -= change;
- node.shift += shift;
- node.prelim += shift;
- node.mod += shift;
-}
-
-function d3_layout_treeAncestor(vim, node, ancestor) {
- return vim._tree.ancestor.parent == node.parent
- ? vim._tree.ancestor
- : ancestor;
-}
-// Squarified Treemaps by Mark Bruls, Kees Huizing, and Jarke J. van Wijk
-// Modified to support a target aspect ratio by Jeff Heer
-d3.layout.treemap = function() {
- var hierarchy = d3.layout.hierarchy(),
- round = Math.round,
- size = [1, 1], // width, height
- padding = null,
- pad = d3_layout_treemapPadNull,
- sticky = false,
- stickies,
- ratio = 0.5 * (1 + Math.sqrt(5)); // golden ratio
-
- // Compute the area for each child based on value & scale.
- function scale(children, k) {
- var i = -1,
- n = children.length,
- child,
- area;
- while (++i < n) {
- area = (child = children[i]).value * (k < 0 ? 0 : k);
- child.area = isNaN(area) || area <= 0 ? 0 : area;
- }
- }
-
- // Recursively arranges the specified node's children into squarified rows.
- function squarify(node) {
- var children = node.children;
- if (children && children.length) {
- var rect = pad(node),
- row = [],
- remaining = children.slice(), // copy-on-write
- child,
- best = Infinity, // the best row score so far
- score, // the current row score
- u = Math.min(rect.dx, rect.dy), // initial orientation
- n;
- scale(remaining, rect.dx * rect.dy / node.value);
- row.area = 0;
- while ((n = remaining.length) > 0) {
- row.push(child = remaining[n - 1]);
- row.area += child.area;
- if ((score = worst(row, u)) <= best) { // continue with this orientation
- remaining.pop();
- best = score;
- } else { // abort, and try a different orientation
- row.area -= row.pop().area;
- position(row, u, rect, false);
- u = Math.min(rect.dx, rect.dy);
- row.length = row.area = 0;
- best = Infinity;
- }
- }
- if (row.length) {
- position(row, u, rect, true);
- row.length = row.area = 0;
- }
- children.forEach(squarify);
- }
- }
-
- // Recursively resizes the specified node's children into existing rows.
- // Preserves the existing layout!
- function stickify(node) {
- var children = node.children;
- if (children && children.length) {
- var rect = pad(node),
- remaining = children.slice(), // copy-on-write
- child,
- row = [];
- scale(remaining, rect.dx * rect.dy / node.value);
- row.area = 0;
- while (child = remaining.pop()) {
- row.push(child);
- row.area += child.area;
- if (child.z != null) {
- position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
- row.length = row.area = 0;
- }
- }
- children.forEach(stickify);
- }
- }
-
- // Computes the score for the specified row, as the worst aspect ratio.
- function worst(row, u) {
- var s = row.area,
- r,
- rmax = 0,
- rmin = Infinity,
- i = -1,
- n = row.length;
- while (++i < n) {
- if (!(r = row[i].area)) continue;
- if (r < rmin) rmin = r;
- if (r > rmax) rmax = r;
- }
- s *= s;
- u *= u;
- return s
- ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio))
- : Infinity;
- }
-
- // Positions the specified row of nodes. Modifies `rect`.
- function position(row, u, rect, flush) {
- var i = -1,
- n = row.length,
- x = rect.x,
- y = rect.y,
- v = u ? round(row.area / u) : 0,
- o;
- if (u == rect.dx) { // horizontal subdivision
- if (flush || v > rect.dy) v = rect.dy; // over+underflow
- while (++i < n) {
- o = row[i];
- o.x = x;
- o.y = y;
- o.dy = v;
- x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
- }
- o.z = true;
- o.dx += rect.x + rect.dx - x; // rounding error
- rect.y += v;
- rect.dy -= v;
- } else { // vertical subdivision
- if (flush || v > rect.dx) v = rect.dx; // over+underflow
- while (++i < n) {
- o = row[i];
- o.x = x;
- o.y = y;
- o.dx = v;
- y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
- }
- o.z = false;
- o.dy += rect.y + rect.dy - y; // rounding error
- rect.x += v;
- rect.dx -= v;
- }
- }
-
- function treemap(d) {
- var nodes = stickies || hierarchy(d),
- root = nodes[0];
- root.x = 0;
- root.y = 0;
- root.dx = size[0];
- root.dy = size[1];
- if (stickies) hierarchy.revalue(root);
- scale([root], root.dx * root.dy / root.value);
- (stickies ? stickify : squarify)(root);
- if (sticky) stickies = nodes;
- return nodes;
- }
-
- treemap.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return treemap;
- };
-
- treemap.padding = function(x) {
- if (!arguments.length) return padding;
-
- function padFunction(node) {
- var p = x.call(treemap, node, node.depth);
- return p == null
- ? d3_layout_treemapPadNull(node)
- : d3_layout_treemapPad(node, typeof p === "number" ? [p, p, p, p] : p);
- }
-
- function padConstant(node) {
- return d3_layout_treemapPad(node, x);
- }
-
- var type;
- pad = (padding = x) == null ? d3_layout_treemapPadNull
- : (type = typeof x) === "function" ? padFunction
- : type === "number" ? (x = [x, x, x, x], padConstant)
- : padConstant;
- return treemap;
- };
-
- treemap.round = function(x) {
- if (!arguments.length) return round != Number;
- round = x ? Math.round : Number;
- return treemap;
- };
-
- treemap.sticky = function(x) {
- if (!arguments.length) return sticky;
- sticky = x;
- stickies = null;
- return treemap;
- };
-
- treemap.ratio = function(x) {
- if (!arguments.length) return ratio;
- ratio = x;
- return treemap;
- };
-
- return d3_layout_hierarchyRebind(treemap, hierarchy);
-};
-
-function d3_layout_treemapPadNull(node) {
- return {x: node.x, y: node.y, dx: node.dx, dy: node.dy};
-}
-
-function d3_layout_treemapPad(node, padding) {
- var x = node.x + padding[3],
- y = node.y + padding[0],
- dx = node.dx - padding[1] - padding[3],
- dy = node.dy - padding[0] - padding[2];
- if (dx < 0) { x += dx / 2; dx = 0; }
- if (dy < 0) { y += dy / 2; dy = 0; }
- return {x: x, y: y, dx: dx, dy: dy};
-}
-d3.csv = function(url, callback) {
- d3.text(url, "text/csv", function(text) {
- callback(text && d3.csv.parse(text));
- });
-};
-d3.csv.parse = function(text) {
- var header;
- return d3.csv.parseRows(text, function(row, i) {
- if (i) {
- var o = {}, j = -1, m = header.length;
- while (++j < m) o[header[j]] = row[j];
- return o;
- } else {
- header = row;
- return null;
- }
- });
-};
-
-d3.csv.parseRows = function(text, f) {
- var EOL = {}, // sentinel value for end-of-line
- EOF = {}, // sentinel value for end-of-file
- rows = [], // output rows
- re = /\r\n|[,\r\n]/g, // field separator regex
- n = 0, // the current line number
- t, // the current token
- eol; // is the current token followed by EOL?
-
- re.lastIndex = 0; // work-around bug in FF 3.6
-
- /** @private Returns the next token. */
- function token() {
- if (re.lastIndex >= text.length) return EOF; // special case: end of file
- if (eol) { eol = false; return EOL; } // special case: end of line
-
- // special case: quotes
- var j = re.lastIndex;
- if (text.charCodeAt(j) === 34) {
- var i = j;
- while (i++ < text.length) {
- if (text.charCodeAt(i) === 34) {
- if (text.charCodeAt(i + 1) !== 34) break;
- i++;
- }
- }
- re.lastIndex = i + 2;
- var c = text.charCodeAt(i + 1);
- if (c === 13) {
- eol = true;
- if (text.charCodeAt(i + 2) === 10) re.lastIndex++;
- } else if (c === 10) {
- eol = true;
- }
- return text.substring(j + 1, i).replace(/""/g, "\"");
- }
-
- // common case
- var m = re.exec(text);
- if (m) {
- eol = m[0].charCodeAt(0) !== 44;
- return text.substring(j, m.index);
- }
- re.lastIndex = text.length;
- return text.substring(j);
- }
-
- while ((t = token()) !== EOF) {
- var a = [];
- while ((t !== EOL) && (t !== EOF)) {
- a.push(t);
- t = token();
- }
- if (f && !(a = f(a, n++))) continue;
- rows.push(a);
- }
-
- return rows;
-};
-d3.csv.format = function(rows) {
- return rows.map(d3_csv_formatRow).join("\n");
-};
-
-function d3_csv_formatRow(row) {
- return row.map(d3_csv_formatValue).join(",");
-}
-
-function d3_csv_formatValue(text) {
- return /[",\n]/.test(text)
- ? "\"" + text.replace(/\"/g, "\"\"") + "\""
- : text;
-}
-d3.geo = {};
-
-var d3_geo_radians = Math.PI / 180;
-// TODO clip input coordinates on opposite hemisphere
-d3.geo.azimuthal = function() {
- var mode = "orthographic", // or stereographic, gnomonic, equidistant or equalarea
- origin,
- scale = 200,
- translate = [480, 250],
- x0,
- y0,
- cy0,
- sy0;
-
- function azimuthal(coordinates) {
- var x1 = coordinates[0] * d3_geo_radians - x0,
- y1 = coordinates[1] * d3_geo_radians,
- cx1 = Math.cos(x1),
- sx1 = Math.sin(x1),
- cy1 = Math.cos(y1),
- sy1 = Math.sin(y1),
- cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null,
- c,
- k = mode === "stereographic" ? 1 / (1 + cc)
- : mode === "gnomonic" ? 1 / cc
- : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0)
- : mode === "equalarea" ? Math.sqrt(2 / (1 + cc))
- : 1,
- x = k * cy1 * sx1,
- y = k * (sy0 * cy1 * cx1 - cy0 * sy1);
- return [
- scale * x + translate[0],
- scale * y + translate[1]
- ];
- }
-
- azimuthal.invert = function(coordinates) {
- var x = (coordinates[0] - translate[0]) / scale,
- y = (coordinates[1] - translate[1]) / scale,
- p = Math.sqrt(x * x + y * y),
- c = mode === "stereographic" ? 2 * Math.atan(p)
- : mode === "gnomonic" ? Math.atan(p)
- : mode === "equidistant" ? p
- : mode === "equalarea" ? 2 * Math.asin(.5 * p)
- : Math.asin(p),
- sc = Math.sin(c),
- cc = Math.cos(c);
- return [
- (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians,
- Math.asin(cc * sy0 - (p ? (y * sc * cy0) / p : 0)) / d3_geo_radians
- ];
- };
-
- azimuthal.mode = function(x) {
- if (!arguments.length) return mode;
- mode = x + "";
- return azimuthal;
- };
-
- azimuthal.origin = function(x) {
- if (!arguments.length) return origin;
- origin = x;
- x0 = origin[0] * d3_geo_radians;
- y0 = origin[1] * d3_geo_radians;
- cy0 = Math.cos(y0);
- sy0 = Math.sin(y0);
- return azimuthal;
- };
-
- azimuthal.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return azimuthal;
- };
-
- azimuthal.translate = function(x) {
- if (!arguments.length) return translate;
- translate = [+x[0], +x[1]];
- return azimuthal;
- };
-
- return azimuthal.origin([0, 0]);
-};
-// Derived from Tom Carden's Albers implementation for Protovis.
-// http://gist.github.com/476238
-// http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html
-
-d3.geo.albers = function() {
- var origin = [-98, 38],
- parallels = [29.5, 45.5],
- scale = 1000,
- translate = [480, 250],
- lng0, // d3_geo_radians * origin[0]
- n,
- C,
- p0;
-
- function albers(coordinates) {
- var t = n * (d3_geo_radians * coordinates[0] - lng0),
- p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n;
- return [
- scale * p * Math.sin(t) + translate[0],
- scale * (p * Math.cos(t) - p0) + translate[1]
- ];
- }
-
- albers.invert = function(coordinates) {
- var x = (coordinates[0] - translate[0]) / scale,
- y = (coordinates[1] - translate[1]) / scale,
- p0y = p0 + y,
- t = Math.atan2(x, p0y),
- p = Math.sqrt(x * x + p0y * p0y);
- return [
- (lng0 + t / n) / d3_geo_radians,
- Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians
- ];
- };
-
- function reload() {
- var phi1 = d3_geo_radians * parallels[0],
- phi2 = d3_geo_radians * parallels[1],
- lat0 = d3_geo_radians * origin[1],
- s = Math.sin(phi1),
- c = Math.cos(phi1);
- lng0 = d3_geo_radians * origin[0];
- n = .5 * (s + Math.sin(phi2));
- C = c * c + 2 * n * s;
- p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;
- return albers;
- }
-
- albers.origin = function(x) {
- if (!arguments.length) return origin;
- origin = [+x[0], +x[1]];
- return reload();
- };
-
- albers.parallels = function(x) {
- if (!arguments.length) return parallels;
- parallels = [+x[0], +x[1]];
- return reload();
- };
-
- albers.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return albers;
- };
-
- albers.translate = function(x) {
- if (!arguments.length) return translate;
- translate = [+x[0], +x[1]];
- return albers;
- };
-
- return reload();
-};
-
-// A composite projection for the United States, 960x500. The set of standard
-// parallels for each region comes from USGS, which is published here:
-// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
-// TODO allow the composite projection to be rescaled?
-d3.geo.albersUsa = function() {
- var lower48 = d3.geo.albers();
-
- var alaska = d3.geo.albers()
- .origin([-160, 60])
- .parallels([55, 65]);
-
- var hawaii = d3.geo.albers()
- .origin([-160, 20])
- .parallels([8, 18]);
-
- var puertoRico = d3.geo.albers()
- .origin([-60, 10])
- .parallels([8, 18]);
-
- function albersUsa(coordinates) {
- var lon = coordinates[0],
- lat = coordinates[1];
- return (lat > 50 ? alaska
- : lon < -140 ? hawaii
- : lat < 21 ? puertoRico
- : lower48)(coordinates);
- }
-
- albersUsa.scale = function(x) {
- if (!arguments.length) return lower48.scale();
- lower48.scale(x);
- alaska.scale(x * .6);
- hawaii.scale(x);
- puertoRico.scale(x * 1.5);
- return albersUsa.translate(lower48.translate());
- };
-
- albersUsa.translate = function(x) {
- if (!arguments.length) return lower48.translate();
- var dz = lower48.scale() / 1000,
- dx = x[0],
- dy = x[1];
- lower48.translate(x);
- alaska.translate([dx - 400 * dz, dy + 170 * dz]);
- hawaii.translate([dx - 190 * dz, dy + 200 * dz]);
- puertoRico.translate([dx + 580 * dz, dy + 430 * dz]);
- return albersUsa;
- };
-
- return albersUsa.scale(lower48.scale());
-};
-d3.geo.bonne = function() {
- var scale = 200,
- translate = [480, 250],
- x0, // origin longitude in radians
- y0, // origin latitude in radians
- y1, // parallel latitude in radians
- c1; // cot(y1)
-
- function bonne(coordinates) {
- var x = coordinates[0] * d3_geo_radians - x0,
- y = coordinates[1] * d3_geo_radians - y0;
- if (y1) {
- var p = c1 + y1 - y, E = x * Math.cos(y) / p;
- x = p * Math.sin(E);
- y = p * Math.cos(E) - c1;
- } else {
- x *= Math.cos(y);
- y *= -1;
- }
- return [
- scale * x + translate[0],
- scale * y + translate[1]
- ];
- }
-
- bonne.invert = function(coordinates) {
- var x = (coordinates[0] - translate[0]) / scale,
- y = (coordinates[1] - translate[1]) / scale;
- if (y1) {
- var c = c1 + y, p = Math.sqrt(x * x + c * c);
- y = c1 + y1 - p;
- x = x0 + p * Math.atan2(x, c) / Math.cos(y);
- } else {
- y *= -1;
- x /= Math.cos(y);
- }
- return [
- x / d3_geo_radians,
- y / d3_geo_radians
- ];
- };
-
- // 90° for Werner, 0° for Sinusoidal
- bonne.parallel = function(x) {
- if (!arguments.length) return y1 / d3_geo_radians;
- c1 = 1 / Math.tan(y1 = x * d3_geo_radians);
- return bonne;
- };
-
- bonne.origin = function(x) {
- if (!arguments.length) return [x0 / d3_geo_radians, y0 / d3_geo_radians];
- x0 = x[0] * d3_geo_radians;
- y0 = x[1] * d3_geo_radians;
- return bonne;
- };
-
- bonne.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return bonne;
- };
-
- bonne.translate = function(x) {
- if (!arguments.length) return translate;
- translate = [+x[0], +x[1]];
- return bonne;
- };
-
- return bonne.origin([0, 0]).parallel(45);
-};
-d3.geo.equirectangular = function() {
- var scale = 500,
- translate = [480, 250];
-
- function equirectangular(coordinates) {
- var x = coordinates[0] / 360,
- y = -coordinates[1] / 360;
- return [
- scale * x + translate[0],
- scale * y + translate[1]
- ];
- }
-
- equirectangular.invert = function(coordinates) {
- var x = (coordinates[0] - translate[0]) / scale,
- y = (coordinates[1] - translate[1]) / scale;
- return [
- 360 * x,
- -360 * y
- ];
- };
-
- equirectangular.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return equirectangular;
- };
-
- equirectangular.translate = function(x) {
- if (!arguments.length) return translate;
- translate = [+x[0], +x[1]];
- return equirectangular;
- };
-
- return equirectangular;
-};
-d3.geo.mercator = function() {
- var scale = 500,
- translate = [480, 250];
-
- function mercator(coordinates) {
- var x = coordinates[0] / 360,
- y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360;
- return [
- scale * x + translate[0],
- scale * Math.max(-.5, Math.min(.5, y)) + translate[1]
- ];
- }
-
- mercator.invert = function(coordinates) {
- var x = (coordinates[0] - translate[0]) / scale,
- y = (coordinates[1] - translate[1]) / scale;
- return [
- 360 * x,
- 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90
- ];
- };
-
- mercator.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- return mercator;
- };
-
- mercator.translate = function(x) {
- if (!arguments.length) return translate;
- translate = [+x[0], +x[1]];
- return mercator;
- };
-
- return mercator;
-};
-function d3_geo_type(types, defaultValue) {
- return function(object) {
- return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue;
- };
-}
-/**
- * Returns a function that, given a GeoJSON object (e.g., a feature), returns
- * the corresponding SVG path. The function can be customized by overriding the
- * projection. Point features are mapped to circles with a default radius of
- * 4.5px; the radius can be specified either as a constant or a function that
- * is evaluated per object.
- */
-d3.geo.path = function() {
- var pointRadius = 4.5,
- pointCircle = d3_path_circle(pointRadius),
- projection = d3.geo.albersUsa();
-
- function path(d, i) {
- if (typeof pointRadius === "function") {
- pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
- }
- return pathType(d) || null;
- }
-
- function project(coordinates) {
- return projection(coordinates).join(",");
- }
-
- var pathType = d3_geo_type({
-
- FeatureCollection: function(o) {
- var path = [],
- features = o.features,
- i = -1, // features.index
- n = features.length;
- while (++i < n) path.push(pathType(features[i].geometry));
- return path.join("");
- },
-
- Feature: function(o) {
- return pathType(o.geometry);
- },
-
- Point: function(o) {
- return "M" + project(o.coordinates) + pointCircle;
- },
-
- MultiPoint: function(o) {
- var path = [],
- coordinates = o.coordinates,
- i = -1, // coordinates.index
- n = coordinates.length;
- while (++i < n) path.push("M", project(coordinates[i]), pointCircle);
- return path.join("");
- },
-
- LineString: function(o) {
- var path = ["M"],
- coordinates = o.coordinates,
- i = -1, // coordinates.index
- n = coordinates.length;
- while (++i < n) path.push(project(coordinates[i]), "L");
- path.pop();
- return path.join("");
- },
-
- MultiLineString: function(o) {
- var path = [],
- coordinates = o.coordinates,
- i = -1, // coordinates.index
- n = coordinates.length,
- subcoordinates, // coordinates[i]
- j, // subcoordinates.index
- m; // subcoordinates.length
- while (++i < n) {
- subcoordinates = coordinates[i];
- j = -1;
- m = subcoordinates.length;
- path.push("M");
- while (++j < m) path.push(project(subcoordinates[j]), "L");
- path.pop();
- }
- return path.join("");
- },
-
- Polygon: function(o) {
- var path = [],
- coordinates = o.coordinates,
- i = -1, // coordinates.index
- n = coordinates.length,
- subcoordinates, // coordinates[i]
- j, // subcoordinates.index
- m; // subcoordinates.length
- while (++i < n) {
- subcoordinates = coordinates[i];
- j = -1;
- if ((m = subcoordinates.length - 1) > 0) {
- path.push("M");
- while (++j < m) path.push(project(subcoordinates[j]), "L");
- path[path.length - 1] = "Z";
- }
- }
- return path.join("");
- },
-
- MultiPolygon: function(o) {
- var path = [],
- coordinates = o.coordinates,
- i = -1, // coordinates index
- n = coordinates.length,
- subcoordinates, // coordinates[i]
- j, // subcoordinates index
- m, // subcoordinates.length
- subsubcoordinates, // subcoordinates[j]
- k, // subsubcoordinates index
- p; // subsubcoordinates.length
- while (++i < n) {
- subcoordinates = coordinates[i];
- j = -1;
- m = subcoordinates.length;
- while (++j < m) {
- subsubcoordinates = subcoordinates[j];
- k = -1;
- if ((p = subsubcoordinates.length - 1) > 0) {
- path.push("M");
- while (++k < p) path.push(project(subsubcoordinates[k]), "L");
- path[path.length - 1] = "Z";
- }
- }
- }
- return path.join("");
- },
-
- GeometryCollection: function(o) {
- var path = [],
- geometries = o.geometries,
- i = -1, // geometries index
- n = geometries.length;
- while (++i < n) path.push(pathType(geometries[i]));
- return path.join("");
- }
-
- });
-
- var areaType = path.area = d3_geo_type({
-
- FeatureCollection: function(o) {
- var area = 0,
- features = o.features,
- i = -1, // features.index
- n = features.length;
- while (++i < n) area += areaType(features[i]);
- return area;
- },
-
- Feature: function(o) {
- return areaType(o.geometry);
- },
-
- Polygon: function(o) {
- return polygonArea(o.coordinates);
- },
-
- MultiPolygon: function(o) {
- var sum = 0,
- coordinates = o.coordinates,
- i = -1, // coordinates index
- n = coordinates.length;
- while (++i < n) sum += polygonArea(coordinates[i]);
- return sum;
- },
-
- GeometryCollection: function(o) {
- var sum = 0,
- geometries = o.geometries,
- i = -1, // geometries index
- n = geometries.length;
- while (++i < n) sum += areaType(geometries[i]);
- return sum;
- }
-
- }, 0);
-
- function polygonArea(coordinates) {
- var sum = area(coordinates[0]), // exterior ring
- i = 0, // coordinates.index
- n = coordinates.length;
- while (++i < n) sum -= area(coordinates[i]); // holes
- return sum;
- }
-
- function polygonCentroid(coordinates) {
- var polygon = d3.geom.polygon(coordinates[0].map(projection)), // exterior ring
- area = polygon.area(),
- centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1),
- x = centroid[0],
- y = centroid[1],
- z = area,
- i = 0, // coordinates index
- n = coordinates.length;
- while (++i < n) {
- polygon = d3.geom.polygon(coordinates[i].map(projection)); // holes
- area = polygon.area();
- centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1);
- x -= centroid[0];
- y -= centroid[1];
- z -= area;
- }
- return [x, y, 6 * z]; // weighted centroid
- }
-
- var centroidType = path.centroid = d3_geo_type({
-
- // TODO FeatureCollection
- // TODO Point
- // TODO MultiPoint
- // TODO LineString
- // TODO MultiLineString
- // TODO GeometryCollection
-
- Feature: function(o) {
- return centroidType(o.geometry);
- },
-
- Polygon: function(o) {
- var centroid = polygonCentroid(o.coordinates);
- return [centroid[0] / centroid[2], centroid[1] / centroid[2]];
- },
-
- MultiPolygon: function(o) {
- var area = 0,
- coordinates = o.coordinates,
- centroid,
- x = 0,
- y = 0,
- z = 0,
- i = -1, // coordinates index
- n = coordinates.length;
- while (++i < n) {
- centroid = polygonCentroid(coordinates[i]);
- x += centroid[0];
- y += centroid[1];
- z += centroid[2];
- }
- return [x / z, y / z];
- }
-
- });
-
- function area(coordinates) {
- return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
- }
-
- path.projection = function(x) {
- projection = x;
- return path;
- };
-
- path.pointRadius = function(x) {
- if (typeof x === "function") pointRadius = x;
- else {
- pointRadius = +x;
- pointCircle = d3_path_circle(pointRadius);
- }
- return path;
- };
-
- return path;
-};
-
-function d3_path_circle(radius) {
- return "m0," + radius
- + "a" + radius + "," + radius + " 0 1,1 0," + (-2 * radius)
- + "a" + radius + "," + radius + " 0 1,1 0," + (+2 * radius)
- + "z";
-}
-/**
- * Given a GeoJSON object, returns the corresponding bounding box. The bounding
- * box is represented by a two-dimensional array: [[left, bottom], [right,
- * top]], where left is the minimum longitude, bottom is the minimum latitude,
- * right is maximum longitude, and top is the maximum latitude.
- */
-d3.geo.bounds = function(feature) {
- var left = Infinity,
- bottom = Infinity,
- right = -Infinity,
- top = -Infinity;
- d3_geo_bounds(feature, function(x, y) {
- if (x < left) left = x;
- if (x > right) right = x;
- if (y < bottom) bottom = y;
- if (y > top) top = y;
- });
- return [[left, bottom], [right, top]];
-};
-
-function d3_geo_bounds(o, f) {
- if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f);
-}
-
-var d3_geo_boundsTypes = {
- Feature: d3_geo_boundsFeature,
- FeatureCollection: d3_geo_boundsFeatureCollection,
- GeometryCollection: d3_geo_boundsGeometryCollection,
- LineString: d3_geo_boundsLineString,
- MultiLineString: d3_geo_boundsMultiLineString,
- MultiPoint: d3_geo_boundsLineString,
- MultiPolygon: d3_geo_boundsMultiPolygon,
- Point: d3_geo_boundsPoint,
- Polygon: d3_geo_boundsPolygon
-};
-
-function d3_geo_boundsFeature(o, f) {
- d3_geo_bounds(o.geometry, f);
-}
-
-function d3_geo_boundsFeatureCollection(o, f) {
- for (var a = o.features, i = 0, n = a.length; i < n; i++) {
- d3_geo_bounds(a[i].geometry, f);
- }
-}
-
-function d3_geo_boundsGeometryCollection(o, f) {
- for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {
- d3_geo_bounds(a[i], f);
- }
-}
-
-function d3_geo_boundsLineString(o, f) {
- for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
- f.apply(null, a[i]);
- }
-}
-
-function d3_geo_boundsMultiLineString(o, f) {
- for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
- for (var b = a[i], j = 0, m = b.length; j < m; j++) {
- f.apply(null, b[j]);
- }
- }
-}
-
-function d3_geo_boundsMultiPolygon(o, f) {
- for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
- for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {
- f.apply(null, b[j]);
- }
- }
-}
-
-function d3_geo_boundsPoint(o, f) {
- f.apply(null, o.coordinates);
-}
-
-function d3_geo_boundsPolygon(o, f) {
- for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {
- f.apply(null, a[i]);
- }
-}
-// TODO breakAtDateLine?
-
-d3.geo.circle = function() {
- var origin = [0, 0],
- degrees = 90 - 1e-2,
- radians = degrees * d3_geo_radians,
- arc = d3.geo.greatArc().target(Object);
-
- function circle() {
- // TODO render a circle as a Polygon
- }
-
- function visible(point) {
- return arc.distance(point) < radians;
- }
-
- circle.clip = function(d) {
- arc.source(typeof origin === "function" ? origin.apply(this, arguments) : origin);
- return clipType(d);
- };
-
- var clipType = d3_geo_type({
-
- FeatureCollection: function(o) {
- var features = o.features.map(clipType).filter(Object);
- return features && (o = Object.create(o), o.features = features, o);
- },
-
- Feature: function(o) {
- var geometry = clipType(o.geometry);
- return geometry && (o = Object.create(o), o.geometry = geometry, o);
- },
-
- Point: function(o) {
- return visible(o.coordinates) && o;
- },
-
- MultiPoint: function(o) {
- var coordinates = o.coordinates.filter(visible);
- return coordinates.length && {
- type: o.type,
- coordinates: coordinates
- };
- },
-
- LineString: function(o) {
- var coordinates = clip(o.coordinates);
- return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
- },
-
- MultiLineString: function(o) {
- var coordinates = o.coordinates.map(clip).filter(function(d) { return d.length; });
- return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
- },
-
- Polygon: function(o) {
- var coordinates = o.coordinates.map(clip);
- return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o);
- },
-
- MultiPolygon: function(o) {
- var coordinates = o.coordinates.map(function(d) { return d.map(clip); }).filter(function(d) { return d[0].length; });
- return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
- },
-
- GeometryCollection: function(o) {
- var geometries = o.geometries.map(clipType).filter(Object);
- return geometries.length && (o = Object.create(o), o.geometries = geometries, o);
- }
-
- });
-
- function clip(coordinates) {
- var i = -1,
- n = coordinates.length,
- clipped = [],
- p0,
- p1,
- p2,
- d0,
- d1;
-
- while (++i < n) {
- d1 = arc.distance(p2 = coordinates[i]);
- if (d1 < radians) {
- if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
- clipped.push(p2);
- p0 = p1 = null;
- } else {
- p1 = p2;
- if (!p0 && clipped.length) {
- clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0)));
- p0 = p1;
- }
- }
- d0 = d1;
- }
-
- if (p1 && clipped.length) {
- d1 = arc.distance(p2 = clipped[0]);
- clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
- }
-
- return resample(clipped);
- }
-
- // Resample coordinates, creating great arcs between each.
- function resample(coordinates) {
- var i = 0,
- n = coordinates.length,
- j,
- m,
- resampled = n ? [coordinates[0]] : coordinates,
- resamples,
- origin = arc.source();
-
- while (++i < n) {
- resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;
- for (j = 0, m = resamples.length; ++j < m;) resampled.push(resamples[j]);
- }
-
- arc.source(origin);
- return resampled;
- }
-
- circle.origin = function(x) {
- if (!arguments.length) return origin;
- origin = x;
- return circle;
- };
-
- circle.angle = function(x) {
- if (!arguments.length) return degrees;
- radians = (degrees = +x) * d3_geo_radians;
- return circle;
- };
-
- // Precision is specified in degrees.
- circle.precision = function(x) {
- if (!arguments.length) return arc.precision();
- arc.precision(x);
- return circle;
- };
-
- return circle;
-}
-d3.geo.greatArc = function() {
- var source = d3_geo_greatArcSource,
- target = d3_geo_greatArcTarget,
- precision = 6 * d3_geo_radians;
-
- function greatArc() {
- var a = typeof source === "function" ? source.apply(this, arguments) : source,
- b = typeof target === "function" ? target.apply(this, arguments) : target,
- i = d3_geo_greatArcInterpolate(a, b),
- dt = precision / i.d,
- t = 0,
- coordinates = [a];
- while ((t += dt) < 1) coordinates.push(i(t));
- coordinates.push(b);
- return {
- type: "LineString",
- coordinates: coordinates
- };
- }
-
- // Length returned in radians; multiply by radius for distance.
- greatArc.distance = function() {
- var a = typeof source === "function" ? source.apply(this, arguments) : source,
- b = typeof target === "function" ? target.apply(this, arguments) : target;
- return d3_geo_greatArcInterpolate(a, b).d;
- };
-
- greatArc.source = function(x) {
- if (!arguments.length) return source;
- source = x;
- return greatArc;
- };
-
- greatArc.target = function(x) {
- if (!arguments.length) return target;
- target = x;
- return greatArc;
- };
-
- // Precision is specified in degrees.
- greatArc.precision = function(x) {
- if (!arguments.length) return precision / d3_geo_radians;
- precision = x * d3_geo_radians;
- return greatArc;
- };
-
- return greatArc;
-};
-
-function d3_geo_greatArcSource(d) {
- return d.source;
-}
-
-function d3_geo_greatArcTarget(d) {
- return d.target;
-}
-
-function d3_geo_greatArcInterpolate(a, b) {
- var x0 = a[0] * d3_geo_radians, cx0 = Math.cos(x0), sx0 = Math.sin(x0),
- y0 = a[1] * d3_geo_radians, cy0 = Math.cos(y0), sy0 = Math.sin(y0),
- x1 = b[0] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1),
- y1 = b[1] * d3_geo_radians, cy1 = Math.cos(y1), sy1 = Math.sin(y1),
- d = interpolate.d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))),
- sd = Math.sin(d);
-
- // From http://williams.best.vwh.net/avform.htm#Intermediate
- function interpolate(t) {
- var A = Math.sin(d - (t *= d)) / sd,
- B = Math.sin(t) / sd,
- x = A * cy0 * cx0 + B * cy1 * cx1,
- y = A * cy0 * sx0 + B * cy1 * sx1,
- z = A * sy0 + B * sy1;
- return [
- Math.atan2(y, x) / d3_geo_radians,
- Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians
- ];
- }
-
- return interpolate;
-}
-d3.geo.greatCircle = d3.geo.circle;
-d3.geom = {};
-/**
- * Computes a contour for a given input grid function using the <a
- * href="http://en.wikipedia.org/wiki/Marching_squares">marching
- * squares</a> algorithm. Returns the contour polygon as an array of points.
- *
- * @param grid a two-input function(x, y) that returns true for values
- * inside the contour and false for values outside the contour.
- * @param start an optional starting point [x, y] on the grid.
- * @returns polygon [[x1, y1], [x2, y2], ā¦]
- */
-d3.geom.contour = function(grid, start) {
- var s = start || d3_geom_contourStart(grid), // starting point
- c = [], // contour polygon
- x = s[0], // current x position
- y = s[1], // current y position
- dx = 0, // next x direction
- dy = 0, // next y direction
- pdx = NaN, // previous x direction
- pdy = NaN, // previous y direction
- i = 0;
-
- do {
- // determine marching squares index
- i = 0;
- if (grid(x-1, y-1)) i += 1;
- if (grid(x, y-1)) i += 2;
- if (grid(x-1, y )) i += 4;
- if (grid(x, y )) i += 8;
-
- // determine next direction
- if (i === 6) {
- dx = pdy === -1 ? -1 : 1;
- dy = 0;
- } else if (i === 9) {
- dx = 0;
- dy = pdx === 1 ? -1 : 1;
- } else {
- dx = d3_geom_contourDx[i];
- dy = d3_geom_contourDy[i];
- }
-
- // update contour polygon
- if (dx != pdx && dy != pdy) {
- c.push([x, y]);
- pdx = dx;
- pdy = dy;
- }
-
- x += dx;
- y += dy;
- } while (s[0] != x || s[1] != y);
-
- return c;
-};
-
-// lookup tables for marching directions
-var d3_geom_contourDx = [1, 0, 1, 1,-1, 0,-1, 1,0, 0,0,0,-1, 0,-1,NaN],
- d3_geom_contourDy = [0,-1, 0, 0, 0,-1, 0, 0,1,-1,1,1, 0,-1, 0,NaN];
-
-function d3_geom_contourStart(grid) {
- var x = 0,
- y = 0;
-
- // search for a starting point; begin at origin
- // and proceed along outward-expanding diagonals
- while (true) {
- if (grid(x,y)) {
- return [x,y];
- }
- if (x === 0) {
- x = y + 1;
- y = 0;
- } else {
- x = x - 1;
- y = y + 1;
- }
- }
-}
-/**
- * Computes the 2D convex hull of a set of points using Graham's scanning
- * algorithm. The algorithm has been implemented as described in Cormen,
- * Leiserson, and Rivest's Introduction to Algorithms. The running time of
- * this algorithm is O(n log n), where n is the number of input points.
- *
- * @param vertices [[x1, y1], [x2, y2], ā¦]
- * @returns polygon [[x1, y1], [x2, y2], ā¦]
- */
-d3.geom.hull = function(vertices) {
- if (vertices.length < 3) return [];
-
- var len = vertices.length,
- plen = len - 1,
- points = [],
- stack = [],
- i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
-
- // find the starting ref point: leftmost point with the minimum y coord
- for (i=1; i<len; ++i) {
- if (vertices[i][1] < vertices[h][1]) {
- h = i;
- } else if (vertices[i][1] == vertices[h][1]) {
- h = (vertices[i][0] < vertices[h][0] ? i : h);
- }
- }
-
- // calculate polar angles from ref point and sort
- for (i=0; i<len; ++i) {
- if (i === h) continue;
- y1 = vertices[i][1] - vertices[h][1];
- x1 = vertices[i][0] - vertices[h][0];
- points.push({angle: Math.atan2(y1, x1), index: i});
- }
- points.sort(function(a, b) { return a.angle - b.angle; });
-
- // toss out duplicate angles
- a = points[0].angle;
- v = points[0].index;
- u = 0;
- for (i=1; i<plen; ++i) {
- j = points[i].index;
- if (a == points[i].angle) {
- // keep angle for point most distant from the reference
- x1 = vertices[v][0] - vertices[h][0];
- y1 = vertices[v][1] - vertices[h][1];
- x2 = vertices[j][0] - vertices[h][0];
- y2 = vertices[j][1] - vertices[h][1];
- if ((x1*x1 + y1*y1) >= (x2*x2 + y2*y2)) {
- points[i].index = -1;
- } else {
- points[u].index = -1;
- a = points[i].angle;
- u = i;
- v = j;
- }
- } else {
- a = points[i].angle;
- u = i;
- v = j;
- }
- }
-
- // initialize the stack
- stack.push(h);
- for (i=0, j=0; i<2; ++j) {
- if (points[j].index !== -1) {
- stack.push(points[j].index);
- i++;
- }
- }
- sp = stack.length;
-
- // do graham's scan
- for (; j<plen; ++j) {
- if (points[j].index === -1) continue; // skip tossed out points
- while (!d3_geom_hullCCW(stack[sp-2], stack[sp-1], points[j].index, vertices)) {
- --sp;
- }
- stack[sp++] = points[j].index;
- }
-
- // construct the hull
- var poly = [];
- for (i=0; i<sp; ++i) {
- poly.push(vertices[stack[i]]);
- }
- return poly;
-}
-
-// are three points in counter-clockwise order?
-function d3_geom_hullCCW(i1, i2, i3, v) {
- var t, a, b, c, d, e, f;
- t = v[i1]; a = t[0]; b = t[1];
- t = v[i2]; c = t[0]; d = t[1];
- t = v[i3]; e = t[0]; f = t[1];
- return ((f-b)*(c-a) - (d-b)*(e-a)) > 0;
-}
-// Note: requires coordinates to be counterclockwise and convex!
-d3.geom.polygon = function(coordinates) {
-
- coordinates.area = function() {
- var i = 0,
- n = coordinates.length,
- a = coordinates[n - 1][0] * coordinates[0][1],
- b = coordinates[n - 1][1] * coordinates[0][0];
- while (++i < n) {
- a += coordinates[i - 1][0] * coordinates[i][1];
- b += coordinates[i - 1][1] * coordinates[i][0];
- }
- return (b - a) * .5;
- };
-
- coordinates.centroid = function(k) {
- var i = -1,
- n = coordinates.length,
- x = 0,
- y = 0,
- a,
- b = coordinates[n - 1],
- c;
- if (!arguments.length) k = -1 / (6 * coordinates.area());
- while (++i < n) {
- a = b;
- b = coordinates[i];
- c = a[0] * b[1] - b[0] * a[1];
- x += (a[0] + b[0]) * c;
- y += (a[1] + b[1]) * c;
- }
- return [x * k, y * k];
- };
-
- // The Sutherland-Hodgman clipping algorithm.
- coordinates.clip = function(subject) {
- var input,
- i = -1,
- n = coordinates.length,
- j,
- m,
- a = coordinates[n - 1],
- b,
- c,
- d;
- while (++i < n) {
- input = subject.slice();
- subject.length = 0;
- b = coordinates[i];
- c = input[(m = input.length) - 1];
- j = -1;
- while (++j < m) {
- d = input[j];
- if (d3_geom_polygonInside(d, a, b)) {
- if (!d3_geom_polygonInside(c, a, b)) {
- subject.push(d3_geom_polygonIntersect(c, d, a, b));
- }
- subject.push(d);
- } else if (d3_geom_polygonInside(c, a, b)) {
- subject.push(d3_geom_polygonIntersect(c, d, a, b));
- }
- c = d;
- }
- a = b;
- }
- return subject;
- };
-
- return coordinates;
-};
-
-function d3_geom_polygonInside(p, a, b) {
- return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
-}
-
-// Intersect two infinite lines cd and ab.
-function d3_geom_polygonIntersect(c, d, a, b) {
- var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0],
- y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1],
- x13 = x1 - x3,
- x21 = x2 - x1,
- x43 = x4 - x3,
- y13 = y1 - y3,
- y21 = y2 - y1,
- y43 = y4 - y3,
- ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
- return [x1 + ua * x21, y1 + ua * y21];
-}
-// Adapted from Nicolas Garcia Belmonte's JIT implementation:
-// http://blog.thejit.org/2010/02/12/voronoi-tessellation/
-// http://blog.thejit.org/assets/voronoijs/voronoi.js
-// See lib/jit/LICENSE for details.
-
-// Notes:
-//
-// This implementation does not clip the returned polygons, so if you want to
-// clip them to a particular shape you will need to do that either in SVG or by
-// post-processing with d3.geom.polygon's clip method.
-//
-// If any vertices are coincident or have NaN positions, the behavior of this
-// method is undefined. Most likely invalid polygons will be returned. You
-// should filter invalid points, and consolidate coincident points, before
-// computing the tessellation.
-
-/**
- * @param vertices [[x1, y1], [x2, y2], ā¦]
- * @returns polygons [[[x1, y1], [x2, y2], ā¦], ā¦]
- */
-d3.geom.voronoi = function(vertices) {
- var polygons = vertices.map(function() { return []; });
-
- d3_voronoi_tessellate(vertices, function(e) {
- var s1,
- s2,
- x1,
- x2,
- y1,
- y2;
- if (e.a === 1 && e.b >= 0) {
- s1 = e.ep.r;
- s2 = e.ep.l;
- } else {
- s1 = e.ep.l;
- s2 = e.ep.r;
- }
- if (e.a === 1) {
- y1 = s1 ? s1.y : -1e6;
- x1 = e.c - e.b * y1;
- y2 = s2 ? s2.y : 1e6;
- x2 = e.c - e.b * y2;
- } else {
- x1 = s1 ? s1.x : -1e6;
- y1 = e.c - e.a * x1;
- x2 = s2 ? s2.x : 1e6;
- y2 = e.c - e.a * x2;
- }
- var v1 = [x1, y1],
- v2 = [x2, y2];
- polygons[e.region.l.index].push(v1, v2);
- polygons[e.region.r.index].push(v1, v2);
- });
-
- // Reconnect the polygon segments into counterclockwise loops.
- return polygons.map(function(polygon, i) {
- var cx = vertices[i][0],
- cy = vertices[i][1];
- polygon.forEach(function(v) {
- v.angle = Math.atan2(v[0] - cx, v[1] - cy);
- });
- return polygon.sort(function(a, b) {
- return a.angle - b.angle;
- }).filter(function(d, i) {
- return !i || (d.angle - polygon[i - 1].angle > 1e-10);
- });
- });
-};
-
-var d3_voronoi_opposite = {"l": "r", "r": "l"};
-
-function d3_voronoi_tessellate(vertices, callback) {
-
- var Sites = {
- list: vertices
- .map(function(v, i) {
- return {
- index: i,
- x: v[0],
- y: v[1]
- };
- })
- .sort(function(a, b) {
- return a.y < b.y ? -1
- : a.y > b.y ? 1
- : a.x < b.x ? -1
- : a.x > b.x ? 1
- : 0;
- }),
- bottomSite: null
- };
-
- var EdgeList = {
- list: [],
- leftEnd: null,
- rightEnd: null,
-
- init: function() {
- EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
- EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
- EdgeList.leftEnd.r = EdgeList.rightEnd;
- EdgeList.rightEnd.l = EdgeList.leftEnd;
- EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
- },
-
- createHalfEdge: function(edge, side) {
- return {
- edge: edge,
- side: side,
- vertex: null,
- "l": null,
- "r": null
- };
- },
-
- insert: function(lb, he) {
- he.l = lb;
- he.r = lb.r;
- lb.r.l = he;
- lb.r = he;
- },
-
- leftBound: function(p) {
- var he = EdgeList.leftEnd;
- do {
- he = he.r;
- } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
- he = he.l;
- return he;
- },
-
- del: function(he) {
- he.l.r = he.r;
- he.r.l = he.l;
- he.edge = null;
- },
-
- right: function(he) {
- return he.r;
- },
-
- left: function(he) {
- return he.l;
- },
-
- leftRegion: function(he) {
- return he.edge == null
- ? Sites.bottomSite
- : he.edge.region[he.side];
- },
-
- rightRegion: function(he) {
- return he.edge == null
- ? Sites.bottomSite
- : he.edge.region[d3_voronoi_opposite[he.side]];
- }
- };
-
- var Geom = {
-
- bisect: function(s1, s2) {
- var newEdge = {
- region: {"l": s1, "r": s2},
- ep: {"l": null, "r": null}
- };
-
- var dx = s2.x - s1.x,
- dy = s2.y - s1.y,
- adx = dx > 0 ? dx : -dx,
- ady = dy > 0 ? dy : -dy;
-
- newEdge.c = s1.x * dx + s1.y * dy
- + (dx * dx + dy * dy) * .5;
-
- if (adx > ady) {
- newEdge.a = 1;
- newEdge.b = dy / dx;
- newEdge.c /= dx;
- } else {
- newEdge.b = 1;
- newEdge.a = dx / dy;
- newEdge.c /= dy;
- }
-
- return newEdge;
- },
-
- intersect: function(el1, el2) {
- var e1 = el1.edge,
- e2 = el2.edge;
- if (!e1 || !e2 || (e1.region.r == e2.region.r)) {
- return null;
- }
- var d = (e1.a * e2.b) - (e1.b * e2.a);
- if (Math.abs(d) < 1e-10) {
- return null;
- }
- var xint = (e1.c * e2.b - e2.c * e1.b) / d,
- yint = (e2.c * e1.a - e1.c * e2.a) / d,
- e1r = e1.region.r,
- e2r = e2.region.r,
- el,
- e;
- if ((e1r.y < e2r.y) ||
- (e1r.y == e2r.y && e1r.x < e2r.x)) {
- el = el1;
- e = e1;
- } else {
- el = el2;
- e = e2;
- }
- var rightOfSite = (xint >= e.region.r.x);
- if ((rightOfSite && (el.side === "l")) ||
- (!rightOfSite && (el.side === "r"))) {
- return null;
- }
- return {
- x: xint,
- y: yint
- };
- },
-
- rightOf: function(he, p) {
- var e = he.edge,
- topsite = e.region.r,
- rightOfSite = (p.x > topsite.x);
-
- if (rightOfSite && (he.side === "l")) {
- return 1;
- }
- if (!rightOfSite && (he.side === "r")) {
- return 0;
- }
- if (e.a === 1) {
- var dyp = p.y - topsite.y,
- dxp = p.x - topsite.x,
- fast = 0,
- above = 0;
-
- if ((!rightOfSite && (e.b < 0)) ||
- (rightOfSite && (e.b >= 0))) {
- above = fast = (dyp >= e.b * dxp);
- } else {
- above = ((p.x + p.y * e.b) > e.c);
- if (e.b < 0) {
- above = !above;
- }
- if (!above) {
- fast = 1;
- }
- }
- if (!fast) {
- var dxs = topsite.x - e.region.l.x;
- above = (e.b * (dxp * dxp - dyp * dyp)) <
- (dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b));
-
- if (e.b < 0) {
- above = !above;
- }
- }
- } else /* e.b == 1 */ {
- var yl = e.c - e.a * p.x,
- t1 = p.y - yl,
- t2 = p.x - topsite.x,
- t3 = yl - topsite.y;
-
- above = (t1 * t1) > (t2 * t2 + t3 * t3);
- }
- return he.side === "l" ? above : !above;
- },
-
- endPoint: function(edge, side, site) {
- edge.ep[side] = site;
- if (!edge.ep[d3_voronoi_opposite[side]]) return;
- callback(edge);
- },
-
- distance: function(s, t) {
- var dx = s.x - t.x,
- dy = s.y - t.y;
- return Math.sqrt(dx * dx + dy * dy);
- }
- };
-
- var EventQueue = {
- list: [],
-
- insert: function(he, site, offset) {
- he.vertex = site;
- he.ystar = site.y + offset;
- for (var i=0, list=EventQueue.list, l=list.length; i<l; i++) {
- var next = list[i];
- if (he.ystar > next.ystar ||
- (he.ystar == next.ystar &&
- site.x > next.vertex.x)) {
- continue;
- } else {
- break;
- }
- }
- list.splice(i, 0, he);
- },
-
- del: function(he) {
- for (var i=0, ls=EventQueue.list, l=ls.length; i<l && (ls[i] != he); ++i) {}
- ls.splice(i, 1);
- },
-
- empty: function() { return EventQueue.list.length === 0; },
-
- nextEvent: function(he) {
- for (var i=0, ls=EventQueue.list, l=ls.length; i<l; ++i) {
- if (ls[i] == he) return ls[i+1];
- }
- return null;
- },
-
- min: function() {
- var elem = EventQueue.list[0];
- return {
- x: elem.vertex.x,
- y: elem.ystar
- };
- },
-
- extractMin: function() {
- return EventQueue.list.shift();
- }
- };
-
- EdgeList.init();
- Sites.bottomSite = Sites.list.shift();
-
- var newSite = Sites.list.shift(), newIntStar;
- var lbnd, rbnd, llbnd, rrbnd, bisector;
- var bot, top, temp, p, v;
- var e, pm;
-
- while (true) {
- if (!EventQueue.empty()) {
- newIntStar = EventQueue.min();
- }
- if (newSite && (EventQueue.empty()
- || newSite.y < newIntStar.y
- || (newSite.y == newIntStar.y
- && newSite.x < newIntStar.x))) { //new site is smallest
- lbnd = EdgeList.leftBound(newSite);
- rbnd = EdgeList.right(lbnd);
- bot = EdgeList.rightRegion(lbnd);
- e = Geom.bisect(bot, newSite);
- bisector = EdgeList.createHalfEdge(e, "l");
- EdgeList.insert(lbnd, bisector);
- p = Geom.intersect(lbnd, bisector);
- if (p) {
- EventQueue.del(lbnd);
- EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
- }
- lbnd = bisector;
- bisector = EdgeList.createHalfEdge(e, "r");
- EdgeList.insert(lbnd, bisector);
- p = Geom.intersect(bisector, rbnd);
- if (p) {
- EventQueue.insert(bisector, p, Geom.distance(p, newSite));
- }
- newSite = Sites.list.shift();
- } else if (!EventQueue.empty()) { //intersection is smallest
- lbnd = EventQueue.extractMin();
- llbnd = EdgeList.left(lbnd);
- rbnd = EdgeList.right(lbnd);
- rrbnd = EdgeList.right(rbnd);
- bot = EdgeList.leftRegion(lbnd);
- top = EdgeList.rightRegion(rbnd);
- v = lbnd.vertex;
- Geom.endPoint(lbnd.edge, lbnd.side, v);
- Geom.endPoint(rbnd.edge, rbnd.side, v);
- EdgeList.del(lbnd);
- EventQueue.del(rbnd);
- EdgeList.del(rbnd);
- pm = "l";
- if (bot.y > top.y) {
- temp = bot;
- bot = top;
- top = temp;
- pm = "r";
- }
- e = Geom.bisect(bot, top);
- bisector = EdgeList.createHalfEdge(e, pm);
- EdgeList.insert(llbnd, bisector);
- Geom.endPoint(e, d3_voronoi_opposite[pm], v);
- p = Geom.intersect(llbnd, bisector);
- if (p) {
- EventQueue.del(llbnd);
- EventQueue.insert(llbnd, p, Geom.distance(p, bot));
- }
- p = Geom.intersect(bisector, rrbnd);
- if (p) {
- EventQueue.insert(bisector, p, Geom.distance(p, bot));
- }
- } else {
- break;
- }
- }//end while
-
- for (lbnd = EdgeList.right(EdgeList.leftEnd);
- lbnd != EdgeList.rightEnd;
- lbnd = EdgeList.right(lbnd)) {
- callback(lbnd.edge);
- }
-}
-/**
-* @param vertices [[x1, y1], [x2, y2], ā¦]
-* @returns triangles [[[x1, y1], [x2, y2], [x3, y3]], ā¦]
- */
-d3.geom.delaunay = function(vertices) {
- var edges = vertices.map(function() { return []; }),
- triangles = [];
-
- // Use the Voronoi tessellation to determine Delaunay edges.
- d3_voronoi_tessellate(vertices, function(e) {
- edges[e.region.l.index].push(vertices[e.region.r.index]);
- });
-
- // Reconnect the edges into counterclockwise triangles.
- edges.forEach(function(edge, i) {
- var v = vertices[i],
- cx = v[0],
- cy = v[1];
- edge.forEach(function(v) {
- v.angle = Math.atan2(v[0] - cx, v[1] - cy);
- });
- edge.sort(function(a, b) {
- return a.angle - b.angle;
- });
- for (var j = 0, m = edge.length - 1; j < m; j++) {
- triangles.push([v, edge[j], edge[j + 1]]);
- }
- });
-
- return triangles;
-};
-// Constructs a new quadtree for the specified array of points. A quadtree is a
-// two-dimensional recursive spatial subdivision. This implementation uses
-// square partitions, dividing each square into four equally-sized squares. Each
-// point exists in a unique node; if multiple points are in the same position,
-// some points may be stored on internal nodes rather than leaf nodes. Quadtrees
-// can be used to accelerate various spatial operations, such as the Barnes-Hut
-// approximation for computing n-body forces, or collision detection.
-d3.geom.quadtree = function(points, x1, y1, x2, y2) {
- var p,
- i = -1,
- n = points.length;
-
- // Type conversion for deprecated API.
- if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);
-
- // Allow bounds to be specified explicitly.
- if (arguments.length < 5) {
- if (arguments.length === 3) {
- y2 = x2 = y1;
- y1 = x1;
- } else {
- x1 = y1 = Infinity;
- x2 = y2 = -Infinity;
-
- // Compute bounds.
- while (++i < n) {
- p = points[i];
- if (p.x < x1) x1 = p.x;
- if (p.y < y1) y1 = p.y;
- if (p.x > x2) x2 = p.x;
- if (p.y > y2) y2 = p.y;
- }
-
- // Squarify the bounds.
- var dx = x2 - x1,
- dy = y2 - y1;
- if (dx > dy) y2 = y1 + dx;
- else x2 = x1 + dy;
- }
- }
-
- // Recursively inserts the specified point p at the node n or one of its
- // descendants. The bounds are defined by [x1, x2] and [y1, y2].
- function insert(n, p, x1, y1, x2, y2) {
- if (isNaN(p.x) || isNaN(p.y)) return; // ignore invalid points
- if (n.leaf) {
- var v = n.point;
- if (v) {
- // If the point at this leaf node is at the same position as the new
- // point we are adding, we leave the point associated with the
- // internal node while adding the new point to a child node. This
- // avoids infinite recursion.
- if ((Math.abs(v.x - p.x) + Math.abs(v.y - p.y)) < .01) {
- insertChild(n, p, x1, y1, x2, y2);
- } else {
- n.point = null;
- insertChild(n, v, x1, y1, x2, y2);
- insertChild(n, p, x1, y1, x2, y2);
- }
- } else {
- n.point = p;
- }
- } else {
- insertChild(n, p, x1, y1, x2, y2);
- }
- }
-
- // Recursively inserts the specified point p into a descendant of node n. The
- // bounds are defined by [x1, x2] and [y1, y2].
- function insertChild(n, p, x1, y1, x2, y2) {
- // Compute the split point, and the quadrant in which to insert p.
- var sx = (x1 + x2) * .5,
- sy = (y1 + y2) * .5,
- right = p.x >= sx,
- bottom = p.y >= sy,
- i = (bottom << 1) + right;
-
- // Recursively insert into the child node.
- n.leaf = false;
- n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
-
- // Update the bounds as we recurse.
- if (right) x1 = sx; else x2 = sx;
- if (bottom) y1 = sy; else y2 = sy;
- insert(n, p, x1, y1, x2, y2);
- }
-
- // Create the root node.
- var root = d3_geom_quadtreeNode();
-
- root.add = function(p) {
- insert(root, p, x1, y1, x2, y2);
- };
-
- root.visit = function(f) {
- d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
- };
-
- // Insert all points.
- points.forEach(root.add);
- return root;
-};
-
-function d3_geom_quadtreeNode() {
- return {
- leaf: true,
- nodes: [],
- point: null
- };
-}
-
-function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
- if (!f(node, x1, y1, x2, y2)) {
- var sx = (x1 + x2) * .5,
- sy = (y1 + y2) * .5,
- children = node.nodes;
- if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
- if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
- if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
- if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
- }
-}
-
-function d3_geom_quadtreePoint(p) {
- return {
- x: p[0],
- y: p[1]
- };
-}
-d3.time = {};
-
-var d3_time = Date;
-
-function d3_time_utc() {
- this._ = new Date(arguments.length > 1
- ? Date.UTC.apply(this, arguments)
- : arguments[0]);
-}
-
-d3_time_utc.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() { d3_time_prototype.setUTCDate.apply(this._, arguments); },
- setDay: function() { d3_time_prototype.setUTCDay.apply(this._, arguments); },
- setFullYear: function() { d3_time_prototype.setUTCFullYear.apply(this._, arguments); },
- setHours: function() { d3_time_prototype.setUTCHours.apply(this._, arguments); },
- setMilliseconds: function() { d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); },
- setMinutes: function() { d3_time_prototype.setUTCMinutes.apply(this._, arguments); },
- setMonth: function() { d3_time_prototype.setUTCMonth.apply(this._, arguments); },
- setSeconds: function() { d3_time_prototype.setUTCSeconds.apply(this._, arguments); },
- setTime: function() { d3_time_prototype.setTime.apply(this._, arguments); }
-};
-
-var d3_time_prototype = Date.prototype;
-d3.time.format = function(template) {
- var n = template.length;
-
- function format(date) {
- var string = [],
- i = -1,
- j = 0,
- c,
- f;
- while (++i < n) {
- if (template.charCodeAt(i) == 37) {
- string.push(
- template.substring(j, i),
- (f = d3_time_formats[c = template.charAt(++i)])
- ? f(date) : c);
- j = i + 1;
- }
- }
- string.push(template.substring(j, i));
- return string.join("");
- }
-
- format.parse = function(string) {
- var d = {y: 1900, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0},
- i = d3_time_parse(d, template, string, 0);
- if (i != string.length) return null;
-
- // The am-pm flag is 0 for AM, and 1 for PM.
- if ("p" in d) d.H = d.H % 12 + d.p * 12;
-
- var date = new d3_time();
- date.setFullYear(d.y, d.m, d.d);
- date.setHours(d.H, d.M, d.S, d.L);
- return date;
- };
-
- format.toString = function() {
- return template;
- };
-
- return format;
-};
-
-function d3_time_parse(date, template, string, j) {
- var c,
- p,
- i = 0,
- n = template.length,
- m = string.length;
- while (i < n) {
- if (j >= m) return -1;
- c = template.charCodeAt(i++);
- if (c == 37) {
- p = d3_time_parsers[template.charAt(i++)];
- if (!p || ((j = p(date, string, j)) < 0)) return -1;
- } else if (c != string.charCodeAt(j++)) {
- return -1;
- }
- }
- return j;
-}
-
-var d3_time_zfill2 = d3.format("02d"),
- d3_time_zfill3 = d3.format("03d"),
- d3_time_zfill4 = d3.format("04d"),
- d3_time_sfill2 = d3.format("2d");
-
-var d3_time_formats = {
- a: function(d) { return d3_time_weekdays[d.getDay()].substring(0, 3); },
- A: function(d) { return d3_time_weekdays[d.getDay()]; },
- b: function(d) { return d3_time_months[d.getMonth()].substring(0, 3); },
- B: function(d) { return d3_time_months[d.getMonth()]; },
- c: d3.time.format("%a %b %e %H:%M:%S %Y"),
- d: function(d) { return d3_time_zfill2(d.getDate()); },
- e: function(d) { return d3_time_sfill2(d.getDate()); },
- H: function(d) { return d3_time_zfill2(d.getHours()); },
- I: function(d) { return d3_time_zfill2(d.getHours() % 12 || 12); },
- j: function(d) { return d3_time_zfill3(1 + d3.time.dayOfYear(d)); },
- L: function(d) { return d3_time_zfill3(d.getMilliseconds()); },
- m: function(d) { return d3_time_zfill2(d.getMonth() + 1); },
- M: function(d) { return d3_time_zfill2(d.getMinutes()); },
- p: function(d) { return d.getHours() >= 12 ? "PM" : "AM"; },
- S: function(d) { return d3_time_zfill2(d.getSeconds()); },
- U: function(d) { return d3_time_zfill2(d3.time.sundayOfYear(d)); },
- w: function(d) { return d.getDay(); },
- W: function(d) { return d3_time_zfill2(d3.time.mondayOfYear(d)); },
- x: d3.time.format("%m/%d/%y"),
- X: d3.time.format("%H:%M:%S"),
- y: function(d) { return d3_time_zfill2(d.getFullYear() % 100); },
- Y: function(d) { return d3_time_zfill4(d.getFullYear() % 10000); },
- Z: d3_time_zone,
- "%": function(d) { return "%"; }
-};
-
-var d3_time_parsers = {
- a: d3_time_parseWeekdayAbbrev,
- A: d3_time_parseWeekday,
- b: d3_time_parseMonthAbbrev,
- B: d3_time_parseMonth,
- c: d3_time_parseLocaleFull,
- d: d3_time_parseDay,
- e: d3_time_parseDay,
- H: d3_time_parseHour24,
- I: d3_time_parseHour24,
- // j: function(d, s, i) { /*TODO day of year [001,366] */ return i; },
- L: d3_time_parseMilliseconds,
- m: d3_time_parseMonthNumber,
- M: d3_time_parseMinutes,
- p: d3_time_parseAmPm,
- S: d3_time_parseSeconds,
- // U: function(d, s, i) { /*TODO week number (sunday) [00,53] */ return i; },
- // w: function(d, s, i) { /*TODO weekday [0,6] */ return i; },
- // W: function(d, s, i) { /*TODO week number (monday) [00,53] */ return i; },
- x: d3_time_parseLocaleDate,
- X: d3_time_parseLocaleTime,
- y: d3_time_parseYear,
- Y: d3_time_parseFullYear
- // ,
- // Z: function(d, s, i) { /*TODO time zone */ return i; },
- // "%": function(d, s, i) { /*TODO literal % */ return i; }
-};
-
-// Note: weekday is validated, but does not set the date.
-function d3_time_parseWeekdayAbbrev(date, string, i) {
- return d3_time_weekdayAbbrevRe.test(string.substring(i, i += 3)) ? i : -1;
-}
-
-// Note: weekday is validated, but does not set the date.
-function d3_time_parseWeekday(date, string, i) {
- d3_time_weekdayRe.lastIndex = 0;
- var n = d3_time_weekdayRe.exec(string.substring(i, i + 10));
- return n ? i += n[0].length : -1;
-}
-
-var d3_time_weekdayAbbrevRe = /^(?:sun|mon|tue|wed|thu|fri|sat)/i,
- d3_time_weekdayRe = /^(?:Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)/i;
- d3_time_weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
-
-function d3_time_parseMonthAbbrev(date, string, i) {
- var n = d3_time_monthAbbrevLookup.get(string.substring(i, i += 3).toLowerCase());
- return n == null ? -1 : (date.m = n, i);
-}
-
-var d3_time_monthAbbrevLookup = 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 d3_time_parseMonth(date, string, i) {
- d3_time_monthRe.lastIndex = 0;
- var n = d3_time_monthRe.exec(string.substring(i, i + 12));
- return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
-}
-
-var d3_time_monthRe = /^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;
-
-var d3_time_monthLookup = 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 d3_time_months = [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
-];
-
-function d3_time_parseLocaleFull(date, string, i) {
- return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
-}
-
-function d3_time_parseLocaleDate(date, string, i) {
- return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
-}
-
-function d3_time_parseLocaleTime(date, string, i) {
- return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
-}
-
-function d3_time_parseFullYear(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 4));
- return n ? (date.y = +n[0], i += n[0].length) : -1;
-}
-
-function d3_time_parseYear(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.y = d3_time_century() + +n[0], i += n[0].length) : -1;
-}
-
-function d3_time_century() {
- return ~~(new Date().getFullYear() / 1000) * 1000;
-}
-
-function d3_time_parseMonthNumber(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
-}
-
-function d3_time_parseDay(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.d = +n[0], i += n[0].length) : -1;
-}
-
-// Note: we don't validate that the hour is in the range [0,23] or [1,12].
-function d3_time_parseHour24(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.H = +n[0], i += n[0].length) : -1;
-}
-
-function d3_time_parseMinutes(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.M = +n[0], i += n[0].length) : -1;
-}
-
-function d3_time_parseSeconds(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.S = +n[0], i += n[0].length) : -1;
-}
-
-function d3_time_parseMilliseconds(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 3));
- return n ? (date.L = +n[0], i += n[0].length) : -1;
-}
-
-// Note: we don't look at the next directive.
-var d3_time_numberRe = /\s*\d+/;
-
-function d3_time_parseAmPm(date, string, i) {
- var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
- return n == null ? -1 : (date.p = n, i);
-}
-
-var d3_time_amPmLookup = d3.map({
- am: 0,
- pm: 1
-});
-
-// TODO table of time zone offset names?
-function d3_time_zone(d) {
- var z = d.getTimezoneOffset(),
- zs = z > 0 ? "-" : "+",
- zh = ~~(Math.abs(z) / 60),
- zm = Math.abs(z) % 60;
- return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);
-}
-d3.time.format.utc = function(template) {
- var local = d3.time.format(template);
-
- function format(date) {
- try {
- d3_time = d3_time_utc;
- var utc = new d3_time();
- utc._ = date;
- return local(utc);
- } finally {
- d3_time = Date;
- }
- }
-
- format.parse = function(string) {
- try {
- d3_time = d3_time_utc;
- var date = local.parse(string);
- return date && date._;
- } finally {
- d3_time = Date;
- }
- };
-
- format.toString = local.toString;
-
- return format;
-};
-var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
-
-d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
-
-function d3_time_formatIsoNative(date) {
- return date.toISOString();
-}
-
-d3_time_formatIsoNative.parse = function(string) {
- return new Date(string);
-};
-
-d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
-function d3_time_interval(local, step, number) {
-
- function round(date) {
- var d0 = local(date), d1 = offset(d0, 1);
- return date - d0 < d1 - date ? d0 : d1;
- }
-
- function ceil(date) {
- step(date = local(new d3_time(date - 1)), 1);
- return date;
- }
-
- function offset(date, k) {
- step(date = new d3_time(+date), k);
- return date;
- }
-
- function range(t0, t1, dt) {
- var time = ceil(t0), times = [];
- if (dt > 1) {
- while (time < t1) {
- if (!(number(time) % dt)) times.push(new Date(+time));
- step(time, 1);
- }
- } else {
- while (time < t1) times.push(new Date(+time)), step(time, 1);
- }
- return times;
- }
-
- function range_utc(t0, t1, dt) {
- try {
- d3_time = d3_time_utc;
- var utc = new d3_time_utc();
- utc._ = t0;
- return range(utc, t1, dt);
- } finally {
- d3_time = Date;
- }
- }
-
- local.floor = local;
- local.round = round;
- local.ceil = ceil;
- local.offset = offset;
- local.range = range;
-
- var utc = local.utc = d3_time_interval_utc(local);
- utc.floor = utc;
- utc.round = d3_time_interval_utc(round);
- utc.ceil = d3_time_interval_utc(ceil);
- utc.offset = d3_time_interval_utc(offset);
- utc.range = range_utc;
-
- return local;
-}
-
-function d3_time_interval_utc(method) {
- return function(date, k) {
- try {
- d3_time = d3_time_utc;
- var utc = new d3_time_utc();
- utc._ = date;
- return method(utc, k)._;
- } finally {
- d3_time = Date;
- }
- };
-}
-d3.time.second = d3_time_interval(function(date) {
- return new d3_time(Math.floor(date / 1e3) * 1e3);
-}, function(date, offset) {
- date.setTime(date.getTime() + Math.floor(offset) * 1e3); // DST breaks setSeconds
-}, function(date) {
- return date.getSeconds();
-});
-
-d3.time.seconds = d3.time.second.range;
-d3.time.seconds.utc = d3.time.second.utc.range;
-d3.time.minute = d3_time_interval(function(date) {
- return new d3_time(Math.floor(date / 6e4) * 6e4);
-}, function(date, offset) {
- date.setTime(date.getTime() + Math.floor(offset) * 6e4); // DST breaks setMinutes
-}, function(date) {
- return date.getMinutes();
-});
-
-d3.time.minutes = d3.time.minute.range;
-d3.time.minutes.utc = d3.time.minute.utc.range;
-d3.time.hour = d3_time_interval(function(date) {
- var timezone = date.getTimezoneOffset() / 60;
- return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
-}, function(date, offset) {
- date.setTime(date.getTime() + Math.floor(offset) * 36e5); // DST breaks setHours
-}, function(date) {
- return date.getHours();
-});
-
-d3.time.hours = d3.time.hour.range;
-d3.time.hours.utc = d3.time.hour.utc.range;
-d3.time.day = d3_time_interval(function(date) {
- return new d3_time(date.getFullYear(), date.getMonth(), date.getDate());
-}, function(date, offset) {
- date.setDate(date.getDate() + offset);
-}, function(date) {
- return date.getDate() - 1;
-});
-
-d3.time.days = d3.time.day.range;
-d3.time.days.utc = d3.time.day.utc.range;
-
-d3.time.dayOfYear = function(date) {
- var year = d3.time.year(date);
- return Math.floor((date - year) / 864e5 - (date.getTimezoneOffset() - year.getTimezoneOffset()) / 1440);
-};
-d3_time_weekdays.forEach(function(day, i) {
- day = day.toLowerCase();
- i = 7 - i;
-
- var interval = d3.time[day] = d3_time_interval(function(date) {
- (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
- return date;
- }, function(date, offset) {
- date.setDate(date.getDate() + Math.floor(offset) * 7);
- }, function(date) {
- var day = d3.time.year(date).getDay();
- return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
- });
-
- d3.time[day + "s"] = interval.range;
- d3.time[day + "s"].utc = interval.utc.range;
-
- d3.time[day + "OfYear"] = function(date) {
- var day = d3.time.year(date).getDay();
- return Math.floor((d3.time.dayOfYear(date) + (day + i) % 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 = d3_time_interval(function(date) {
- return new d3_time(date.getFullYear(), date.getMonth(), 1);
-}, function(date, offset) {
- date.setMonth(date.getMonth() + offset);
-}, function(date) {
- return date.getMonth();
-});
-
-d3.time.months = d3.time.month.range;
-d3.time.months.utc = d3.time.month.utc.range;
-d3.time.year = d3_time_interval(function(date) {
- return new d3_time(date.getFullYear(), 0, 1);
-}, function(date, offset) {
- date.setFullYear(date.getFullYear() + offset);
-}, function(date) {
- return date.getFullYear();
-});
-
-d3.time.years = d3.time.year.range;
-d3.time.years.utc = d3.time.year.utc.range;
-function d3_time_scale(linear, methods, format) {
-
- function scale(x) {
- return linear(x);
- }
-
- scale.invert = function(x) {
- return d3_time_scaleDate(linear.invert(x));
- };
-
- scale.domain = function(x) {
- if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
- linear.domain(x);
- return scale;
- };
-
- scale.nice = function(m) {
- var extent = d3_time_scaleExtent(scale.domain());
- return scale.domain([m.floor(extent[0]), m.ceil(extent[1])]);
- };
-
- scale.ticks = function(m, k) {
- var extent = d3_time_scaleExtent(scale.domain());
- if (typeof m !== "function") {
- var span = extent[1] - extent[0],
- target = span / m,
- i = d3.bisect(d3_time_scaleSteps, target);
- if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
- if (!i) return linear.ticks(m).map(d3_time_scaleDate);
- if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
- m = methods[i];
- k = m[1];
- m = m[0].range;
- }
- return m(extent[0], new Date(+extent[1] + 1), k); // inclusive upper bound
- };
-
- scale.tickFormat = function() {
- return format;
- };
-
- scale.copy = function() {
- return d3_time_scale(linear.copy(), methods, format);
- };
-
- // TOOD expose d3_scale_linear_rebind?
- return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
-}
-
-// TODO expose d3_scaleExtent?
-function d3_time_scaleExtent(domain) {
- var start = domain[0], stop = domain[domain.length - 1];
- return start < stop ? [start, stop] : [stop, start];
-}
-
-function d3_time_scaleDate(t) {
- return new Date(t);
-}
-
-function d3_time_scaleFormat(formats) {
- return function(date) {
- var i = formats.length - 1, f = formats[i];
- while (!f[1](date)) f = formats[--i];
- return f[0](date);
- };
-}
-
-function d3_time_scaleSetYear(y) {
- var d = new Date(y, 0, 1);
- d.setFullYear(y); // Y2K fail
- return d;
-}
-
-function d3_time_scaleGetYear(d) {
- var y = d.getFullYear(),
- d0 = d3_time_scaleSetYear(y),
- d1 = d3_time_scaleSetYear(y + 1);
- return y + (d - d0) / (d1 - d0);
-}
-
-var d3_time_scaleSteps = [
- 1e3, // 1-second
- 5e3, // 5-second
- 15e3, // 15-second
- 3e4, // 30-second
- 6e4, // 1-minute
- 3e5, // 5-minute
- 9e5, // 15-minute
- 18e5, // 30-minute
- 36e5, // 1-hour
- 108e5, // 3-hour
- 216e5, // 6-hour
- 432e5, // 12-hour
- 864e5, // 1-day
- 1728e5, // 2-day
- 6048e5, // 1-week
- 2592e6, // 1-month
- 7776e6, // 3-month
- 31536e6 // 1-year
-];
-
-var d3_time_scaleLocalMethods = [
- [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 d3_time_scaleLocalFormats = [
- [d3.time.format("%Y"), function(d) { return true; }],
- [d3.time.format("%B"), function(d) { return d.getMonth(); }],
- [d3.time.format("%b %d"), function(d) { return d.getDate() != 1; }],
- [d3.time.format("%a %d"), function(d) { return d.getDay() && d.getDate() != 1; }],
- [d3.time.format("%I %p"), function(d) { return d.getHours(); }],
- [d3.time.format("%I:%M"), function(d) { return d.getMinutes(); }],
- [d3.time.format(":%S"), function(d) { return d.getSeconds(); }],
- [d3.time.format(".%L"), function(d) { return d.getMilliseconds(); }]
-];
-
-var d3_time_scaleLinear = d3.scale.linear(),
- d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
-
-d3_time_scaleLocalMethods.year = function(extent, m) {
- return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
-};
-
-d3.time.scale = function() {
- return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
-};
-var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
- return [m[0].utc, m[1]];
-});
-
-var d3_time_scaleUTCFormats = [
- [d3.time.format.utc("%Y"), function(d) { return true; }],
- [d3.time.format.utc("%B"), function(d) { return d.getUTCMonth(); }],
- [d3.time.format.utc("%b %d"), function(d) { return d.getUTCDate() != 1; }],
- [d3.time.format.utc("%a %d"), function(d) { return d.getUTCDay() && d.getUTCDate() != 1; }],
- [d3.time.format.utc("%I %p"), function(d) { return d.getUTCHours(); }],
- [d3.time.format.utc("%I:%M"), function(d) { return d.getUTCMinutes(); }],
- [d3.time.format.utc(":%S"), function(d) { return d.getUTCSeconds(); }],
- [d3.time.format.utc(".%L"), function(d) { return d.getUTCMilliseconds(); }]
-];
-
-var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
-
-function d3_time_scaleUTCSetYear(y) {
- var d = new Date(Date.UTC(y, 0, 1));
- d.setUTCFullYear(y); // Y2K fail
- return d;
-}
-
-function d3_time_scaleUTCGetYear(d) {
- var y = d.getUTCFullYear(),
- d0 = d3_time_scaleUTCSetYear(y),
- d1 = d3_time_scaleUTCSetYear(y + 1);
- return y + (d - d0) / (d1 - d0);
-}
-
-d3_time_scaleUTCMethods.year = function(extent, m) {
- return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
-};
-
-d3.time.scale.utc = function() {
- return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
-};
-})();
--- a/integ/js/vs/lib/highlight.v0.min.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-
-Copyright 2006, Ivan Sagalaev.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice, this
- list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
-
-* Neither the name of highlight.js nor the names of its contributors may be used
- to endorse or promote products derived from this software without specific
- prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-var hljs=new function(){function m(p){return p.replace(/&/gm,"&").replace(/</gm,"<")}function c(r,q,p){return RegExp(q,"m"+(r.cI?"i":"")+(p?"g":""))}function j(r){for(var p=0;p<r.childNodes.length;p++){var q=r.childNodes[p];if(q.nodeName=="CODE"){return q}if(!(q.nodeType==3&&q.nodeValue.match(/\s+/))){break}}}function g(t,s){var r="";for(var q=0;q<t.childNodes.length;q++){if(t.childNodes[q].nodeType==3){var p=t.childNodes[q].nodeValue;if(s){p=p.replace(/\n/g,"")}r+=p}else{if(t.childNodes[q].nodeName=="BR"){r+="\n"}else{r+=g(t.childNodes[q])}}}if(/MSIE [678]/.test(navigator.userAgent)){r=r.replace(/\r/g,"\n")}return r}function a(s){var q=s.className.split(/\s+/);q=q.concat(s.parentNode.className.split(/\s+/));for(var p=0;p<q.length;p++){var r=q[p].replace(/^language-/,"");if(d[r]||r=="no-highlight"){return r}}}function b(p){var q=[];(function(s,t){for(var r=0;r<s.childNodes.length;r++){if(s.childNodes[r].nodeType==3){t+=s.childNodes[r].nodeValue.length}else{if(s.childNodes[r].nodeName=="BR"){t+=1}else{q.push({event:"start",offset:t,node:s.childNodes[r]});t=arguments.callee(s.childNodes[r],t);q.push({event:"stop",offset:t,node:s.childNodes[r]})}}}return t})(p,0);return q}function l(y,z,x){var r=0;var w="";var t=[];function u(){if(y.length&&z.length){if(y[0].offset!=z[0].offset){return(y[0].offset<z[0].offset)?y:z}else{return z[0].event=="start"?y:z}}else{return y.length?y:z}}function s(C){var D="<"+C.nodeName.toLowerCase();for(var A=0;A<C.attributes.length;A++){var B=C.attributes[A];D+=" "+B.nodeName.toLowerCase();if(B.nodeValue!=undefined&&B.nodeValue!=false&&B.nodeValue!=null){D+='="'+m(B.nodeValue)+'"'}}return D+">"}while(y.length||z.length){var v=u().splice(0,1)[0];w+=m(x.substr(r,v.offset-r));r=v.offset;if(v.event=="start"){w+=s(v.node);t.push(v.node)}else{if(v.event=="stop"){var q=t.length;do{q--;var p=t[q];w+=("</"+p.nodeName.toLowerCase()+">")}while(p!=v.node);t.splice(q,1);while(q<t.length){w+=s(t[q]);q++}}}}w+=x.substr(r);return w}function i(){function p(u,t,v){if(u.compiled){return}if(!v){u.bR=c(t,u.b?u.b:"\\B|\\b");if(!u.e&&!u.eW){u.e="\\B|\\b"}if(u.e){u.eR=c(t,u.e)}}if(u.i){u.iR=c(t,u.i)}if(u.r==undefined){u.r=1}if(u.k){u.lR=c(t,u.l||hljs.IR,true)}for(var s in u.k){if(!u.k.hasOwnProperty(s)){continue}if(u.k[s] instanceof Object){u.kG=u.k}else{u.kG={keyword:u.k}}break}if(!u.c){u.c=[]}u.compiled=true;for(var r=0;r<u.c.length;r++){p(u.c[r],t,false)}if(u.starts){p(u.starts,t,false)}}for(var q in d){if(!d.hasOwnProperty(q)){continue}p(d[q].dM,d[q],true)}}function e(J,D){if(!i.called){i();i.called=true}function z(r,M){for(var L=0;L<M.c.length;L++){if(M.c[L].bR.test(r)){return M.c[L]}}}function w(L,r){if(C[L].e&&C[L].eR.test(r)){return 1}if(C[L].eW){var M=w(L-1,r);return M?M+1:0}return 0}function x(r,L){return L.iR&&L.iR.test(r)}function A(O,N){var M=[];for(var L=0;L<O.c.length;L++){M.push(O.c[L].b)}var r=C.length-1;do{if(C[r].e){M.push(C[r].e)}r--}while(C[r+1].eW);if(O.i){M.push(O.i)}return c(N,"("+M.join("|")+")",true)}function s(M,L){var N=C[C.length-1];if(!N.t){N.t=A(N,H)}N.t.lastIndex=L;var r=N.t.exec(M);if(r){return[M.substr(L,r.index-L),r[0],false]}else{return[M.substr(L),"",true]}}function p(O,r){var L=H.cI?r[0].toLowerCase():r[0];for(var N in O.kG){if(!O.kG.hasOwnProperty(N)){continue}var M=O.kG[N].hasOwnProperty(L);if(M){return[N,M]}}return false}function F(M,O){if(!O.k){return m(M)}var N="";var P=0;O.lR.lastIndex=0;var L=O.lR.exec(M);while(L){N+=m(M.substr(P,L.index-P));var r=p(O,L);if(r){t+=r[1];N+='<span class="'+r[0]+'">'+m(L[0])+"</span>"}else{N+=m(L[0])}P=O.lR.lastIndex;L=O.lR.exec(M)}N+=m(M.substr(P,M.length-P));return N}function K(r,M){if(M.sL&&d[M.sL]){var L=e(M.sL,r);t+=L.keyword_count;return L.value}else{return F(r,M)}}function I(M,r){var L=M.cN?'<span class="'+M.cN+'">':"";if(M.rB){q+=L;M.buffer=""}else{if(M.eB){q+=m(r)+L;M.buffer=""}else{q+=L;M.buffer=r}}C.push(M);B+=M.r}function E(O,L,Q){var R=C[C.length-1];if(Q){q+=K(R.buffer+O,R);return false}var M=z(L,R);if(M){q+=K(R.buffer+O,R);I(M,L);return M.rB}var r=w(C.length-1,L);if(r){var N=R.cN?"</span>":"";if(R.rE){q+=K(R.buffer+O,R)+N}else{if(R.eE){q+=K(R.buffer+O,R)+N+m(L)}else{q+=K(R.buffer+O+L,R)+N}}while(r>1){N=C[C.length-2].cN?"</span>":"";q+=N;r--;C.length--}var P=C[C.length-1];C.length--;C[C.length-1].buffer="";if(P.starts){I(P.starts,"")}return R.rE}if(x(L,R)){throw"Illegal"}}var H=d[J];var C=[H.dM];var B=0;var t=0;var q="";try{var v=0;H.dM.buffer="";do{var y=s(D,v);var u=E(y[0],y[1],y[2]);v+=y[0].length;if(!u){v+=y[1].length}}while(!y[2]);if(C.length>1){throw"Illegal"}return{r:B,keyword_count:t,value:q}}catch(G){if(G=="Illegal"){return{r:0,keyword_count:0,value:m(D)}}else{throw G}}}function f(t){var r={keyword_count:0,r:0,value:m(t)};var q=r;for(var p in d){if(!d.hasOwnProperty(p)){continue}var s=e(p,t);s.language=p;if(s.keyword_count+s.r>q.keyword_count+q.r){q=s}if(s.keyword_count+s.r>r.keyword_count+r.r){q=r;r=s}}if(q.language){r.second_best=q}return r}function h(r,q,p){if(q){r=r.replace(/^((<[^>]+>|\t)+)/gm,function(t,w,v,u){return w.replace(/\t/g,q)})}if(p){r=r.replace(/\n/g,"<br>")}return r}function o(u,x,q){var y=g(u,q);var s=a(u);if(s=="no-highlight"){return}if(s){var w=e(s,y)}else{var w=f(y);s=w.language}var p=b(u);if(p.length){var r=document.createElement("pre");r.innerHTML=w.value;w.value=l(p,b(r),y)}w.value=h(w.value,x,q);var t=u.className;if(!t.match("(\\s|^)(language-)?"+s+"(\\s|$)")){t=t?(t+" "+s):s}if(/MSIE [678]/.test(navigator.userAgent)&&u.tagName=="CODE"&&u.parentNode.tagName=="PRE"){var r=u.parentNode;var v=document.createElement("div");v.innerHTML="<pre><code>"+w.value+"</code></pre>";u=v.firstChild.firstChild;v.firstChild.cN=r.cN;r.parentNode.replaceChild(v.firstChild,r)}else{u.innerHTML=w.value}u.className=t;u.result={language:s,kw:w.keyword_count,re:w.r};if(w.second_best){u.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function k(){if(k.called){return}k.called=true;var r=document.getElementsByTagName("pre");for(var p=0;p<r.length;p++){var q=j(r[p]);if(q){o(q,hljs.tabReplace)}}}function n(){if(window.addEventListener){window.addEventListener("DOMContentLoaded",k,false);window.addEventListener("load",k,false)}else{if(window.attachEvent){window.attachEvent("onload",k)}else{window.onload=k}}}var d={};this.LANGUAGES=d;this.highlight=e;this.highlightAuto=f;this.fixMarkup=h;this.highlightBlock=o;this.initHighlighting=k;this.initHighlightingOnLoad=n;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR=this.CNR="\\b[-+]?(?:\\d+\\.?\\d*|\\d*\\.?\\d+)(?:[eE][-+]?\\d+)?";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.inherit=function(p,s){var r={};for(var q in p){r[q]=p[q]}if(s){for(var q in s){r[q]=s[q]}}return r}}();hljs.LANGUAGES.javascript={dM:{k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}},c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM,hljs.CNM,{b:"("+hljs.RSR+"|case|return|throw)\\s*",k:{"return":1,"throw":1,"case":1},c:[hljs.CLCM,hljs.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",c:[{b:"\\\\/"}]}],r:0},{cN:"function",b:"\\bfunction\\b",e:"{",k:{"function":1},c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM]}]}]}};hljs.LANGUAGES.css=function(){var a={cN:"function",b:hljs.IR+"\\(",e:"\\)",c:[{eW:true,eE:true,c:[hljs.NM,hljs.ASM,hljs.QSM]}]};return{cI:true,dM:{i:"[=/|']",c:[hljs.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:{"font-face":1,page:1}},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:{"import":1,page:1,media:1,charset:1},c:[a,hljs.ASM,hljs.QSM,hljs.NM]},{cN:"tag",b:hljs.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[hljs.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[a,hljs.NM,hljs.QSM,hljs.ASM,hljs.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}();hljs.LANGUAGES.xml=function(){var b="[A-Za-z0-9\\._:-]+";var a={eW:true,c:[{cN:"attribute",b:b,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style",e:">",k:{title:{style:1}},c:[a],starts:{cN:"css",e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script",e:">",k:{title:{script:1}},c:[a],starts:{cN:"javascript",e:"<\/script>",rE:true,sL:"javascript"}},{cN:"vbscript",b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},a]}]}}}();
-d3.selectAll("code:not([class])").classed("javascript", 1);
-d3.selectAll("code").each(function() { hljs.highlightBlock(this); });
--- a/integ/js/vs/lib/jQuery/jquery-1.4.2.min.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
- * jQuery JavaScript Library v1.4.2
- * http://jquery.com/
- *
- * Copyright 2010, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2010, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Sat Feb 13 22:33:48 2010 -0500
- */
-(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
-e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
-j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
-"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
-true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
-Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
-(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
-a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
-"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.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(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
-function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
-c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
-L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
-"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.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 A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
-a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
-d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
-a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
-!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},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:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
-true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
-var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
-parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
-false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
-s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
-applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
-else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
-a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
-w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
-cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
-i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
-" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
-this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
-e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
-c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
-a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
-function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
-k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
-C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
-null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
-e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
-f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
-if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.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(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
-d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
-"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
-a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
-isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
-{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
-if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
-e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
-"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
-d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
-!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
-toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
-u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.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(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
-if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
-e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
-t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
-g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
-for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
-1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.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(g){return g.getAttribute("href")}},
-relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
-l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
-h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
-CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
-g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
-text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
-setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
-h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
-m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
-"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
-h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
-!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
-h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
-q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
-if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
-(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
-function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
-gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
-c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
-{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
-"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
-d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
-a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
-1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
-a:b+"></"+d+">"},F={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,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
-c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
-wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(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(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(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(b){this.parentNode.insertBefore(b,
-this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
-return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
-""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
-this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
-u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
-1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
-return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
-""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
-c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
-c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
-function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
-Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
-"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
-a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
-a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
-"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
-serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
-function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
-global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.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(a){function b(){e.success&&
-e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
-"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
-false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
-false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
-c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
-d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
-g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
-1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
-"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
-if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
-this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
-"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
-animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
-j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
-this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
-"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
-c.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(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
-this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
-this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
-e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
-c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.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(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
-function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
-this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
-k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
-f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.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>";
-a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
-c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
-d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
-f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
-"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
-e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
--- a/integ/js/vs/min/vs.0.1-min.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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);
\ No newline at end of file
--- a/integ/js/vs/tweets/main.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +0,0 @@
-var myPodium,
- myTweetSource,
- myQueueManager;
-
-var columnCounts,
- onlineTweets = [],
- dumpIsPaused = false;
-
-var MAX_TWEETS_BEFORE_DUMP = 20,
- TWEETS_TO_DUMP_AT_ONCE = 10;
-
-function updateLastTweetList() {
- var _filtered = myTweetSource, //.afterDate(startHour),
- _txtFilter = ""//$("#btv-cp-champ-filtre").val(),
- _reFilter = null;
- if (_txtFilter.length > 1) {
- _filtered = _filtered.search(_txtFilter);
- _reFilter = regexpFromText(_txtFilter);
- for (var _i = 0; _i < onlineTweets.length; _i++) {
- if (onlineTweets[_i].text.search(_reFilter) == -1) {
- $('#'+onlineTweets[_i].id_str).fadeTo(250, 0.1);
- } else {
- $('#'+onlineTweets[_i].id_str).fadeTo(250, 1);
- }
- }
- } else {
- for (var _i = 0; _i < onlineTweets.length; _i++) {
- $('#'+onlineTweets[_i].id_str).fadeTo(250, 1);
- }
- }
- $('#btv-cp-liste-tweets-tout').html(
- _filtered.reverse().slice(0,20).map(function(_t) {
- return '<li onclick="addTweetToSelection(this); return false;"><a title="Ajouter à la sélection" href="#">'
- + '<span class="btv-cp-tweet-date tweet-data-date">'
- + _t.created_at.match(/\d+:\d+:\d+/)[0]
- + '</span> <span class="btv-cp-tweet-from tweet-data-from">'
- + ( _reFilter ? ('@' + _t.from_user).replace(_reFilter, '<span class="btv-cp-highlight">$1</span>') : ('@' + _t.from_user) )
- + '</span> <span class="btv-cp-tweet-from-name tweet-data-from-name">'
- + _t.from_user_name
- + '</span> <span class="btv-cp-tweet-text tweet-data-text">'
- + ( _reFilter ? _t.text.replace(_reFilter, '<span class="btv-cp-highlight">$1</span>') : _t.text )
- + '</span><img class="btv-cp-tweet-image tweet-data-image" src="'
- + _t.profile_image_url
- + '" /><div class="btv-cp-tweet-button btv-cp-tweet-add"></div></a></li>'
- }).join('')
- );
-}
-
-function saveTweetSelection() {
- if (window.localStorage) {
- localStorage.setItem('listetweets', $("#btv-cp-liste-tweets-selection").html());
- }
-}
-
-function addTweetToSelection(_e) {
- $("#btv-cp-liste-tweets-selection").prepend(
- '<li><a title="Afficher sur l\'Ʃcran" href="#" onclick="showTweetOnScreen(this); return false;">'
- + '<span class="btv-cp-tweet-date tweet-data-date">'
- + $(_e).find(".tweet-data-date").text()
- + '</span> <span class="btv-cp-tweet-from tweet-data-from">'
- + $(_e).find(".tweet-data-from").text()
- + '</span> <span class="btv-cp-tweet-from-name tweet-data-from-name">'
- + $(_e).find(".tweet-data-from-name").text()
- + '</span> <span class="btv-cp-tweet-text tweet-data-text">'
- + $(_e).find(".tweet-data-text").text()
- + '</span><img class="btv-cp-tweet-image tweet-data-image" src="'
- + $(_e).find(".tweet-data-image").attr("src")
- + '" /><div class="btv-cp-tweet-button btv-cp-tweet-show"></div></a>'
- + '<a title="Supprimer de cette liste" href="#" onclick="$(this).parent().detach(); saveTweetSelection(); return false;"><div class="btv-cp-tweet-button btv-cp-tweet-remove"></div></a></li>'
- );
- saveTweetSelection();
-}
-
-function showTweetOnScreen(_e) {
- $("#btv-bigtweet").html('<img class="btv-bigtweet-image" src="'
- + $(_e).find(".tweet-data-image").attr("src")
- + '" /><p class="btv-bigtweet-screen-name">'
- + $(_e).find(".tweet-data-from").text()
- + '</p><p class="btv-bigtweet-name">'
- + $(_e).find(".tweet-data-from-name").text()
- +'</p><p class="btv-bigtweet-text">'
- + $(_e).find(".tweet-data-text").text()
- +'</p>').show();
- $(".btv-cp-hide-tweets").show();
-}
-
-function showTooltip(_t, _x, _y) {
- $("#btv-tooltip").html('<img class="btv-tooltip-image tweet-data-image" src="'
- + _t.profile_image_url
- + '" /><p class="btv-tooltip-name"><span class="tweet-data-from">'
- + _t.from_user
- + '</span> (<span class="tweet-data-from-name">'
- + _t.from_user_name
- +'</span>)<span class="btv-tooltip-date tweet-data-date">'
- + _t.created_at.match(/\d+:\d+:\d+/)[0]
- + '</span></p><p class="tweet-data-text">'
- + _t.text
- +'</p><div class="btv-tooltip-arrow"></div>').show().css({
- "left": _x + "px",
- "top": _y + "px",
- })
-}
-
-function hideTooltip() {
- $("#btv-tooltip").hide();
-}
-
-function showControlPanel() {
- $("#btv-cp-container").dequeue().animate({
- "left": 0
- });
-}
-
-function hideControlPanel() {
- $("#btv-cp-container").dequeue().animate({
- "left": "-315px"
- });
-}
-
-function updatePodiumAndLabels(_counts) {
- //myPodium.update(_counts);
- //$("#podium-chiffres").html(_counts.map(function(_c) {
- // return '<li>' + _c + '</li>'
- //}).join(""));
-}
-
-function getPodium() {
- $.getJSON(serverUrl
- + 'podium/'
- + Math.floor(startHour/1000)
- + '/'
- + columnKeywords.map(function(_c) {
- return encodeURIComponent(_c);
- }).join(',')
- + '?callback=?',
- function(_data) {
- var _counts = columnKeywords.map(function(_c) {
- return _data.podium[_c] || 0;
- });
- $("#btv-cp-nb-tweets").html(_data.total);
- updatePodiumAndLabels(_counts);
- });
-}
-
-$(function() {
- columnCounts = columnKeywords.map(function() {
- return 0;
- })
- setInterval(function() {
- var _d = (new Date() - startHour),
- _t = Math.abs(Math.floor(_d/1000)),
- _s = _t % 60,
- _m = Math.floor(_t/60) % 60,
- _h = Math.floor(_t/3600);
- $("#btv-cp-temps").html(
- (_d < 0 ? '-' : '' ) + _h + ':' + (_m < 10 ? '0' : '') + _m + ':' + (_s < 10 ? '0' : '') + _s
- )
- }, 500);
-
-
- if (typeof serverUrl != "undefined") {
- setInterval(getPodium, 2000);
- }
-
- $("#podium-labels").html(columnKeywords.map(function(_w) {
- return '<li>' + _w + '</li>'
- }).join(""));
-
- myTweetSource = new Btv_TweetSource({
- keywords: searchKeywords
- });
- myTweetSource.setOnNewTweets(function() {
- console.log("new tweets")
- updateLastTweetList();
- if (typeof serverUrl == "undefined") {
- var _filtered = this.afterDate(startHour);
- $("#btv-cp-nb-tweets").html(_filtered.count());
- var _counts = [];
- for (var _i = 0; _i < columnKeywords.length; _i++) {
- _counts.push(_filtered.search(columnKeywords[_i]).count());
- }
- updatePodiumAndLabels(_counts);
- }
- });
- myQueueManager = new Btv_TweetQueueManager(myTweetSource, function(_t) {
- var _cat = -1;
- for (var i = 0; i < columnKeywords.length; i++) {
- if (_t.text.search(regexpFromText(columnKeywords[i])) != -1) {
- _cat = i;
- break;
- }
- }
- if (_cat != -1) {
- _t.cat = _cat;
- columnCounts[_cat]++;
- onlineTweets.push(_t);
- //createBallTweetForce(_t);
- if (!dumpIsPaused) {
- for (var _i = 0; _i < columnCounts.length; _i++) {
- if (columnCounts[_cat] > MAX_TWEETS_BEFORE_DUMP) {
- var toDel = onlineTweets.splice(0,TWEETS_TO_DUMP_AT_ONCE);
-
- for (var _j = 0; _j < toDel.length; _j++) {
- var _id = toDel[_j].id_str;
- world.DestroyBody(b2bod[_id]);
-
- $('#'+_id).fadeTo(500, 0, function() {
- $(this).remove();
- });
- }
-
- // Regenerate column counts
- columnCounts = columnKeywords.map(function() {
- return 0;
- });
- for (var _k = 0; _k < onlineTweets.length; _k++) {
- columnCounts[onlineTweets[_k].cat]++;
- }
- break;
- }
- }
- }
- }
- });
-
- $("#btv-cp-container").mouseover(showControlPanel).mouseout(hideControlPanel);
-
- $("#btv-cp-champ-filtre").keyup(function() {
- updateLastTweetList();
- });
- $("#btv-cp-clear-filtre").click(function() {
- $("#btv-cp-champ-filtre").val("");
- updateLastTweetList();
- return false;
- });
- $("#btv-bigtweet, .btv-cp-hide-tweets").click(function() {
- $("#btv-bigtweet, .btv-cp-hide-tweets").hide();
- });
- $("#btv-cp-cont-pause-amont").click(function() {
- if (myQueueManager.playPause()) {
- $(this).removeClass("btv-cp-status-pause");
- $(this).addClass("btv-cp-status-play");
- } else {
- $(this).addClass("btv-cp-status-pause");
- $(this).removeClass("btv-cp-status-play");
- }
- });
- $("#btv-cp-cont-pause-aval").click(function() {
- dumpIsPaused = !dumpIsPaused
- if (dumpIsPaused) {
- $(this).removeClass("btv-cp-status-pause");
- $(this).addClass("btv-cp-status-play");
- } else {
- $(this).addClass("btv-cp-status-pause");
- $(this).removeClass("btv-cp-status-play");
- }
- });
-
- if (window.localStorage) {
- var _tw = localStorage.getItem('listetweets');
- if (_tw) {
- $("#btv-cp-liste-tweets-selection").html(_tw);
- }
- }
-});
\ No newline at end of file
--- a/integ/js/vs/tweets/podium.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/* Author: Raphaƫl Velt, IRI
- *
- * Licence: CeCILL-B - http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.html
- *
- * */
-
-Btv_Podium = function(data, opts) {
- this.options = opts || {};
- this.options.container = this.options.container || 'podium';
- this.options.spacing = this.options.spacing || 20;
- this.options.barBgd = this.options.barBgd || '#ffffff';
- this.options.transitionDuration = this.options.transitionDuration || 200;
- this.$ = this.options.jquery || jQuery;
- this._$ = this.$('#' + this.options.container);
- if (!this._$.length) {
- var _el = document.createElement("div");
- _el.id = this.options.container;
- document.body.appendChild(_el);
- this._$ = this.$(_el);
- }
- this.options.width = this.options.width || this._$.width();
- this.options.height = this.options.height || this._$.height();
- this.options.minHeight = this.options.minHeight || 0;
- this.lastheights = [];
- this.update(data, true);
-}
-
-Btv_Podium.prototype.update = function(data, noAnimate) {
- var _data = data || [];
- while (_data.length > this._$.children().length) {
- var _newCol = document.createElement("div");
- this.$(_newCol).css({
- "float": "left",
- "background": this.options.barBgd,
- "width": 0,
- "height": 0,
- "margin-top": this.options.height,
- "margin-left": 0,
- });
- this._$.append(_newCol);
- }
- while (_data.length < this._$.children().length) {
- this._$.children().last().detach();
- }
- if (_data.length) {
- var _max = _data.reduce(function(_memo, _val) {
- return Math.max(_memo, _val);
- }, 1),
- _scale = (this.options.height - this.options.minHeight) / _max,
- _spacing = Math.min(this.options.spacing, Math.floor(.5*this.options.width/_data.length)),
- _width = Math.floor(( this.options.width - (_data.length - 1) * _spacing) / _data.length),
- _this = this,
- _heights = [];
- this._$.children().each(function(_i, _e) {
- var _height = Math.floor(_scale * _data[_i] + _this.options.minHeight),
- _css = {},
- _changed = false;
- _heights.push(_height);
- if (_data.length != _this.lastheights.length) {
- _css["width"] = _width;
- _css["margin-left"] = (_i ? _spacing : 0);
- _changed = true;
- }
- if (_i >= _data.length || _height != _this.lastheights[_i]) {
- _css["height"] = _height;
- _css["margin-top"] = _this.options.height - _height
- _changed = true;
- }
- if (_changed) {
- if (noAnimate) {
- _this.$(_e).css(_css);
- } else {
- _this.$(_e).animate(_css);
- }
- }
- });
- this.lastheights = _heights;
- }
-}
\ No newline at end of file
--- a/integ/js/vs/tweets/tweetsource.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-/* Author: Raphaƫl Velt, IRI
- *
- * Licence: CeCILL-B - http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.html
- *
- * */
-
-function regexpFromText(_text) {
- return new RegExp('(' + _text.replace(/(\W)/gim,'\\$1') + ')','gim');
-}
-
-Btv_TweetArray = function() {
- this.tweets = [];
- this.idIndex = [];
-}
-
-Btv_TweetArray.prototype.push = function(_tweet) {
- this.tweets.push(_tweet);
- this.idIndex.push(_tweet.id_str);
-}
-
-Btv_TweetArray.prototype.setOnAdd = function(_callback) {
- this.onAdd = _callback;
-}
-
-Btv_TweetArray.prototype.addTweet = function(_tweet) {
- if (this.idIndex.indexOf(_tweet.id_str) != -1) {
- return;
- }
- if (!_tweet.date_value) {
- _tweet.date_value = Date.parse(_tweet.created_at.replace(/(\+|-)/,'UTC$1'));
- }
- var _pos = this.tweets.length;
- while (_pos && this.idIndex[_pos - 1] > _tweet.id_str) {
- _pos--;
- }
- this.tweets.splice(_pos,0,_tweet);
- this.idIndex.splice(_pos,0,_tweet.id_str);
- if (typeof this.onAdd == "function") {
- this.onAdd(_tweet);
- }
-}
-
-Btv_TweetArray.prototype.addMultipleTweets = function(_multiTweets) {
- var _l = _multiTweets.length;
- for (var _i = 0; _i < _l; _i++) {
- this.addTweet(_multiTweets[_i], true);
- }
-}
-
-Btv_TweetArray.prototype.count = function() {
- return this.tweets.length;
-}
-
-Btv_TweetArray.prototype.tweetAtPos = function(_i) {
- return this.tweets[_i];
-}
-
-Btv_TweetArray.prototype.slice = function(_start, _end) {
- var _slice = this.tweets.slice(_start, _end),
- _result = new Btv_TweetArray(),
- _l = _slice.length;
- for (var _i = 0; _i < _l; _i++) {
- _result.push(_slice[_i]);
- }
- return _result;
-}
-
-Btv_TweetArray.prototype.reverse = function() {
- var _result = new Btv_TweetArray(),
- _l = this.tweets.length;
- for (var _i = _l-1; _i >= 0; _i--) {
- _result.push(this.tweets[_i]);
- }
- return _result;
-}
-
-Btv_TweetArray.prototype.each = function(_callback) {
- var _l = this.count();
- for (var _i = 0; _i < _l; _i++) {
- _callback(this.tweets[_i]);
- }
-}
-
-Btv_TweetArray.prototype.map = function(_callback) {
- var _result = [];
- this.each(function(_tweet) {
- _result.push(_callback(_tweet))
- });
- return _result;
-}
-
-Btv_TweetArray.prototype.search = function(_filter) {
- var _filtered = new Btv_TweetArray(),
- _reFilter = regexpFromText(_filter);
- this.each(function(_tweet) {
- var _mention = '@' + _tweet.from_user;
- if (( _tweet.text.search(_reFilter) != -1 ) || ( _mention.search(_reFilter) != -1 )) {
- _filtered.push(_tweet);
- }
- });
- return _filtered;
-}
-
-Btv_TweetArray.prototype.beforeDate = function(_date) {
- var _filtered = new Btv_TweetArray();
- this.each(function(_tweet) {
- if (_tweet.date_value <= _date) {
- _filtered.push(_tweet);
- }
- });
- return _filtered;
-}
-
-Btv_TweetArray.prototype.afterDate = function(_date) {
- var _filtered = new Btv_TweetArray();
- this.each(function(_tweet) {
- if (_tweet.date_value > _date) {
- _filtered.push(_tweet);
- }
- });
- return _filtered;
-}
-
-Btv_TweetArray.prototype.tweetById = function(_tweetId) {
- var _index = this.idIndex.indexOf(_tweetId);
- return (_index ? this.tweets[_index] : null);
-}
-
-Btv_TweetArray.prototype.lastTweet = function() {
- return this.tweets[this.tweets.length - 1];
-}
-
-/*
- *
- */
-
-Btv_TweetSource = function(_opts) {
- Btv_TweetArray.call(this);
- this.loading = false;
- if (!_opts || !_opts.keywords || !_opts.keywords.length) {
- return;
- }
- this.options = _opts;
- var _this = this;
- this.retrieveInitialTweets();
- setInterval(function() {
- _this.retrieveNewTweets();
- }, 5000);
-}
-
-Btv_TweetSource.prototype = new Btv_TweetArray();
-
-Btv_TweetSource.prototype.retrieveTweets = function(_opts) {
-
- function getTwitterUrl(url) {
- $.getJSON(url, function(data) {
- _currentPage++;
- var _isLast = true;
- if (data.results && data.results.length) {
- _this.addMultipleTweets(data.results);
- var _oldestTweetId = data.results[data.results.length - 1].id_str,
- _maxId = _oldestTweetId;
- if (_currentPage < _opts.pages) {
- _isLast = false;
- getTwitterUrl(_baseurl + _firstparams + '&max_id=' + _maxId + _lastparams);
- }
- }
-
- if (_isLast) {
- _this.loading = false;
- if (typeof _this.onNewTweets == "function") {
- _this.onNewTweets();
- }
- }
- });
- }
-
-
- if (this.loading) {
- return;
- }
- this.loading = true;
- var _baseurl = "http://search.twitter.com/search.json",
- _currentPage = 0,
- _firstparams = "?q="
- + encodeURIComponent(this.options.keywords.join(' OR '))
- + "&rpp=100"
- + (this.options.lang ? "&lang=" + this.options.lang : '' ),
- _lastparams = ( _opts.since_id ? "&since_id=" + _opts.since_id : '' )
- + "&callback=?",
- _jsonurl = _baseurl + _firstparams + _lastparams,
- _this = this;
- getTwitterUrl(_jsonurl);
-
-}
-
-Btv_TweetSource.prototype.retrieveInitialTweets = function() {
- this.retrieveTweets({
- "pages": 1
- });
-}
-
-Btv_TweetSource.prototype.retrieveNewTweets = function() {
- var _last = this.lastTweet();
- this.retrieveTweets({
- "pages": 1,
- "since_id": _last ? _last.id_str : 0
- });
-}
-
-Btv_TweetSource.prototype.setOnNewTweets = function(_callback) {
- this.onNewTweets = _callback;
-}
-
-Btv_TweetQueueManager = function(_tweetArray, _callback) {
- this.tweetArray = _tweetArray;
- this.majorInterval = 10000; // Time slices for calculating the minor Interval setting
- this.minimumInterval = 1000; // Safe limit to avoid tweets going to the wrong column
- this.initialBuffer = 300000; // don't start with empty columns, but show the tweets of the last five minutes - 5 * 60 * 1000 = 300000
- this.waitIfNoTweets = 2000;
- this.callback = _callback;
- this.lastEndTime = new Date().valueOf() - this.initialBuffer;
- this.isPaused = false;
- this.onMajorInterval();
-}
-
-Btv_TweetQueueManager.prototype.onMinorInterval = function() {
- if (this.isPaused) {
- this.waitMinorInterval();
- } else {
- var _l = this.currentSlice.count();
- if (this.position < _l) {
- this.callback(this.currentSlice.tweetAtPos(this.position));
- this.position++;
- this.waitMinorInterval();
- } else {
- this.onMajorInterval();
- }
- }
-}
-
-Btv_TweetQueueManager.prototype.waitMinorInterval = function() {
- var _this = this;
- window.setTimeout(function() {
- _this.onMinorInterval();
- }, this.minorInterval);
-}
-
-Btv_TweetQueueManager.prototype.onMajorInterval = function() {
- this.position = 0;
- this.currentSlice = this.tweetArray.afterDate(this.lastEndTime);
- var _l = this.currentSlice.count();
- if (_l) {
- this.lastEndTime = this.currentSlice.tweetAtPos(_l - 1).date_value;
- this.minorInterval = Math.floor(Math.max(this.minimumInterval, this.majorInterval / _l));
- this.onMinorInterval();
- } else {
- var _this = this;
- window.setTimeout(function() {
- _this.onMajorInterval();
- }, this.waitIfNoTweets);
- }
-}
-
-Btv_TweetQueueManager.prototype.playPause = function() {
- this.isPaused = !this.isPaused;
- return this.isPaused;
-}
--- a/integ/js/vs/tweets/tweetvote-anim.js Mon May 06 14:57:50 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,320 +0,0 @@
-var canvas;
-var tooltipOpen=true;
-var Width = 960;
-var Height = 400;
-var delta = [0, 0];
-var stage = [195, 250, 1150, 835] // bottom
-var b2bod = [];
-
-var worldAABB, world, iterations = 1, timeStep = 1 / 20;
-
-var walls = [];
-var wall_thickness = 20;
-var wallsSetted = false;
-
-var bodies, elements, text;
-
-var createMode = false;
-var destroyMode = false;
-
-var emptyBottom = true;
-
-var isFreezing = false;
-var refLoop, refFileAttente;
-
-var isMouseDown = false;
-var isMouseDragging = false;
-var isMouseDragging2 = true;
-var mouseJoint;
-var mouse = { x: 0, y: 0 };
-var gravity = { x: 0, y: 0.3 };
-
-var PI2 = Math.PI * 2;
-
-var timeOfLastTouch = 0;
-var tweetSilos = [];
-
-init();
-play();
-
-function init() {
-
- worldAABB = new b2AABB();
- worldAABB.minVertex.Set( -200, -200 );
- worldAABB.maxVertex.Set( window.innerWidth + 200, window.innerHeight + 200 );
-
- world = new b2World( worldAABB, new b2Vec2( 0, 0 ), true );
-
- setWalls();
- reset();
-}
-
-
-function play() {
-
- if(!isFreezing)
- refLoop = setInterval( loop, 1000 / 40 );
- else
- clearInterval(refLoop);
-
- isFreezing = !isFreezing;
-}
-
-function reset() {
-
- if(bodies) {
- for (var i= 0; i < bodies.length; i++ ) {
- var body = bodies[ i ]
- canvas.removeChild( body.GetUserData().element );
- world.DestroyBody( body );
- body = null;
- }
- }
- bodies = [];
- elements = [];
-}
-
-function loop() {
-
- delta[0] += (0 - delta[0]) * .5;
- delta[1] += (0 - delta[1]) * .5;
- world.m_gravity.x = gravity.x * 350 + delta[0];
- world.m_gravity.y = gravity.y * 350 + delta[1];
-
- world.Step(timeStep, iterations);
-
- for (i = 0; i < bodies.length; i++) {
- var body = bodies[i];
- var element = elements[i];
- element.style.left = (body.m_position0.x - (element.width >> 1)) + 'px';
- element.style.top = (body.m_position0.y - (element.height >> 1)) + 'px';
- }
-}
-
-function createBox(world, x, y, width, height, fixed) {
-
- var c=document.createElement('canvas');
- var ctx=c.getContext("2d");
- ctx.fillStyle="#FF0000";
- ctx.fillRect(0,0,1500,750);
-
- if (typeof(fixed) == 'undefined') {
- fixed = true;
- }
-
- var boxSd = new b2BoxDef();
-
- if (!fixed) {
- boxSd.density = 1.0;
- }
-
- boxSd.extents.Set(width, height);
- var boxBd = new b2BodyDef();
- boxBd.AddShape(boxSd);
- boxBd.position.Set(x,y);
-
- return world.CreateBody(boxBd);
-}
-
-
-
-function getBodyAtMouse() {
-
- // Make a small box.
- var mousePVec = new b2Vec2();
- mousePVec.Set(mouse.x, mouse.y);
-
- var aabb = new b2AABB();
- aabb.minVertex.Set(mouse.x - 1, mouse.y - 1);
- aabb.maxVertex.Set(mouse.x + 1, mouse.y + 1);
-
- // Query the world for overlapping shapes.
- var k_maxCount = 10;
- var shapes = new Array();
- var count = world.Query(aabb, shapes, k_maxCount);
- var body = null;
-
- for (var i = 0; i < count; ++i) {
- if (shapes[i].m_body.IsStatic() == false) {
- if ( shapes[i].TestPoint(mousePVec) ) {
- body = shapes[i].m_body;
- break;
- }
- }
- }
- return body;
-}
-
-function setWalls() {
-
- if (wallsSetted) {
- world.DestroyBody(walls[0]);
- world.DestroyBody(walls[1]);
- world.DestroyBody(walls[2]);
- world.DestroyBody(walls[3]);
- walls[0] = null;
- walls[1] = null;
- walls[2] = null;
- walls[3] = null;
- } else {
-
- walls[0] = createBox(world, 1880, 900, wall_thickness, 900); // rightmost wall
- walls[1] = createBox(world, 1510, 600, wall_thickness, 300); // wall 4 / 3
-
- walls[2] = createBox(world, 1130, 600, wall_thickness, 300); // wall 3 / 2
- walls[3] = createBox(world, 760, 600, wall_thickness, 300); // wall 2 / 1
- walls[4] = createBox(world, 390, 600, wall_thickness, 300); // leftmostwall
-
- walls[5] = createBox(world, 580, 600, 170, 10); // 4
- walls[6] = createBox(world, 950, 750, 170, 10); // 3
- walls[7] = createBox(world, 1320, 750, 170, 10); // 2
- walls[8] = createBox(world, 1690, 600, 170, 10); // 1
-
- setInterval(function() {
-
- // Check if div podiums are already loaded
- if($('#podium div').size() > 0) {
-
- $('#podium div').each( function(idx, panel) {
-
- var idxWall = 5+idx;
- var yWall = 920-$(this).height();
- world.DestroyBody(walls[idxWall]);
- walls[idxWall] = createBox(world, 580+370*idx, yWall, 170, 10);
-
- });
- }
- }, 1000);
- }
-}
-
-function createBallTweetForce(t) {
-
- var element = document.createElement( 'div' );
- element.width = 96;
- element.height = 96;
- element.style.position = 'absolute';
- element.style.left = -200 + 'px';
- element.style.top = -200 + 'px';
- element.style.cursor = "default";
- element.style.hover = "red";
- element.id = t.id_str;
-
- var id = "tweet_"+bodies.length;
- var canvas = document.getElementById('canvas');
- canvas.appendChild(element);
- elements.push( element );
-
- BALL_SIZE = 150;
-
- var circle = document.createElement('canvas');
- circle.width = 96;
- circle.height = 96;
-
- var offset = (48 - BALL_SIZE)/2;
-
- var graphics = circle.getContext('2d');
- graphics.fillStyle = "white";
- graphics.beginPath();
- graphics.arc(BALL_SIZE* .25+10, BALL_SIZE* .25, BALL_SIZE* .25, 0, PI2, true);
- graphics.closePath();
- graphics.fill();
-
- graphics.fillStyle = "#E2F0D6";
- graphics.beginPath();
- graphics.arc(BALL_SIZE * .5 +offset+24, BALL_SIZE * .5+offset+14, BALL_SIZE * .20, 0, PI2, true);
- graphics.closePath();
- graphics.fill();
-
- var img = new Image();
- img.src = t.profile_image_url;
-
- img.onload = function(){
-
- // Resize image
- var canvasCopy = document.createElement("canvas");
- var copyContext = canvasCopy.getContext("2d");
- canvasCopy.width = 96;
- canvasCopy.height = 96;
- copyContext.drawImage(img, 0, 0, 96, 96);
-
- var ptrn = graphics.createPattern(canvasCopy,'no-repeat');
- graphics.fillStyle = ptrn;
- graphics.fill(-5,0,150,150);
- }
-
- element.appendChild(circle);
-
- var circle = new b2CircleDef();
- circle.radius = BALL_SIZE/4+2 ;
- circle.density = 1;
- circle.friction = 0.3;
- circle.restitution = 0.3;
-
- var a, b, xpos, ypos;
-
- switch (t.cat) {
- case 0: // 1
- a = 250;
- b = -100;
- xpos = 40;
- ypos = 250;
- break;
- case 1: // 2
- a = 250;
- b = -150;
- xpos = 40;
- ypos = 70;
- break;
- case 2: // 3
- a = 290;
- b = -180;
- xpos = 40;
- ypos = 100;
- break;
- case 3: // 4
- a = 400;
- b = -180;
- xpos = 40;
- ypos = 150;
- break;
- default:
- a = 390;
- b = -180;
- xpos = 40;
- ypos = 70;
- console.log("DEFAULT IMPULS PARAMS! Should not be there..");
- break;
- }
-
- var b2body = new b2BodyDef();
- b2body.AddShape(circle);
- b2body.userData = {element: element};
- b2body.position.Set( xpos, ypos);
-
- b2body.linearVelocity.Set(a, b);
- b2bod[t.id_str] = world.CreateBody(b2body);
- console.log("created " + t.id_str)
- bodies.push(b2bod[t.id_str]);
-
- $("#"+t.id_str).mouseover(function() {
- var _of = $(this).offset();
- $(this).css({
- "cursor": "pointer"
- });
- showTooltip(t, _of.left, _of.top);
- }).mouseout(hideTooltip).click(function() {
- addTweetToSelection($("#btv-tooltip"));
- $(this).fadeTo(100,.25, function() {
- $(this).fadeTo(100,1);
- showControlPanel();
- })
- });
-
-/* $("#"+t.id_str).click(function() {
- if(!isMouseDragging) {
- fancyBoxTwitter(t.from_user, (t.candidats && t.candidats.length ? candidats[t.candidats[0]].couleur : '#666699'));
-// window.open("https://twitter.com/#!/"+t.from_user+"/status/"+t.id_str);
- }
- }); */
-}
\ No newline at end of file