supernets.org

- https://supernets.org
git clone git://git.acid.vegas/supernets.org.git
Log | Files | Refs | Archive

commit 86d30c4b31c685ed3765a2dcea0889a262ec7149
parent 0898267eecad9f237d153481e570578295925e62
Author: acidvegas <acid.vegas@acid.vegas>
Date: Thu, 8 Jun 2023 18:52:33 -0400

Added worms

Diffstat:
Dworms | 1-
Aworms/css/bootstrap.min.css | 9+++++++++
Aworms/css/custom.css | 249+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aworms/data/images/README.md | 2++
Aworms/data/images/levels/level2.png | 0
Aworms/data/images/menu/xbox360controls.png | 0
Aworms/data/sounds/boring.wav | 0
Aworms/data/sounds/explosion1.wav | 0
Aworms/data/sounds/explosion2.wav | 0
Aworms/data/sounds/explosion3.wav | 0
Aworms/external/Box2dWeb-2.1.a.3.js | 10870+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aworms/external/Box2dWeb-2.1.a.3.min.js | 445+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aworms/external/Stats.js | 7+++++++
Aworms/external/bootstrap.min.js | 7+++++++
Aworms/external/jquery.1.8.2.min.js | 3+++
Aworms/external/test/qunit.css | 242+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aworms/index.html | 176+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

17 files changed, 12010 insertions(+), 1 deletion(-)

diff --git a/worms b/worms
@@ -1 +0,0 @@
-Subproject commit 6b07e61b9bd2e7db361d5babe8a1b9ff1d2b2a50
diff --git a/worms/css/bootstrap.min.css b/worms/css/bootstrap.min.css
@@ -0,0 +1,9 @@
+/*!
+ * Bootstrap v2.2.1
+ *
+ * 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.
+ */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}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}.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}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{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}.text-warning{color:#c09853}a.text-warning:hover{color:#a47e3c}.text-error{color:#b94a48}a.text-error:hover{color:#953b39}.text-info{color:#3a87ad}a.text-info:hover{color:#2d6987}.text-success{color:#468847}a.text-success:hover{color:#356635}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}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:16px;font-weight:300;line-height:25px}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;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;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;cursor:pointer}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>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>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>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>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:required:invalid,textarea:focus:required:invalid,select:focus:required:invalid{color:#b94a48;border-color:#ee5f5b}input:focus:required:invalid:focus,textarea:focus:required:invalid:focus,select:focus:required: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{margin-bottom:5px;font-size:0;white-space:nowrap}.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{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{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,.input-append select+.btn-group .btn,.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-append .add-on,.input-append .btn,.input-append .btn-group{margin-left:-1px}.input-append .add-on:last-child,.input-append .btn:last-child{-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{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-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{-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{-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 tfoot:last-child tr:last-child td:first-child{-webkit-border-radius:0 0 0 4px;-moz-border-radius:0 0 0 4px;border-radius:0 0 0 4px;-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 tfoot:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px}.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:hover>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:hover>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{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{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{color:#333;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{color:#999}.dropdown-menu .disabled>a:hover{text-decoration:none;cursor:default;background-color:transparent;background-image:none}.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{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{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;*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 #bbb;*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:#a2a2a2;-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: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{color:#333;text-decoration:none;background-color:#e6e6e6;*background-color:#d9d9d9;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-color:#e6e6e6;background-color:#d9d9d9 \9;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-color:#e6e6e6;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:2px}.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{padding:1px 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{border-color:#c5c5c5;border-color:rgba(0,0,0,0.15) rgba(0,0,0,0.15) rgba(0,0,0,0.25)}.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: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: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: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: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: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: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{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover{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{font-size:14px}.btn-group>.btn-mini{font-size:11px}.btn-group>.btn-small{font-size:12px}.btn-group>.btn-large{font-size:16px}.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-mini .caret,.btn-small .caret,.btn-large .caret{margin-top:6px}.btn-large .caret{border-top-width:5px;border-right-width:5px;border-left-width:5px}.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;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;color:#c09853;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 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-danger,.alert-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.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{text-decoration:none;background-color:#eee}.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{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{border-color:#eee #eee #ddd}.nav-tabs>.active>a,.nav-tabs>.active>a:hover{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{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{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{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{cursor:pointer}.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover{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{border-top-color:#fff;border-bottom-color:#fff;opacity:1;filter:alpha(opacity=100)}.tabs-stacked .open>a:hover{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{border-top-color:#ddd;border-bottom-color:transparent}.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover{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{border-color:#eee #ddd #eee #eee}.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:hover{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{border-color:#eee #eee #eee #ddd}.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover{border-color:#ddd #ddd #ddd transparent;*border-left-color:#fff}.nav>.disabled>a{color:#999}.nav>.disabled>a:hover{text-decoration:none;cursor:default;background-color:transparent}.navbar{*position:relative;*z-index:2;margin-bottom:20px;overflow:visible;color:#777}.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{text-decoration:none}.navbar-text{margin-bottom:0;line-height:40px}.navbar-link{color:#777}.navbar-link:hover{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{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:6px;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: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.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{color:#999}.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{color:#fff}.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{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>.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: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 .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>.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{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:1px 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{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>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:50%;left:50%;z-index:1050;width:560px;margin:-250px 0 0 -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:50%}.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{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;padding:5px;font-size:11px;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.8;filter:alpha(opacity=80)}.tooltip.top{margin-top:-3px}.tooltip.right{margin-left:3px}.tooltip.bottom{margin-top:3px}.tooltip.left{margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 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;width:236px;padding:1px;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-content{padding:9px 14px}.popover-content p,.popover-content ul,.popover-content ol{margin-bottom:0}.popover .arrow,.popover .arrow:after{position:absolute;display:inline-block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow:after{z-index:-1;content:""}.popover.top .arrow{bottom:-10px;left:50%;margin-left:-10px;border-top-color:#fff;border-width:10px 10px 0}.popover.top .arrow:after{bottom:-1px;left:-11px;border-top-color:rgba(0,0,0,0.25);border-width:11px 11px 0}.popover.right .arrow{top:50%;left:-10px;margin-top:-10px;border-right-color:#fff;border-width:10px 10px 10px 0}.popover.right .arrow:after{bottom:-11px;left:-1px;border-right-color:rgba(0,0,0,0.25);border-width:11px 11px 11px 0}.popover.bottom .arrow{top:-10px;left:50%;margin-left:-10px;border-bottom-color:#fff;border-width:0 10px 10px}.popover.bottom .arrow:after{top:-1px;left:-11px;border-bottom-color:rgba(0,0,0,0.25);border-width:0 11px 11px}.popover.left .arrow{top:50%;right:-10px;margin-top:-10px;border-left-color:#fff;border-width:10px 0 10px 10px}.popover.left .arrow:after{right:-1px;bottom:-11px;border-left-color:rgba(0,0,0,0.25);border-width:11px 0 11px 11px}.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{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}a.label:hover,a.badge:hover{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 .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 .item>img{display:block;line-height:1}.carousel .active,.carousel .next,.carousel .prev{display:block}.carousel .active{left:0}.carousel .next,.carousel .prev{position:absolute;top:0;width:100%}.carousel .next{left:100%}.carousel .prev{left:-100%}.carousel .next.left,.carousel .prev.right{left:0}.carousel .active.left{left:-100%}.carousel .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{color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.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}
diff --git a/worms/css/custom.css b/worms/css/custom.css
@@ -0,0 +1,249 @@
+body, html {
+    overflow: hidden;
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    -moz-user-select: none;
+    -khtml-user-select: none;
+    -webkit-user-select: none;
+    -ms-user-select: none;
+    user-select: none;
+}
+
+#action {
+    background: #242a4a; /* Old browsers */
+    background: -moz-linear-gradient(top, #242a4a 0%, #201610 100%); /* FF3.6+ */
+    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#242a4a), color-stop(100%,#201610)); /* Chrome,Safari4+ */
+    background: -webkit-linear-gradient(top, #242a4a 0%,#201610 100%); /* Chrome10+,Safari5.1+ */
+    background: -o-linear-gradient(top, #242a4a 0%,#201610 100%); /* Opera 11.10+ */
+    background: -ms-linear-gradient(top, #242a4a 0%,#201610 100%); /* IE10+ */
+    background: linear-gradient(to bottom, #242a4a 0%,#201610 100%); /* W3C */
+    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#242a4a', endColorstr='#201610',GradientType=0 ); /* IE6-9 */
+}
+
+
+#startMenu {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    margin-left: -360px;
+    margin-top: -280px;
+    width: 600px;
+    height: 490px;
+    z-index: 1;
+}
+
+
+.btn-large {
+    margin-left: 10px;
+    margin-right: 10px;
+}
+
+.thumbnail {
+    padding: 5px;
+}
+
+#weaponsMenu .thumbnail {
+    padding: 17px;
+}
+
+
+
+.thumbnails {
+    margin-left: auto;
+    list-style: none;
+}
+
+#weaponsMenu {
+    position: absolute;
+    left: 100%;
+    top: 100%;
+    width: 275px;
+    height: 350px;
+    margin-top: -350px;
+    z-index: 9999999;
+    background: black;
+    border: 1px white solid;
+    padding: 10px;
+    padding-left: 2px;
+    padding-right: 2px;
+    border-radius: 3px;
+    cursor: default;
+}
+
+#weaponsMenuBtn {
+    -webkit-transform: rotate(90deg);
+    -moz-transform: rotate(90deg);
+    -ms-transform: rotate(90deg);
+    -o-transform: rotate(90deg);
+    transform: rotate(90deg);
+    cursor: pointer;
+    position: absolute;
+    left: -42.5%;
+    top: 20%;
+    padding: 20px;
+    font-style: bold;
+    background: black;
+    color: white;
+    border: white 1px solid;
+    border-radius: 3px;
+    z-index: 1;
+    font-size: 20px;
+    border-top: none;
+}
+
+    #weaponsMenuBtn:hover {
+        color: #08c;
+    }
+
+#weaponsMenu .thumbnail:active {
+    -ms-transform: scale(0.9,0.9); /* IE 9 */
+    -webkit-transform: scale(0.9,0.9); /* Safari and Chrome */
+    -o-transform: scale(0.9,0.9); /* Opera */
+    -moz-transform: scale(0.9,0.9);
+    transform: scale(0.9,0.9); /* Firefox */
+    cursor: pointer;
+}
+
+#weaponsMenu .noAmmo {
+    -moz-opacity: 0.4;
+    opacity: 0.4;
+}
+
+a.noAmmo:hover {
+    border-color: none;
+    cursor: pointer;
+}
+
+
+.span1 {
+    width: auto;
+}
+
+a.thumbnail.ammo {
+    background: black;
+    cursor: pointer;
+}
+
+.ammoCount {
+    position: absolute;
+    font-size: 11.5px;
+    margin-left: 26px;
+    margin-top: -7px;
+    font-weight: bold;
+    color: white;
+}
+
+#turnTimeCounter {
+    background: black;
+    border: white 1px solid;
+    width: 70px;
+    height: 70px;
+    position: absolute;
+    top: 100%;
+    margin-top: -78px;
+    margin-left: 10px;
+    color: white;
+    font-size: 40px;
+    display: -webkit-box;
+    box-align: center;
+    -webkit-box-orient: horizontal;
+    -webkit-box-pack: center;
+    -moz-box-align: center;
+    -webkit-box-align: center;
+    border-radius: 3px;
+    z-index: 1;
+}
+
+kbd {
+    white-space: nowrap;
+    color: black;
+    background: #EEE;
+    border-style: solid;
+    border-color: #CCC #AAA #888 #BBB;
+    padding: 2px 4px;
+    border-width: 1px 3px 3px 1px;
+}
+
+.healthMenu {
+    position: absolute;
+    left: 50%;
+    bottom: 1%;
+    width: 150px;
+    z-index: 1;
+    margin-left: -200px;
+}
+
+    .healthMenu li {
+        list-style: none;
+        padding: 5px;
+    }
+
+        .healthMenu li span {
+            margin-left: 10px;
+            margin-right: 10px;
+            background: black;
+            color: white;
+            font-size: 14px;
+            padding: 5px;
+            border-radius: 3px;
+            border: 1px white solid;
+        }
+
+
+
+    .healthMenu span.health {
+        position: absolute;
+        height: 15px;
+    }
+
+
+.modal-body h1 {
+    font-size: 18.5px;
+    line-height: normal;
+}
+
+
+.touchButton {
+    position: absolute;
+    left: 100%;
+    top: 100%;
+    width: 80px;
+    height: 50px;
+    margin-top: -78px;
+    margin-left: -100px;
+    z-index: 1;
+    background: black;
+    border: 1px white solid;
+    padding: 10px;
+    padding-left: 2px;
+    padding-right: 2px;
+    border-radius: 3px;
+    cursor: default;
+    color: white;
+    font-size: 30px;
+    display: -webkit-box;
+    -webkit-box-orient: horizontal;
+    -webkit-box-pack: center;
+    -webkit-box-align: center;
+}
+
+#touchJump {
+    margin-left: -200px;
+}
+
+#touchFire {
+    margin-left: -100px;
+}
+
+#notifaction {
+    text-align: center;
+    z-index: 99;
+    position: absolute;
+    top: -50px;
+    left: 50%;
+    margin-left: -250px;
+    width: 500px;
+    font-size: 17px;
+    border-color: black;
+}
diff --git a/worms/data/images/README.md b/worms/data/images/README.md
@@ -0,0 +1 @@
+Game Assets are not in the git repo due to the fact I don't own the copyright to them. 
+\ No newline at end of file
diff --git a/worms/data/images/levels/level2.png b/worms/data/images/levels/level2.png
Binary files differ.
diff --git a/worms/data/images/menu/xbox360controls.png b/worms/data/images/menu/xbox360controls.png
Binary files differ.
diff --git a/worms/data/sounds/boring.wav b/worms/data/sounds/boring.wav
Binary files differ.
diff --git a/worms/data/sounds/explosion1.wav b/worms/data/sounds/explosion1.wav
Binary files differ.
diff --git a/worms/data/sounds/explosion2.wav b/worms/data/sounds/explosion2.wav
Binary files differ.
diff --git a/worms/data/sounds/explosion3.wav b/worms/data/sounds/explosion3.wav
Binary files differ.
diff --git a/worms/external/Box2dWeb-2.1.a.3.js b/worms/external/Box2dWeb-2.1.a.3.js
@@ -0,0 +1,10869 @@
+/*
+* 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)
+                 //__this.m_ctx.translate(100, 100);
+            }
+         }
+      };
+   };
+   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
diff --git a/worms/external/Box2dWeb-2.1.a.3.min.js b/worms/external/Box2dWeb-2.1.a.3.min.js
@@ -0,0 +1,445 @@
+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;
diff --git a/worms/external/Stats.js b/worms/external/Stats.js
@@ -0,0 +1,7 @@
+// stats.js r8 - http://github.com/mrdoob/stats.js
+var Stats=function(){var h,a,n=0,o=0,i=Date.now(),u=i,p=i,l=0,q=1E3,r=0,e,j,f,b=[[16,16,48],[0,255,255]],m=0,s=1E3,t=0,d,k,g,c=[[16,48,16],[0,255,0]];h=document.createElement("div");h.style.cursor="pointer";h.style.width="80px";h.style.opacity="0.9";h.style.zIndex="10001";h.addEventListener("mousedown",function(a){a.preventDefault();n=(n+1)%2;n==0?(e.style.display="block",d.style.display="none"):(e.style.display="none",d.style.display="block")},!1);e=document.createElement("div");e.style.textAlign=
+"left";e.style.lineHeight="1.2em";e.style.backgroundColor="rgb("+Math.floor(b[0][0]/2)+","+Math.floor(b[0][1]/2)+","+Math.floor(b[0][2]/2)+")";e.style.padding="0 0 3px 3px";h.appendChild(e);j=document.createElement("div");j.style.fontFamily="Helvetica, Arial, sans-serif";j.style.fontSize="9px";j.style.color="rgb("+b[1][0]+","+b[1][1]+","+b[1][2]+")";j.style.fontWeight="bold";j.innerHTML="FPS";e.appendChild(j);f=document.createElement("div");f.style.position="relative";f.style.width="74px";f.style.height=
+"30px";f.style.backgroundColor="rgb("+b[1][0]+","+b[1][1]+","+b[1][2]+")";for(e.appendChild(f);f.children.length<74;)a=document.createElement("span"),a.style.width="1px",a.style.height="30px",a.style.cssFloat="left",a.style.backgroundColor="rgb("+b[0][0]+","+b[0][1]+","+b[0][2]+")",f.appendChild(a);d=document.createElement("div");d.style.textAlign="left";d.style.lineHeight="1.2em";d.style.backgroundColor="rgb("+Math.floor(c[0][0]/2)+","+Math.floor(c[0][1]/2)+","+Math.floor(c[0][2]/2)+")";d.style.padding=
+"0 0 3px 3px";d.style.display="none";h.appendChild(d);k=document.createElement("div");k.style.fontFamily="Helvetica, Arial, sans-serif";k.style.fontSize="9px";k.style.color="rgb("+c[1][0]+","+c[1][1]+","+c[1][2]+")";k.style.fontWeight="bold";k.innerHTML="MS";d.appendChild(k);g=document.createElement("div");g.style.position="relative";g.style.width="74px";g.style.height="30px";g.style.backgroundColor="rgb("+c[1][0]+","+c[1][1]+","+c[1][2]+")";for(d.appendChild(g);g.children.length<74;)a=document.createElement("span"),
+a.style.width="1px",a.style.height=Math.random()*30+"px",a.style.cssFloat="left",a.style.backgroundColor="rgb("+c[0][0]+","+c[0][1]+","+c[0][2]+")",g.appendChild(a);return{domElement:h,update:function(){i=Date.now();m=i-u;s=Math.min(s,m);t=Math.max(t,m);k.textContent=m+" MS ("+s+"-"+t+")";var a=Math.min(30,30-m/200*30);g.appendChild(g.firstChild).style.height=a+"px";u=i;o++;if(i>p+1E3)l=Math.round(o*1E3/(i-p)),q=Math.min(q,l),r=Math.max(r,l),j.textContent=l+" FPS ("+q+"-"+r+")",a=Math.min(30,30-l/
+100*30),f.appendChild(f.firstChild).style.height=a+"px",p=i,o=0}}};
diff --git a/worms/external/bootstrap.min.js b/worms/external/bootstrap.min.js
@@ -0,0 +1,6 @@
+/*!
+* 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(!0)),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("click.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&&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.fn[this.type].defaults,r={},i;this._options&&e.each(this._options,function(e,t){n[e]!=t&&(r[e]=t)},this),i=e(t.currentTarget)[this.type](r).data(this.type);if(!i.options.delay||!i.options.delay.show)return i.show();clearTimeout(this.timeout),i.hoverState="in",this.timeout=setTimeout(function(){i.hoverState=="in"&&i.show()},i.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
diff --git a/worms/external/jquery.1.8.2.min.js b/worms/external/jquery.1.8.2.min.js
@@ -0,0 +1,2 @@
+/*! jQuery v1.8.2 jquery.com | jquery.org/license */
+(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bZ(c)&&(e[f]=p._data(c,"olddisplay",cc(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b_(a,b,c){var d=bP.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function ca(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bV[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bV[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bV[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bV[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bV[e]+"Width"))||0));return f}function cb(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0||d==null){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bQ.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+ca(a,b,c||(f?"border":"content"),e)+"px"}function cc(a){if(bS[a])return bS[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cA(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cv;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cA(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cA(a,c,d,e,"*",g)),h}function cB(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cC(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cD(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cL(){try{return new a.XMLHttpRequest}catch(b){}}function cM(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cU(){return setTimeout(function(){cN=b},0),cN=p.now()}function cV(a,b){p.each(b,function(b,c){var d=(cT[b]||[]).concat(cT["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cW(a,b,c){var d,e=0,f=0,g=cS.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cN||cU(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cN||cU(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cX(k,j.opts.specialEasing);for(;e<g;e++){d=cS[e].call(j,a,k,j.opts);if(d)return d}return cV(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cX(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}}function cY(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bZ(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cc(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cP.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cZ(a,b,c,d,e){return new cZ.prototype.init(a,b,c,d,e)}function c$(a,b){var c,d={height:a},e=0;b=b?1:0;for(;e<4;e+=2-b)c=bV[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function da(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,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(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o&&!o.call(" ")?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":(a+"").replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete")setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){var e=p.type(c);e==="function"&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&e!=="string"&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return a!=null?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||p.guid++:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")||(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)d=p._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)f.indexOf(" "+b[g]+" ")<0&&(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>=0)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=b+""}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&p.expr.match.needsContext.test(f),namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=k.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click"))for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){h={},j=[];for(d=0;d<q;d++)l=o[d],m=l.selector,h[m]===b&&(h[m]=l.needsContext?p(m,this).index(f)>=0:p.find(m,this,null,[f]).length),h[m]&&j.push(l);j.length&&u.push({elem:f,matches:j})}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){i=u[d],c.currentTarget=i.elem;for(e=0;e<i.matches.length&&!c.isImmediatePropagationStopped();e++){l=i.matches[e];if(s||!c.namespace&&!l.namespace||c.namespace_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,g=((p.event.special[l.origType]||{}).handle||l.handler).apply(i.elem,r),g!==b&&(c.result=g,g===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),!V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length===1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.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 contextmenu".split(" "),function(a,b){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bc(a,b,c,d){c=c||[],b=b||r;var e,f,i,j,k=b.nodeType;if(!a||typeof a!="string")return c;if(k!==1&&k!==9)return[];i=g(b);if(!i&&!d)if(e=P.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&h(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return w.apply(c,x.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&_&&b.getElementsByClassName)return w.apply(c,x.call(b.getElementsByClassName(j),0)),c}return bp(a.replace(L,"$1"),b,c,d,i)}function bd(a){return function(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function be(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bf(a){return z(function(b){return b=+b,z(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function bg(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bh(a,b){var c,d,f,g,h,i,j,k=C[o][a];if(k)return b?0:k.slice(0);h=a,i=[],j=e.preFilter;while(h){if(!c||(d=M.exec(h)))d&&(h=h.slice(d[0].length)),i.push(f=[]);c=!1;if(d=N.exec(h))f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=d[0].replace(L," ");for(g in e.filter)(d=W[g].exec(h))&&(!j[g]||(d=j[g](d,r,!0)))&&(f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=g,c.matches=d);if(!c)break}return b?h.length:h?bc.error(a):C(a,i).slice(0)}function bi(a,b,d){var e=b.dir,f=d&&b.dir==="parentNode",g=u++;return b.first?function(b,c,d){while(b=b[e])if(f||b.nodeType===1)return a(b,c,d)}:function(b,d,h){if(!h){var i,j=t+" "+g+" ",k=j+c;while(b=b[e])if(f||b.nodeType===1){if((i=b[o])===k)return b.sizset;if(typeof i=="string"&&i.indexOf(j)===0){if(b.sizset)return b}else{b[o]=k;if(a(b,d,h))return b.sizset=!0,b;b.sizset=!1}}}else while(b=b[e])if(f||b.nodeType===1)if(a(b,d,h))return b}}function bj(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function bk(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=b!=null;for(;h<i;h++)if(f=a[h])if(!c||c(f,d,e))g.push(f),j&&b.push(h);return g}function bl(a,b,c,d,e,f){return d&&!d[o]&&(d=bl(d)),e&&!e[o]&&(e=bl(e,f)),z(function(f,g,h,i){if(f&&e)return;var j,k,l,m=[],n=[],o=g.length,p=f||bo(b||"*",h.nodeType?[h]:h,[],f),q=a&&(f||!b)?bk(p,m,a,h,i):p,r=c?e||(f?a:o||d)?[]:g:q;c&&c(q,r,h,i);if(d){l=bk(r,n),d(l,[],h,i),j=l.length;while(j--)if(k=l[j])r[n[j]]=!(q[n[j]]=k)}if(f){j=a&&r.length;while(j--)if(k=r[j])f[m[j]]=!(g[m[j]]=k)}else r=bk(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):w.apply(g,r)})}function bm(a){var b,c,d,f=a.length,g=e.relative[a[0].type],h=g||e.relative[" "],i=g?1:0,j=bi(function(a){return a===b},h,!0),k=bi(function(a){return y.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==l)||((b=c).nodeType?j(a,c,d):k(a,c,d))}];for(;i<f;i++)if(c=e.relative[a[i].type])m=[bi(bj(m),c)];else{c=e.filter[a[i].type].apply(null,a[i].matches);if(c[o]){d=++i;for(;d<f;d++)if(e.relative[a[d].type])break;return bl(i>1&&bj(m),i>1&&a.slice(0,i-1).join("").replace(L,"$1"),c,i<d&&bm(a.slice(i,d)),d<f&&bm(a=a.slice(d)),d<f&&a.join(""))}m.push(c)}return bj(m)}function bn(a,b){var d=b.length>0,f=a.length>0,g=function(h,i,j,k,m){var n,o,p,q=[],s=0,u="0",x=h&&[],y=m!=null,z=l,A=h||f&&e.find.TAG("*",m&&i.parentNode||i),B=t+=z==null?1:Math.E;y&&(l=i!==r&&i,c=g.el);for(;(n=A[u])!=null;u++){if(f&&n){for(o=0;p=a[o];o++)if(p(n,i,j)){k.push(n);break}y&&(t=B,c=++g.el)}d&&((n=!p&&n)&&s--,h&&x.push(n))}s+=u;if(d&&u!==s){for(o=0;p=b[o];o++)p(x,q,i,j);if(h){if(s>0)while(u--)!x[u]&&!q[u]&&(q[u]=v.call(k));q=bk(q)}w.apply(k,q),y&&!h&&q.length>0&&s+b.length>1&&bc.uniqueSort(k)}return y&&(t=B,l=z),x};return g.el=0,d?z(g):g}function bo(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)bc(a,b[e],c,d);return c}function bp(a,b,c,d,f){var g,h,j,k,l,m=bh(a),n=m.length;if(!d&&m.length===1){h=m[0]=m[0].slice(0);if(h.length>2&&(j=h[0]).type==="ID"&&b.nodeType===9&&!f&&e.relative[h[1].type]){b=e.find.ID(j.matches[0].replace(V,""),b,f)[0];if(!b)return c;a=a.slice(h.shift().length)}for(g=W.POS.test(a)?-1:h.length-1;g>=0;g--){j=h[g];if(e.relative[k=j.type])break;if(l=e.find[k])if(d=l(j.matches[0].replace(V,""),R.test(h[0].type)&&b.parentNode||b,f)){h.splice(g,1),a=d.length&&h.join("");if(!a)return w.apply(c,x.call(d,0)),c;break}}}return i(a,m)(d,b,f,c,R.test(a)),c}function bq(){}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=String,r=a.document,s=r.documentElement,t=0,u=0,v=[].pop,w=[].push,x=[].slice,y=[].indexOf||function(a){var b=0,c=this.length;for(;b<c;b++)if(this[b]===a)return b;return-1},z=function(a,b){return a[o]=b==null||b,a},A=function(){var a={},b=[];return z(function(c,d){return b.push(c)>e.cacheLength&&delete a[b.shift()],a[c]=d},a)},B=A(),C=A(),D=A(),E="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",G=F.replace("w","w#"),H="([*^$|!~]?=)",I="\\["+E+"*("+F+")"+E+"*(?:"+H+E+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+G+")|)|)"+E+"*\\]",J=":("+F+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+I+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)",L=new RegExp("^"+E+"+|((?:^|[^\\\\])(?:\\\\.)*)"+E+"+$","g"),M=new RegExp("^"+E+"*,"+E+"*"),N=new RegExp("^"+E+"*([\\x20\\t\\r\\n\\f>+~])"+E+"*"),O=new RegExp(J),P=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,Q=/^:not/,R=/[\x20\t\r\n\f]*[+~]/,S=/:not\($/,T=/h\d/i,U=/input|select|textarea|button/i,V=/\\(?!\\)/g,W={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),NAME:new RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+J),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),needsContext:new RegExp("^"+E+"*[>+~]|"+K,"i")},X=function(a){var b=r.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},Y=X(function(a){return a.appendChild(r.createComment("")),!a.getElementsByTagName("*").length}),Z=X(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),$=X(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),_=X(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length===2)}),ba=X(function(a){a.id=o+0,a.innerHTML="<a name='"+o+"'></a><div name='"+o+"'></div>",s.insertBefore(a,s.firstChild);var b=r.getElementsByName&&r.getElementsByName(o).length===2+r.getElementsByName(o+0).length;return d=!r.getElementById(o),s.removeChild(a),b});try{x.call(s.childNodes,0)[0].nodeType}catch(bb){x=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}bc.matches=function(a,b){return bc(a,null,null,b)},bc.matchesSelector=function(a,b){return bc(b,null,null,[a]).length>0},f=bc.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},g=bc.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},h=bc.contains=s.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:s.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc.attr=function(a,b){var c,d=g(a);return d||(b=b.toLowerCase()),(c=e.attrHandle[b])?c(a):d||$?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},e=bc.selectors={cacheLength:50,createPseudo:z,match:W,attrHandle:Z?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:d?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:Y?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:ba&&function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:_&&function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(V,""),a[3]=(a[4]||a[5]||"").replace(V,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||bc.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&bc.error(a[0]),a},PSEUDO:function(a){var b,c;if(W.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(b=a[4])O.test(b)&&(c=bh(b,!0))&&(c=b.indexOf(")",b.length-c)-b.length)&&(b=b.slice(0,c),a[0]=a[0].slice(0,c)),a[2]=b;return a.slice(0,3)}},filter:{ID:d?function(a){return a=a.replace(V,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(V,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(V,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=B[o][a];return b||(b=B(a,new RegExp("(^|"+E+")"+a+"("+E+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return function(d,e){var f=bc.attr(d,a);return f==null?b==="!=":b?(f+="",b==="="?f===c:b==="!="?f!==c:b==="^="?c&&f.indexOf(c)===0:b==="*="?c&&f.indexOf(c)>-1:b==="$="?c&&f.substr(f.length-c.length)===c:b==="~="?(" "+f+" ").indexOf(c)>-1:b==="|="?f===c||f.substr(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d){return a==="nth"?function(a){var b,e,f=a.parentNode;if(c===1&&d===0)return!0;if(f){e=0;for(b=f.firstChild;b;b=b.nextSibling)if(b.nodeType===1){e++;if(a===b)break}}return e-=d,e===c||e%c===0&&e/c>=0}:function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||bc.error("unsupported pseudo: "+a);return d[o]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?z(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=y.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:z(function(a){var b=[],c=[],d=i(a.replace(L,"$1"));return d[o]?z(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)if(f=g[h])a[h]=!(b[h]=f)}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:z(function(a){return function(b){return bc(a,b).length>0}}),contains:z(function(a){return function(b){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!e.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},header:function(a){return T.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:bd("radio"),checkbox:bd("checkbox"),file:bd("file"),password:bd("password"),image:bd("image"),submit:be("submit"),reset:be("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return U.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement},first:bf(function(a,b,c){return[0]}),last:bf(function(a,b,c){return[b-1]}),eq:bf(function(a,b,c){return[c<0?c+b:c]}),even:bf(function(a,b,c){for(var d=0;d<b;d+=2)a.push(d);return a}),odd:bf(function(a,b,c){for(var d=1;d<b;d+=2)a.push(d);return a}),lt:bf(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:bf(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},j=s.compareDocumentPosition?function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,h=b.parentNode,i=g;if(g===h)return bg(a,b);if(!g)return-1;if(!h)return 1;while(i)e.unshift(i),i=i.parentNode;i=h;while(i)f.unshift(i),i=i.parentNode;c=e.length,d=f.length;for(var j=0;j<c&&j<d;j++)if(e[j]!==f[j])return bg(e[j],f[j]);return j===c?bg(a,f[j],-1):bg(e[j],b,1)},[0,0].sort(j),m=!k,bc.uniqueSort=function(a){var b,c=1;k=m,a.sort(j);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1);return a},bc.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},i=bc.compile=function(a,b){var c,d=[],e=[],f=D[o][a];if(!f){b||(b=bh(a)),c=b.length;while(c--)f=bm(b[c]),f[o]?d.push(f):e.push(f);f=D(a,bn(e,d))}return f},r.querySelectorAll&&function(){var a,b=bp,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[":focus"],f=[":active",":focus"],h=s.matchesSelector||s.mozMatchesSelector||s.webkitMatchesSelector||s.oMatchesSelector||s.msMatchesSelector;X(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+E+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),X(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+E+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'/>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=new RegExp(e.join("|")),bp=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a))){var i,j,k=!0,l=o,m=d,n=d.nodeType===9&&a;if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){i=bh(a),(k=d.getAttribute("id"))?l=k.replace(c,"\\$&"):d.setAttribute("id",l),l="[id='"+l+"'] ",j=i.length;while(j--)i[j]=l+i[j].join("");m=R.test(a)&&d.parentNode||d,n=i.join(",")}if(n)try{return w.apply(f,x.call(m.querySelectorAll(n),0)),f}catch(p){}finally{k||d.removeAttribute("id")}}return b(a,d,f,g,h)},h&&(X(function(b){a=h.call(b,"div");try{h.call(b,"[test!='']:sizzle"),f.push("!=",J)}catch(c){}}),f=new RegExp(f.join("|")),bc.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!g(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=h.call(b,c);if(i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return bc(c,null,null,[b]).length>0})}(),e.pseudos.nth=e.pseudos.eq,e.filters=bq.prototype=e.pseudos,e.setFilters=new bq,bc.attr=p.attr,p.find=bc,p.expr=bc.selectors,p.expr[":"]=p.expr.pseudos,p.unique=bc.uniqueSort,p.text=bc.getText,p.isXMLDoc=bc.isXML,p.contains=bc.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={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,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{ck=f.href}catch(cy){ck=e.createElement("a"),ck.href="",ck=ck.href}cj=ct.exec(ck.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:ck,isLocal:cn.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=(c||y)+"",k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase())||!1,l.crossDomain=i&&i.join(":")+(i[3]?"":i[1]==="http:"?80:443)!==cj.join(":")+(cj[3]?"":cj[1]==="http:"?80:443)),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=cQ.exec(b),g=e.cur(),h=+g||0,i=1,j=20;if(f){c=+f[2],d=f[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&h){h=p.css(e.elem,a,!0)||c||1;do i=i||".5",h=h/i,p.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&i!==1&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cT[c]=cT[c]||[],cT[c].unshift(b)},prefilter:function(a,b){b?cS.unshift(a):cS.push(a)}}),p.Tween=cZ,cZ.prototype={constructor:cZ,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cZ.propHooks[this.prop];return a&&a.get?a.get(this):cZ.propHooks._default.get(this)},run:function(a){var b,c=cZ.propHooks[this.prop];return this.options.duration?this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cZ.propHooks._default.set(this),this}},cZ.prototype.init.prototype=cZ.prototype,cZ.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cZ.propHooks.scrollTop=cZ.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(c$(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bZ).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cW(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cR.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:c$("show"),slideUp:c$("hide"),slideToggle:c$("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cZ.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cO&&(cO=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cO),cO=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c_=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j={top:0,left:0},k=this[0],l=k&&k.ownerDocument;if(!l)return;return(d=l.body)===k?p.offset.bodyOffset(k):(c=l.documentElement,p.contains(c,k)?(typeof k.getBoundingClientRect!="undefined"&&(j=k.getBoundingClientRect()),e=da(l),f=c.clientTop||d.clientTop||0,g=c.clientLeft||d.clientLeft||0,h=e.pageYOffset||c.scrollTop,i=e.pageXOffset||c.scrollLeft,{top:j.top+h-f,left:j.left+i-g}):j)},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c_.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c_.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=da(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window);
+\ No newline at end of file
diff --git a/worms/external/test/qunit.css b/worms/external/test/qunit.css
@@ -0,0 +1,242 @@
+/**
+ * QUnit v1.10.0 - A JavaScript Unit Testing Framework
+ *
+ * http://qunitjs.com
+ *
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ */
+
+/** Font Family and Sizes */
+
+#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
+	font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
+}
+
+#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
+#qunit-tests { font-size: smaller; }
+
+
+/** Resets */
+
+#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
+	margin: 0;
+	padding: 0;
+}
+
+
+/** Header */
+
+#qunit-header {
+	padding: 0.5em 0 0.5em 1em;
+
+	color: #8699a4;
+	background-color: #0d3349;
+
+	font-size: 1.5em;
+	line-height: 1em;
+	font-weight: normal;
+
+	border-radius: 5px 5px 0 0;
+	-moz-border-radius: 5px 5px 0 0;
+	-webkit-border-top-right-radius: 5px;
+	-webkit-border-top-left-radius: 5px;
+}
+
+#qunit-header a {
+	text-decoration: none;
+	color: #c2ccd1;
+}
+
+#qunit-header a:hover,
+#qunit-header a:focus {
+	color: #fff;
+}
+
+#qunit-testrunner-toolbar label {
+	display: inline-block;
+	padding: 0 .5em 0 .1em;
+}
+
+#qunit-banner {
+	height: 5px;
+}
+
+#qunit-testrunner-toolbar {
+	padding: 0.5em 0 0.5em 2em;
+	color: #5E740B;
+	background-color: #eee;
+	overflow: hidden;
+}
+
+#qunit-userAgent {
+	padding: 0.5em 0 0.5em 2.5em;
+	background-color: #2b81af;
+	color: #fff;
+	text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
+}
+
+#qunit-modulefilter-container {
+	float: right;
+}
+
+/** Tests: Pass/Fail */
+
+#qunit-tests {
+	list-style-position: inside;
+}
+
+#qunit-tests li {
+	padding: 0.4em 0.5em 0.4em 2.5em;
+	border-bottom: 1px solid #fff;
+	list-style-position: inside;
+}
+
+#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running  {
+	display: none;
+}
+
+#qunit-tests li strong {
+	cursor: pointer;
+}
+
+#qunit-tests li a {
+	padding: 0.5em;
+	color: #c2ccd1;
+	text-decoration: none;
+}
+#qunit-tests li a:hover,
+#qunit-tests li a:focus {
+	color: #000;
+}
+
+#qunit-tests ol {
+	margin-top: 0.5em;
+	padding: 0.5em;
+
+	background-color: #fff;
+
+	border-radius: 5px;
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;
+}
+
+#qunit-tests table {
+	border-collapse: collapse;
+	margin-top: .2em;
+}
+
+#qunit-tests th {
+	text-align: right;
+	vertical-align: top;
+	padding: 0 .5em 0 0;
+}
+
+#qunit-tests td {
+	vertical-align: top;
+}
+
+#qunit-tests pre {
+	margin: 0;
+	white-space: pre-wrap;
+	word-wrap: break-word;
+}
+
+#qunit-tests del {
+	background-color: #e0f2be;
+	color: #374e0c;
+	text-decoration: none;
+}
+
+#qunit-tests ins {
+	background-color: #ffcaca;
+	color: #500;
+	text-decoration: none;
+}
+
+/*** Test Counts */
+
+#qunit-tests b.counts                       { color: black; }
+#qunit-tests b.passed                       { color: #5E740B; }
+#qunit-tests b.failed                       { color: #710909; }
+
+#qunit-tests li li {
+	padding: 5px;
+	background-color: #fff;
+	border-bottom: none;
+	list-style-position: inside;
+}
+
+/*** Passing Styles */
+
+#qunit-tests li li.pass {
+	color: #3c510c;
+	background-color: #fff;
+	border-left: 10px solid #C6E746;
+}
+
+#qunit-tests .pass                          { color: #528CE0; background-color: #D2E0E6; }
+#qunit-tests .pass .test-name               { color: #366097; }
+
+#qunit-tests .pass .test-actual,
+#qunit-tests .pass .test-expected           { color: #999999; }
+
+#qunit-banner.qunit-pass                    { background-color: #C6E746; }
+
+/*** Failing Styles */
+
+#qunit-tests li li.fail {
+	color: #710909;
+	background-color: #fff;
+	border-left: 10px solid #EE5757;
+	white-space: pre;
+}
+
+#qunit-tests > li:last-child {
+	border-radius: 0 0 5px 5px;
+	-moz-border-radius: 0 0 5px 5px;
+	-webkit-border-bottom-right-radius: 5px;
+	-webkit-border-bottom-left-radius: 5px;
+}
+
+#qunit-tests .fail                          { color: #000000; background-color: #EE5757; }
+#qunit-tests .fail .test-name,
+#qunit-tests .fail .module-name             { color: #000000; }
+
+#qunit-tests .fail .test-actual             { color: #EE5757; }
+#qunit-tests .fail .test-expected           { color: green;   }
+
+#qunit-banner.qunit-fail                    { background-color: #EE5757; }
+
+
+/** Result */
+
+#qunit-testresult {
+	padding: 0.5em 0.5em 0.5em 2.5em;
+
+	color: #2b81af;
+	background-color: #D2E0E6;
+
+	border-bottom: 1px solid white;
+}
+#qunit-testresult .module-name {
+	font-weight: bold;
+}
+
+/** Fixture */
+
+#qunit-fixture {
+	position: absolute;
+	top: -10000px;
+	left: -10000px;
+	width: 1000px;
+	height: 1000px;
+}
+
+
+#qunit{
+    position:absolute;
+    z-index: 1;
+
+}
diff --git a/worms/index.html b/worms/index.html
@@ -0,0 +1,175 @@
+<!doctype html>
+<html manifest="offline.appcache">
+<head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1, user-scalable=0" />
+    <meta name="apple-mobile-web-app-capable" content="yes" />
+    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+    <title>Worms Armageddon HTML5 Clone</title>
+    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
+    <link rel="stylesheet" href="css/custom.min.css" type="text/css" />
+
+    <!-- External deps -->
+    <script src="external/jquery.1.8.2.min.js"></script>
+    <script src="external/Box2dWeb-2.1.a.3.min.js"></script>
+    <script src="external/Stats.js"></script>
+    <script src="external/bootstrap.min.js"></script>
+
+    <!-- None complied js files -->
+    <script src="src/audio/SoundBufferLoader.js"></script>
+
+    <!-- Complied Typescript Javascript -->
+    <script src="src/Worms.js"></script>
+
+    <!-- Socket.io -->
+    <script src="http://96.126.111.211:8080/socket.io/socket.io.js"></script>
+</head>
+<body>
+    <div class="alert" id="notifaction"><strong></strong>
+        <p></p>
+    </div>
+    <div class="modal fade" id="createLobby">
+        <div class="modal-header">
+            <a class="close" data-dismiss="modal">&times;</a>
+            <h3>Create Game Lobby</h3>
+        </div>
+        <div class="modal-body">
+            <form class="bs-docs-example form-horizontal" id="createLobbyForm" name="createLobbyForm">
+                <div class="control-group">
+                    <label class="control-label" for="inputName">Lobby Name</label>
+                    <div class="controls">
+                        <input type="text" id="inputName" placeholder="Lobby Name">
+                    </div>
+                </div>
+                <div class="control-group">
+                    <label class="control-label" for="inputPlayers">Number Players</label>
+                    <div class="controls">
+                        <select id="inputPlayers" placeholder=" Number Players">
+                            <option>2</option>
+                            <option>3</option>
+                            <option>4</option>
+                        </select>
+                    </div>
+                </div>
+        </div>
+        <div class="modal-footer">
+            <a href="#" class="btn" data-dismiss="modal">Close</a>
+            <a href="#" class="btn btn-primary" data-dismiss="modal" id="submit">Create</a>
+            </form>
+        </div>
+    </div>
+    <div class="modal fade" id="nickname">
+        <div class="modal-header">
+            <a class="close" data-dismiss="modal">&times;</a>
+            <h3>Welcome</h3>
+        </div>
+        <div class="modal-body" style="text-align: center">
+            <p>Sign in with Google+ for leaderboard rankings or just be another John Doe :( </p>
+            <br />
+            <span id="signinButton">
+                <span
+                    class="g-signin"
+                    data-callback="googlePlusSignIn"
+                    data-clientid-live="1023068169705-t3jfknsu2cafmauctr3l34mqhnn4sivf.apps.googleusercontent.com"
+                    data-clientid="1023068169705.apps.googleusercontent.com"
+                    data-cookiepolicy="single_host_origin"
+                    data-scope="https://www.googleapis.com/auth/plus.login"></span>
+            </span>
+            <br />
+        </div>
+        <div class="modal-footer">
+            <a href="#" class="btn btn-primary" data-dismiss="modal">Continue without signing in</a>
+        </div>
+    </div>
+    <div id="turnTimeCounter" style="display: none"></div>
+
+    <div class="hero-unit" id="startMenu">
+        <div class="slide">
+            <h1 style="text-align: center">Worms Armageddon HTML5 Clone</h1>
+            <br />
+            <p>
+                Welcome to a recreation of <a href="http://www.team17.com/">Team17's</a> turn-based artillery strategy worms armageddon. 
+                All copyright and credit for the art/sound assets belongs to <a href="http://www.team17.com/">Team17</a>
+                and for making such an awesome game in the first place. This clone is currently under development by <a href="http://www.ciaranmccann.me/">Ciarán McCann</a> as part of his final year on the <a href="http://www.itcarlow.ie/study-at-itc/science/computing-networking/cw208.htm">IT Carlow Games Development</a> course.
+                <a href="http://www.ciaranmccann.me/">Read more..</a>
+            </p>
+            <br />
+
+            <p style="text-align: center">
+
+                <a class="btn btn-primary btn-large" id="startTutorial" disabled="disabled">Noobs tutorial</a>
+                <a class="btn btn-primary btn-large" id="startLocal" disabled="disabled">Local two player</a>
+                <a class="btn btn-primary btn-large" id="startOnline" disabled="disabled">Online multiplayer</a>
+            </p>
+            <div id="notice" style="font-size: 14px"></div>
+            <div style="background: none; margin-top: 20px;">
+
+                <div style="margin-top: -10px; position: absolute; left: 225px;">
+                    <a href="https://twitter.com/share" class="twitter-share-button"
+                        data-via="C_McCann"
+                        data-related="C_McCann"
+                        data-url="http://www.ciaranmccann.me/wormsjs/"
+                        data-text="Multiplayer Worms Armageddon HTML5 Clone #Javascript #gamedev #irishgamedev">Tweet</a>
+                </div>
+
+                <div style="margin-top: -15px; position: absolute; left: 320px;">
+                    <div class="fb-like" data-href="http://www.ciaranmccann.me/wormsjs/" data-send="false" data-layout="button_count" data-show-faces="true"></div>
+                </div>
+
+
+                <div style="margin-top: -10px; position: absolute; left: 405px;">
+                    <div class="g-plusone" data-size="tall" data-annotation="inline" data-width="10"></div>
+                    </span>
+
+              <div style="margin-top: -33px; position: absolute; left: 60px;">
+                  <script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
+                  <script type="IN/Share" data-url="http://www.ciaranmccann.me/wormsjs/" data-counter="right"></script>
+              </div>
+
+
+                    <div />
+                </div>
+            </div>
+
+            <div class="healthMenu">
+                <ul></ul>
+            </div>
+
+            <div id="fb-root"></div>
+            <script>
+
+                ////Twiiter
+                !function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = "https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); } }(document, "script", "twitter-wjs");
+
+                var _gaq = _gaq || [];
+                _gaq.push(['_setAccount', 'UA-633762-11']);
+                _gaq.push(['_addDevId', 'i9k95']); // Google Analyticator App ID with Google 
+
+                _gaq.push(['_trackPageview']);
+
+                //G+
+                (function ()
+                {
+                    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
+                    po.src = 'https://apis.google.com/js/plusone.js';
+                    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
+                })();
+
+                (function ()
+                {
+                    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+                    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+                    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+                })();
+
+
+                (function (d, s, id)
+                {
+                    var js, fjs = d.getElementsByTagName(s)[0];
+                    if (d.getElementById(id)) return;
+                    js = d.createElement(s); js.id = id;
+                    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=134430549926818";
+                    fjs.parentNode.insertBefore(js, fjs);
+                }(document, 'script', 'facebook-jssdk'));
+
+            </script></body></html>
+\ No newline at end of file